diff -r e98a5b6e56a4 -r 0c722056e496 pidgin/gtkconv.c --- a/pidgin/gtkconv.c Wed Jul 29 04:17:40 2009 +0000 +++ b/pidgin/gtkconv.c Wed Aug 19 00:44:02 2009 +0000 @@ -965,6 +965,12 @@ } static void +menu_join_chat_cb(gpointer data, guint action, GtkWidget *widget) +{ + pidgin_blist_joinchat_show(); +} + +static void savelog_writefile_cb(void *user_data, const char *filename) { PurpleConversation *conv = (PurpleConversation *)user_data; @@ -3345,6 +3351,8 @@ { N_("/Conversation/New Instant _Message..."), "M", menu_new_conv_cb, 0, "", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW }, + { N_("/Conversation/Join a _Chat..."), "C", menu_join_chat_cb, + 0, "", PIDGIN_STOCK_CHAT }, { "/Conversation/sep0", NULL, NULL, 0, "", NULL }, @@ -3552,6 +3560,62 @@ } static void +regenerate_media_items(PidginWindow *win) +{ +#ifdef USE_VV + PurpleAccount *account; + PurpleConversation *conv; + + conv = pidgin_conv_window_get_active_conversation(win); + + if (conv == NULL) { + purple_debug_error("gtkconv", "couldn't get active conversation" + " when regenerating media items\n"); + return; + } + + account = purple_conversation_get_account(conv); + + if (account == NULL) { + purple_debug_error("gtkconv", "couldn't get account when" + " regenerating media items\n"); + return; + } + + /* + * Check if account support voice and/or calls, and + * if the current buddy supports it. + */ + if (account != NULL && purple_conversation_get_type(conv) + == PURPLE_CONV_TYPE_IM) { + PurpleMediaCaps caps = + purple_prpl_get_media_caps(account, + purple_conversation_get_name(conv)); + + gtk_widget_set_sensitive(win->audio_call, + caps & PURPLE_MEDIA_CAPS_AUDIO + ? TRUE : FALSE); + gtk_widget_set_sensitive(win->video_call, + caps & PURPLE_MEDIA_CAPS_VIDEO + ? TRUE : FALSE); + gtk_widget_set_sensitive(win->audio_video_call, + caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO + ? TRUE : FALSE); + } else if (purple_conversation_get_type(conv) + == PURPLE_CONV_TYPE_CHAT) { + /* for now, don't care about chats... */ + gtk_widget_set_sensitive(win->audio_call, FALSE); + gtk_widget_set_sensitive(win->video_call, FALSE); + gtk_widget_set_sensitive(win->audio_video_call, FALSE); + } else { + gtk_widget_set_sensitive(win->audio_call, FALSE); + gtk_widget_set_sensitive(win->video_call, FALSE); + gtk_widget_set_sensitive(win->audio_video_call, FALSE); + } +#endif +} + +static void regenerate_options_items(PidginWindow *win) { #if GTK_CHECK_VERSION(2,6,0) @@ -3643,6 +3707,7 @@ static void menubar_activated(GtkWidget *item, gpointer data) { PidginWindow *win = data; + regenerate_media_items(win); regenerate_options_items(win); regenerate_plugins_items(win); @@ -4682,7 +4747,11 @@ return; } - gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic); + if (current_topic) + gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic); + else + gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), ""); + prpl_info->set_chat_topic(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), new_topic); @@ -5752,6 +5821,7 @@ { PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops(); gboolean hide = FALSE; + guint timer; /* create hidden conv if hide_new pref is always */ if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "always") == 0) @@ -5775,6 +5845,13 @@ purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); ui_ops->create_conversation = pidgin_conv_new; } + + /* Somebody wants to keep this conversation around, so don't time it out */ + timer = GPOINTER_TO_INT(purple_conversation_get_data(conv, "close-timer")); + if (timer) { + purple_timeout_remove(timer); + purple_conversation_set_data(conv, "close-timer", GINT_TO_POINTER(0)); + } } static void @@ -6872,36 +6949,6 @@ buttons |= GTK_IMHTML_CUSTOM_SMILEY; else buttons &= ~GTK_IMHTML_CUSTOM_SMILEY; - -#ifdef USE_VV - /* check if account support voice calls, and if the current buddy - supports it */ - if (account != NULL && purple_conversation_get_type(conv) - == PURPLE_CONV_TYPE_IM) { - PurpleMediaCaps caps = - purple_prpl_get_media_caps(account, - purple_conversation_get_name(conv)); - - gtk_widget_set_sensitive(win->audio_call, - caps & PURPLE_MEDIA_CAPS_AUDIO - ? TRUE : FALSE); - gtk_widget_set_sensitive(win->video_call, - caps & PURPLE_MEDIA_CAPS_VIDEO - ? TRUE : FALSE); - gtk_widget_set_sensitive(win->audio_video_call, - caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO - ? TRUE : FALSE); - } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { - /* for now, don't care about chats... */ - gtk_widget_set_sensitive(win->audio_call, FALSE); - gtk_widget_set_sensitive(win->video_call, FALSE); - gtk_widget_set_sensitive(win->audio_video_call, FALSE); - } else { - gtk_widget_set_sensitive(win->audio_call, FALSE); - gtk_widget_set_sensitive(win->video_call, FALSE); - gtk_widget_set_sensitive(win->audio_video_call, FALSE); - } -#endif gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); if (account != NULL)