changeset 10751:bf5e48215158

[gaim-migrate @ 12354] Get rid of serv_finish_login because it's dumb. Also fix some problems with gg and silc that I introduced yesterday. I didn't grep for places where account->password was accessed directly. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 27 Mar 2005 17:50:35 +0000
parents d5a00882d118
children aa10aa27c177
files src/connection.c src/protocols/gg/gg.c src/protocols/irc/msgs.c src/protocols/jabber/jabber.c src/protocols/msn/session.c src/protocols/napster/napster.c src/protocols/novell/novell.c src/protocols/oscar/oscar.c src/protocols/silc/ops.c src/protocols/silc/silc.c src/protocols/silc/util.c src/protocols/toc/toc.c src/protocols/trepia/trepia.c src/protocols/yahoo/yahoo.c src/protocols/zephyr/zephyr.c src/server.c src/server.h
diffstat 17 files changed, 33 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/src/connection.c	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/connection.c	Sun Mar 27 17:50:35 2005 +0000
@@ -27,6 +27,7 @@
 #include "blist.h"
 #include "connection.h"
 #include "debug.h"
+#include "gaim.h"
 #include "log.h"
 #include "notify.h"
 #include "prefs.h"
@@ -103,7 +104,7 @@
 	}
 	else
 	{
-		if ((password == NULL) &&
+		if (((password == NULL) || (*password == '\0')) &&
 			!(prpl_info->options & OPT_PROTO_NO_PASSWORD) &&
 			!(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL))
 		{
@@ -115,7 +116,8 @@
 
 	gc = g_new0(GaimConnection, 1);
 	gc->prpl = prpl;
-	gc->password = g_strdup(password);
+	if ((password != NULL) && (*password != '\0'))
+		gc->password = g_strdup(password);
 	gaim_connection_set_account(gc, account);
 	gaim_connection_set_state(gc, GAIM_CONNECTING);
 	connections = g_list_append(connections, gc);
@@ -331,6 +333,15 @@
 		serv_set_permit_deny(gc);
 
 		update_keepalive(gc, TRUE);
+
+		if (gaim_account_get_user_info(account) != NULL)
+			serv_set_info(gc, gaim_account_get_user_info(account));
+
+		if (gc->idle_timer > 0)
+			gaim_timeout_remove(gc->idle_timer);
+
+		gc->idle_timer = gaim_timeout_add(20000, check_idle, gc);
+		serv_touch_idle(gc);
 	}
 	else if (gc->state == GAIM_DISCONNECTED) {
 		GaimAccount *account = gaim_connection_get_account(gc);
--- a/src/protocols/gg/gg.c	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/protocols/gg/gg.c	Sun Mar 27 17:50:35 2005 +0000
@@ -1,6 +1,6 @@
 /*
  * gaim - Gadu-Gadu Protocol Plugin
- * $Id: gg.c 12342 2005-03-26 23:25:18Z thekingant $
+ * $Id: gg.c 12354 2005-03-27 17:50:35Z thekingant $
  *
  * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
  *
@@ -178,12 +178,19 @@
 
 static void agg_set_status(GaimAccount *account, GaimStatus *status)
 {
-	GaimConnection *gc = gaim_account_get_connection(account);
-	struct agg_data *gd = (struct agg_data *)gc->proto_data;
-	int status_num = gd->own_status;
+	GaimConnection *gc;
+	struct agg_data *gd;
+	int status_num;
 	const char *status_id;
 	char *msg = NULL;
 
+	gc = gaim_account_get_connection(account);
+
+	if (gc == NULL)
+		return;
+
+	gd = (struct agg_data *)gc->proto_data;
+	status_num = gd->own_status;
 	status_id = gaim_status_get_id(status);
 
 	if (!strcmp(status_id, "available"))
@@ -830,7 +837,6 @@
 
 		/* Our signon is complete */
 		gaim_connection_set_state(gc, GAIM_CONNECTED);
-		serv_finish_login(gc);
 
 		break;
 	case GG_EVENT_CONN_FAILED:
@@ -888,7 +894,7 @@
 	 */
 
 	gd->sess->uin = (uin_t) strtol(account->username, (char **)NULL, 10);
-	gd->sess->password = g_strdup(account->password);
+	gd->sess->password = g_strdup(gaim_connection_get_password(gc));
 	gd->sess->state = GG_STATE_CONNECTING;
 	gd->sess->check = GG_CHECK_WRITE;
 	gd->sess->async = 1;
--- a/src/protocols/irc/msgs.c	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/protocols/irc/msgs.c	Sun Mar 27 17:50:35 2005 +0000
@@ -437,7 +437,6 @@
 		return;
 
 	gaim_connection_set_state(gc, GAIM_CONNECTED);
-	serv_finish_login (gc);
 
 	irc_blist_timeout(irc);
 	if (!irc->timer)
--- a/src/protocols/jabber/jabber.c	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/protocols/jabber/jabber.c	Sun Mar 27 17:50:35 2005 +0000
@@ -832,7 +832,6 @@
 			status = gaim_presence_get_active_status(gpresence);
 			jabber_presence_send(js->gc->account, status);
 			jabber_disco_items_server(js);
-			serv_finish_login(js->gc);
 			break;
 	}
 }
--- a/src/protocols/msn/session.c	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/protocols/msn/session.c	Sun Mar 27 17:50:35 2005 +0000
@@ -416,6 +416,4 @@
 
 	/* Sync users */
 	msn_session_sync_users(session);
-
-	serv_finish_login(gc);
 }
--- a/src/protocols/napster/napster.c	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/protocols/napster/napster.c	Sun Mar 27 17:50:35 2005 +0000
@@ -277,7 +277,6 @@
 
 		/* Our signon is complete */
 		gaim_connection_set_state(gc, GAIM_CONNECTED);
-		serv_finish_login(gc);
 
 		break;
 
--- a/src/protocols/novell/novell.c	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/protocols/novell/novell.c	Sun Mar 27 17:50:35 2005 +0000
@@ -104,7 +104,6 @@
 
 		/* Tell Gaim that we are connected */
 		gaim_connection_set_state(gc, GAIM_CONNECTED);
-		serv_finish_login(gc);
 
 		_sync_contact_list(user);
 
--- a/src/protocols/oscar/oscar.c	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/protocols/oscar/oscar.c	Sun Mar 27 17:50:35 2005 +0000
@@ -5066,7 +5066,6 @@
 	od->rights.maxdenies = (guint)maxdenies;
 
 	gaim_connection_set_state(gc, GAIM_CONNECTED);
-	serv_finish_login(gc);
 
 	gaim_debug_info("oscar", "buddy list loaded\n");
 
--- a/src/protocols/silc/ops.c	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/protocols/silc/ops.c	Sun Mar 27 17:50:35 2005 +0000
@@ -1466,7 +1466,6 @@
 	case SILC_CLIENT_CONN_SUCCESS:
 	case SILC_CLIENT_CONN_SUCCESS_RESUME:
 		gaim_connection_set_state(gc, GAIM_CONNECTED);
-		serv_finish_login(gc);
 		g_unlink(silcgaim_session_file(gaim_account_get_username(sg->account)));
 
 		/* Send any UMODEs configured for account */
@@ -1593,6 +1592,7 @@
 	GaimConnection *gc = client->application;
 	SilcGaim sg = gc->proto_data;
 	SilcGaimGetAuthMethod internal;
+	const char *password;
 
 	/* Progress */
 	if (sg->resuming)
@@ -1606,9 +1606,9 @@
 		completion(TRUE, SILC_AUTH_PUBLIC_KEY, NULL, 0, context);
 		return;
 	}
-	if (gc->account->password && *gc->account->password) {
-		completion(TRUE, SILC_AUTH_PASSWORD, gc->account->password,
-			   strlen(gc->account->password), context);
+	password = gaim_connection_get_password(gc);
+	if (password && *password) {
+		completion(TRUE, SILC_AUTH_PASSWORD, password, strlen(password), context);
 		return;
 	}
 
--- a/src/protocols/silc/silc.c	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/protocols/silc/silc.c	Sun Mar 27 17:50:35 2005 +0000
@@ -303,7 +303,7 @@
 	/* Load SILC key pair */
 	if (!silc_load_key_pair(gaim_prefs_get_string("/plugins/prpl/silc/pubkey"),
 				gaim_prefs_get_string("/plugins/prpl/silc/privkey"),
-				(account->password == NULL) ? "" : account->password, &client->pkcs,
+				(gc->password == NULL) ? "" : gc->password, &client->pkcs,
 				&client->public_key, &client->private_key)) {
 		gaim_connection_error(gc, ("Could not load SILC key pair"));
 		return;
--- a/src/protocols/silc/util.c	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/protocols/silc/util.c	Sun Mar 27 17:50:35 2005 +0000
@@ -203,7 +203,7 @@
 			silc_create_key_pair(SILCGAIM_DEF_PKCS,
 					     SILCGAIM_DEF_PKCS_LEN,
 					     file_public_key, file_private_key, NULL,
-					     (gc->account->password == NULL) ? "" : gc->account->password,
+					     (gc->password == NULL) ? "" : gc->password,
 						 NULL, NULL, NULL, FALSE);
 			g_stat(file_public_key, &st);
 		} else {
@@ -228,7 +228,7 @@
 			silc_create_key_pair(SILCGAIM_DEF_PKCS,
 					     SILCGAIM_DEF_PKCS_LEN,
 					     file_public_key, file_private_key, NULL,
-					     (gc->account->password == NULL) ? "" : gc->account->password,
+					     (gc->password == NULL) ? "" : gc->password,
 						 NULL, NULL, NULL, FALSE);
 			g_stat(file_private_key, &st);
 		} else {
--- a/src/protocols/toc/toc.c	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/protocols/toc/toc.c	Sun Mar 27 17:50:35 2005 +0000
@@ -733,7 +733,6 @@
 		tdt->state = STATE_ONLINE;
 
 		gaim_connection_set_state(gc, GAIM_CONNECTED);
-		serv_finish_login(gc);
 
 		/*
 		 * Add me to my buddy list so that we know the time when
--- a/src/protocols/trepia/trepia.c	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/protocols/trepia/trepia.c	Sun Mar 27 17:50:35 2005 +0000
@@ -637,7 +637,6 @@
 						_("Retrieving buddy list"), 2, TREPIA_CONNECT_STEPS);
 
 				gaim_connection_set_state(session->gc, GAIM_CONNECTED);
-				serv_finish_login(session->gc);
 				break;
 
 			case TREPIA_MSG_INCOMING: /* Incoming Message */
--- a/src/protocols/yahoo/yahoo.c	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/protocols/yahoo/yahoo.c	Sun Mar 27 17:50:35 2005 +0000
@@ -151,7 +151,6 @@
 			if (!yd->logged_in) {
 				gaim_connection_set_display_name(gc, pair->value);
 				gaim_connection_set_state(gc, GAIM_CONNECTED);
-				serv_finish_login(gc);
 				yd->logged_in = TRUE;
 				if (yd->picture_upload_todo) {
 					yahoo_buddy_icon_upload(gc, yd->picture_upload_todo);
--- a/src/protocols/zephyr/zephyr.c	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/protocols/zephyr/zephyr.c	Sun Mar 27 17:50:35 2005 +0000
@@ -1751,8 +1751,6 @@
 	if (read_zsubs)
 		process_zsubs(zephyr);
 
-	serv_finish_login(gc);
-
 	if (use_zeph02(zephyr)) {
 		zephyr->nottimer = gaim_timeout_add(100, check_notify_zeph02, gc);
 	} else if (use_tzc(zephyr)) {
--- a/src/server.c	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/server.c	Sun Mar 27 17:50:35 2005 +0000
@@ -56,26 +56,6 @@
 		check_idle(gc);
 }
 
-void serv_finish_login(GaimConnection *gc)
-{
-	GaimPluginProtocolInfo *prpl_info = NULL;
-	GaimAccount *account;
-
-	if (gc != NULL && gc->prpl != NULL)
-		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
-
-	account = gaim_connection_get_account(gc);
-
-	if (gaim_account_get_user_info(account) != NULL)
-		serv_set_info(gc, gaim_account_get_user_info(account));
-
-	if (gc->idle_timer > 0)
-		gaim_timeout_remove(gc->idle_timer);
-
-	gc->idle_timer = gaim_timeout_add(20000, check_idle, gc);
-	serv_touch_idle(gc);
-}
-
 /* This should return the elapsed time in seconds in which Gaim will not send
  * typing notifications.
  * if it returns zero, it will not send any more typing notifications
@@ -1237,7 +1217,7 @@
 void serv_send_file(GaimConnection *gc, const char *who, const char *file)
 {
 	GaimPluginProtocolInfo *prpl_info = NULL;
-	
+
 	if (gc != NULL && gc->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
--- a/src/server.h	Sun Mar 27 17:39:22 2005 +0000
+++ b/src/server.h	Sun Mar 27 17:50:35 2005 +0000
@@ -74,7 +74,6 @@
 void serv_got_typing_stopped(GaimConnection *gc, const char *name);
 void serv_got_im(GaimConnection *gc, const char *who, const char *msg,
 				 GaimConvImFlags imflags, time_t mtime);
-void serv_finish_login(GaimConnection *gc);
 void serv_got_chat_invite(GaimConnection *gc, const char *name,
 						  const char *who, const char *message,
 						  GHashTable *data);