changeset 6034:5a0060191a77

[gaim-migrate @ 6484] (16:32:42) javabsp: Who wants a patch? Fixes 744090 (16:33:15) javabsp: 0.64cvs bad confirmation removing chat room(from blist) (16:33:55) javabsp: It's showing something like "remove chat (null)" if the chat doesn't have an alias committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sat, 05 Jul 2003 20:52:43 +0000
parents 22923270493f
children 8c44020a958e
files src/blist.c src/blist.h src/dialogs.c
diffstat 3 files changed, 39 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/blist.c	Sat Jul 05 18:55:07 2003 +0000
+++ b/src/blist.c	Sat Jul 05 20:52:43 2003 +0000
@@ -23,6 +23,7 @@
 #include "blist.h"
 #include "conversation.h"
 #include "debug.h"
+#include "multi.h"
 #include "notify.h"
 #include "prefs.h"
 #include "privacy.h"
@@ -347,6 +348,33 @@
 	return chat;
 }
 
+const char *gaim_chat_get_display_name(struct chat *chat)
+{
+	char *name;
+
+	if(chat->alias){
+		 name = g_strdup(chat->alias);
+	}
+	else{
+		 GList *parts;
+		 GaimPlugin *prpl;
+		 GaimPluginProtocolInfo *prpl_info;
+		 struct proto_chat_entry *pce;
+
+		 prpl = gaim_find_prpl(gaim_account_get_protocol(chat->account));
+		 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
+
+		 parts = prpl_info->chat_info(chat->account->gc);
+
+		 pce = parts->data;
+		 name = g_markup_escape_text(g_hash_table_lookup(chat->components,
+														 pce->identifier), -1);
+		 g_list_free(parts);
+	}
+
+	return name;
+}
+
 struct buddy *gaim_buddy_new(GaimAccount *account, const char *screenname, const char *alias)
 {
 	struct buddy *b;
--- a/src/blist.h	Sat Jul 05 18:55:07 2003 +0000
+++ b/src/blist.h	Sat Jul 05 20:52:43 2003 +0000
@@ -291,6 +291,14 @@
 struct chat *gaim_chat_new(GaimAccount *account, const char *alias, GHashTable *components);
 
 /**
+ * Gets the alias of the chat, or the chat name if the alias does not exist
+ *
+ * @param chat    The chat
+ * @return        The display name of the chat
+ */
+const char *gaim_chat_get_display_name(struct chat *chat);
+
+/**
  * Adds a new chat to the buddy list.
  *
  * The chat will be inserted right after node or appended to the end
--- a/src/dialogs.c	Sat Jul 05 18:55:07 2003 +0000
+++ b/src/dialogs.c	Sat Jul 05 20:52:43 2003 +0000
@@ -457,12 +457,14 @@
 
 void show_confirm_del_chat(struct chat *chat)
 {
-	char *text = g_strdup_printf(_("You are about to remove the chat %s from your buddy list.  Do you want to continue?"), chat->alias);
+	const 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,
 						_("Remove Chat"), G_CALLBACK(do_remove_chat),
 						_("Cancel"), NULL);
 
+	g_free(name);
 	g_free(text);
 }