Yann Leboulanger pushed to branch master at gajim / gajim
Commits: 65362358 by Yann Leboulanger at 2017-01-04T13:14:21+01:00 ability to have a random string in the resource
- - - - - 7b8eec95 by Yann Leboulanger at 2017-01-04T13:14:21+01:00 Fix some spaces in strings
- - - - -
4 changed files:
- src/common/config.py - src/common/connection.py - src/common/helpers.py - src/common/multimedia_helpers.py
Changes:
===================================== src/common/config.py ===================================== --- a/src/common/config.py +++ b/src/common/config.py @@ -325,7 +325,7 @@ class Config: 'client_cert_encrypted': [ opt_bool, False, '', False ], 'savepass': [ opt_bool, False ], 'password': [ opt_str, '' ], - 'resource': [ opt_str, 'gajim', '', True ], + 'resource': [ opt_str, 'gajim.$rand', '', True ], 'priority': [ opt_int, 5, '', True ], 'adjust_priority_with_status': [ opt_bool, True, _('Priority will change automatically according to your status. Priorities are defined in autopriority_* options.') ], 'autopriority_online': [ opt_int, 50],
===================================== src/common/connection.py ===================================== --- a/src/common/connection.py +++ b/src/common/connection.py @@ -36,7 +36,7 @@ import os import random import socket import operator - +import string import time import locale import hmac @@ -182,8 +182,10 @@ class CommonConnection: resource = gajim.config.get_per('accounts', self.name, 'resource') # All valid resource substitution strings should be added to this hash. if resource: + rand = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(8)) resource = Template(resource).safe_substitute({ - 'hostname': socket.gethostname() + 'hostname': socket.gethostname(), + 'rand': rand }) return resource
===================================== src/common/helpers.py ===================================== --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -1078,13 +1078,14 @@ def get_notification_icon_tooltip_dict(): messages[jid], messages[jid], messages[jid]) contact = gajim.contacts.get_first_contact_from_jid( account['name'], jid) + text += ' ' if jid in gajim.gc_connected[account['name']]: - text += _(' from room %s') % (jid) + text += _('from room %s') % (jid) elif contact: name = contact.get_shown_name() - text += _(' from user %s') % (name) + text += _('from user %s') % (name) else: - text += _(' from %s') % (jid) + text += _('from %s') % (jid) account['event_lines'].append(text)
# Display unseen events numbers, if any @@ -1099,7 +1100,7 @@ def get_notification_icon_tooltip_dict(): for jid in non_messages.keys(): text = ngettext('%d event pending', '%d events pending', non_messages[jid], non_messages[jid], non_messages[jid]) - text += _(' from user %s') % (jid) + text += ' ' + _('from user %s') % (jid) account[account]['event_lines'].append(text)
return accounts
===================================== src/common/multimedia_helpers.py ===================================== --- a/src/common/multimedia_helpers.py +++ b/src/common/multimedia_helpers.py @@ -37,7 +37,7 @@ class DeviceManager(object): element.set_state(Gst.State.READY) devices = element.get_properties('device') if devices: - self.devices[text % _(' Default device')] = pipe % name + self.devices[text % _('Default device')] = pipe % name for device in devices: element.set_state(Gst.State.NULL) element.set_property('device', device)
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/2b1b461e90f1a2d26c7a8a1ecf0ac80aa4...