diff libpurple/protocols/jabber/presence.c @ 26952:92565c8e1e3a

Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
author Paul Aurich <paul@darkrain42.org>
date Tue, 12 May 2009 05:49:34 +0000
parents e7819fa37224
children c9ac5cc1e46c
line wrap: on
line diff
--- a/libpurple/protocols/jabber/presence.c	Mon May 11 22:05:00 2009 +0000
+++ b/libpurple/protocols/jabber/presence.c	Tue May 12 05:49:34 2009 +0000
@@ -446,8 +446,8 @@
 
 void jabber_presence_parse(JabberStream *js, xmlnode *packet)
 {
-	const char *from = xmlnode_get_attrib(packet, "from");
-	const char *type = xmlnode_get_attrib(packet, "type");
+	const char *from;
+	const char *type;
 	const char *real_jid = NULL;
 	const char *affiliation = NULL;
 	const char *role = NULL;
@@ -469,10 +469,19 @@
 	xmlnode *caps = NULL;
 	int idle = 0;
 	gchar *nickname = NULL;
+	gboolean signal_return;
+
+	from = xmlnode_get_attrib(packet, "from");
+	type = xmlnode_get_attrib(packet, "type");
 
 	if(!(jb = jabber_buddy_find(js, from, TRUE)))
 		return;
 
+	signal_return = GPOINTER_TO_INT(purple_signal_emit_return_1(jabber_plugin,
+			"jabber-receiving-presence", js->gc, type, from, packet));
+	if (signal_return)
+		return;
+
 	if(!(jid = jabber_id_new(from)))
 		return;