changeset 11261:b53606580f68

[gaim-migrate @ 13439] Patch #1226486 from Levi Bard Fixes bug #1224178 If you change the topic in a chat room and that topic change is rejected, the topic field is wrong -- it shows the new topic even thought it didn't get set. This patch resets the GUI's topic immediately when you hit enter. Then, if the topic change is successful, the server will echo the topic change back to us and we'll update the GUI to the new topic. The only question is, does the server always echo the topic back to us? From the core's point of view, I'm ready to assume yes. It's the case for both IRC and Jabber*. If someone could test changing a topic in SILC or Zephyr, that'd be great. If servers using those protocols do not echo the topic back, the prpl will have to fake it as appropriate. * I didn't actually test on Jabber, but Nathan said the server will echo the topic change back. If it's broken, let me know. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sun, 14 Aug 2005 06:55:57 +0000
parents fd4aba9dab9d
children ecbbe6d18b0d
files src/gtkconv.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkconv.c	Sun Aug 14 06:23:51 2005 +0000
+++ b/src/gtkconv.c	Sun Aug 14 06:55:57 2005 +0000
@@ -3811,7 +3811,7 @@
 	GaimConnection *gc;
 	GaimConversation *conv = gtkconv->active_conv;
 	GaimGtkChatPane *gtkchat;
-	const char *new_topic;
+	char *new_topic;
 	const char *current_topic;
 
 	gc      = gaim_conversation_get_gc(conv);
@@ -3824,14 +3824,20 @@
 
 	gtkconv = GAIM_GTK_CONVERSATION(conv);
 	gtkchat = gtkconv->u.chat;
-	new_topic = gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text));
+	new_topic = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)));
 	current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv));
 
-	if(current_topic && !g_utf8_collate(new_topic, current_topic))
+	if(current_topic && !g_utf8_collate(new_topic, current_topic)){
+		g_free(new_topic);
 		return;
+	}
+
+	gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic);
 
 	prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)),
 			new_topic);
+
+	g_free(new_topic);
 }
 
 static gint