Use original JID when choosing which accounts to reconnect
Some Jabber servers (notably Facebook Chat) assign a different JID at resource binding. This used to confuse jabber-connect-all, such that it would establish a new connection although the existing one is perfectly healthy. With this change, we save the JID that we originally connected with, and use that to avoid duplicate connections.
This commit is contained in:
parent
45ca35f79c
commit
bb8eeb204f
|
@ -171,7 +171,7 @@ With many prefix arguments, one less is passed to `jabber-connect'."
|
|||
arg))))
|
||||
(call-interactively 'jabber-connect))
|
||||
;; Only connect those accounts that are not yet connected.
|
||||
(let ((already-connected (mapcar #'jabber-connection-bare-jid jabber-connections))
|
||||
(let ((already-connected (mapcar #'jabber-connection-original-jid jabber-connections))
|
||||
(connected-one nil))
|
||||
(dolist (account accounts)
|
||||
(unless (member (jabber-jid-user (car account)) already-connected)
|
||||
|
@ -277,6 +277,8 @@ With double prefix argument, specify more connection details."
|
|||
|
||||
(list :connecting
|
||||
(list :send-function send-function
|
||||
;; Save the JID we originally connected with.
|
||||
:original-jid (concat username "@" server)
|
||||
:username username
|
||||
:server server
|
||||
:resource resource
|
||||
|
|
|
@ -145,6 +145,13 @@ properties to add to the result."
|
|||
(concat (plist-get sd :username) "@"
|
||||
(plist-get sd :server))))
|
||||
|
||||
(defun jabber-connection-original-jid (jc)
|
||||
"Return the original JID of the given connection.
|
||||
The \"original JID\" is the JID we authenticated with. The
|
||||
server might subsequently assign us a different JID at resource
|
||||
binding."
|
||||
(plist-get (fsm-get-state-data jc) :original-jid))
|
||||
|
||||
(defun jabber-find-connection (bare-jid)
|
||||
"Find the connection to the account named by BARE-JID.
|
||||
Return nil if none found."
|
||||
|
|
Loading…
Reference in New Issue