pidgin: 8eabca26: jabber: Add a PurpleAccount convenience ...

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


-----------------------------------------------------------------
Revision: 8eabca26aece03779958d7090c8048de3a9f03b7
Ancestor: e7e77ba57572905d2ff67a531c24eb8334301f1a
Author: darkrain42 at pidgin.im
Date: 2010-02-10T05:22:00
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/8eabca26aece03779958d7090c8048de3a9f03b7

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

ChangeLog: 

jabber: Add a PurpleAccount convenience variable.

...because what jabber_presence_parse() needs is another function-scoped var.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/presence.c	c012fbbd799cc8b0cd45ed4c5ceae345097e26fe
+++ libpurple/protocols/jabber/presence.c	440358f5ea4d76c82108bc98d6994c1476dbd273
@@ -502,6 +502,7 @@ void jabber_presence_parse(JabberStream 
 	PurpleConvChatBuddyFlags flags = PURPLE_CBFLAGS_NONE;
 	gboolean delayed = FALSE;
 	const gchar *stamp = NULL; /* from <delayed/> element */
+	PurpleAccount *account;
 	PurpleBuddy *b = NULL;
 	char *buddy_name;
 	JabberBuddyState state = JABBER_BUDDY_STATE_UNKNOWN;
@@ -523,6 +524,8 @@ void jabber_presence_parse(JabberStream 
 	if (signal_return)
 		return;
 
+	account = purple_connection_get_account(js->gc);
+
 	jid = jabber_id_new(from);
 	if (jid == NULL) {
 		purple_debug_error("jabber", "Ignoring presence with malformed 'from' "
@@ -559,12 +562,10 @@ void jabber_presence_parse(JabberStream 
 	} else if (g_str_equal(type, "subscribe")) {
 		struct _jabber_add_permit *jap = g_new0(struct _jabber_add_permit, 1);
 		gboolean onlist = FALSE;
-		PurpleAccount *account;
 		PurpleBuddy *buddy;
 		JabberBuddy *jb = NULL;
 		xmlnode *nick;
 
-		account = purple_connection_get_account(js->gc);
 		buddy = purple_find_buddy(account, from);
 		nick = xmlnode_get_child_with_namespace(packet, "nick", "http://jabber.org/protocol/nick");
 		if (nick)
@@ -748,7 +749,7 @@ void jabber_presence_parse(JabberStream 
 											" you like to configure it, or"
 											" accept the default settings?"),
 										/* Default Action */ 1,
-										purple_connection_get_account(js->gc), NULL, chat->conv,
+										account, NULL, chat->conv,
 										chat, 2,
 										_("_Configure Room"), G_CALLBACK(jabber_chat_request_room_configure),
 										_("_Accept Defaults"), G_CALLBACK(jabber_chat_create_instant_room));
@@ -957,10 +958,10 @@ void jabber_presence_parse(JabberStream 
 	} else {
 		buddy_name = g_strdup_printf("%s%s%s", jid->node ? jid->node : "",
 									 jid->node ? "@" : "", jid->domain);
-		if((b = purple_find_buddy(js->gc->account, buddy_name)) == NULL) {
+		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",
-									 buddy_name, purple_account_get_username(js->gc->account), js->gc->account);
+									 buddy_name, purple_account_get_username(account), account);
 				jabber_id_free(jid);
 				g_free(avatar_hash);
 				g_free(buddy_name);
@@ -1004,7 +1005,7 @@ void jabber_presence_parse(JabberStream 
 			PurpleConversation *conv;
 
 			jabber_buddy_remove_resource(jb, jid->resource);
-			if((conv = jabber_find_unnormalized_im_conv(from, js->gc->account)))
+			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
@@ -1024,12 +1025,12 @@ void jabber_presence_parse(JabberStream 
 
 		if((found_jbr = jabber_buddy_find_resource(jb, NULL))) {
 			jabber_google_presence_incoming(js, buddy_name, found_jbr);
-			purple_prpl_got_user_status(js->gc->account, buddy_name, jabber_buddy_state_get_status_id(found_jbr->state), "priority", found_jbr->priority, "message", found_jbr->status, NULL);
-			purple_prpl_got_user_idle(js->gc->account, buddy_name, found_jbr->idle, found_jbr->idle);
+			purple_prpl_got_user_status(account, buddy_name, jabber_buddy_state_get_status_id(found_jbr->state), "priority", found_jbr->priority, "message", found_jbr->status, NULL);
+			purple_prpl_got_user_idle(account, buddy_name, found_jbr->idle, found_jbr->idle);
 			if (nickname)
 				serv_got_alias(js->gc, buddy_name, nickname);
 		} else {
-			purple_prpl_got_user_status(js->gc->account, buddy_name, "offline", status ? "message" : NULL, status, NULL);
+			purple_prpl_got_user_status(account, buddy_name, "offline", status ? "message" : NULL, status, NULL);
 		}
 		g_free(buddy_name);
 	}


More information about the Commits mailing list