# HG changeset patch # User Elliott Sales de Andrade # Date 1320631679 0 # Node ID 08151b40c598674cbf575c5a1764d11a9fb75ba2 # Parent ec6371d4cae82a68edafc2194f54dc4d6f9aba6a# Parent ab736b16bb263fc7031164640f65c9037ba690d0 merge of '071d7e809e0a4532e6dc367a6f05ea43e1ab0de0' and 'f7828c5032d27f14c4543fe56ed1b5cecb5517f7' diff -r ab736b16bb26 -r 08151b40c598 ChangeLog.API --- a/ChangeLog.API Sun Nov 06 05:28:11 2011 +0000 +++ b/ChangeLog.API Mon Nov 07 02:07:59 2011 +0000 @@ -4,8 +4,10 @@ libpurple: Added: * pidgin_create_webview + * purple_account_is_disconnecting * purple_account_get_ui_data * purple_account_set_ui_data + * purple_account_register_completed * purple_conv_chat_cb_get_alias * purple_conv_chat_cb_get_flags * purple_conv_chat_cb_is_buddy diff -r ab736b16bb26 -r 08151b40c598 libpurple/account.c --- a/libpurple/account.c Sun Nov 06 05:28:11 2011 +0000 +++ b/libpurple/account.c Mon Nov 07 02:07:59 2011 +0000 @@ -1119,6 +1119,15 @@ } void +purple_account_register_completed(PurpleAccount *account, gboolean succeeded) +{ + g_return_if_fail(account != NULL); + + if (account->registration_cb) + (account->registration_cb)(account, succeeded, account->registration_cb_user_data); +} + +void purple_account_unregister(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data) { g_return_if_fail(account != NULL); @@ -1265,6 +1274,14 @@ account->disconnecting = FALSE; } +gboolean +purple_account_is_disconnecting(const PurpleAccount *account) +{ + g_return_val_if_fail(account != NULL, TRUE); + + return account->disconnecting; +} + void purple_account_notify_added(PurpleAccount *account, const char *remote_user, const char *id, const char *alias, diff -r ab736b16bb26 -r 08151b40c598 libpurple/account.h --- a/libpurple/account.h Sun Nov 06 05:28:11 2011 +0000 +++ b/libpurple/account.h Mon Nov 07 02:07:59 2011 +0000 @@ -221,6 +221,15 @@ void purple_account_register(PurpleAccount *account); /** + * Registration of the account was completed. + * Calls the registration call-back set with purple_account_set_register_callback(). + * + * @param account The account being registered. + * @param succeeded Was the account registration successful? + */ +void purple_account_register_completed(PurpleAccount *account, gboolean succeeded); + +/** * Unregisters an account (deleting it from the server). * * @param account The account to unregister. @@ -237,6 +246,15 @@ void purple_account_disconnect(PurpleAccount *account); /** + * Indicates if the account is currently being disconnected. + * + * @param account The account + * + * @return TRUE if the account is being disconnected. + */ +gboolean purple_account_is_disconnecting(const PurpleAccount *account); + +/** * Notifies the user that the account was added to a remote user's * buddy list. * diff -r ab736b16bb26 -r 08151b40c598 libpurple/protocols/gg/gg.c --- a/libpurple/protocols/gg/gg.c Sun Nov 06 05:28:11 2011 +0000 +++ b/libpurple/protocols/gg/gg.c Mon Nov 07 02:07:59 2011 +0000 @@ -391,8 +391,8 @@ purple_notify_info(NULL, _("New Gadu-Gadu Account Registered"), _("Registration completed successfully!"), NULL); - if(account->registration_cb) - (account->registration_cb)(account, TRUE, account->registration_cb_user_data); + purple_account_register_completed(account, TRUE); + /* TODO: the currently open Accounts Window will not be updated withthe * new username and etc, we need to somehow have it refresh at this * point @@ -402,8 +402,7 @@ purple_account_disconnect(account); exit_err: - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); + purple_account_register_completed(account, FALSE); gg_register_free(h); g_free(email); diff -r ab736b16bb26 -r 08151b40c598 libpurple/protocols/gg/lib/common.c --- a/libpurple/protocols/gg/lib/common.c Sun Nov 06 05:28:11 2011 +0000 +++ b/libpurple/protocols/gg/lib/common.c Mon Nov 07 02:07:59 2011 +0000 @@ -32,9 +32,6 @@ #include #include -#ifndef _WIN32 -# include -#endif #include #include #include diff -r ab736b16bb26 -r 08151b40c598 libpurple/protocols/irc/cmds.c --- a/libpurple/protocols/irc/cmds.c Sun Nov 06 05:28:11 2011 +0000 +++ b/libpurple/protocols/irc/cmds.c Mon Nov 07 02:07:59 2011 +0000 @@ -423,7 +423,7 @@ irc->quitting = TRUE; - if (!irc->account->disconnecting) + if (!purple_account_is_disconnecting(irc->account)) purple_account_set_status(irc->account, "offline", TRUE, NULL); } diff -r ab736b16bb26 -r 08151b40c598 libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c Sun Nov 06 05:28:11 2011 +0000 +++ b/libpurple/protocols/jabber/jabber.c Mon Nov 07 02:07:59 2011 +0000 @@ -440,7 +440,7 @@ * we're disconnecting, don't generate (possibly another) error that * (for some UIs) would mask the first. */ - if (!account->disconnecting) { + if (!purple_account_is_disconnecting(account)) { gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); purple_connection_error(js->gc, @@ -1144,8 +1144,7 @@ if(js->registration) { buf = g_strdup_printf(_("Registration of %s@%s successful"), js->user->node, js->user->domain); - if(account->registration_cb) - (account->registration_cb)(account, TRUE, account->registration_cb_user_data); + purple_account_register_completed(account, TRUE); } else { g_return_if_fail(to != NULL); buf = g_strdup_printf(_("Registration to %s successful"), @@ -1163,8 +1162,7 @@ purple_notify_error(NULL, _("Registration Failed"), _("Registration Failed"), msg); g_free(msg); - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); + purple_account_register_completed(account, FALSE); } g_free(to); if(js->registration) @@ -1288,8 +1286,7 @@ { PurpleAccount *account = purple_connection_get_account(cbdata->js->gc); if(account && cbdata->js->registration) { - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); + purple_account_register_completed(account, FALSE); jabber_connection_schedule_close(cbdata->js); } g_free(cbdata->who); @@ -1358,8 +1355,7 @@ if(js->registration) { purple_notify_error(NULL, _("Already Registered"), _("Already Registered"), NULL); - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); + purple_account_register_completed(account, FALSE); jabber_connection_schedule_close(js); return; } @@ -1380,8 +1376,8 @@ if(js->registration) { js->gc->wants_to_die = TRUE; - if(account->registration_cb) /* succeeded, but we have no login info */ - (account->registration_cb)(account, TRUE, account->registration_cb_user_data); + /* succeeded, but we have no login info */ + purple_account_register_completed(account, TRUE); jabber_connection_schedule_close(js); } return; diff -r ab736b16bb26 -r 08151b40c598 libpurple/protocols/oscar/flap_connection.c --- a/libpurple/protocols/oscar/flap_connection.c Sun Nov 06 05:28:11 2011 +0000 +++ b/libpurple/protocols/oscar/flap_connection.c Mon Nov 07 02:07:59 2011 +0000 @@ -456,7 +456,7 @@ * TODO: If we don't have a SNAC_FAMILY_LOCATE connection then * we should try to request one instead of disconnecting. */ - if (!account->disconnecting && ((od->oscar_connections == NULL) + if (!purple_account_is_disconnecting(account) && ((od->oscar_connections == NULL) || (!flap_connection_getbytype(od, SNAC_FAMILY_LOCATE)))) { /* No more FLAP connections! Sign off this PurpleConnection! */