changeset 10646:6a618db0a404

[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 <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Tue, 01 Mar 2005 21:15:58 +0000
parents 6480697e907b
children 7d13c04387ad
files src/account.c src/gtkaccount.c src/protocols/irc/irc.c src/protocols/jabber/presence.c src/protocols/msn/msn.c src/protocols/oscar/oscar.c
diffstat 6 files changed, 34 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- 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);
--- 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
 	{
--- 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)
--- 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)
--- 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
--- 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