From: Magnus H. <leg...@us...> - 2007-12-09 00:55:37
|
Update of /cvsroot/emacs-jabber/emacs-jabber In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv15642 Modified Files: jabber-presence.el Log Message: Revision: ma...@fr...--2005/emacs-jabber--cvs-head--0--patch-429 Creator: Magnus Henoch <ma...@fr...> Handle unavailable and error presence from bare JID Index: jabber-presence.el =================================================================== RCS file: /cvsroot/emacs-jabber/emacs-jabber/jabber-presence.el,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- jabber-presence.el 26 Oct 2007 14:04:42 -0000 1.37 +++ jabber-presence.el 9 Dec 2007 00:55:34 -0000 1.38 @@ -134,6 +134,20 @@ (get buddy 'resources)))) newstatus) (cond + ((and (string= resource "") (member type '("unavailable" "error"))) + ;; 'unavailable' or 'error' from bare JID means that all resources + ;; are offline. + (setq resource-plist nil) + (setq newstatus (if (string= type "error") "error" nil)) + (let ((new-message (if error + (jabber-parse-error error) + presence-status))) + ;; erase any previous information + (put buddy 'resources nil) + (put buddy 'connected nil) + (put buddy 'show newstatus) + (put buddy 'status new-message))) + ((string= type "unavailable") (setq resource-plist (plist-put resource-plist 'connected nil)) @@ -173,11 +187,12 @@ (plist-put resource-plist 'priority priority)) (setq newstatus (or presence-show "")))) - ;; this is for `assoc-set!' in guile - (if (assoc resource (get buddy 'resources)) - (setcdr (assoc resource (get buddy 'resources)) resource-plist) - (put buddy 'resources (cons (cons resource resource-plist) (get buddy 'resources)))) - (jabber-prioritize-resources buddy) + (when resource-plist + ;; this is for `assoc-set!' in guile + (if (assoc resource (get buddy 'resources)) + (setcdr (assoc resource (get buddy 'resources)) resource-plist) + (put buddy 'resources (cons (cons resource resource-plist) (get buddy 'resources)))) + (jabber-prioritize-resources buddy)) (jabber-roster-update jc nil (list buddy) nil) |