add an option to allow disabling sending local time. Fixes #6764
This commit is contained in:
parent
caf9d69bfc
commit
23d3d79f83
|
@ -366,7 +366,8 @@ class Config:
|
|||
'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, ''],
|
||||
|
|
|
@ -1496,12 +1496,18 @@ ConnectionJingle, ConnectionIBBytestream):
|
|||
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 @@ ConnectionJingle, ConnectionIBBytestream):
|
|||
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):
|
||||
|
|
Loading…
Reference in New Issue