Daniel Brötzmann pushed to branch master at gajim / gajim
Commits: 2c54d9e6 by wurstsalat at 2022-06-03T20:43:38+02:00 imprv: History: Add Keep History 'Until Gajim is Closed' option
This moves history cleanup from startup to Gajim’s shutdown routine
- - - - -
3 changed files:
- gajim/common/application.py - gajim/common/storage/archive.py - gajim/gtk/accounts.py
Changes:
===================================== gajim/common/application.py ===================================== @@ -116,6 +116,7 @@ def _on_disconnect(event: AccountDisonnected) -> None:
def _shutdown_core(self) -> None: # Commit any outstanding SQL transactions + app.storage.archive.cleanup_chat_history() app.storage.cache.shutdown() app.storage.archive.shutdown()
===================================== gajim/common/storage/archive.py ===================================== @@ -181,7 +181,6 @@ def init(self, **kwargs: Any) -> None: self._con.create_function("get_timeout", 0, self._get_timeout)
self._get_jid_ids_from_db() - self._cleanup_chat_history()
def _namedtuple_factory(self, cursor: sqlite.Cursor, @@ -1391,7 +1390,7 @@ def remove_all_history(self) -> None: self._execute_multiple(statements) log.info('Removed all chat history')
- def _cleanup_chat_history(self) -> None: + def cleanup_chat_history(self) -> None: """ Remove messages from account where messages are older than max_age """
===================================== gajim/gtk/accounts.py ===================================== @@ -722,6 +722,7 @@ def __init__(self, account: str) -> None:
history_max_age = { -1: _('Forever'), + 0: _('Until Gajim is Closed'), 86400: _('1 Day'), 604800: _('1 Week'), 2629743: _('1 Month'),
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/2c54d9e674f1ffd4f00bea1e8c1419b21...