changeset 6036:547ba881bc7e

[gaim-migrate @ 6486] Fix the --login=[NAME] command line argument. Fix the password prompt when signing on an account with no password set. I made some similar changes that probably fix problems with the filectl plugin, using gaim-remote to sign on an account, and signing on an account via perl script. (The change is calling gaim_account_connect() instead of serv_login().) Fix a silly compiler warning. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 05 Jul 2003 22:24:57 +0000
parents 8c44020a958e
children 4543f56f6fc3
files plugins/filectl.c plugins/gaim-remote/remote.c plugins/perl/perl.c src/account.c src/blist.c src/blist.h src/connection.c src/dialogs.c src/gtkconn.c src/main.c
diffstat 10 files changed, 37 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/filectl.c	Sat Jul 05 21:54:19 2003 +0000
+++ b/plugins/filectl.c	Sat Jul 05 22:24:57 2003 +0000
@@ -53,7 +53,7 @@
 				free(arg1);
 			}
 			if (account) /* username found */
-				serv_login(account);
+				gaim_account_connect(account);
 		} else if (!strncasecmp(command, "signoff", 7)) {
 			struct gaim_connection *gc = NULL;
 			GSList *c = connections;
--- a/plugins/gaim-remote/remote.c	Sat Jul 05 21:54:19 2003 +0000
+++ b/plugins/gaim-remote/remote.c	Sat Jul 05 22:24:57 2003 +0000
@@ -387,7 +387,7 @@
 		memcpy(&id, data, sizeof(id));
 		account = g_list_nth_data(gaim_accounts_get_all(), id);
 		if (account)
-			serv_login(account);
+			gaim_account_connect(account);
 		/* don't need to do anything here because the UI will get updates from other handlers */
 		break;
 	default:
--- a/plugins/perl/perl.c	Sat Jul 05 21:54:19 2003 +0000
+++ b/plugins/perl/perl.c	Sat Jul 05 22:24:57 2003 +0000
@@ -739,7 +739,7 @@
 	if (!strncasecmp(command, "signon", 6)) {
 		int index = SvIV(ST(1));
 		if (g_list_nth_data(gaim_accounts_get_all(), index))
-		serv_login(g_list_nth_data(gaim_accounts_get_all(), index));
+		gaim_account_connect(g_list_nth_data(gaim_accounts_get_all(), index));
 	} else if (!strncasecmp(command, "signoff", 7)) {
 		GaimConnection *gc = (GaimConnection *)SvIV(ST(1));
 		if (g_list_find(gaim_connections_get_all(), gc))
--- a/src/account.c	Sat Jul 05 21:54:19 2003 +0000
+++ b/src/account.c	Sat Jul 05 22:24:57 2003 +0000
@@ -173,6 +173,9 @@
 	g_return_val_if_fail(account != NULL, NULL);
 	g_return_val_if_fail(!gaim_account_is_connected(account), NULL);
 
+//	if (gaim_account_is_connected(account))
+//		return gaim_account_get_connection(account);
+
 	gc = gaim_connection_new(account);
 
 	gaim_debug(GAIM_DEBUG_INFO, "account",
--- a/src/blist.c	Sat Jul 05 21:54:19 2003 +0000
+++ b/src/blist.c	Sat Jul 05 22:24:57 2003 +0000
@@ -348,7 +348,7 @@
 	return chat;
 }
 
-const char *gaim_chat_get_display_name(struct chat *chat)
+char *gaim_chat_get_display_name(struct chat *chat)
 {
 	char *name;
 
@@ -769,10 +769,11 @@
 char *  gaim_get_buddy_alias (struct buddy *buddy)
 {
 	char *ret = gaim_get_buddy_alias_only(buddy);
-        if(!ret)
-                return buddy ? buddy->name : _("Unknown");
-        return ret;
 
+	if(!ret)
+		return buddy ? buddy->name : _("Unknown");
+
+	return ret;
 }
 
 struct buddy *gaim_find_buddy(GaimAccount *account, const char *name)
--- a/src/blist.h	Sat Jul 05 21:54:19 2003 +0000
+++ b/src/blist.h	Sat Jul 05 22:24:57 2003 +0000
@@ -296,7 +296,7 @@
  * @param chat    The chat
  * @return        The display name of the chat
  */
-const char *gaim_chat_get_display_name(struct chat *chat);
+char *gaim_chat_get_display_name(struct chat *chat);
 
 /**
  * Adds a new chat to the buddy list.
--- a/src/connection.c	Sat Jul 05 21:54:19 2003 +0000
+++ b/src/connection.c	Sat Jul 05 22:24:57 2003 +0000
@@ -102,7 +102,7 @@
 
 	account = gaim_connection_get_account(gc);
 
-	if ((prpl_info->options & OPT_PROTO_NO_PASSWORD) &&
+	if (!(prpl_info->options & OPT_PROTO_NO_PASSWORD) &&
 		!(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL) &&
 		gaim_account_get_password(account) == NULL) {
 
--- a/src/dialogs.c	Sat Jul 05 21:54:19 2003 +0000
+++ b/src/dialogs.c	Sat Jul 05 22:24:57 2003 +0000
@@ -457,7 +457,7 @@
 
 void show_confirm_del_chat(struct chat *chat)
 {
-	const char *name = gaim_chat_get_display_name(chat);
+	char *name = gaim_chat_get_display_name(chat);
 	char *text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list.  Do you want to continue?"), name);
 
 	gaim_request_action(NULL, NULL, _("Remove Chat"), text, -1, chat, 2,
--- a/src/gtkconn.c	Sat Jul 05 21:54:19 2003 +0000
+++ b/src/gtkconn.c	Sat Jul 05 22:24:57 2003 +0000
@@ -26,6 +26,7 @@
 #include "util.h"
 
 #include "gtkblist.h"
+#include "gtkrequest.h"
 #include "gtkutils.h"
 
 #include "ui.h"
@@ -238,8 +239,26 @@
 		kill_meter(meter, _("Done."));
 }
 
+static void request_pass_ok_cb(GaimConnection *gc, const char *entry)
+{
+	GaimAccount *account = gaim_connection_get_account(gc);
+
+	gaim_account_set_password(account, (*entry != '\0') ? entry : NULL);
+
+	gaim_connection_connect(gc);
+}
+
+static void request_pass_cancel_cb(GaimConnection *gc, const char *entry)
+{
+	gaim_connection_destroy(gc);
+}
+
 static void gaim_gtk_connection_request_pass(GaimConnection *gc)
 {
+	gaim_request_input(gc, NULL, _("Enter your password."), NULL, 
+		NULL, FALSE, TRUE,
+		_("OK"), G_CALLBACK(request_pass_ok_cb),
+		_("Cancel"), G_CALLBACK(request_pass_cancel_cb), gc);
 }
 
 static void gaim_gtk_connection_disconnected(GaimConnection *gc,
--- a/src/main.c	Sat Jul 05 21:54:19 2003 +0000
+++ b/src/main.c	Sat Jul 05 22:24:57 2003 +0000
@@ -230,7 +230,7 @@
 	const char *username = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(name)->entry));
 	const char *password = gtk_entry_get_text(GTK_ENTRY(pass));
 
-	if (!strlen(username)) {
+	if (*username == '\0') {
 		gaim_notify_error(NULL, NULL, _("Please enter your login."), NULL);
 		return;
 	}
@@ -246,7 +246,7 @@
 		gaim_account_set_remember_password(account, TRUE);
 	}
 
-	gaim_account_set_password(account, password);
+	gaim_account_set_password(account, (*password != '\0') ? password : NULL);
 
 	gaim_account_connect(account);
 }
@@ -271,7 +271,7 @@
 			if (account) {	/* found a user */
 				if (gaim_account_get_remember_password(account)) {
 					retval = 0;
-					serv_login(account);
+					gaim_account_connect(account);
 				}
 			}
 		}
@@ -281,7 +281,7 @@
 
 		if (gaim_account_get_remember_password(account)) {
 			retval = 0;
-			serv_login(account);
+			gaim_account_connect(account);
 		}
 	}