cpw.darkrain42.xmpp.disco, im.pidgin.pidgin: f5465e97: Use the modified signal in more places.

darkrain42 at pidgin.im darkrain42 at pidgin.im
Wed Jun 3 03:00:27 EDT 2009


-----------------------------------------------------------------
Revision: f5465e97b37c0fd2e81355f6131c2fa8b03eb803
Ancestor: dc58db7bac2bc32659355e5e1844935f531ca94f
Author: darkrain42 at pidgin.im
Date: 2009-06-03T06:54:35
Branch: im.pidgin.cpw.darkrain42.xmpp.disco
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/f5465e97b37c0fd2e81355f6131c2fa8b03eb803

Modified files:
        libpurple/plugins/signals-test.c
        pidgin/plugins/disco/xmppdisco.c

ChangeLog: 

Use the modified signal in more places.

-------------- next part --------------
============================================================
--- libpurple/plugins/signals-test.c	87b5ba1505dbae0cb25cc63f76eac69d052b81b9
+++ libpurple/plugins/signals-test.c	b4552e807a6d52ec1ce60da52f61c7db673ee66e
@@ -671,22 +671,16 @@ jabber_watched_iq(PurpleConnection *pc, 
 	                  xmlnode_get_namespace(child));
 
 	if (g_str_equal(type, "get") || g_str_equal(type, "set")) {
-		PurplePlugin *prpl;
-		PurplePluginProtocolInfo *prpl_info;
-		char *str;
-
 		/* Send the requisite reply */
 		xmlnode *iq = xmlnode_new("iq");
 		xmlnode_set_attrib(iq, "to", from);
 		xmlnode_set_attrib(iq, "id", id);
 		xmlnode_set_attrib(iq, "type", "result");
 
-		str = xmlnode_to_str(iq, NULL);
-		prpl = purple_connection_get_prpl(pc);
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
-		prpl_info->send_raw(pc, str, -1);
-		g_free(str);
-		xmlnode_free(iq);
+		purple_signal_emit(purple_connection_get_prpl(pc),
+		                   "jabber-sending-xmlnode", pc, &iq);
+		if (iq != NULL)
+			xmlnode_free(iq);
 	}
 
 	/* Cookie monster eats IQ stanzas; the prpl shouldn't keep processing */
============================================================
--- pidgin/plugins/disco/xmppdisco.c	f3a15d2c982d726d00facb4d310f25ab9824f8c9
+++ pidgin/plugins/disco/xmppdisco.c	6f03902f898aa3ecc542abce91322ed98e471f28
@@ -141,11 +141,8 @@ xmpp_disco_info_do(PurpleConnection *pc,
 xmpp_disco_info_do(PurpleConnection *pc, gpointer cbdata, const char *jid,
                    const char *node, XmppIqCallback cb)
 {
-	PurplePlugin *prpl;
-	PurplePluginProtocolInfo *prpl_info;
 	xmlnode *iq, *query;
 	char *id = generate_next_id();
-	char *str;
 
 	iq = xmlnode_new("iq");
 	xmlnode_set_attrib(iq, "type", "get");
@@ -157,26 +154,21 @@ xmpp_disco_info_do(PurpleConnection *pc,
 	if (node)
 		xmlnode_set_attrib(query, "node", node);
 
+	/* Steals id */
 	xmpp_iq_register_callback(pc, id, cbdata, cb);
 
-	str = xmlnode_to_str(iq, NULL);
-	prpl = purple_connection_get_prpl(pc);
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
-	prpl_info->send_raw(pc, str, -1);
-	g_free(str);
-	xmlnode_free(iq);
-	g_free(id);
+	purple_signal_emit(purple_connection_get_prpl(pc), "jabber-sending-xmlnode",
+	                   pc, &iq);
+	if (iq != NULL)
+		xmlnode_free(iq);
 }
 
 static void
 xmpp_disco_items_do(PurpleConnection *pc, gpointer cbdata, const char *jid,
                     const char *node, XmppIqCallback cb)
 {
-	PurplePlugin *prpl;
-	PurplePluginProtocolInfo *prpl_info;
 	xmlnode *iq, *query;
 	char *id = generate_next_id();
-	char *str;
 
 	iq = xmlnode_new("iq");
 	xmlnode_set_attrib(iq, "type", "get");
@@ -188,15 +180,13 @@ xmpp_disco_items_do(PurpleConnection *pc
 	if (node)
 		xmlnode_set_attrib(query, "node", node);
 
+	/* Steals id */
 	xmpp_iq_register_callback(pc, id, cbdata, cb);
 
-	str = xmlnode_to_str(iq, NULL);
-	prpl = purple_connection_get_prpl(pc);
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
-	prpl_info->send_raw(pc, str, -1);
-	g_free(str);
-	xmlnode_free(iq);
-	g_free(id);
+	purple_signal_emit(purple_connection_get_prpl(pc), "jabber-sending-xmlnode",
+	                   pc, &iq);
+	if (iq != NULL)
+		xmlnode_free(iq);
 }
 
 static XmppDiscoServiceType
@@ -533,11 +523,8 @@ void xmpp_disco_service_register(XmppDis
 
 void xmpp_disco_service_register(XmppDiscoService *service)
 {
-	PurplePlugin *prpl;
-	PurplePluginProtocolInfo *prpl_info;
 	xmlnode *iq, *query;
 	char *id = generate_next_id();
-	char *str;
 
 	iq = xmlnode_new("iq");
 	xmlnode_set_attrib(iq, "type", "get");
@@ -547,12 +534,10 @@ void xmpp_disco_service_register(XmppDis
 	query = xmlnode_new_child(iq, "query");
 	xmlnode_set_namespace(query, NS_REGISTER);
 
-	str = xmlnode_to_str(iq, NULL);
-	prpl = purple_connection_get_prpl(service->list->pc);
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
-	prpl_info->send_raw(service->list->pc, str, -1);
-	g_free(str);
-	xmlnode_free(iq);
+	purple_signal_emit(purple_connection_get_prpl(service->list->pc),
+			"jabber-sending-xmlnode", service->list->pc, &iq);
+	if (iq != NULL)
+		xmlnode_free(iq);
 	g_free(id);
 }
 


More information about the Commits mailing list