From a44a71d6a5f5c550be3512c6252043029b25914c Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Thu, 20 Aug 2015 15:08:53 +0200 Subject: add option to en(dis)able XEP-0136/0313. Fixes #8127 --- data/gui/accounts_window.ui | 23 ++++++++++++++++++++--- src/common/config.py | 1 + src/config.py | 8 ++++++++ src/gui_interface.py | 6 ++++-- 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/data/gui/accounts_window.ui b/data/gui/accounts_window.ui index f525f8d3e..d5277748b 100644 --- a/data/gui/accounts_window.ui +++ b/data/gui/accounts_window.ui @@ -579,6 +579,23 @@ 2 + + + Synchronize logs with server + True + True + False + True + True + True + + + + False + False + 3 + + Synch_ronize account status with global status @@ -594,7 +611,7 @@ False False - 3 + 4 @@ -611,7 +628,7 @@ False False - 4 + 5 @@ -629,7 +646,7 @@ False False - 5 + 6 diff --git a/src/common/config.py b/src/common/config.py index f9670f912..4d6ad1de5 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -363,6 +363,7 @@ class Config: 'custom_host': [ opt_str, '', '', True ], 'sync_with_global_status': [ opt_bool, False, ], 'no_log_for': [ opt_str, '', _('Space separated list of JIDs for which you do not want to store logs. You can also add account name to log nothing for this account.')], + 'sync_logs_with_server': [ opt_bool, True, _('Download logs stored on server on Gajim startup if server supports XEP-0136 or XEP-0313')], 'allow_no_log_for': [ opt_str, '', _('Space separated list of JIDs for which you accept to not log conversations if he does not want to.')], 'minimized_gc': [ opt_str, '' ], 'attached_gpg_keys': [ opt_str, '' ], diff --git a/src/config.py b/src/config.py index 580ca864c..bc8883421 100644 --- a/src/config.py +++ b/src/config.py @@ -1990,6 +1990,8 @@ class AccountsWindow: else: self.xml.get_object('log_history_checkbutton1').set_active(True) + self.xml.get_object('sync_logs_with_server_checkbutton1').set_active( + gajim.config.get_per('accounts', account, 'sync_logs_with_server')) self.xml.get_object('sync_with_global_status_checkbutton1').set_active( gajim.config.get_per('accounts', account, 'sync_with_global_status')) @@ -2343,6 +2345,12 @@ class AccountsWindow: gajim.config.set_per('accounts', self.current_account, 'no_log_for', ' '.join(list_no_log_for)) + def on_sync_logs_with_server_checkbutton_toggled(self, widget): + if self.ignore_events: + return + self.on_checkbutton_toggled(widget, 'sync_logs_with_server', + account=self.current_account) + def on_sync_with_global_status_checkbutton_toggled(self, widget): if self.ignore_events: return diff --git a/src/gui_interface.py b/src/gui_interface.py index 723437943..c5cbe565d 100644 --- a/src/gui_interface.py +++ b/src/gui_interface.py @@ -1139,13 +1139,15 @@ class Interface: # Else disable autoaway gajim.sleeper_state[account] = 'off' - if obj.conn.archiving_136_supported: + if obj.conn.archiving_136_supported and gajim.config.get_per('accounts', + account, 'sync_logs_with_server'): # Start merging logs from server obj.conn.request_modifications_page(gajim.config.get_per('accounts', account, 'last_archiving_time')) gajim.config.set_per('accounts', account, 'last_archiving_time', time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())) - if obj.conn.archiving_313_supported: + if obj.conn.archiving_313_supported and gajim.config.get_per('accounts', + account, 'sync_logs_with_server'): mam_id = gajim.config.get_per('accounts', account, 'last_mam_id') if mam_id: obj.conn.request_archive(after=mam_id) -- cgit v1.2.3