Mercurial > pidgin
changeset 6581:0473a28ce807
[gaim-migrate @ 7103]
this should fix jabber registrations yet again
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sat, 23 Aug 2003 05:40:51 +0000 |
parents | 74d1cd241a3d |
children | c571981c7ce8 |
files | src/account.c src/account.h src/connection.c src/connection.h src/gtkaccount.c src/protocols/jabber/jabber.c |
diffstat | 6 files changed, 85 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/account.c Sat Aug 23 05:39:10 2003 +0000 +++ b/src/account.c Sat Aug 23 05:40:51 2003 +0000 @@ -172,6 +172,26 @@ } GaimConnection * +gaim_account_register(GaimAccount *account) +{ + GaimConnection *gc; + + g_return_val_if_fail(account != NULL, NULL); + + if (gaim_account_get_connection(account) != NULL) + return NULL; + + gc = gaim_connection_new(account); + + gaim_debug(GAIM_DEBUG_INFO, "account", + "Registering account %p. gc = %p\n", account, gc); + + gaim_connection_register(gc); + + return gc; +} + +GaimConnection * gaim_account_connect(GaimAccount *account) { GaimConnection *gc;
--- a/src/account.h Sat Aug 23 05:39:10 2003 +0000 +++ b/src/account.h Sat Aug 23 05:40:51 2003 +0000 @@ -97,6 +97,15 @@ GaimConnection *gaim_account_connect(GaimAccount *account); /** + * Registers an account. + * + * @param account The account to register. + * + * @return The gaim connection. + */ +GaimConnection *gaim_account_register(GaimAccount *account); + +/** * Disconnects from an account. * * @param account The account to disconnect from.
--- a/src/connection.c Sat Aug 23 05:39:10 2003 +0000 +++ b/src/connection.c Sat Aug 23 05:40:51 2003 +0000 @@ -97,6 +97,53 @@ gaim_account_connect(account); } +void +gaim_connection_register(GaimConnection *gc) +{ + GaimAccount *account; + GaimConnectionUiOps *ops; + GaimPluginProtocolInfo *prpl_info = NULL; + + g_return_if_fail(gc != NULL); + + gaim_debug(GAIM_DEBUG_INFO, "connection", + "Registering. gc = %p\n", gc); + + ops = gaim_get_connection_ui_ops(); + + if (gc->prpl != NULL) + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); + else { + gchar *message = g_strdup_printf(_("Missing protocol plugin for %s"), + gaim_account_get_username(gaim_connection_get_account(gc))); + + gaim_debug(GAIM_DEBUG_ERROR, "connection", + "Could not get prpl info for %p\n", gc); + gaim_notify_error(NULL, _("Registration Error"), + message, NULL); + g_free(message); + return; + } + + account = gaim_connection_get_account(gc); + + if (gaim_connection_get_state(gc) != GAIM_DISCONNECTED) + return; + + gaim_connection_set_state(gc, GAIM_CONNECTING); + + connections = g_list_append(connections, gc); + + gaim_signal_emit(gaim_connections_get_handle(), "signing-on", gc); + + /* set this so we don't auto-reconnect after registering */ + gc->wants_to_die = TRUE; + + gaim_debug(GAIM_DEBUG_INFO, "connection", "Calling register_user\n"); + + prpl_info->register_user(account); +} + void gaim_connection_connect(GaimConnection *gc)
--- a/src/connection.h Sat Aug 23 05:39:10 2003 +0000 +++ b/src/connection.h Sat Aug 23 05:40:51 2003 +0000 @@ -127,6 +127,13 @@ void gaim_connection_connect(GaimConnection *gc); /** + * Registers a connection. + * + * @param gc The connection to register. + */ +void gaim_connection_register(GaimConnection *gc); + +/** * Signs a connection off. * @param gc The connection to sign off.
--- a/src/gtkaccount.c Sat Aug 23 05:39:10 2003 +0000 +++ b/src/gtkaccount.c Sat Aug 23 05:40:51 2003 +0000 @@ -1106,12 +1106,11 @@ static void register_account_prefs_cb(GtkWidget *w, AccountPrefsDialog *dialog) { - GaimAccount *account = dialog->account; GaimPluginProtocolInfo *prpl_info = dialog->prpl_info; ok_account_prefs_cb(NULL, dialog); - prpl_info->register_user(account); + gaim_account_register(dialog->account); } void
--- a/src/protocols/jabber/jabber.c Sat Aug 23 05:39:10 2003 +0000 +++ b/src/protocols/jabber/jabber.c Sat Aug 23 05:40:51 2003 +0000 @@ -4276,7 +4276,7 @@ */ void jabber_register_user(GaimAccount *account) { - GaimConnection *gc = gaim_connection_new(account); + GaimConnection *gc = gaim_account_get_connection(account); struct jabber_data *jd = gc->proto_data = g_new0(struct jabber_data, 1); char *loginname = create_valid_jid(account->username, DEFAULT_SERVER, "Gaim");