Magnus Henoch | 6 Feb 19:07
Picon

[SCM] emacs-jabber branch, master, updated. 7c3e8e98ce458539efe2dd30b3051fbbed06cd01

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "emacs-jabber".

The branch, master has been updated
       via  7c3e8e98ce458539efe2dd30b3051fbbed06cd01 (commit)
      from  a98bbc4da6ab878ea3693e6335e2ba6badf1d701 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7c3e8e98ce458539efe2dd30b3051fbbed06cd01
Author: Magnus Henoch <legoscia <at> users.sourceforge.net>
Date:   Mon Feb 6 18:10:04 2012 +0000

    Avoid groupchat buffer on RET in roster if we're not 100% sure it's a groupchat (bug 3483380)

    * jabber-roster.el (jabber-roster-ret-action-at-point): Ask for disco info before doing anything.
    (jabber-roster-ret-action-at-point-1): Only assume it's a groupchat if it explicitly says so.

diff --git a/jabber-roster.el b/jabber-roster.el
index fdc6ff5..8a9f759 100644
--- a/jabber-roster.el
+++ b/jabber-roster.el
@@ -25,6 +25,7 @@
 (require 'jabber-alert)
 (require 'jabber-keymap)
 (require 'format-spec)
+(require 'cl)				;for `find'

 (defgroup jabber-roster nil "roster display options"
   :group 'jabber)
@@ -254,11 +255,27 @@ chat-with-jid-at-point is no group at point"
 					 'jabber-jid)))
     (if (and group-at-point account-at-point)
 	(jabber-roster-roll-group account-at-point group-at-point)
-      (jabber-chat-with-jid-at-point)
-      (ignore-errors (jabber-muc-join
-                      account-at-point
-                      jid-at-point
-                      (jabber-muc-read-my-nickname account-at-point jid-at-point t) t)))))
+      ;; Is this a normal contact, or a groupchat?  Let's ask it.
+      (jabber-disco-get-info
+       account-at-point (jabber-jid-user jid-at-point) nil
+       #'jabber-roster-ret-action-at-point-1
+       jid-at-point))))
+
+(defun jabber-roster-ret-action-at-point-1 (jc jid result)
+  ;; If we get an error, assume it's a normal contact.
+  (if (eq (car result) 'error)
+      (jabber-chat-with jc jid)
+    ;; Otherwise, let's check whether it has a groupchat identity.
+    (let ((identities (car result)))
+      (if (find "conference" (if (sequencep identities) identities nil)
+		:key (lambda (i) (aref i 1))
+		:test #'string=)
+	  ;; Yes!  Let's join it.
+	  (jabber-muc-join jc jid
+			   (jabber-muc-read-my-nickname jc jid t)
+			   t)
+	;; No.  Let's open a normal chat buffer.
+	(jabber-chat-with jc jid)))))

 (defun jabber-roster-mouse-2-action-at-point (e)
   "Action for mouse-2. Before try to roll up/down group. Eval

-----------------------------------------------------------------------

Summary of changes:
 jabber-roster.el |   27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)

hooks/post-receive
--

-- 
emacs-jabber

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2

Gmane