diff pidgin/gtkconv.c @ 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 2e16a86883c7
children 5624eec4da24
line wrap: on
line diff
--- 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. */