pidgin: 080a4ba9: jabber: Unbind/Unlock from a specific re..

darkrain42 at pidgin.im darkrain42 at pidgin.im
Wed Feb 10 01:08:16 EST 2010


-----------------------------------------------------------------
Revision: 080a4ba95022e5c7613fdab2833eee2085b65b46
Ancestor: 62919c16628070664295946932fc2aeb6d904324
Author: darkrain42 at pidgin.im
Date: 2010-02-10T05:44:25
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/080a4ba95022e5c7613fdab2833eee2085b65b46

Modified files:
        libpurple/protocols/jabber/presence.c

ChangeLog: 

jabber: Unbind/Unlock from a specific resource on presences.

Closes #9874.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/presence.c	7965e6ef55da28e6157c2e6ee1309cec7fa841a1
+++ libpurple/protocols/jabber/presence.c	cbc82d833bc7dcf8c338ff7575ad01f90b2ce2de
@@ -959,8 +959,24 @@ void jabber_presence_parse(JabberStream 
 		/* End of DEALING WITH CHATS...about 5000 lines ago */
 	} else {
 		/* DEALING WITH CONTACT (i.e. not a chat) */
+		PurpleConversation *conv;
+
 		buddy_name = g_strdup_printf("%s%s%s", jid->node ? jid->node : "",
 									 jid->node ? "@" : "", jid->domain);
+
+		/*
+		 * Unbind/unlock from sending messages to a specific resource on
+		 * presence changes.  This is locked to a specific resource when
+		 * receiving a message (in message.c).
+		 */
+		conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
+				buddy_name, account);
+		if (conv) {
+			purple_debug_warning("jabber", "Changed conversation binding from %s to %s\n",
+					purple_conversation_get_name(conv), buddy_name);
+			purple_conversation_set_name(conv, buddy_name);
+		}
+
 		if((b = purple_find_buddy(account, buddy_name)) == NULL) {
 			if (jb != js->user_jb) {
 				purple_debug_warning("jabber", "Got presence for unknown buddy %s on account %s (%p)\n",
@@ -1005,17 +1021,7 @@ void jabber_presence_parse(JabberStream 
 		if(state == JABBER_BUDDY_STATE_ERROR ||
 				(type && (g_str_equal(type, "unavailable") ||
 				          g_str_equal(type, "unsubscribed")))) {
-			PurpleConversation *conv;
-
 			jabber_buddy_remove_resource(jb, jid->resource);
-			if((conv = jabber_find_unnormalized_im_conv(from, account)))
-				/*
-				 * If a resource went offline (or the buddy unsubscribed),
-				 * send further messages to the bare JID.  (This is also
-				 * updated in message.c when receiving a message)
-				 */
-				purple_conversation_set_name(conv, buddy_name);
-
 		} else {
 			jbr = jabber_buddy_track_resource(jb, jid->resource, priority,
 					state, status);


More information about the Commits mailing list