changeset 9699:267eab8f3fa4

[gaim-migrate @ 10558] Add a password hint to the "Enter password" dialog. Also added a gaim_account_get_protocol_name() to account.c/.h This change sponsored in part by Daniel Atallah, Jon Oberheide, Mark Doliner, the National Science Foundation, and by viewers like you. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 07 Aug 2004 15:04:15 +0000
parents bd5abccacff2
children d6292978a704
files src/account.c src/account.h src/away.c src/connection.c src/gtkaccount.c src/gtkconv.c src/gtkpounce.c
diffstat 7 files changed, 31 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/src/account.c	Sat Aug 07 14:43:14 2004 +0000
+++ b/src/account.c	Sat Aug 07 15:04:15 2004 +0000
@@ -727,6 +727,16 @@
 	return account->protocol_id;
 }
 
+const char *
+gaim_account_get_protocol_name(const GaimAccount *account)
+{
+	g_return_val_if_fail(account != NULL, NULL);
+
+	GaimPlugin *p = gaim_find_prpl(account->protocol_id);
+
+	return ((p && p->info->name) ? _(p->info->name) : _("Unknown"));
+}
+
 GaimConnection *
 gaim_account_get_connection(const GaimAccount *account)
 {
--- a/src/account.h	Sat Aug 07 14:43:14 2004 +0000
+++ b/src/account.h	Sat Aug 07 15:04:15 2004 +0000
@@ -384,6 +384,15 @@
 const char *gaim_account_get_protocol_id(const GaimAccount *account);
 
 /**
+ * Returns the account's protocol name.
+ *
+ * @param account The account.
+ *
+ * @return The protocol name.
+ */
+const char *gaim_account_get_protocol_name(const GaimAccount *account);
+
+/**
  * Returns the account's connection.
  *
  * @param account The account.
--- a/src/away.c	Sat Aug 07 14:43:14 2004 +0000
+++ b/src/away.c	Sat Aug 07 15:04:15 2004 +0000
@@ -538,7 +538,8 @@
 				account = gaim_connection_get_account(gc);
 
 				g_snprintf(buf, sizeof(buf), "%s (%s)",
-					   gaim_account_get_username(account), gc->prpl->info->name);
+						   gaim_account_get_username(account),
+						   gaim_account_get_protocol_name(account));
 				menuitem = gtk_image_menu_item_new_with_label(buf);
 
 				pixbuf = create_prpl_icon(gc->account);
--- a/src/connection.c	Sat Aug 07 14:43:14 2004 +0000
+++ b/src/connection.c	Sat Aug 07 15:04:15 2004 +0000
@@ -192,7 +192,8 @@
 		gaim_debug(GAIM_DEBUG_INFO, "connection", "Requesting password\n");
 		gaim_connection_destroy(gc);
 		escaped = g_markup_escape_text(username, strlen(username));
-		primary = g_strdup_printf(_("Enter password for %s"), escaped);
+		primary = g_strdup_printf(_("Enter password for %s (%s)"), escaped,
+								  gaim_account_get_protocol_name(account));
 		gaim_request_input(gc, NULL, primary, NULL, NULL, FALSE, TRUE, NULL,
 						   _("OK"), G_CALLBACK(request_pass_ok_cb),
 						   _("Cancel"), NULL, account);
--- a/src/gtkaccount.c	Sat Aug 07 14:43:14 2004 +0000
+++ b/src/gtkaccount.c	Sat Aug 07 15:04:15 2004 +0000
@@ -161,14 +161,6 @@
 static char*
 convert_buddy_icon(GaimAccount *account, const char *path);
 
-static char *
-proto_name(const char *id)
-{
-	GaimPlugin *p = gaim_find_prpl(id);
-
-	return ((p && p->info->name) ? _(p->info->name) : _("Unknown"));
-}
-
 /**************************************************************************
  * Add/Modify Account dialog
  **************************************************************************/
@@ -2193,7 +2185,7 @@
 			COLUMN_SCREENNAME, gaim_account_get_username(account),
 			COLUMN_ONLINE, gaim_account_is_connected(account),
 			COLUMN_AUTOLOGIN, gaim_account_get_auto_login(account, GAIM_GTK_UI),
-			COLUMN_PROTOCOL, proto_name(gaim_account_get_protocol_id(account)),
+			COLUMN_PROTOCOL, gaim_account_get_protocol_name(account),
 			COLUMN_DATA, account,
 			-1);
 
--- a/src/gtkconv.c	Sat Aug 07 14:43:14 2004 +0000
+++ b/src/gtkconv.c	Sat Aug 07 15:04:15 2004 +0000
@@ -36,6 +36,7 @@
 
 #include <gdk/gdkkeysyms.h>
 
+#include "account.h"
 #include "cmds.h"
 #include "debug.h"
 #include "imgstore.h"
@@ -1770,16 +1771,14 @@
 	GaimAccount *account = g_object_get_data(m, "gaim_account");
 	GaimConversation *conv;
 	GaimGtkConversation *gtkconv;
-	GaimPlugin *protocol;
 
 	conv = gaim_conv_window_get_active_conversation(win);
 
 	gaim_conversation_set_account(conv, account);
 
 	gtkconv = GAIM_GTK_CONVERSATION(conv);
-	protocol = gaim_find_prpl(conv->account->protocol_id);
 	gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry),
-								 protocol->info->name);
+								 gaim_account_get_protocol_name(conv->account));
 }
 
 static void
@@ -3924,7 +3923,6 @@
 	GaimGtkConversation *gtkconv;
 	GaimGtkChatPane *gtkchat;
 	GaimConnection *gc;
-	GaimPlugin *protocol;
 	GtkWidget *vpaned, *hpaned;
 	GtkWidget *vbox, *hbox;
 	GtkWidget *lbox, *bbox;
@@ -4150,9 +4148,8 @@
 	gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry),
 			gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts"));
 
-	protocol = gaim_find_prpl(conv->account->protocol_id);
 	gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry),
-								 protocol->info->name);
+								 gaim_account_get_protocol_name(conv->account));
 	gtkconv->entry_buffer =
 		gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry));
 	gaim_setup_imhtml(gtkconv->entry);
@@ -4203,7 +4200,6 @@
 {
 	GaimGtkConversation *gtkconv;
 	GaimGtkImPane *gtkim;
-	GaimPlugin *protocol;
 	GtkWidget *paned;
 	GtkWidget *vbox;
 	GtkWidget *vbox2;
@@ -4289,9 +4285,8 @@
 	gtk_imhtml_html_shortcuts(GTK_IMHTML(gtkconv->entry),
 			gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts"));
 
-	protocol = gaim_find_prpl(conv->account->protocol_id);
 	gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry),
-								 protocol->info->name);
+								 gaim_account_get_protocol_name(conv->account));
 	gtkconv->entry_buffer =
 		gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry));
 	gaim_setup_imhtml(gtkconv->entry);
@@ -5035,7 +5030,8 @@
 		strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime));
 
 	if(gc)
-		sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name);
+		sml_attrib = g_strdup_printf("sml=\"%s\"",
+									 gaim_account_get_protocol_name(conv->account));
 
 	gtk_font_options ^= GTK_IMHTML_NO_COMMENTS;
 
--- a/src/gtkpounce.c	Sat Aug 07 14:43:14 2004 +0000
+++ b/src/gtkpounce.c	Sat Aug 07 15:04:15 2004 +0000
@@ -922,10 +922,8 @@
 	GaimConversation *conv;
 	GaimAccount *account;
 	GaimBuddy *buddy;
-	GaimPlugin *proto;
 	const char *pouncee;
 	const char *alias;
-	const char *proto_id;
 
 	pouncee = gaim_pounce_get_pouncee(pounce);
 	account = gaim_pounce_get_pouncer(pounce);
@@ -934,10 +932,6 @@
 
 	alias = gaim_buddy_get_alias(buddy);
 
-	/* Find the protocol id for the window title and/or message */
-	proto = gaim_find_prpl(gaim_account_get_protocol_id(account));
-	proto_id = proto->info->name;
-
 	if (gaim_pounce_action_is_enabled(pounce, "open-window"))
 	{
 		conv = gaim_find_conversation_with_account(pouncee, account);
@@ -973,7 +967,7 @@
 				   (events & GAIM_POUNCE_AWAY) ?
 				   _("%s has gone away. (%s)") :
 				   _("Unknown pounce event. Please report this!"),
-				   alias,proto_id);
+				   alias, gaim_account_get_protocol_name(account));
 
 		/*
 		 * Ok here is where I change the second argument, title, from