changeset 17869:6842cc73b1b7

Implemented XEP-0172: User Nickname, fixed some potential crashers in the other PEP callbacks.
author Andreas Monitzer <pidgin@monitzer.com>
date Mon, 18 Jun 2007 14:45:17 +0000
parents 6820304c215f
children 5f4dcaf1f886
files libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/pep.c libpurple/protocols/jabber/usermood.c libpurple/protocols/jabber/usertune.c
diffstat 4 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Mon Jun 18 13:54:26 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Mon Jun 18 14:45:17 2007 +0000
@@ -1325,6 +1325,7 @@
 			"tune_time", _("Tune Time"), purple_value_new(PURPLE_TYPE_INT),
 			"tune_year", _("Tune Year"), purple_value_new(PURPLE_TYPE_INT),
 			"tune_url", _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING),
+			"nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
 			NULL);
 	types = g_list_append(types, type);
 
@@ -1346,6 +1347,7 @@
 			"tune_time", _("Tune Time"), purple_value_new(PURPLE_TYPE_INT),
 			"tune_year", _("Tune Year"), purple_value_new(PURPLE_TYPE_INT),
 			"tune_url", _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING),
+			"nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
 			NULL);
 	types = g_list_append(types, type);
 
@@ -1367,6 +1369,7 @@
 			"tune_time", _("Tune Time"), purple_value_new(PURPLE_TYPE_INT),
 			"tune_year", _("Tune Year"), purple_value_new(PURPLE_TYPE_INT),
 			"tune_url", _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING),
+			"nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
 			NULL);
 	types = g_list_append(types, type);
 
@@ -1388,6 +1391,7 @@
 			"tune_time", _("Tune Time"), purple_value_new(PURPLE_TYPE_INT),
 			"tune_year", _("Tune Year"), purple_value_new(PURPLE_TYPE_INT),
 			"tune_url", _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING),
+			"nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
 			NULL);
 	types = g_list_append(types, type);
 
@@ -1409,6 +1413,7 @@
 			"tune_time", _("Tune Time"), purple_value_new(PURPLE_TYPE_INT),
 			"tune_year", _("Tune Year"), purple_value_new(PURPLE_TYPE_INT),
 			"tune_url", _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING),
+			"nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
 			NULL);
 	types = g_list_append(types, type);
 
--- a/libpurple/protocols/jabber/pep.c	Mon Jun 18 13:54:26 2007 +0000
+++ b/libpurple/protocols/jabber/pep.c	Mon Jun 18 14:45:17 2007 +0000
@@ -23,6 +23,7 @@
 #include "iq.h"
 #include <string.h>
 #include "usermood.h"
+#include "usernick.h"
 
 static GHashTable *pep_handlers = NULL;
 
@@ -32,12 +33,14 @@
 		
 		/* register PEP handlers */
 		jabber_mood_init();
+		jabber_nick_init();
 	}
 }
 
 void jabber_pep_init_actions(GList **m) {
 	/* register the PEP-specific actions */
 	jabber_mood_init_action(m);
+	jabber_nick_init_action(m);
 }
 
 void jabber_pep_register_handler(const char *shortname, const char *xmlns, JabberPEPHandler handlerfunc) {
--- a/libpurple/protocols/jabber/usermood.c	Mon Jun 18 13:54:26 2007 +0000
+++ b/libpurple/protocols/jabber/usermood.c	Mon Jun 18 14:45:17 2007 +0000
@@ -126,6 +126,11 @@
 	}
 	if (newmood != NULL) {
 		JabberBuddyResource *resource = jabber_buddy_find_resource(buddy, NULL);
+		if(!resource) { /* huh? */
+			if (moodtext)
+				g_free(moodtext);
+			return;
+		}
 		const char *status_id = jabber_buddy_state_get_status_id(resource->state);
 		
 		purple_prpl_got_user_status(js->gc->account, from, status_id, "mood", _(newmood), "moodtext", moodtext?moodtext:"", NULL);
--- a/libpurple/protocols/jabber/usertune.c	Mon Jun 18 13:54:26 2007 +0000
+++ b/libpurple/protocols/jabber/usertune.c	Mon Jun 18 14:45:17 2007 +0000
@@ -77,6 +77,8 @@
 		}
 	}
 	resource = jabber_buddy_find_resource(buddy, NULL);
+	if(!resource)
+		return; /* huh? */
 	status_id = jabber_buddy_state_get_status_id(resource->state);
 
 	purple_prpl_got_user_status(js->gc->account, from, status_id, PURPLE_TUNE_ARTIST, tuneinfodata.artist, PURPLE_TUNE_TITLE, tuneinfodata.title, PURPLE_TUNE_ALBUM, tuneinfodata.album, PURPLE_TUNE_TRACK, tuneinfodata.track, PURPLE_TUNE_TIME, tuneinfodata.time, PURPLE_TUNE_URL, tuneinfodata.url, NULL);