comparison src/gtkconv.c @ 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 90be432e8385
children 477e5cca8287
comparison
equal deleted inserted replaced
11260:fd4aba9dab9d 11261:b53606580f68
3809 { 3809 {
3810 GaimPluginProtocolInfo *prpl_info = NULL; 3810 GaimPluginProtocolInfo *prpl_info = NULL;
3811 GaimConnection *gc; 3811 GaimConnection *gc;
3812 GaimConversation *conv = gtkconv->active_conv; 3812 GaimConversation *conv = gtkconv->active_conv;
3813 GaimGtkChatPane *gtkchat; 3813 GaimGtkChatPane *gtkchat;
3814 const char *new_topic; 3814 char *new_topic;
3815 const char *current_topic; 3815 const char *current_topic;
3816 3816
3817 gc = gaim_conversation_get_gc(conv); 3817 gc = gaim_conversation_get_gc(conv);
3818 3818
3819 if(!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) 3819 if(!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)))
3822 if(prpl_info->set_chat_topic == NULL) 3822 if(prpl_info->set_chat_topic == NULL)
3823 return; 3823 return;
3824 3824
3825 gtkconv = GAIM_GTK_CONVERSATION(conv); 3825 gtkconv = GAIM_GTK_CONVERSATION(conv);
3826 gtkchat = gtkconv->u.chat; 3826 gtkchat = gtkconv->u.chat;
3827 new_topic = gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)); 3827 new_topic = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text)));
3828 current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv)); 3828 current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv));
3829 3829
3830 if(current_topic && !g_utf8_collate(new_topic, current_topic)) 3830 if(current_topic && !g_utf8_collate(new_topic, current_topic)){
3831 g_free(new_topic);
3831 return; 3832 return;
3833 }
3834
3835 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic);
3832 3836
3833 prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), 3837 prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)),
3834 new_topic); 3838 new_topic);
3839
3840 g_free(new_topic);
3835 } 3841 }
3836 3842
3837 static gint 3843 static gint
3838 sort_chat_users(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer userdata) 3844 sort_chat_users(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer userdata)
3839 { 3845 {