changeset d2c270eb2f7c in /home/hg/repos/gajim
author: Yann Leboulanger asterix@lagaule.org branches: gajim_0.16 details:http://hg.gajim.org/gajim?cmd=changeset;node=d2c270eb2f7c description: add option to en(dis)able XEP-0136/0313. Fixes #8127
diffstat:
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(-)
diffs (111 lines):
diff -r 37c9f39aa69d -r d2c270eb2f7c data/gui/accounts_window.ui --- a/data/gui/accounts_window.ui Wed Aug 12 22:13:29 2015 +0200 +++ b/data/gui/accounts_window.ui Thu Aug 20 15:08:53 2015 +0200 @@ -556,6 +556,23 @@ </packing> </child> <child> + <object class="GtkCheckButton" id="sync_logs_with_server_checkbutton1"> + <property name="label" translatable="yes">Synchronize logs with server</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_sync_logs_with_server_checkbutton_toggled"/> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">3</property> + </packing> + </child> + <child> <object class="GtkCheckButton" id="sync_with_global_status_checkbutton1"> <property name="label" translatable="yes">Synch_ronize account status with global status</property> <property name="visible">True</property> @@ -569,7 +586,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> <child> @@ -585,7 +602,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">4</property> + <property name="position">5</property> </packing> </child> <child> @@ -602,7 +619,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">5</property> + <property name="position">6</property> </packing> </child> </object> diff -r 37c9f39aa69d -r d2c270eb2f7c src/common/config.py --- a/src/common/config.py Wed Aug 12 22:13:29 2015 +0200 +++ b/src/common/config.py Thu Aug 20 15:08:53 2015 +0200 @@ -362,6 +362,7 @@ '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 -r 37c9f39aa69d -r d2c270eb2f7c src/config.py --- a/src/config.py Wed Aug 12 22:13:29 2015 +0200 +++ b/src/config.py Thu Aug 20 15:08:53 2015 +0200 @@ -1963,6 +1963,8 @@ 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')) @@ -2318,6 +2320,12 @@ 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 -r 37c9f39aa69d -r d2c270eb2f7c src/gui_interface.py --- a/src/gui_interface.py Wed Aug 12 22:13:29 2015 +0200 +++ b/src/gui_interface.py Thu Aug 20 15:08:53 2015 +0200 @@ -1138,13 +1138,15 @@ # 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)