Mercurial > pidgin
diff libpurple/protocols/jabber/jabber.c @ 18920:2a9d60d7af82
Implemented a callback for unregistering, mirroring the registration callback. Since this is a new API, I can do it properly by passing it right in the unregister function call, instead of having a separate function for setting it.
author | Andreas Monitzer <pidgin@monitzer.com> |
---|---|
date | Tue, 31 Jul 2007 03:50:41 +0000 |
parents | 177552010f1d |
children | ba3b22cd280b |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c Mon Jul 30 00:05:02 2007 +0000 +++ b/libpurple/protocols/jabber/jabber.c Tue Jul 31 03:50:41 2007 +0000 @@ -1120,6 +1120,7 @@ } static void jabber_unregister_account_iq_cb(JabberStream *js, xmlnode *packet, gpointer data) { + PurpleAccount *account = purple_connection_get_account(js->gc); const char *type = xmlnode_get_attrib(packet,"type"); if(!strcmp(type,"error")) { char *msg = jabber_parse_error(js, packet); @@ -1127,9 +1128,13 @@ purple_notify_error(js->gc, _("Error unregistering account"), _("Error unregistering account"), msg); g_free(msg); + if(js->unregistration_cb) + js->unregistration_cb(account, TRUE, js->unregistration_user_data); } else if(!strcmp(type,"result")) { purple_notify_info(js->gc, _("Account successfully unregistered"), _("Account successfully unregistered"), NULL); + if(js->unregistration_cb) + js->unregistration_cb(account, FALSE, js->unregistration_user_data); } } @@ -1150,7 +1155,7 @@ jabber_iq_send(iq); } -void jabber_unregister_account(PurpleAccount *account) { +void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data) { PurpleConnection *gc = purple_account_get_connection(account); JabberStream *js; @@ -1159,12 +1164,16 @@ jabber_login(account); js = gc->proto_data; js->unregistration = TRUE; + js->unregistration_cb = cb; + js->unregistration_user_data = user_data; return; } js = gc->proto_data; assert(!js->unregistration); /* don't allow multiple calls */ js->unregistration = TRUE; + js->unregistration_cb = cb; + js->unregistration_user_data = user_data; jabber_unregister_account_cb(js); }