changeset 22645:f75509f776cc

When you try to execute a command (e.g., /part etc.) in a chat on a disconnected account, the command fails. But there's no notification of the failure. Fix this by making sure the error message gets written in the conv.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 13 Apr 2008 17:12:05 +0000
parents d14294a40d74
children 654f8386f4b3
files libpurple/conversation.c pidgin/gtkconv.c
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/conversation.c	Sun Apr 13 16:54:33 2008 +0000
+++ b/libpurple/conversation.c	Sun Apr 13 17:12:05 2008 +0000
@@ -862,7 +862,7 @@
 		gc = purple_account_get_connection(account);
 
 	if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT &&
-		(gc == NULL || !g_slist_find(gc->buddy_chats, conv)))
+		(gc != NULL && !g_slist_find(gc->buddy_chats, conv)))
 		return;
 
 	if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM &&
--- a/pidgin/gtkconv.c	Sun Apr 13 16:54:33 2008 +0000
+++ b/pidgin/gtkconv.c	Sun Apr 13 17:12:05 2008 +0000
@@ -5430,7 +5430,7 @@
 	account = purple_conversation_get_account(conv);
 	g_return_if_fail(account != NULL);
 	gc = purple_account_get_connection(account);
-	g_return_if_fail(gc != NULL);
+	g_return_if_fail(gc != NULL || !(flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)));
 
 	/* Make sure URLs are clickable */
 	if(flags & PURPLE_MESSAGE_NO_LINKIFY)
@@ -5463,7 +5463,7 @@
 	}
 
 	win = gtkconv->win;
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL;
 
 	line_count = gtk_text_buffer_get_line_count(
 			gtk_text_view_get_buffer(GTK_TEXT_VIEW(
@@ -5702,7 +5702,7 @@
 		g_free(alias_escaped);
 
 		/* Are we in a chat where we can tell which users are buddies? */
-		if  (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) &&
+		if  (prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) &&
 		     purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
 
 			/* Bold buddies to make them stand out from non-buddies. */