Philipp Hörist pushed to branch master at gajim / gajim
Commits:
1c895e89 by Philipp Hörist at 2017-11-20T18:10:51+01:00
Persist resource across sessions
This was somehow lost once we implemented random resource strings
Although its good that initally a random resource is chosen, it
still should persist across sessions.
This helps to kill zombie client connections on the server because
most servers kill the old session once a new with the same resource
connects
Also dont notify the user about resource conflicts if no custom
resource is set. We should not expect users to know about resources
and what they are used for as long as possible.
- - - - -
2 changed files:
- gajim/common/connection.py
- gajim/gui_interface.py
Changes:
=====================================
gajim/common/connection.py
=====================================
--- a/gajim/common/connection.py
+++ b/gajim/common/connection.py
@@ -191,6 +191,7 @@ class CommonConnection:
'hostname': socket.gethostname(),
'rand': rand
})
+ app.config.set_per('accounts', self.name, 'resource', resource)
return resource
def dispatch(self, event, data):
=====================================
gajim/gui_interface.py
=====================================
--- a/gajim/gui_interface.py
+++ b/gajim/gui_interface.py
@@ -1162,10 +1162,18 @@ class Interface:
account = obj.conn.name
conn = obj.conn
self.roster.send_status(account, 'offline', conn.status)
+
def on_ok(new_resource):
app.config.set_per('accounts', account, 'resource', new_resource)
self.roster.send_status(account, conn.old_show, conn.status)
+
proposed_resource = conn.server_resource
+ if proposed_resource.startswith('gajim.'):
+ # Dont notify the user about resource change if he didnt set
+ # a custom resource
+ on_ok('gajim.$rand')
+ return
+
proposed_resource += app.config.get('gc_proposed_nick_char')
dlg = dialogs.ResourceConflictDialog(_('Resource Conflict'),
_('You are already connected to this account with the same '
View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/1c895e89835c2ef4a53275cdd59e3b668a060bf3
---
View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/1c895e89835c2ef4a53275cdd59e3b668a060bf3
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits