# HG changeset patch # User Andreas Monitzer # Date 1182177917 0 # Node ID 6842cc73b1b7c9c4e2b18d0a2334c68055e16b60 # Parent 6820304c215f72fcb970bc0cad4121b314fe8dd9 Implemented XEP-0172: User Nickname, fixed some potential crashers in the other PEP callbacks. diff -r 6820304c215f -r 6842cc73b1b7 libpurple/protocols/jabber/jabber.c --- 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); diff -r 6820304c215f -r 6842cc73b1b7 libpurple/protocols/jabber/pep.c --- 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 #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) { diff -r 6820304c215f -r 6842cc73b1b7 libpurple/protocols/jabber/usermood.c --- 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); diff -r 6820304c215f -r 6842cc73b1b7 libpurple/protocols/jabber/usertune.c --- 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);