changeset 7689773e3487 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=7689773e3487 description: add an option to allow disabling sending local time. Fixes #6764
diffstat:
src/common/config.py | 3 ++- src/common/connection_handlers.py | 38 +++++++++++++++++++++++++------------- 2 files changed, 27 insertions(+), 14 deletions(-)
diffs (68 lines):
diff -r 97a5f921882b -r 7689773e3487 src/common/config.py --- a/src/common/config.py Wed Jan 12 22:47:36 2011 +0100 +++ b/src/common/config.py Wed Jan 19 09:08:31 2011 +0100 @@ -366,7 +366,8 @@ 'subscribe_nick': [opt_bool, True], 'subscribe_location': [opt_bool, True], 'ignore_unknown_contacts': [ opt_bool, False ], - 'send_os_info': [ opt_bool, True ], + 'send_os_info': [ opt_bool, True, _("Allow Gajim to send information about the operating system you are running.") ], + 'send_time_info': [ opt_bool, True, _("Allow Gajim to send your local time.") ], 'log_encrypted_sessions': [opt_bool, True, _('When negotiating an encrypted session, should Gajim assume you want your messages to be logged?')], 'send_idle_time': [ opt_bool, True ], 'roster_version': [opt_str, ''], diff -r 97a5f921882b -r 7689773e3487 src/common/connection_handlers.py --- a/src/common/connection_handlers.py Wed Jan 12 22:47:36 2011 +0100 +++ b/src/common/connection_handlers.py Wed Jan 19 09:08:31 2011 +0100 @@ -1496,12 +1496,18 @@ def _nec_time_request_received(self, obj): if obj.conn.name != self.name: return - iq_obj = obj.stanza.buildReply('result') - qp = iq_obj.getTag('query') - qp.setTagData('utc', strftime('%Y%m%dT%H:%M:%S', gmtime())) - qp.setTagData('tz', helpers.decode_string(tzname[daylight])) - qp.setTagData('display', helpers.decode_string(strftime('%c', - localtime()))) + if gajim.config.get_per('accounts', self.name, 'send_time_info'): + iq_obj = obj.stanza.buildReply('result') + qp = iq_obj.getTag('query') + qp.setTagData('utc', strftime('%Y%m%dT%H:%M:%S', gmtime())) + qp.setTagData('tz', helpers.decode_string(tzname[daylight])) + qp.setTagData('display', helpers.decode_string(strftime('%c', + localtime()))) + else: + iq_obj = obj.stanza.buildReply('error') + err = common.xmpp.ErrorNode(name=common.xmpp.NS_STANZAS + \ + ' service-unavailable') + iq_obj.addChild(node=err) self.connection.send(iq_obj)
def _TimeRevisedCB(self, con, iq_obj): @@ -1515,13 +1521,19 @@ def _nec_time_revised_request_received(self, obj): if obj.conn.name != self.name: return - iq_obj = obj.stanza.buildReply('result') - qp = iq_obj.setTag('time', namespace=common.xmpp.NS_TIME_REVISED) - qp.setTagData('utc', strftime('%Y-%m-%dT%H:%M:%SZ', gmtime())) - isdst = localtime().tm_isdst - zone = -(timezone, altzone)[isdst] / 60.0 - tzo = (zone / 60, abs(zone % 60)) - qp.setTagData('tzo', '%+03d:%02d' % (tzo)) + if gajim.config.get_per('accounts', self.name, 'send_time_info'): + iq_obj = obj.stanza.buildReply('result') + qp = iq_obj.setTag('time', namespace=common.xmpp.NS_TIME_REVISED) + qp.setTagData('utc', strftime('%Y-%m-%dT%H:%M:%SZ', gmtime())) + isdst = localtime().tm_isdst + zone = -(timezone, altzone)[isdst] / 60.0 + tzo = (zone / 60, abs(zone % 60)) + qp.setTagData('tzo', '%+03d:%02d' % (tzo)) + else: + iq_obj = obj.stanza.buildReply('error') + err = common.xmpp.ErrorNode(name=common.xmpp.NS_STANZAS + \ + ' service-unavailable') + iq_obj.addChild(node=err) self.connection.send(iq_obj)
def _TimeRevisedResultCB(self, con, iq_obj):