pidgin: 437fb254: jabber: Clean up this code a little.
darkrain42 at pidgin.im
darkrain42 at pidgin.im
Sat Dec 5 19:55:58 EST 2009
-----------------------------------------------------------------
Revision: 437fb25487d856c5472b5a7428416ced7464a61e
Ancestor: d434ce06afcd01bcaa35f6f861f6e4b9a2651421
Author: darkrain42 at pidgin.im
Date: 2009-12-05T22:48:34
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/437fb25487d856c5472b5a7428416ced7464a61e
Modified files:
libpurple/protocols/jabber/google.c
libpurple/protocols/jabber/google.h
libpurple/protocols/jabber/jabber.c
ChangeLog:
jabber: Clean up this code a little.
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/google.c dd7dfacc2e0637748c7b5295cfbe017ec9947143
+++ libpurple/protocols/jabber/google.c d09d5f1cd3a2480e3fed8b8ee167a5bae32a6a6f
@@ -1032,9 +1032,9 @@ gboolean jabber_google_roster_incoming(J
return TRUE;
}
-void jabber_google_roster_add_deny(PurpleConnection *gc, const char *who)
+void jabber_google_roster_add_deny(JabberStream *js, const char *who)
{
- JabberStream *js;
+ PurpleAccount *account;
GSList *buddies;
JabberIq *iq;
xmlnode *query;
@@ -1044,14 +1044,10 @@ void jabber_google_roster_add_deny(Purpl
JabberBuddy *jb;
const char *balias;
- js = (JabberStream*)(gc->proto_data);
-
- if (!js || !(js->server_caps & JABBER_CAP_GOOGLE_ROSTER))
- return;
-
jb = jabber_buddy_find(js, who, TRUE);
- buddies = purple_find_buddies(js->gc->account, who);
+ account = purple_connection_get_account(js->gc);
+ buddies = purple_find_buddies(account, who);
if(!buddies)
return;
@@ -1098,12 +1094,11 @@ void jabber_google_roster_add_deny(Purpl
}
}
- purple_prpl_got_user_status(purple_connection_get_account(gc), who, "offline", NULL);
+ purple_prpl_got_user_status(account, who, "offline", NULL);
}
-void jabber_google_roster_rem_deny(PurpleConnection *gc, const char *who)
+void jabber_google_roster_rem_deny(JabberStream *js, const char *who)
{
- JabberStream *js;
GSList *buddies;
JabberIq *iq;
xmlnode *query;
@@ -1112,14 +1107,6 @@ void jabber_google_roster_rem_deny(Purpl
PurpleBuddy *b;
const char *balias;
- g_return_if_fail(gc != NULL);
- g_return_if_fail(who != NULL);
-
- js = (JabberStream*)(gc->proto_data);
-
- if (!js || !(js->server_caps & JABBER_CAP_GOOGLE_ROSTER))
- return;
-
buddies = purple_find_buddies(purple_connection_get_account(js->gc), who);
if(!buddies)
return;
============================================================
--- libpurple/protocols/jabber/google.h 6dcd8a11876e13bb0f302772c628492440b91c87
+++ libpurple/protocols/jabber/google.h 43aa22fc05a7a6333b84674eb8cbb4c8a639fe01
@@ -43,8 +43,8 @@ char *jabber_google_presence_outgoing(Pu
void jabber_google_presence_incoming(JabberStream *js, const char *who, JabberBuddyResource *jbr);
char *jabber_google_presence_outgoing(PurpleStatus *tune);
-void jabber_google_roster_add_deny(PurpleConnection *gc, const char *who);
-void jabber_google_roster_rem_deny(PurpleConnection *gc, const char *who);
+void jabber_google_roster_add_deny(JabberStream *js, const char *who);
+void jabber_google_roster_rem_deny(JabberStream *js, const char *who);
char *jabber_google_format_to_html(const char *text);
============================================================
--- libpurple/protocols/jabber/jabber.c c38f7f5c70b2d75f921b0c269b57d240e54ae0ba
+++ libpurple/protocols/jabber/jabber.c b68799f681041cfe9f7688573ee77523615dd27c
@@ -1742,13 +1742,15 @@ void jabber_add_deny(PurpleConnection *g
JabberIq *iq;
xmlnode *block, *item;
- js = gc->proto_data;
+ g_return_if_fail(who != NULL && *who != '\0');
+
+ js = purple_connection_get_protocol_data(gc);
if (js == NULL)
return;
if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER)
{
- jabber_google_roster_add_deny(gc, who);
+ jabber_google_roster_add_deny(js, who);
return;
}
@@ -1776,13 +1778,15 @@ void jabber_rem_deny(PurpleConnection *g
JabberIq *iq;
xmlnode *unblock, *item;
- js = gc->proto_data;
+ g_return_if_fail(who != NULL && *who != '\0');
+
+ js = purple_connection_get_protocol_data(gc);
if (js == NULL)
return;
if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER)
{
- jabber_google_roster_rem_deny(gc, who);
+ jabber_google_roster_rem_deny(js, who);
return;
}
More information about the Commits
mailing list