diff libpurple/protocols/jabber/google.c @ 28767:9ab75ab032b4

jabber: The google roster request code was so lonely, so let's just drop-kick it and add the little custom logic to roster.c
author Paul Aurich <paul@darkrain42.org>
date Sun, 06 Dec 2009 22:44:20 +0000
parents edf0aa0e55cb
children c38f6e6bf4ce d4ec9ba82814
line wrap: on
line diff
--- a/libpurple/protocols/jabber/google.c	Sun Dec 06 19:26:52 2009 +0000
+++ b/libpurple/protocols/jabber/google.c	Sun Dec 06 22:44:20 2009 +0000
@@ -950,33 +950,6 @@
 	jabber_iq_send(iq);
 }
 
-static void
-roster_init_cb(JabberStream *js, const char *from, JabberIqType type,
-               const char *id, xmlnode *packet, gpointer data)
-{
-	xmlnode *query = xmlnode_get_child(packet, "query");
-
-	if (type == JABBER_IQ_RESULT && query)
-		jabber_roster_parse(js, from, type, id, query);
-
-	jabber_stream_set_state(js, JABBER_STREAM_CONNECTED);
-}
-
-void jabber_google_roster_init(JabberStream *js)
-{
-	JabberIq *iq;
-	xmlnode *query;
-
-	iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:roster");
-	query = xmlnode_get_child(iq->node, "query");
-
-	xmlnode_set_attrib(query, "xmlns:gr", "google:roster");
-	xmlnode_set_attrib(query, "gr:ext", "2");
-
-	jabber_iq_set_callback(iq, roster_init_cb, NULL);
-	jabber_iq_send(iq);
-}
-
 void jabber_google_roster_outgoing(JabberStream *js, xmlnode *query, xmlnode *item)
 {
 	PurpleAccount *account = purple_connection_get_account(js->gc);
@@ -986,7 +959,7 @@
 
 	while (list) {
 		if (!strcmp(jid_norm, (char*)list->data)) {
-			xmlnode_set_attrib(query, "xmlns:gr", "google:roster");
+			xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER);
 			xmlnode_set_attrib(query, "gr:ext", "2");
 			xmlnode_set_attrib(item, "gr:t", "B");
 			return;
@@ -1003,7 +976,7 @@
 
 	char *jid_norm;
 
-	const char *grt = xmlnode_get_attrib_with_namespace(item, "t", "google:roster");
+	const char *grt = xmlnode_get_attrib_with_namespace(item, "t", NS_GOOGLE_ROSTER);
 	const char *subscription = xmlnode_get_attrib(item, "subscription");
 	const char *ask = xmlnode_get_attrib(item, "ask");
 
@@ -1088,7 +1061,7 @@
 	xmlnode_set_attrib(item, "jid", who);
 	xmlnode_set_attrib(item, "name", balias ? balias : "");
 	xmlnode_set_attrib(item, "gr:t", "B");
-	xmlnode_set_attrib(query, "xmlns:gr", "google:roster");
+	xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER);
 	xmlnode_set_attrib(query, "gr:ext", "2");
 
 	jabber_iq_send(iq);
@@ -1147,7 +1120,7 @@
 	balias = purple_buddy_get_local_buddy_alias(b);
 	xmlnode_set_attrib(item, "jid", who);
 	xmlnode_set_attrib(item, "name", balias ? balias : "");
-	xmlnode_set_attrib(query, "xmlns:gr", "google:roster");
+	xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER);
 	xmlnode_set_attrib(query, "gr:ext", "2");
 
 	jabber_iq_send(iq);