# HG changeset patch # User Sean Egan # Date 1109711758 0 # Node ID 6a618db0a4044c2a37df4772da4285c97f92fb88 # Parent 6480697e907b8f0860c311e044c000ab5100cad0 [gaim-migrate @ 12162] Made IRC, Jabber, MSN, and ICQ not crash on login. Note that these don't necessarily work the way they should yet, they just don't crash. committer: Tailor Script diff -r 6480697e907b -r 6a618db0a404 src/account.c --- a/src/account.c Mon Feb 28 18:18:22 2005 +0000 +++ b/src/account.c Tue Mar 01 21:15:58 2005 +0000 @@ -584,7 +584,7 @@ account->ui_settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_hash_table_destroy); account->system_log = NULL; - + account->presence = gaim_presence_new_for_account(account); prpl = gaim_find_prpl(protocol_id); diff -r 6480697e907b -r 6a618db0a404 src/gtkaccount.c --- a/src/gtkaccount.c Mon Feb 28 18:18:22 2005 +0000 +++ b/src/gtkaccount.c Tue Mar 01 21:15:58 2005 +0000 @@ -1353,6 +1353,8 @@ screenname = gtk_entry_get_text(GTK_ENTRY(dialog->screenname_entry)); dialog->account = gaim_account_new(screenname, dialog->protocol_id); + gaim_account_set_enabled(dialog->account, GAIM_GTK_UI, TRUE); + } else { diff -r 6480697e907b -r 6a618db0a404 src/protocols/irc/irc.c --- a/src/protocols/irc/irc.c Mon Feb 28 18:18:22 2005 +0000 +++ b/src/protocols/irc/irc.c Tue Mar 01 21:15:58 2005 +0000 @@ -434,19 +434,24 @@ static void irc_set_status(GaimAccount *account, GaimStatus *status) { GaimConnection *gc = gaim_account_get_connection(account); - struct irc_conn *irc = gc->proto_data; + struct irc_conn *irc; const char *args[1]; const char *status_id = gaim_status_get_id(status); + if (gc) + irc = gc->proto_data; + if (!gaim_status_is_active(status)) return; args[0] = NULL; - if (!strcmp(status_id, "away")) + if (strcmp(status_id, "offline") && !gc) { + gaim_account_connect(account, status); + } else if (!strcmp(status_id, "away")) { args[0] = gaim_status_get_attr_string(status, "message"); - - irc_cmd_away(irc, "away", NULL, args); + irc_cmd_away(irc, "away", NULL, args); + } } static void irc_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) diff -r 6480697e907b -r 6a618db0a404 src/protocols/jabber/presence.c --- a/src/protocols/jabber/presence.c Mon Feb 28 18:18:22 2005 +0000 +++ b/src/protocols/jabber/presence.c Tue Mar 01 21:15:58 2005 +0000 @@ -102,10 +102,13 @@ if(!account) return ; gc = account->gc; - - if(!gc) return ; + + if (!gc && strcmp(gaim_status_get_id(status), "offline")) + gaim_account_connect(account, status); + + if(!gc) return; js= gc->proto_data; - + gaim_status_to_jabber(status, &state, &msg, &priority); if(msg) diff -r 6480697e907b -r 6a618db0a404 src/protocols/msn/msn.c --- a/src/protocols/msn/msn.c Mon Feb 28 18:18:22 2005 +0000 +++ b/src/protocols/msn/msn.c Tue Mar 01 21:15:58 2005 +0000 @@ -823,14 +823,17 @@ gc = gaim_account_get_connection(account); - if (gc == NULL) - return; - - session = gc->proto_data; + if (gc) + session = gc->proto_data; state = gaim_status_get_id(status); - if (!strcmp(state, "away")) + printf("%d %s\n", gc, state); + if (strcmp(state, "offline") && !gc) { + gaim_account_connect(account, status); + return; + } + else if (!strcmp(state, "away")) msnstatus = MSN_AWAY; else if (!strcmp(state, "brb")) msnstatus = MSN_BRB; @@ -846,8 +849,8 @@ msnstatus = MSN_IDLE; else msnstatus = MSN_ONLINE; - - msn_change_status(session, msnstatus); + if (gc) + msn_change_status(session, msnstatus); } static void diff -r 6480697e907b -r 6a618db0a404 src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Mon Feb 28 18:18:22 2005 +0000 +++ b/src/protocols/oscar/oscar.c Tue Mar 01 21:15:58 2005 +0000 @@ -5802,9 +5802,14 @@ oscar_set_status_icq(GaimAccount *account, GaimStatus *status) { GaimConnection *gc = gaim_account_get_connection(account); - OscarData *od = (OscarData *)gc->proto_data; + OscarData *od = NULL; const gchar *status_id = gaim_status_get_id(status); + if (gc) + od = (OscarData *)gc->proto_data; + if (!od) + return; + if (gaim_status_type_get_primitive(gaim_status_get_type(status)) == GAIM_STATUS_HIDDEN) account->perm_deny = 4; else