pidgin: 3e6ed182: jabber: More namespaces! This is a good...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Fri Nov 27 12:10:46 EST 2009


-----------------------------------------------------------------
Revision: 3e6ed1829a654e5c7cf286670e3adc20e6158113
Ancestor: e12f3c23fc628eabb99cfe528b5b5b9f3609d5db
Author: darkrain42 at pidgin.im
Date: 2009-11-27T17:07:19
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/3e6ed1829a654e5c7cf286670e3adc20e6158113

Modified files:
        libpurple/protocols/jabber/adhoccommands.c
        libpurple/protocols/jabber/buddy.c
        libpurple/protocols/jabber/caps.c
        libpurple/protocols/jabber/chat.c
        libpurple/protocols/jabber/disco.c
        libpurple/protocols/jabber/google.c
        libpurple/protocols/jabber/ibb.c
        libpurple/protocols/jabber/iq.c
        libpurple/protocols/jabber/jabber.c
        libpurple/protocols/jabber/message.c
        libpurple/protocols/jabber/namespaces.h
        libpurple/protocols/jabber/oob.c
        libpurple/protocols/jabber/presence.c
        libpurple/protocols/jabber/si.c

ChangeLog: 

jabber: More namespaces!  This is a good stopping point for now.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/adhoccommands.c	c787144a53cb6dd87f0f9d8a13f31b0d51beec55
+++ libpurple/protocols/jabber/adhoccommands.c	ab99b44d8822d021a3110688b009fe30c26fd8b1
@@ -97,7 +97,7 @@ jabber_adhoc_disco_result_cb(JabberStrea
 	if (type == JABBER_IQ_ERROR)
 		return;
 
-	query = xmlnode_get_child_with_namespace(packet, "query", "http://jabber.org/protocol/disco#items");
+	query = xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_ITEMS);
 	if (!query)
 		return;
 	node = xmlnode_get_attrib(query, "node");
@@ -275,7 +275,8 @@ jabber_adhoc_server_got_list_cb(JabberSt
                                 JabberIqType type, const char *id,
                                 xmlnode *packet, gpointer data)
 {
-	xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", "http://jabber.org/protocol/disco#items");
+	xmlnode *query = xmlnode_get_child_with_namespace(packet, "query",
+			NS_DISCO_ITEMS);
 
 	jabber_adhoc_got_server_list(js, from, query);
 
@@ -291,8 +292,9 @@ void jabber_adhoc_server_get_list(Jabber
 }
 
 void jabber_adhoc_server_get_list(JabberStream *js) {
-	JabberIq *iq = jabber_iq_new_query(js,JABBER_IQ_GET,"http://jabber.org/protocol/disco#items");
-	xmlnode *query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#items");
+	JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS);
+	xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query",
+			NS_DISCO_ITEMS);
 
 	xmlnode_set_attrib(iq->node,"to",js->user->domain);
 	xmlnode_set_attrib(query,"node","http://jabber.org/protocol/commands");
============================================================
--- libpurple/protocols/jabber/buddy.c	23271dbb78131bf7d47ad4c59b9d58119b954181
+++ libpurple/protocols/jabber/buddy.c	04bc7984bb02176cfd7fbf99dc3b00e27d50ff8f
@@ -1466,7 +1466,7 @@ static gboolean _client_is_blacklisted(J
 	if(!jbr->client.name)
 		return FALSE;
 
-	if(!strcmp(ns, "jabber:iq:last")) {
+	if(!strcmp(ns, NS_LAST_ACTIVITY)) {
 		if(!strcmp(jbr->client.name, "Trillian")) {
 			/* verified by nwalp 2007/05/09 */
 			if(!strcmp(jbr->client.version, "3.1.0.121") ||
@@ -1512,8 +1512,8 @@ dispatch_queries_for_resource(JabberStre
 	 * respond (with an error or otherwise) to jabber:iq:last
 	 * requests.  There are a number of Trillian users in my
 	 * office. */
-	if(!_client_is_blacklisted(jbr, "jabber:iq:last")) {
-		iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:last");
+	if(!_client_is_blacklisted(jbr, NS_LAST_ACTIVITY)) {
+		iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_LAST_ACTIVITY);
 		xmlnode_set_attrib(iq->node, "to", to);
 		jabber_iq_set_callback(iq, jabber_last_parse, jbi);
 		jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id));
@@ -1522,12 +1522,12 @@ dispatch_queries_for_resource(JabberStre
 
 	if (jbr->tz_off == PURPLE_NO_TZ_OFF &&
 			(!jbr->caps.info ||
-			 	jabber_resource_has_capability(jbr, "urn:xmpp:time"))) {
+			 	jabber_resource_has_capability(jbr, NS_ENTITY_TIME))) {
 		xmlnode *child;
 		iq = jabber_iq_new(js, JABBER_IQ_GET);
 		xmlnode_set_attrib(iq->node, "to", to);
 		child = xmlnode_new_child(iq->node, "time");
-		xmlnode_set_namespace(child, "urn:xmpp:time");
+		xmlnode_set_namespace(child, NS_ENTITY_TIME);
 		jabber_iq_set_callback(iq, jabber_time_parse, jbi);
 		jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id));
 		jabber_iq_send(iq);
@@ -1590,7 +1590,7 @@ static void jabber_buddy_get_info_for_ji
 
 	if (!jb->resources && is_bare_jid) {
 		/* user is offline, send a jabber:iq:last to find out last time online */
-		iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:last");
+		iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_LAST_ACTIVITY);
 		xmlnode_set_attrib(iq->node, "to", jid);
 		jabber_iq_set_callback(iq, jabber_last_offline_parse, jbi);
 		jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id));
============================================================
--- libpurple/protocols/jabber/caps.c	6d23929e05937b1c51246cbafc4881b57efc4ce3
+++ libpurple/protocols/jabber/caps.c	601f3fb5871c57af331f041d525a94218ed61d94
@@ -440,7 +440,7 @@ jabber_caps_client_iqcb(JabberStream *js
                         const char *id, xmlnode *packet, gpointer data)
 {
 	xmlnode *query = xmlnode_get_child_with_namespace(packet, "query",
-		"http://jabber.org/protocol/disco#info");
+		NS_DISCO_INFO);
 	jabber_caps_cbplususerdata *userdata = data;
 	JabberCapsClientInfo *info = NULL, *value;
 	JabberCapsTuple key;
@@ -531,7 +531,7 @@ jabber_caps_ext_iqcb(JabberStream *js, c
                      const char *id, xmlnode *packet, gpointer data)
 {
 	xmlnode *query = xmlnode_get_child_with_namespace(packet, "query",
-		"http://jabber.org/protocol/disco#info");
+		NS_DISCO_INFO);
 	xmlnode *child;
 	ext_iq_data *userdata = data;
 	GList *features = NULL;
@@ -638,10 +638,9 @@ void jabber_caps_get_info(JabberStream *
 		xmlnode *query;
 		char *nodever;
 
-		iq = jabber_iq_new_query(js, JABBER_IQ_GET,
-					"http://jabber.org/protocol/disco#info");
+		iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO);
 		query = xmlnode_get_child_with_namespace(iq->node, "query",
-					"http://jabber.org/protocol/disco#info");
+					NS_DISCO_INFO);
 		nodever = g_strdup_printf("%s#%s", node, ver);
 		xmlnode_set_attrib(query, "node", nodever);
 		g_free(nodever);
@@ -679,10 +678,9 @@ void jabber_caps_get_info(JabberStream *
 				cbdata->name = exts[i];
 				cbdata->data = cbplususerdata_ref(userdata);
 
-				iq = jabber_iq_new_query(js, JABBER_IQ_GET,
-				            "http://jabber.org/protocol/disco#info");
+				iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO);
 				query = xmlnode_get_child_with_namespace(iq->node, "query",
-				            "http://jabber.org/protocol/disco#info");
+				            NS_DISCO_INFO);
 				nodeext = g_strdup_printf("%s#%s", node, exts[i]);
 				xmlnode_set_attrib(query, "node", nodeext);
 				g_free(nodeext);
@@ -771,7 +769,7 @@ static JabberCapsClientInfo *jabber_caps
 	xmlnode *child;
 	JabberCapsClientInfo *info;
 
-	if (!query || strcmp(query->xmlns, "http://jabber.org/protocol/disco#info"))
+	if (!query || strcmp(query->xmlns, NS_DISCO_INFO))
 		return 0;
 
 	info = g_new0(JabberCapsClientInfo, 1);
============================================================
--- libpurple/protocols/jabber/chat.c	3a68552f9a26fb9143fca11f2b3293d4d97ec776
+++ libpurple/protocols/jabber/chat.c	131d1890de69d77be2338ce3c03e2041c87e7b4d
@@ -825,7 +825,7 @@ static void roomlist_ok_cb(JabberStream 
 
 	purple_roomlist_set_in_progress(js->roomlist, TRUE);
 
-	iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
+	iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS);
 
 	xmlnode_set_attrib(iq->node, "to", server);
 
@@ -1201,7 +1201,7 @@ static void jabber_chat_disco_traffic_cb
 	for(x = xmlnode_get_child(query, "feature"); x; x = xmlnode_get_next_twin(x)) {
 		const char *var = xmlnode_get_attrib(x, "var");
 
-		if(var && !strcmp(var, "http://jabber.org/protocol/xhtml-im")) {
+		if(var && !strcmp(var, NS_XHTML_IM)) {
 			chat->xhtml = TRUE;
 		}
 	}
@@ -1216,8 +1216,7 @@ void jabber_chat_disco_traffic(JabberCha
 
 	room_jid = g_strdup_printf("%s@%s", chat->room, chat->server);
 
-	iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET,
-			"http://jabber.org/protocol/disco#info");
+	iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, NS_DISCO_INFO);
 
 	xmlnode_set_attrib(iq->node, "to", room_jid);
 
============================================================
--- libpurple/protocols/jabber/disco.c	78710aca03628159b03b222d103e842b57053aee
+++ libpurple/protocols/jabber/disco.c	12f8057571663f481d70ed663f277cdf8b2893b3
@@ -60,7 +60,7 @@ jabber_disco_bytestream_server_cb(Jabber
 {
 	JabberBytestreamsStreamhost *sh = data;
 	xmlnode *query = xmlnode_get_child_with_namespace(packet, "query",
-		"http://jabber.org/protocol/bytestreams");
+		NS_BYTESTREAMS);
 
 	if (from && !strcmp(from, sh->jid) && query != NULL) {
 		xmlnode *sh_node = xmlnode_get_child(query, "streamhost");
@@ -109,8 +109,7 @@ void jabber_disco_info_parse(JabberStrea
 		/* create custom caps node URI */
 		node_uri = g_strconcat(CAPS0115_NODE, "#", jabber_caps_get_own_hash(js), NULL);
 
-		iq = jabber_iq_new_query(js, JABBER_IQ_RESULT,
-				"http://jabber.org/protocol/disco#info");
+		iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, NS_DISCO_INFO);
 
 		jabber_iq_set_id(iq, id);
 
@@ -189,7 +188,7 @@ void jabber_disco_info_parse(JabberStrea
 			xmlnode_set_attrib(error, "code", "404");
 			xmlnode_set_attrib(error, "type", "cancel");
 			inf = xmlnode_new_child(error, "item-not-found");
-			xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas");
+			xmlnode_set_namespace(inf, NS_XMPP_STANZAS);
 		}
 		g_free(node_uri);
 		jabber_iq_send(iq);
@@ -204,7 +203,7 @@ void jabber_disco_info_parse(JabberStrea
 		error = xmlnode_new_child(iq->node, "error");
 		xmlnode_set_attrib(error, "type", "modify");
 		bad_request = xmlnode_new_child(error, "bad-request");
-		xmlnode_set_namespace(bad_request, "urn:ietf:params:xml:ns:xmpp-stanzas");
+		xmlnode_set_namespace(bad_request, NS_XMPP_STANZAS);
 
 		jabber_iq_set_id(iq, id);
 		if (from)
@@ -221,8 +220,7 @@ static void jabber_disco_info_cb(JabberS
 	struct _jabber_disco_info_cb_data *jdicd = data;
 	xmlnode *query;
 
-	query = xmlnode_get_child_with_namespace(packet, "query",
-				"http://jabber.org/protocol/disco#info");
+	query = xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_INFO);
 
 	if (type == JABBER_IQ_RESULT && query) {
 		xmlnode *child;
@@ -257,7 +255,7 @@ static void jabber_disco_info_cb(JabberS
 				} else if(!strcmp(category, "directory") && !strcmp(type, "user")) {
 					/* we found a JUD */
 					js->user_directories = g_list_prepend(js->user_directories, g_strdup(from));
-				} else if(!strcmp(category, "proxy") && !strcmp(type, "bytestreams")) {
+				} else if(!strcmp(category, "proxy") && !strcmp(type, NS_BYTESTREAMS)) {
 					/* This is a bytestream proxy */
 					JabberIq *iq;
 					JabberBytestreamsStreamhost *sh;
@@ -269,7 +267,7 @@ static void jabber_disco_info_cb(JabberS
 					js->bs_proxies = g_list_prepend(js->bs_proxies, sh);
 
 					iq = jabber_iq_new_query(js, JABBER_IQ_GET,
-								 "http://jabber.org/protocol/bytestreams");
+							NS_BYTESTREAMS);
 					xmlnode_set_attrib(iq->node, "to", sh->jid);
 					jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh);
 					jabber_iq_send(iq);
@@ -284,7 +282,7 @@ static void jabber_disco_info_cb(JabberS
 					capabilities |= JABBER_CAP_SI;
 				else if(!strcmp(var, "http://jabber.org/protocol/si/profile/file-transfer"))
 					capabilities |= JABBER_CAP_SI_FILE_XFER;
-				else if(!strcmp(var, "http://jabber.org/protocol/bytestreams"))
+				else if(!strcmp(var, NS_BYTESTREAMS))
 					capabilities |= JABBER_CAP_BYTESTREAMS;
 				else if(!strcmp(var, "jabber:iq:search"))
 					capabilities |= JABBER_CAP_IQ_SEARCH;
@@ -292,12 +290,12 @@ static void jabber_disco_info_cb(JabberS
 					capabilities |= JABBER_CAP_IQ_REGISTER;
 				else if(!strcmp(var, NS_PING))
 					capabilities |= JABBER_CAP_PING;
-				else if(!strcmp(var, "http://jabber.org/protocol/disco#items"))
+				else if(!strcmp(var, NS_DISCO_ITEMS))
 					capabilities |= JABBER_CAP_ITEMS;
 				else if(!strcmp(var, "http://jabber.org/protocol/commands")) {
 					capabilities |= JABBER_CAP_ADHOC;
 				}
-				else if(!strcmp(var, "http://jabber.org/protocol/ibb")) {
+				else if(!strcmp(var, NS_IBB)) {
 					purple_debug_info("jabber", "remote supports IBB\n");
 					capabilities |= JABBER_CAP_IBB;
 				}
@@ -341,7 +339,7 @@ void jabber_disco_items_parse(JabberStre
 {
 	if(type == JABBER_IQ_GET) {
 		JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT,
-				"http://jabber.org/protocol/disco#items");
+				NS_DISCO_ITEMS);
 
 		/* preserve node */
 		xmlnode *iq_query = xmlnode_get_child(iq->node, "query");
@@ -409,8 +407,7 @@ jabber_disco_finish_server_info_result_c
 			sh->jid = g_strdup(ft_proxy_list[i]);
 			js->bs_proxies = g_list_prepend(js->bs_proxies, sh);
 
-			iq = jabber_iq_new_query(js, JABBER_IQ_GET,
-						 "http://jabber.org/protocol/bytestreams");
+			iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_BYTESTREAMS);
 			xmlnode_set_attrib(iq->node, "to", sh->jid);
 			jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh);
 			jabber_iq_send(iq);
@@ -555,7 +552,7 @@ jabber_disco_server_info_result_cb(Jabbe
 		if (!var)
 			continue;
 
-		if (!strcmp("google:mail:notify", var)) {
+		if (!strcmp(NS_GOOGLE_MAIL_NOTIFY, var)) {
 			js->server_caps |= JABBER_CAP_GMAIL_NOTIFY;
 			jabber_gmail_init(js);
 		} else if (!strcmp("google:roster", var)) {
@@ -563,7 +560,7 @@ jabber_disco_server_info_result_cb(Jabbe
 			jabber_google_roster_init(js);
 		} else if (!strcmp("http://jabber.org/protocol/commands", var)) {
 			js->server_caps |= JABBER_CAP_ADHOC;
-		} else if (!strcmp("urn:xmpp:blocking", var)) {
+		} else if (!strcmp(NS_SIMPLE_BLOCKING, var)) {
 			js->server_caps |= JABBER_CAP_BLOCKING;
 		}
 	}
@@ -604,7 +601,7 @@ jabber_disco_server_items_result_cb(Jabb
 		if((node = xmlnode_get_attrib(child, "node")))
 			continue;
 
-		iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
+		iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO);
 		xmlnode_set_attrib(iq->node, "to", jid);
 		jabber_iq_set_callback(iq, jabber_disco_info_cb, NULL);
 		jabber_iq_send(iq);
@@ -613,15 +610,14 @@ void jabber_disco_items_server(JabberStr
 
 void jabber_disco_items_server(JabberStream *js)
 {
-	JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET,
-			"http://jabber.org/protocol/disco#items");
+	JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS);
 
 	xmlnode_set_attrib(iq->node, "to", js->user->domain);
 
 	jabber_iq_set_callback(iq, jabber_disco_server_items_result_cb, NULL);
 	jabber_iq_send(iq);
 
-	iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
+	iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO);
 	xmlnode_set_attrib(iq->node, "to", js->user->domain);
 	jabber_iq_set_callback(iq, jabber_disco_server_info_result_cb, NULL);
 	jabber_iq_send(iq);
@@ -650,7 +646,7 @@ void jabber_disco_info_do(JabberStream *
 	jdicd->data = data;
 	jdicd->callback = callback;
 
-	iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info");
+	iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO);
 	xmlnode_set_attrib(iq->node, "to", who);
 
 	jabber_iq_set_callback(iq, jabber_disco_info_cb, jdicd);
============================================================
--- libpurple/protocols/jabber/google.c	a1cb7a21691a5e17dafc6e799ab56c9ecfd88a5d
+++ libpurple/protocols/jabber/google.c	dd7dfacc2e0637748c7b5295cfbe017ec9947143
@@ -910,7 +910,7 @@ jabber_gmail_poke(JabberStream *js, cons
 	purple_debug_misc("jabber",
 		   "Got new mail notification. Sending request for more info\n");
 
-	iq = jabber_iq_new_query(js, JABBER_IQ_GET, "google:mail:notify");
+	iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_GOOGLE_MAIL_NOTIFY);
 	jabber_iq_set_callback(iq, jabber_gmail_parse, NULL);
 	query = xmlnode_get_child(iq->node, "query");
 
@@ -944,7 +944,7 @@ void jabber_gmail_init(JabberStream *js)
 	xmlnode_set_attrib(mailnotifications, "value", "true");
 	jabber_iq_send(iq);
 
-	iq = jabber_iq_new_query(js, JABBER_IQ_GET, "google:mail:notify");
+	iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_GOOGLE_MAIL_NOTIFY);
 	jabber_iq_set_callback(iq, jabber_gmail_parse, NULL);
 	jabber_iq_send(iq);
 }
============================================================
--- libpurple/protocols/jabber/ibb.c	340cdc40e222d2486519bc02dc4a19fe7bb993ab
+++ libpurple/protocols/jabber/ibb.c	e34ce2522b378bdde90d1cd86ece8268253b17e6
@@ -361,8 +361,7 @@ jabber_ibb_send_error_response(JabberStr
 	xmlnode *error = xmlnode_new("error");
 	xmlnode *item_not_found = xmlnode_new("item-not-found");
 
-	xmlnode_set_namespace(item_not_found,
-		"urn:ietf:params:xml:ns:xmpp-stanzas");
+	xmlnode_set_namespace(item_not_found, NS_XMPP_STANZAS);
 	xmlnode_set_attrib(error, "code", "440");
 	xmlnode_set_attrib(error, "type", "cancel");
 	jabber_iq_set_id(result, id);
============================================================
--- libpurple/protocols/jabber/iq.c	abec2ce35b510c6566f0465df75b94385792f8e4
+++ libpurple/protocols/jabber/iq.c	50153ac815cd7620aabd8a6e3524745e2025c47b
@@ -155,7 +155,7 @@ static void jabber_iq_last_parse(JabberS
 	char *idle_time;
 
 	if(type == JABBER_IQ_GET) {
-		iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, "jabber:iq:last");
+		iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, NS_LAST_ACTIVITY);
 		jabber_iq_set_id(iq, id);
 		if (from)
 			xmlnode_set_attrib(iq->node, "to", from);
@@ -190,7 +190,7 @@ static void jabber_time_parse(JabberStre
 			xmlnode_set_attrib(iq->node, "to", from);
 
 		child = xmlnode_new_child(iq->node, child->name);
-		xmlnode_set_namespace(child, "urn:xmpp:time");
+		xmlnode_set_namespace(child, NS_ENTITY_TIME);
 
 		/* <tzo>-06:00</tzo> */
 		tm = localtime(&now_t);
@@ -332,7 +332,7 @@ void jabber_iq_parse(JabberStream *js, x
 			error = xmlnode_new_child(iq->node, "error");
 			xmlnode_set_attrib(error, "type", "modify");
 			x = xmlnode_new_child(error, "bad-request");
-			xmlnode_set_namespace(x, "urn:ietf:params:xml:ns:xmpp-stanzas");
+			xmlnode_set_namespace(x, NS_XMPP_STANZAS);
 
 			jabber_iq_send(iq);
 		} else
@@ -397,7 +397,7 @@ void jabber_iq_parse(JabberStream *js, x
 		xmlnode_set_attrib(error, "type", "cancel");
 		xmlnode_set_attrib(error, "code", "501");
 		x = xmlnode_new_child(error, "feature-not-implemented");
-		xmlnode_set_namespace(x, "urn:ietf:params:xml:ns:xmpp-stanzas");
+		xmlnode_set_namespace(x, NS_XMPP_STANZAS);
 
 		jabber_iq_send(iq);
 	}
@@ -458,21 +458,19 @@ void jabber_iq_init(void)
 	signal_iq_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
 
 	jabber_iq_register_handler("jingle", JINGLE, jingle_parse);
-	jabber_iq_register_handler("mailbox", "google:mail:notify",
+	jabber_iq_register_handler("mailbox", NS_GOOGLE_MAIL_NOTIFY,
 			jabber_gmail_poke);
-	jabber_iq_register_handler("new-mail", "google:mail:notify",
+	jabber_iq_register_handler("new-mail", NS_GOOGLE_MAIL_NOTIFY,
 			jabber_gmail_poke);
 	jabber_iq_register_handler("ping", NS_PING, jabber_ping_parse);
 	jabber_iq_register_handler("query", NS_GOOGLE_JINGLE_INFO,
 			jabber_google_handle_jingle_info);
-	jabber_iq_register_handler("query", "http://jabber.org/protocol/bytestreams",
+	jabber_iq_register_handler("query", NS_BYTESTREAMS,
 			jabber_bytestreams_parse);
-	jabber_iq_register_handler("query", "http://jabber.org/protocol/disco#info",
-			jabber_disco_info_parse);
-	jabber_iq_register_handler("query", "http://jabber.org/protocol/disco#items",
-			jabber_disco_items_parse);
-	jabber_iq_register_handler("query", "jabber:iq:last", jabber_iq_last_parse);
-	jabber_iq_register_handler("query", "jabber:iq:oob", jabber_oob_parse);
+	jabber_iq_register_handler("query", NS_DISCO_INFO, jabber_disco_info_parse);
+	jabber_iq_register_handler("query", NS_DISCO_ITEMS, jabber_disco_items_parse);
+	jabber_iq_register_handler("query", NS_LAST_ACTIVITY, jabber_iq_last_parse);
+	jabber_iq_register_handler("query", NS_OOB_IQ_DATA, jabber_oob_parse);
 	jabber_iq_register_handler("query", "jabber:iq:register",
 			jabber_register_parse);
 	jabber_iq_register_handler("query", "jabber:iq:roster",
@@ -483,9 +481,9 @@ void jabber_iq_init(void)
 	jabber_iq_register_handler("session", NS_GOOGLE_SESSION,
 		jabber_google_session_parse);
 #endif
-	jabber_iq_register_handler("block", "urn:xmpp:blocking", jabber_blocklist_parse_push);
-	jabber_iq_register_handler("unblock", "urn:xmpp:blocking", jabber_blocklist_parse_push);
-	jabber_iq_register_handler("time", "urn:xmpp:time", jabber_time_parse);
+	jabber_iq_register_handler("block", NS_SIMPLE_BLOCKING, jabber_blocklist_parse_push);
+	jabber_iq_register_handler("unblock", NS_SIMPLE_BLOCKING, jabber_blocklist_parse_push);
+	jabber_iq_register_handler("time", NS_ENTITY_TIME, jabber_time_parse);
 
 }
 
============================================================
--- libpurple/protocols/jabber/jabber.c	b8903b76b30a2df63524e4565ee24dd5884469b9
+++ libpurple/protocols/jabber/jabber.c	739a0e2460a56e90818d6e6156ea37fa9d5fdde5
@@ -81,8 +81,8 @@ static void jabber_stream_init(JabberStr
 	char *open_stream;
 
 	open_stream = g_strdup_printf("<stream:stream to='%s' "
-				          "xmlns='jabber:client' "
-						  "xmlns:stream='http://etherx.jabber.org/streams' "
+				          "xmlns='" NS_XMPP_CLIENT "' "
+						  "xmlns:stream='" NS_XMPP_STREAMS "' "
 						  "version='1.0'>",
 						  js->user->domain);
 	/* setup the parser fresh for each stream */
@@ -116,7 +116,7 @@ static void jabber_session_init(JabberSt
 	jabber_iq_set_callback(iq, jabber_session_initialized_cb, NULL);
 
 	session = xmlnode_new_child(iq->node, "session");
-	xmlnode_set_namespace(session, "urn:ietf:params:xml:ns:xmpp-session");
+	xmlnode_set_namespace(session, NS_XMPP_SESSION);
 
 	jabber_iq_send(iq);
 }
@@ -128,7 +128,7 @@ static void jabber_bind_result_cb(Jabber
 	xmlnode *bind;
 
 	if (type == JABBER_IQ_RESULT &&
-			(bind = xmlnode_get_child_with_namespace(packet, "bind", "urn:ietf:params:xml:ns:xmpp-bind"))) {
+			(bind = xmlnode_get_child_with_namespace(packet, "bind", NS_XMPP_BIND))) {
 		xmlnode *jid;
 		char *full_jid;
 		if((jid = xmlnode_get_child(bind, "jid")) && (full_jid = xmlnode_get_data(jid))) {
@@ -217,7 +217,7 @@ void jabber_stream_features_parse(Jabber
 		char *requested_resource;
 		JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET);
 		bind = xmlnode_new_child(iq->node, "bind");
-		xmlnode_set_namespace(bind, "urn:ietf:params:xml:ns:xmpp-bind");
+		xmlnode_set_namespace(bind, NS_XMPP_BIND);
 		requested_resource = jabber_prep_resource(js->user->resource);
 
 		if (requested_resource != NULL) {
@@ -272,11 +272,11 @@ void jabber_process_packet(JabberStream 
 	} else if(!strcmp((*packet)->name, "stream:features")) {
 		jabber_stream_features_parse(js, *packet);
 	} else if (!strcmp((*packet)->name, "features") && xmlns &&
-		   !strcmp(xmlns, "http://etherx.jabber.org/streams")) {
+		   !strcmp(xmlns, NS_XMPP_STREAMS)) {
 		jabber_stream_features_parse(js, *packet);
 	} else if(!strcmp((*packet)->name, "stream:error") ||
 			 (!strcmp((*packet)->name, "error") && xmlns &&
-				!strcmp(xmlns, "http://etherx.jabber.org/streams")))
+				!strcmp(xmlns, NS_XMPP_STREAMS)))
 	{
 		jabber_stream_handle_error(js, *packet);
 	} else if(!strcmp((*packet)->name, "challenge")) {
@@ -385,7 +385,7 @@ void jabber_send_raw(JabberStream *js, c
 		if(js->state != JABBER_STREAM_CONNECTED &&
 				/* Either <auth> or <query><password>... */
 				(((tag_start = strstr(data, "<auth ")) &&
-					strstr(data, "xmlns='urn:ietf:params:xml:ns:xmpp-sasl'")) ||
+					strstr(data, "xmlns='" NS_XMPP_SASL "'")) ||
 				((tag_start = strstr(data, "<query ")) &&
 					strstr(data, "xmlns='jabber:iq:auth'>") &&
 					(tag_start = strstr(tag_start, "<password>"))))) {
@@ -488,7 +488,7 @@ void jabber_send_signal_cb(PurpleConnect
 		if (g_str_equal((*packet)->name, "message") ||
 				g_str_equal((*packet)->name, "iq") ||
 				g_str_equal((*packet)->name, "presence"))
-			xmlnode_set_namespace(*packet, "jabber:client");
+			xmlnode_set_namespace(*packet, NS_XMPP_CLIENT);
 	txt = xmlnode_to_str(*packet, &len);
 	jabber_send_raw(js, txt, len);
 	g_free(txt);
@@ -1213,7 +1213,7 @@ void jabber_register_parse(JabberStream 
 		jabber_x_data_request(js, x, jabber_register_x_data_cb, g_strdup(from));
 		return;
 
-	} else if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:oob"))) {
+	} else if((x = xmlnode_get_child_with_namespace(query, "x", NS_OOB_X_DATA))) {
 		xmlnode *url;
 
 		if((url = xmlnode_get_child(x, "url"))) {
@@ -1642,7 +1642,7 @@ void jabber_blocklist_parse_push(JabberS
 		error = xmlnode_new_child(result->node, "error");
 		xmlnode_set_attrib(error, "type", "cancel");
 		x = xmlnode_new_child(error, "not-allowed");
-		xmlnode_set_namespace(x, "urn:ietf:params:xml:ns:xmpp-stanzas");
+		xmlnode_set_namespace(x, NS_XMPP_STANZAS);
 
 		jabber_iq_send(result);
 		return;
@@ -1668,7 +1668,7 @@ void jabber_blocklist_parse_push(JabberS
 		error = xmlnode_new_child(result->node, "error");
 		xmlnode_set_attrib(error, "type", "modify");
 		x = xmlnode_new_child(error, "bad-request");
-		xmlnode_set_namespace(x, "urn:ietf:params:xml:ns:xmpp-stanzas");
+		xmlnode_set_namespace(x, NS_XMPP_STANZAS);
 
 		jabber_iq_send(result);
 		return;
@@ -1698,7 +1698,7 @@ static void jabber_blocklist_parse(Jabbe
 	PurpleAccount *account;
 
 	blocklist = xmlnode_get_child_with_namespace(packet,
-			"blocklist", "urn:xmpp:blocking");
+			"blocklist", NS_SIMPLE_BLOCKING);
 	account = purple_connection_get_account(js->gc);
 
 	if (type == JABBER_IQ_ERROR || blocklist == NULL)
@@ -1731,7 +1731,7 @@ void jabber_request_block_list(JabberStr
 	iq = jabber_iq_new(js, JABBER_IQ_GET);
 
 	blocklist = xmlnode_new_child(iq->node, "blocklist");
-	xmlnode_set_namespace(blocklist, "urn:xmpp:blocking");
+	xmlnode_set_namespace(blocklist, NS_SIMPLE_BLOCKING);
 
 	jabber_iq_set_callback(iq, jabber_blocklist_parse, NULL);
 
@@ -1764,7 +1764,7 @@ void jabber_add_deny(PurpleConnection *g
 	iq = jabber_iq_new(js, JABBER_IQ_SET);
 
 	block = xmlnode_new_child(iq->node, "block");
-	xmlnode_set_namespace(block, "urn:xmpp:blocking");
+	xmlnode_set_namespace(block, NS_SIMPLE_BLOCKING);
 
 	item = xmlnode_new_child(block, "item");
 	xmlnode_set_attrib(item, "jid", who);
@@ -1794,7 +1794,7 @@ void jabber_rem_deny(PurpleConnection *g
 	iq = jabber_iq_new(js, JABBER_IQ_SET);
 
 	unblock = xmlnode_new_child(iq->node, "unblock");
-	xmlnode_set_namespace(unblock, "urn:xmpp:blocking");
+	xmlnode_set_namespace(unblock, NS_SIMPLE_BLOCKING);
 
 	item = xmlnode_new_child(unblock, "item");
 	xmlnode_set_attrib(item, "jid", who);
@@ -2458,7 +2458,7 @@ char *jabber_parse_error(JabberStream *j
 		} else if(xmlnode_get_child(error, "undefined-condition")) {
 			text = _("Unknown Error");
 		}
-	} else if(xmlns && !strcmp(xmlns, "urn:ietf:params:xml:ns:xmpp-sasl")) {
+	} else if(xmlns && !strcmp(xmlns, NS_XMPP_SASL)) {
 		/* Most common reason can be the default */
 		SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR);
 		if(xmlnode_get_child(packet, "aborted")) {
@@ -2486,7 +2486,7 @@ char *jabber_parse_error(JabberStream *j
 		}
 	} else if(!strcmp(packet->name, "stream:error") ||
 			 (!strcmp(packet->name, "error") && xmlns &&
-				!strcmp(xmlns, "http://etherx.jabber.org/streams"))) {
+				!strcmp(xmlns, NS_XMPP_STREAMS))) {
 		/* Most common reason as default: */
 		SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR);
 		if(xmlnode_get_child(packet, "bad-format")) {
@@ -3267,7 +3267,7 @@ gboolean jabber_can_receive_file(PurpleC
 				if (jabber_resource_has_capability(jbr,
 						"http://jabber.org/protocol/si/profile/file-transfer")
 			    	&& (jabber_resource_has_capability(jbr,
-			    			"http://jabber.org/protocol/bytestreams")
+			    			NS_BYTESTREAMS)
 			        	|| jabber_resource_has_capability(jbr, NS_IBB))) {
 					return TRUE;
 				}
@@ -3479,22 +3479,22 @@ jabber_init_plugin(PurplePlugin *plugin)
 	jabber_add_identity("client", type, NULL, ui_name);
 
 	/* initialize jabber_features list */
-	jabber_add_feature("jabber:iq:last", 0);
-	jabber_add_feature("jabber:iq:oob", 0);
-	jabber_add_feature("urn:xmpp:time", 0);
+	jabber_add_feature(NS_LAST_ACTIVITY, 0);
+	jabber_add_feature(NS_OOB_IQ_DATA, 0);
+	jabber_add_feature(NS_ENTITY_TIME, 0);
 	jabber_add_feature("jabber:iq:version", 0);
 	jabber_add_feature("jabber:x:conference", 0);
-	jabber_add_feature("http://jabber.org/protocol/bytestreams", 0);
+	jabber_add_feature(NS_BYTESTREAMS, 0);
 	jabber_add_feature("http://jabber.org/protocol/caps", 0);
 	jabber_add_feature("http://jabber.org/protocol/chatstates", 0);
-	jabber_add_feature("http://jabber.org/protocol/disco#info", 0);
-	jabber_add_feature("http://jabber.org/protocol/disco#items", 0);
+	jabber_add_feature(NS_DISCO_INFO, 0);
+	jabber_add_feature(NS_DISCO_ITEMS, 0);
 	jabber_add_feature(NS_IBB, 0);
 	jabber_add_feature("http://jabber.org/protocol/muc", 0);
 	jabber_add_feature("http://jabber.org/protocol/muc#user", 0);
 	jabber_add_feature("http://jabber.org/protocol/si", 0);
 	jabber_add_feature("http://jabber.org/protocol/si/profile/file-transfer", 0);
-	jabber_add_feature("http://jabber.org/protocol/xhtml-im", 0);
+	jabber_add_feature(NS_XHTML_IM, 0);
 	jabber_add_feature(NS_PING, 0);
 
 	/* Buzz/Attention */
============================================================
--- libpurple/protocols/jabber/message.c	ea9d42479761affdb7cd94a1d4a0e6c1b309c7ce
+++ libpurple/protocols/jabber/message.c	ed0d9b9f32d619ba1d18170986523fc2d0923c6b
@@ -178,7 +178,7 @@ static void handle_headline(JabberMessag
 	for(etc = jm->etc; etc; etc = etc->next) {
 		xmlnode *x = etc->data;
 		const char *xmlns = xmlnode_get_namespace(x);
-		if(xmlns && !strcmp(xmlns, "jabber:x:oob")) {
+		if(xmlns && !strcmp(xmlns, NS_OOB_X_DATA)) {
 			xmlnode *url, *desc;
 			char *urltxt, *desctxt;
 
@@ -611,22 +611,22 @@ void jabber_message_parse(JabberStream *
 				jm->etc = g_list_append(jm->etc, child);
 			/* The following tests expect xmlns != NULL */
 			continue;
-		} else if(!strcmp(child->name, "subject") && !strcmp(xmlns,"jabber:client")) {
+		} else if(!strcmp(child->name, "subject") && !strcmp(xmlns, NS_XMPP_CLIENT)) {
 			if(!jm->subject) {
 				jm->subject = xmlnode_get_data(child);
 				if(!jm->subject)
 					jm->subject = g_strdup("");
 			}
-		} else if(!strcmp(child->name, "thread") && !strcmp(xmlns,"jabber:client")) {
+		} else if(!strcmp(child->name, "thread") && !strcmp(xmlns, NS_XMPP_CLIENT)) {
 			if(!jm->thread_id)
 				jm->thread_id = xmlnode_get_data(child);
-		} else if(!strcmp(child->name, "body") && !strcmp(xmlns,"jabber:client")) {
+		} else if(!strcmp(child->name, "body") && !strcmp(xmlns, NS_XMPP_CLIENT)) {
 			if(!jm->body) {
 				char *msg = xmlnode_to_str(child, NULL);
 				jm->body = purple_strdup_withhtml(msg);
 				g_free(msg);
 			}
-		} else if(!strcmp(child->name, "html") && !strcmp(xmlns,"http://jabber.org/protocol/xhtml-im")) {
+		} else if(!strcmp(child->name, "html") && !strcmp(xmlns, NS_XHTML_IM)) {
 			if(!jm->xhtml && xmlnode_get_child(child, "body")) {
 				char *c;
 
@@ -800,7 +800,7 @@ void jabber_message_parse(JabberStream *
 			}
 		} else if (g_str_equal(child->name, "query")) {
 			const char *node = xmlnode_get_attrib(child, "node");
-			if (purple_strequal(xmlns, "http://jabber.org/protocol/disco#items")
+			if (purple_strequal(xmlns, NS_DISCO_ITEMS)
 					&& purple_strequal(node, "http://jabber.org/protocol/commands")) {
 				jabber_adhoc_got_list(js, jm->from, child);
 			}
@@ -1204,9 +1204,9 @@ int jabber_message_send_im(PurpleConnect
 	 * the user's roster, allow sending XHTML-IM markup.
 	 */
 	if (!jbr || !jbr->caps.info ||
-			jabber_resource_has_capability(jbr, "http://jabber.org/protocol/xhtml-im")) {
+			jabber_resource_has_capability(jbr, NS_XHTML_IM)) {
 		if (!jabber_xhtml_plain_equal(xhtml, jm->body))
-			jm->xhtml = g_strdup_printf("<html xmlns='http://jabber.org/protocol/xhtml-im'><body xmlns='http://www.w3.org/1999/xhtml'>%s</body></html>", xhtml);
+			jm->xhtml = g_strdup_printf("<html xmlns='" NS_XHTML_IM "'><body xmlns='" NS_XHTML "'>%s</body></html>", xhtml);
 	}
 
 	g_free(xhtml);
@@ -1249,7 +1249,7 @@ int jabber_message_send_chat(PurpleConne
 	}
 
 	if (chat->xhtml && !jabber_xhtml_plain_equal(xhtml, jm->body))
-		jm->xhtml = g_strdup_printf("<html xmlns='http://jabber.org/protocol/xhtml-im'><body xmlns='http://www.w3.org/1999/xhtml'>%s</body></html>", xhtml);
+		jm->xhtml = g_strdup_printf("<html xmlns='" NS_XHTML_IM "'><body xmlns='" NS_XHTML "'>%s</body></html>", xhtml);
 
 	g_free(xhtml);
 
============================================================
--- libpurple/protocols/jabber/namespaces.h	38a3f8ecf446cba1d1e8d0a5b53dff6719b9317d
+++ libpurple/protocols/jabber/namespaces.h	86aa40602b6554679e545d7cb2d287e3d421b83b
@@ -24,11 +24,34 @@
 #ifndef PURPLE_JABBER_NAMESPACES_H_
 #define PURPLE_JABBER_NAMESPACES_H_
 
-/* Implementation of XEP-0084 */
+#define NS_XMPP_BIND "urn:ietf:params:xml:ns:xmpp-bind"
+#define NS_XMPP_CLIENT "jabber:client"
+#define NS_XMPP_SASL "urn:ietf:params:xml:ns:xmpp-sasl"
+#define NS_XMPP_SESSION "urn:ietf:params:xml:ns:xmpp-session"
+#define NS_XMPP_STANZAS "urn:ietf:params:xml:ns:xmpp-stanzas"
+#define NS_XMPP_STREAMS "http://etherx.jabber.org/streams"
 
+/* XEP-0012 Last Activity (and XEP-0256 Last Activity in Presence) */
+#define NS_LAST_ACTIVITY "jabber:iq:last"
+
+/* XEP-0030 Service Discovery */
+#define NS_DISCO_INFO "http://jabber.org/protocol/disco#info"
+#define NS_DISCO_ITEMS "http://jabber.org/protocol/disco#items"
+
 /* XEP-0047 IBB (In-band bytestreams) */
 #define NS_IBB "http://jabber.org/protocol/ibb"
 
+/* XEP-0065 SOCKS5 Bytestreams */
+#define NS_BYTESTREAMS "http://jabber.org/protocol/bytestreams"
+
+/* XEP-0066 Out of Band Data (OOB) */
+#define NS_OOB_IQ_DATA "jabber:iq:oob"
+#define NS_OOB_X_DATA  "jabber:x:oob"
+
+/* XEP-0071 XHTML-IM (rich-text messages) */
+#define NS_XHTML_IM "http://jabber.org/protocol/xhtml-im"
+#define NS_XHTML "http://www.w3.org/1999/xhtml"
+
 /* XEP-0084 v0.12 User Avatar */
 #define NS_AVATAR_0_12_DATA     "http://www.xmpp.org/extensions/xep-0084.html#ns-data"
 #define NS_AVATAR_0_12_METADATA "http://www.xmpp.org/extensions/xep-0084.html#ns-metadata"
@@ -37,9 +60,15 @@
 #define NS_AVATAR_1_1_DATA      "urn:xmpp:avatar:data"
 #define NS_AVATAR_1_1_METADATA  "urn:xmpp:avatar:metadata"
 
+/* XEP-0191 Simple Communications Blocking */
+#define NS_SIMPLE_BLOCKING "urn:xmpp:blocking"
+
 /* XEP-0199 Ping */
 #define NS_PING "urn:xmpp:ping"
 
+/* XEP-0202 Entity Time */
+#define NS_ENTITY_TIME "urn:xmpp:time"
+
 /* XEP-0224 Attention */
 #define NS_ATTENTION "urn:xmpp:attention:0"
 
@@ -52,6 +81,8 @@
 #define NS_GOOGLE_VOICE "http://www.google.com/xmpp/protocol/voice/v1"
 #define NS_GOOGLE_JINGLE_INFO "google:jingleinfo"
 
+#define NS_GOOGLE_MAIL_NOTIFY "google:mail:notify"
+
 #define NS_GOOGLE_PROTOCOL_SESSION "http://www.google.com/xmpp/protocol/session"
 #define NS_GOOGLE_SESSION "http://www.google.com/session"
 #define NS_GOOGLE_SESSION_PHONE "http://www.google.com/session/phone"
============================================================
--- libpurple/protocols/jabber/oob.c	7789039f4c6c2f45c55c0c9d623e6478bf072753
+++ libpurple/protocols/jabber/oob.c	ae1a227467cd399da9dceb4878d80c4cdfd368b9
@@ -170,11 +170,11 @@ static void jabber_oob_xfer_recv_error(P
 	if(!strcmp(code, "406")) {
 		z = xmlnode_new_child(y, "not-acceptable");
 		xmlnode_set_attrib(y, "type", "modify");
-		xmlnode_set_namespace(z, "urn:ietf:params:xml:ns:xmpp-stanzas");
+		xmlnode_set_namespace(z, NS_XMPP_STANZAS);
 	} else if(!strcmp(code, "404")) {
 		z = xmlnode_new_child(y, "not-found");
 		xmlnode_set_attrib(y, "type", "cancel");
-		xmlnode_set_namespace(z, "urn:ietf:params:xml:ns:xmpp-stanzas");
+		xmlnode_set_namespace(z, NS_XMPP_STANZAS);
 	}
 	jabber_iq_send(iq);
 
============================================================
--- libpurple/protocols/jabber/presence.c	da6a06862a683b1316e6ae5f8dacccf03d14d522
+++ libpurple/protocols/jabber/presence.c	bd0687baa39cdcc2481c7092e1be4f73e628fd8f
@@ -297,7 +297,7 @@ xmlnode *jabber_presence_create_js(Jabbe
 		gchar seconds[10];
 		g_snprintf(seconds, 10, "%d", (int) (time(NULL) - js->idle));
 
-		xmlnode_set_namespace(query, "jabber:iq:last");
+		xmlnode_set_namespace(query, NS_LAST_ACTIVITY);
 		xmlnode_set_attrib(query, "seconds", seconds);
 	}
 
@@ -462,8 +462,8 @@ jabber_presence_set_capabilities(JabberC
 		goto out;
 
 	if (!jbr->commands_fetched && jabber_resource_has_capability(jbr, "http://jabber.org/protocol/commands")) {
-		JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
-		xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query", "http://jabber.org/protocol/disco#items");
+		JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, NS_DISCO_ITEMS);
+		xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query", NS_DISCO_ITEMS);
 		xmlnode_set_attrib(iq->node, "to", userdata->from);
 		xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/commands");
 		jabber_iq_set_callback(iq, jabber_adhoc_disco_result_cb, NULL);
@@ -655,7 +655,7 @@ void jabber_presence_parse(JabberStream 
 				}
 			}
 		} else if (!strcmp(y->name, "query") &&
-			!strcmp(xmlnode_get_namespace(y), "jabber:iq:last")) {
+			!strcmp(xmlnode_get_namespace(y), NS_LAST_ACTIVITY)) {
 			/* resource has specified idle */
 			const gchar *seconds = xmlnode_get_attrib(y, "seconds");
 			if (seconds) {
============================================================
--- libpurple/protocols/jabber/si.c	f68895c292d0223f6b998514460c9fb4556ab120
+++ libpurple/protocols/jabber/si.c	24a86e00c7202943b57a97818e6b4b8ae025fd88
@@ -144,7 +144,7 @@ jabber_si_bytestreams_connect_cb(gpointe
 	if(xfer->type == PURPLE_XFER_SEND)
 	{
 		xmlnode *activate;
-		iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, "http://jabber.org/protocol/bytestreams");
+		iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, NS_BYTESTREAMS);
 		xmlnode_set_attrib(iq->node, "to", streamhost->jid);
 		query = xmlnode_get_child(iq->node, "query");
 		xmlnode_set_attrib(query, "sid", jsx->stream_id);
@@ -155,7 +155,7 @@ jabber_si_bytestreams_connect_cb(gpointe
 	}
 	else
 	{
-		iq = jabber_iq_new_query(jsx->js, JABBER_IQ_RESULT, "http://jabber.org/protocol/bytestreams");
+		iq = jabber_iq_new_query(jsx->js, JABBER_IQ_RESULT, NS_BYTESTREAMS);
 		xmlnode_set_attrib(iq->node, "to", xfer->who);
 		jabber_iq_set_id(iq, jsx->iq_id);
 		query = xmlnode_get_child(iq->node, "query");
@@ -232,7 +232,7 @@ static void jabber_si_bytestreams_attemp
 		xmlnode_set_attrib(error, "code", "404");
 		xmlnode_set_attrib(error, "type", "cancel");
 		inf = xmlnode_new_child(error, "item-not-found");
-		xmlnode_set_namespace(inf, "urn:ietf:params:xml:ns:xmpp-stanzas");
+		xmlnode_set_namespace(inf, NS_XMPP_STANZAS);
 
 		jabber_iq_send(iq);
 
@@ -843,8 +843,7 @@ jabber_si_xfer_bytestreams_listen_cb(int
 
 	purple_xfer_unref(xfer);
 
-	iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET,
-			"http://jabber.org/protocol/bytestreams");
+	iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, NS_BYTESTREAMS);
 	xmlnode_set_attrib(iq->node, "to", xfer->who);
 	query = xmlnode_get_child(iq->node, "query");
 
@@ -1206,7 +1205,7 @@ static void jabber_si_xfer_send_method_c
 		if(var && !strcmp(var, "stream-method")) {
 			if((value = xmlnode_get_child(field, "value"))) {
 				char *val = xmlnode_get_data(value);
-				if(val && !strcmp(val, "http://jabber.org/protocol/bytestreams")) {
+				if(val && !strcmp(val, NS_BYTESTREAMS)) {
 					jabber_si_xfer_bytestreams_send_init(xfer);
 					jsx->stream_method |= STREAM_METHOD_BYTESTREAMS;
 					found_method = TRUE;
@@ -1268,10 +1267,10 @@ static void jabber_si_xfer_send_request(
 		behind troublesome firewalls */
 	option = xmlnode_new_child(field, "option");
 	value = xmlnode_new_child(option, "value");
-	xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1);
+	xmlnode_insert_data(value, NS_BYTESTREAMS, -1);
 	option = xmlnode_new_child(field, "option");
 	value = xmlnode_new_child(option, "value");
-	xmlnode_insert_data(value, "http://jabber.org/protocol/ibb", -1);
+	xmlnode_insert_data(value, NS_IBB, -1);
 
 	jabber_iq_set_callback(iq, jabber_si_xfer_send_method_cb, xfer);
 
@@ -1372,9 +1371,9 @@ static void jabber_si_xfer_request_denie
 		error = xmlnode_new_child(iq->node, "error");
 		xmlnode_set_attrib(error, "type", "cancel");
 		child = xmlnode_new_child(error, "forbidden");
-		xmlnode_set_namespace(child, "urn:ietf:params:xml:ns:xmpp-stanzas");
+		xmlnode_set_namespace(child, NS_XMPP_STANZAS);
 		child = xmlnode_new_child(error, "text");
-		xmlnode_set_namespace(child, "urn:ietf:params:xml:ns:xmpp-stanzas");
+		xmlnode_set_namespace(child, NS_XMPP_STANZAS);
 		xmlnode_insert_data(child, "Offer Declined", -1);
 
 		jabber_iq_send(iq);
@@ -1580,10 +1579,10 @@ static void jabber_si_xfer_init(PurpleXf
 			for people who know their firewalls are very restrictive */
 		if (jsx->stream_method & STREAM_METHOD_BYTESTREAMS) {
 			value = xmlnode_new_child(field, "value");
-			xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1);
+			xmlnode_insert_data(value, NS_BYTESTREAMS, -1);
 		} else if(jsx->stream_method & STREAM_METHOD_IBB) {
 			value = xmlnode_new_child(field, "value");
-			xmlnode_insert_data(value, "http://jabber.org/protocol/ibb", -1);
+			xmlnode_insert_data(value, NS_IBB, -1);
 		}
 
 		jabber_iq_send(iq);
@@ -1687,9 +1686,9 @@ void jabber_si_parse(JabberStream *js, c
 				if((value = xmlnode_get_child(option, "value"))) {
 					char *val;
 					if((val = xmlnode_get_data(value))) {
-						if(!strcmp(val, "http://jabber.org/protocol/bytestreams")) {
+						if(!strcmp(val, NS_BYTESTREAMS)) {
 							jsx->stream_method |= STREAM_METHOD_BYTESTREAMS;
-						} else if(!strcmp(val, "http://jabber.org/protocol/ibb")) {
+						} else if(!strcmp(val, NS_IBB)) {
 							jsx->stream_method |= STREAM_METHOD_IBB;
 						}
 						g_free(val);


More information about the Commits mailing list