pidgin: 40443f94: jabber: Use some convenience variables h...

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


-----------------------------------------------------------------
Revision: 40443f948cfde18de2a53d8e2bc2cbfed3416e99
Ancestor: e6dc0b75d96693c72f0ce70eec29ffc6fd65cbc5
Author: darkrain42 at pidgin.im
Date: 2010-02-10T04:35:10
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/40443f948cfde18de2a53d8e2bc2cbfed3416e99

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

ChangeLog: 

jabber: Use some convenience variables here.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/message.c	72bb1a4f1af71ff911da12ae566fd026253c20f2
+++ libpurple/protocols/jabber/message.c	53480c08b58f3ec961bdf83aa74e0300fb7c2a45
@@ -61,16 +61,21 @@ static void handle_chat(JabberMessage *j
 	JabberID *jid = jabber_id_new(jm->from);
 	char *from;
 
+	PurpleConnection *gc;
+	PurpleAccount *account;
 	JabberBuddy *jb;
 	JabberBuddyResource *jbr;
 
 	if(!jid)
 		return;
 
+	gc = jm->js->gc;
+	account = purple_connection_get_account(gc);
+
 	jb = jabber_buddy_find(jm->js, jm->from, TRUE);
 	jbr = jabber_buddy_find_resource(jb, jid->resource);
 
-	if(jabber_find_unnormalized_conv(jm->from, jm->js->gc->account)) {
+	if(jabber_find_unnormalized_conv(jm->from, account)) {
 		from = g_strdup(jm->from);
 	} else  if(jid->node) {
 		if (jid->resource) {
@@ -85,7 +90,7 @@ static void handle_chat(JabberMessage *j
 			PurpleConversation *conv;
 
 			from = g_strdup_printf("%s@%s", jid->node, jid->domain);
-			conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, jm->js->gc->account);
+			conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, account);
 			if (conv) {
 				purple_conversation_set_name(conv, jm->from);
 			}
@@ -105,19 +110,19 @@ static void handle_chat(JabberMessage *j
 		}
 
 		if(JM_STATE_COMPOSING == jm->chat_state) {
-			serv_got_typing(jm->js->gc, from, 0, PURPLE_TYPING);
+			serv_got_typing(gc, from, 0, PURPLE_TYPING);
 		} else if(JM_STATE_PAUSED == jm->chat_state) {
-			serv_got_typing(jm->js->gc, from, 0, PURPLE_TYPED);
+			serv_got_typing(gc, from, 0, PURPLE_TYPED);
 		} else if(JM_STATE_GONE == jm->chat_state) {
 			PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
-					from, jm->js->gc->account);
+					from, account);
 			if (conv && jid->node && jid->domain) {
 				char buf[256];
 				PurpleBuddy *buddy;
 
 				g_snprintf(buf, sizeof(buf), "%s@%s", jid->node, jid->domain);
 
-				if ((buddy = purple_find_buddy(jm->js->gc->account, buf))) {
+				if ((buddy = purple_find_buddy(account, buf))) {
 					const char *who;
 					char *escaped;
 
@@ -135,10 +140,10 @@ static void handle_chat(JabberMessage *j
 					                        PURPLE_MESSAGE_SYSTEM, time(NULL));
 				}
 			}
-			serv_got_typing_stopped(jm->js->gc, from);
+			serv_got_typing_stopped(gc, from);
 
 		} else {
-			serv_got_typing_stopped(jm->js->gc, from);
+			serv_got_typing_stopped(gc, from);
 		}
 	} else {
 		if(jbr) {
@@ -157,8 +162,7 @@ static void handle_chat(JabberMessage *j
 			jm->body = jabber_google_format_to_html(jm->body);
 			g_free(tmp);
 		}
-		serv_got_im(jm->js->gc, from, jm->xhtml ? jm->xhtml : jm->body, 0,
-				jm->sent);
+		serv_got_im(gc, from, jm->xhtml ? jm->xhtml : jm->body, 0, jm->sent);
 	}
 
 


More information about the Commits mailing list