[ekg2-commit] r3889 - trunk/plugins/jabber: trunk/plugins/jabber/jabber_handlers_iq_result.c

SVN commit svn w toxygen.net
Pon, 10 Mar 2008, 21:07:32 CET


Author: peres
Date: 2008-03-10 21:07:32 +0100 (Mon, 10 Mar 2008)
New Revision: 3889

Modified:
   trunk/plugins/jabber/jabber_handlers_iq_result.c
Log:

Strip resources in vCards if !muc. If muc, then leave it, but don't display vCard-daemon photo link.



Modified: trunk/plugins/jabber/jabber_handlers_iq_result.c
===================================================================
--- trunk/plugins/jabber/jabber_handlers_iq_result.c	2008-03-10 19:29:03 UTC (rev 3888)
+++ trunk/plugins/jabber/jabber_handlers_iq_result.c	2008-03-10 20:07:32 UTC (rev 3889)
@@ -725,9 +725,20 @@
  */
 
 JABBER_HANDLER_RESULT(jabber_handle_vcard) {
-	char *from_str = jabber_unescape(from);
-	int hadphoto = 0;
+	char *from_str	= jabber_unescape(from);
+	char *tmp;	
+	int hadphoto	= 0;
+	int ismuc	= 0;
 
+		/* Normally vCard is resource-independent, so we can strip it.
+		 * We also strip it to check whether it ain't conference UID.
+		 * If it is, then we shall leave the resource (as it points to user),
+		 * and not display vCard-daemon link (as it wouldn't work). */
+	if ((tmp = xstrchr(from_str, '/'))) {
+		*tmp = 0;
+		if ((ismuc = !!newconference_find(s, mucuid)))
+			*tmp = '/';
+	}
 	print("jabber_userinfo_response2", session_name(s), jabberfix(from_str, _("unknown")));
 
 	for (n = n->children; n; n = n->next) {
@@ -813,9 +824,10 @@
 
 	}
 
-	if (hadphoto && from_str)
+	if (hadphoto && from_str && !ismuc) /* XXX: maybe we could get JID of conference user and use it instead? */
 		print("jabber_userinfo_photourl", from_str);
 	print("jabber_userinfo_end", session_name(s), jabberfix(from_str, _("unknown")));
+	xfree(from_str);
 }
 
 JABBER_HANDLER_RESULT(jabber_handle_vcard_old) {



Więcej informacji o liście dyskusyjnej ekg2-commit