summaryrefslogtreecommitdiff
path: root/jabber-muc.el
diff options
context:
space:
mode:
authorMagnus Henoch <magnus.henoch@gmail.com>2014-08-11 09:49:53 +0100
committerMagnus Henoch <magnus.henoch@gmail.com>2014-08-11 09:49:53 +0100
commitd374ff85bab670431cdc2b91634f092b33a670bd (patch)
tree0a81356fd00d4cb419bd2afbbe6d809efe04ba49 /jabber-muc.el
parent4b9c46232e83efae34ff8497325fae0e3b5675aa (diff)
Clear MUC data on disconnection
Avoid "phantom" participants when we reconnect and rejoin an MUC room.
Diffstat (limited to 'jabber-muc.el')
-rw-r--r--jabber-muc.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/jabber-muc.el b/jabber-muc.el
index ba713a4..2efb37e 100644
--- a/jabber-muc.el
+++ b/jabber-muc.el
@@ -243,6 +243,23 @@ This function is idempotent."
(setq jabber-muc-participants
(delq whichparticipants jabber-muc-participants))))
+(defun jabber-muc-connection-closed (bare-jid)
+ "Remove MUC data for BARE-JID.
+Forget all information about rooms that had been entered with
+this JID. Suitable to call when the connection is closed."
+ (dolist (room-entry jabber-muc-participants)
+ (let* ((room (car room-entry))
+ (buffer (get-buffer (jabber-muc-get-buffer room))))
+ (when (bufferp buffer)
+ (with-current-buffer buffer
+ (when (string= bare-jid
+ (jabber-connection-bare-jid jabber-buffer-connection))
+ (setq *jabber-active-groupchats*
+ (delete* room *jabber-active-groupchats*
+ :key #'car :test #'string=))
+ (setq jabber-muc-participants
+ (delq room-entry jabber-muc-participants))))))))
+
(defun jabber-muc-participant-plist (group nickname)
"Return plist associated with NICKNAME in GROUP.
Return nil if nothing known about that combination."