# HG changeset patch # User Daniel Atallah # Date 1189729053 0 # Node ID ab38146f8f78e40d9fe374f9e325f8b349ec5b49 # Parent da29f5c7dc1abfc9d28428a45ad7595239a94971 There shouldn't be assert()s in pretty much any libpurple code. diff -r da29f5c7dc1a -r ab38146f8f78 libpurple/protocols/jabber/adhoccommands.c --- a/libpurple/protocols/jabber/adhoccommands.c Fri Sep 14 00:03:30 2007 +0000 +++ b/libpurple/protocols/jabber/adhoccommands.c Fri Sep 14 00:17:33 2007 +0000 @@ -22,7 +22,6 @@ #include "internal.h" #include "adhoccommands.h" -#include #include #include "internal.h" #include "xdata.h" diff -r da29f5c7dc1a -r ab38146f8f78 libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c Fri Sep 14 00:03:30 2007 +0000 +++ b/libpurple/protocols/jabber/jabber.c Fri Sep 14 00:17:33 2007 +0000 @@ -57,8 +57,6 @@ #include "pep.h" #include "adhoccommands.h" -#include - #define JABBER_CONNECT_STEPS (js->gsc ? 9 : 5) static PurplePlugin *my_protocol = NULL; @@ -1134,17 +1132,17 @@ static void jabber_unregister_account_cb(JabberStream *js) { JabberIq *iq; xmlnode *query; - assert(js->unregistration); - - iq = jabber_iq_new_query(js,JABBER_IQ_SET,"jabber:iq:register"); - assert(iq); - query = xmlnode_get_child_with_namespace(iq->node,"query","jabber:iq:register"); - assert(query); - xmlnode_new_child(query,"remove"); - - xmlnode_set_attrib(iq->node,"to",js->user->domain); - jabber_iq_set_callback(iq,jabber_unregister_account_iq_cb,NULL); - + + g_return_if_fail(js->unregistration); + + iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); + + query = xmlnode_get_child_with_namespace(iq->node, "query", "jabber:iq:register"); + + xmlnode_new_child(query, "remove"); + xmlnode_set_attrib(iq->node, "to", js->user->domain); + + jabber_iq_set_callback(iq, jabber_unregister_account_iq_cb, NULL); jabber_iq_send(iq); } @@ -1163,11 +1161,16 @@ } js = gc->proto_data; - assert(!js->unregistration); /* don't allow multiple calls */ + + if (js->unregistration) { + purple_debug_error("jabber", "Unregistration in process; ignoring duplicate request.\n"); + return; + } + js->unregistration = TRUE; js->unregistration_cb = cb; js->unregistration_user_data = user_data; - + jabber_unregister_account_cb(js); } @@ -1325,10 +1328,10 @@ void jabber_add_feature(const char *shortname, const char *namespace, JabberFeatureEnabled cb) { JabberFeature *feat; - - assert(shortname != NULL); - assert(namespace != NULL); - + + g_return_if_fail(shortname != NULL); + g_return_if_fail(namespace != NULL); + feat = g_new0(JabberFeature,1); feat->shortname = g_strdup(shortname); feat->namespace = g_strdup(namespace); diff -r da29f5c7dc1a -r ab38146f8f78 libpurple/protocols/jabber/usermood.c --- a/libpurple/protocols/jabber/usermood.c Fri Sep 14 00:03:30 2007 +0000 +++ b/libpurple/protocols/jabber/usermood.c Fri Sep 14 00:17:33 2007 +0000 @@ -23,7 +23,6 @@ #include "usermood.h" #include "pep.h" -#include #include #include "internal.h" #include "request.h" @@ -195,9 +194,9 @@ void jabber_mood_set(JabberStream *js, const char *mood, const char *text) { xmlnode *publish, *moodnode; - - assert(mood != NULL); - + + g_return_if_fail(mood != NULL); + publish = xmlnode_new("publish"); xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/mood"); moodnode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "mood"); diff -r da29f5c7dc1a -r ab38146f8f78 libpurple/protocols/jabber/usernick.c --- a/libpurple/protocols/jabber/usernick.c Fri Sep 14 00:03:30 2007 +0000 +++ b/libpurple/protocols/jabber/usernick.c Fri Sep 14 00:17:33 2007 +0000 @@ -23,7 +23,6 @@ #include "usernick.h" #include "pep.h" -#include #include #include "internal.h" #include "request.h" diff -r da29f5c7dc1a -r ab38146f8f78 libpurple/protocols/jabber/usertune.c --- a/libpurple/protocols/jabber/usertune.c Fri Sep 14 00:03:30 2007 +0000 +++ b/libpurple/protocols/jabber/usertune.c Fri Sep 14 00:17:33 2007 +0000 @@ -23,7 +23,6 @@ #include "usertune.h" #include "pep.h" -#include #include #include "internal.h" #include "request.h"