# HG changeset patch # User Luke Schierer # Date 1132165021 0 # Node ID e75ef7aa913efbacb9126b71690af616b35a0683 # Parent e9790eb9321654fc46f1ab8b7ce78a91a083c393 [gaim-migrate @ 14416] " This patch implements a replacement for the queuing system from 1.x. It also obsoletes a previous patch [#1338873] I submitted to prioritize the unseen states in gtk conversations. The attached envelope.png is ripped from the msgunread.png already included in gaim. It should be dropped in the pixmaps directory (Makefile.am is updated accordingly in this patch). The two separate queuing preferences from 1.x, queuing messages while away and queuing all new messages (from docklet), are replaced with a single 3-way preference for conversations. The new preference is "Hide new IM conversations". This preference can be set to never, away and always. When a gtk conversation is created, it may be placed in a hidden conversation window instead of being placed normally. This decision is based upon the preference and possibly the away state of the account the conversation is being created for. This *will* effect conversations the user explicitly requests to be created, so in these cases the caller must be sure to present the conversation to the user, using gaim_gtkconv_present_conversation(). This is done already in gtkdialogs.c which handles creating conversations requested by the user from gaim proper (menus, double-clicking on budy in blist, etc.). The main advantage to not queuing messages is that the conversations exist, the message is written to the conversation (and logged if appropriate) and the unseen state is set on the conversation. This means no additional features are needed to track whether there are queued messages or not, just use the unseen state on conversations. Since conversations may not be visible (messages "queued"), gaim proper needs some notification that there are messages waiting. I opted for a menutray icon that shows up when an im conversation has an unseen message. Clicking this icon will focus (and show if hidden) the first conversation with an unseen message. This is essentially the same behavior of the docklet in cvs right now, except that the icon is only visible when there is a conversation with an unread message. The api that is added is flexible enough to allow either the docklet or the new blist menutray icon to be visible for conversations of any/all types and for unseen messages >= any state. Currently they are set to only IM conversations and only unseen states >= TEXT (system messages and no log messages will not trigger blinking the docklet or showing the blist tray icon), but these could be made preferences relatively easily in the future. Other plugins could probably benefit as well: gaim_gtk_conversations_get_first_unseen(). There is probably some limit to comment size, so I'll stop rambling now. If anyone has more questions/comments, catch me in #gaim, here or on gaim-devel." committer: Tailor Script diff -r e9790eb93216 -r e75ef7aa913e pixmaps/Makefile.am --- a/pixmaps/Makefile.am Wed Nov 16 17:55:26 2005 +0000 +++ b/pixmaps/Makefile.am Wed Nov 16 18:17:01 2005 +0000 @@ -8,6 +8,7 @@ change-fgcolor-small.png \ connect.png \ edit.png \ + envelope.png \ gaim.png \ gaim_auth.png \ gaim_cool.png \ @@ -78,7 +79,7 @@ gaimiconpix_DATA = away.png connect.png msgpend.png offline.png online.png msgunread.png info.png gaimdistpixdir = $(datadir)/pixmaps/gaim -gaimdistpix_DATA = logo.png tb_drag_arrow_down.xpm tb_drag_arrow_left.xpm tb_drag_arrow_right.xpm tb_drag_arrow_up.xpm typed.png typing.png status-online.png status-offline.png status-away.png status-invisible.png status-typing0.png status-typing1.png status-typing2.png status-typing3.png status-connect0.png status-connect1.png status-connect2.png status-connect3.png phone.png +gaimdistpix_DATA = envelope.png logo.png tb_drag_arrow_down.xpm tb_drag_arrow_left.xpm tb_drag_arrow_right.xpm tb_drag_arrow_up.xpm typed.png typing.png status-online.png status-offline.png status-away.png status-invisible.png status-typing0.png status-typing1.png status-typing2.png status-typing3.png status-connect0.png status-connect1.png status-connect2.png status-connect3.png phone.png distpixmapdir = $(datadir)/pixmaps distpixmap_DATA = gaim.png diff -r e9790eb93216 -r e75ef7aa913e pixmaps/envelope.png Binary file pixmaps/envelope.png has changed diff -r e9790eb93216 -r e75ef7aa913e plugins/docklet/docklet.c --- a/plugins/docklet/docklet.c Wed Nov 16 17:55:26 2005 +0000 +++ b/plugins/docklet/docklet.c Wed Nov 16 18:17:01 2005 +0000 @@ -178,31 +178,6 @@ return FALSE; } -static gboolean -focus_first_unseen_conv() -{ - GList *l; - GaimConversation *conv; - GaimGtkConversation *gtkconv; - - /* find first im with unseen messages */ - for(l = gaim_get_ims(); l!=NULL; l=l->next) { - conv = (GaimConversation*)l->data; - if(GAIM_IS_GTK_CONVERSATION(conv)) { - gtkconv=GAIM_GTK_CONVERSATION(conv); - if(gtkconv->unseen_state!=GAIM_UNSEEN_NONE) { - gtkconv->active_conv=conv; - gaim_gtk_conv_window_switch_gtkconv(gtkconv->win, gtkconv); - gaim_gtk_conv_window_raise(gtkconv->win); - gtk_window_present(GTK_WINDOW(gtkconv->win->window)); - return TRUE; - } - } - } - - return FALSE; -} - /************************************************************************** * callbacks and signal handlers **************************************************************************/ @@ -369,9 +344,10 @@ { switch (button_type) { case 1: - if(status==DOCKLET_STATUS_ONLINE_PENDING - || status==DOCKLET_STATUS_AWAY_PENDING) - focus_first_unseen_conv(); + if(status==DOCKLET_STATUS_ONLINE_PENDING || status==DOCKLET_STATUS_AWAY_PENDING) + gaim_gtkconv_present_conversation( + gaim_gtk_conversations_get_first_unseen( + GAIM_CONV_TYPE_IM, GAIM_UNSEEN_TEXT)); else gaim_gtk_blist_toggle_visibility(); break; diff -r e9790eb93216 -r e75ef7aa913e src/gtkblist.c --- a/src/gtkblist.c Wed Nov 16 17:55:26 2005 +0000 +++ b/src/gtkblist.c Wed Nov 16 18:17:01 2005 +0000 @@ -46,6 +46,7 @@ #include "gtkdialogs.h" #include "gtkft.h" #include "gtklog.h" +#include "gtkmenutray.h" #include "gtkpounce.h" #include "gtkplugin.h" #include "gtkprefs.h" @@ -117,6 +118,7 @@ #endif static GaimGtkBuddyList *gtkblist = NULL; +static void gaim_gtk_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node); static void gaim_gtk_blist_selection_changed(GtkTreeSelection *selection, gpointer data); static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node); static char *gaim_get_tooltip_text(GaimBlistNode *node); @@ -3121,6 +3123,39 @@ gaim_gtk_blist_update_plugin_actions(); } +static gboolean +menutray_press_cb(GtkWidget *widget, GdkEventButton *event) +{ + gaim_gtkconv_present_conversation(gaim_gtk_conversations_get_first_unseen( + GAIM_CONV_TYPE_IM, GAIM_UNSEEN_TEXT)); + return TRUE; +} + +static void +conversation_updated_cb(GaimConversation *conv, GaimConvUpdateType type, + GaimGtkBuddyList *gtkblist) +{ + GtkWidget *img = NULL; + + if(gtkblist->menutrayicon) { + gtk_widget_destroy(gtkblist->menutrayicon); + gtkblist->menutrayicon = NULL; + } + + if(gaim_gtk_conversations_get_first_unseen(GAIM_CONV_TYPE_IM, GAIM_UNSEEN_TEXT)) + img = gtk_image_new_from_stock(GAIM_STOCK_PENDING, GTK_ICON_SIZE_MENU); + + if(img) { + gtkblist->menutrayicon = gtk_event_box_new(); + gtk_container_add(GTK_CONTAINER(gtkblist->menutrayicon), img); + gtk_widget_show(img); + gtk_widget_show(gtkblist->menutrayicon); + g_signal_connect(G_OBJECT(gtkblist->menutrayicon), "button-press-event", G_CALLBACK(menutray_press_cb), NULL); + + gaim_gtk_menu_tray_append(GAIM_GTK_MENU_TRAY(gtkblist->menutray), gtkblist->menutrayicon, NULL); + } +} + /********************************************************************************** * Public API Functions * **********************************************************************************/ @@ -3329,6 +3364,9 @@ g_signal_connect(G_OBJECT(accel_group), "accel-changed", G_CALLBACK(gaim_gtk_save_accels_cb), NULL); menu = gtk_item_factory_get_widget(gtkblist->ift, ""); + gtkblist->menutray = gaim_gtk_menu_tray_new(); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), gtkblist->menutray); + gtk_widget_show(gtkblist->menutray); gtk_widget_show(menu); gtk_box_pack_start(GTK_BOX(gtkblist->vbox), menu, FALSE, FALSE, 0); @@ -3524,6 +3562,10 @@ gaim_signal_connect(gaim_plugins_get_handle(), "plugin-unload", gtkblist, GAIM_CALLBACK(plugin_changed_cb), NULL); + gaim_signal_connect(gaim_conversations_get_handle(), "conversation-updated", + gtkblist, GAIM_CALLBACK(conversation_updated_cb), + gtkblist); + /* emit our created signal */ gaim_signal_emit(handle, "gtkblist-created", list); } diff -r e9790eb93216 -r e75ef7aa913e src/gtkblist.h --- a/src/gtkblist.h Wed Nov 16 17:55:26 2005 +0000 +++ b/src/gtkblist.h Wed Nov 16 18:17:01 2005 +0000 @@ -69,6 +69,8 @@ GtkItemFactory *ift; GtkWidget *bpmenu; /**< The buddy pounce menu. */ + GtkWidget *menutray; /**< The menu tray widget. */ + GtkWidget *menutrayicon; /**< The menu tray icon. */ guint refresh_timer; /**< The timer for refreshing every 30 seconds */ diff -r e9790eb93216 -r e75ef7aa913e src/gtkconv.c --- a/src/gtkconv.c Wed Nov 16 17:55:26 2005 +0000 +++ b/src/gtkconv.c Wed Nov 16 18:17:01 2005 +0000 @@ -113,6 +113,10 @@ static GtkWidget *invite_dialog = NULL; static GtkWidget *warn_close_dialog = NULL; +static GaimGtkWindow *hidden_convwin = NULL; +static GList *window_list = NULL; + + static gboolean update_send_to_selection(GaimGtkWindow *win); static void generate_send_to_items(GaimGtkWindow *win); @@ -128,6 +132,8 @@ static void update_typing_icon(GaimGtkConversation *gtkconv); static char *item_factory_translate_func (const char *path, gpointer func_data); gboolean gaim_gtkconv_has_focus(GaimConversation *conv); +static void private_remove_gtkconv(GaimGtkWindow *win, GaimGtkConversation *gtkconv, + gboolean destroy_empty); static GdkColor *get_nick_color(GaimGtkConversation *gtkconv, const char *name) { static GdkColor col; @@ -2096,7 +2102,7 @@ if (status != NULL) g_object_unref(status); - if (gaim_gtk_conv_window_get_active_conversation(win) == conv && + if (gaim_gtk_conv_window_is_active_conversation(conv) && (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM || gtkconv->u.im->anim == NULL)) { @@ -2354,6 +2360,22 @@ /************************************************************************** * End of the bunch of buddy icon functions **************************************************************************/ +void +gaim_gtkconv_present_conversation(GaimConversation *conv) +{ + GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv); + + if(gtkconv->win==hidden_convwin) { + private_remove_gtkconv(hidden_convwin, gtkconv, FALSE); + gaim_gtkconv_placement_place(gtkconv); + } + + gaim_gtkconv_set_active_conversation(conv); + gaim_gtk_conv_window_switch_gtkconv(gtkconv->win, gtkconv); + gaim_gtk_conv_window_raise(gtkconv->win); + gtk_window_present(GTK_WINDOW(gtkconv->win->window)); +} + GaimConversation * gaim_gtk_conversations_get_first_unseen(GaimConversationType type, GaimUnseenState min_state) @@ -3958,6 +3980,23 @@ G_CALLBACK(gtk_widget_grab_focus), gtkconv->entry); + if (conv_type == GAIM_CONV_TYPE_IM) { + /* put conv in hidden_convwin if hide_new pref is always */ + if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "always")==0) { + gaim_gtk_conv_window_add_gtkconv(hidden_convwin, gtkconv); + return; + } + + /* put conv in hidden_convwin if hide_new pref is away and account is away */ + if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away")==0 + && gaim_status_type_get_primitive( + gaim_status_get_type(gaim_account_get_active_status( + gaim_conversation_get_account(conv)))) == GAIM_STATUS_AWAY) { + gaim_gtk_conv_window_add_gtkconv(hidden_convwin, gtkconv); + return; + } + } + gaim_gtkconv_placement_place(gtkconv); } @@ -4622,12 +4661,9 @@ g_object_get(G_OBJECT(win->window), "has-toplevel-focus", &has_focus, NULL); - if (has_focus) - { - GaimConversation *c = gaim_gtk_conv_window_get_active_conversation(win); - if (GAIM_GTK_CONVERSATION(c) == gtkconv) - return TRUE; - } + if (has_focus && gaim_gtk_conv_window_is_active_conversation(conv)) + return TRUE; + return FALSE; } @@ -5078,12 +5114,12 @@ else gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), title); - if (conv == gaim_gtk_conv_window_get_active_conversation(win)) + if (gaim_gtk_conv_window_is_active_conversation(conv)) update_typing_icon(gtkconv); if (type == GAIM_CONV_UPDATE_TITLE) { gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), title); - if (conv == gaim_gtk_conv_window_get_active_conversation(win)) + if (gaim_gtk_conv_window_is_active_conversation(conv)) gtk_window_set_title(GTK_WINDOW(win->window), title); } @@ -5308,7 +5344,7 @@ /* The buddy icon code needs badly to be fixed. */ buf = gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); - if(conv == gaim_gtk_conv_window_get_active_conversation(gtkconv->win)) + if(gaim_gtk_conv_window_is_active_conversation(conv)) gtk_window_set_icon(GTK_WINDOW(win->window), buf); } @@ -5534,6 +5570,72 @@ } static void +account_status_changed_cb(GaimAccount *account, GaimStatus *oldstatus, + GaimStatus *newstatus) +{ + GList *l; + GaimConversation *conv = NULL; + GaimGtkConversation *gtkconv; + + if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away")!=0) + return; + + if(gaim_status_type_get_primitive(gaim_status_get_type(oldstatus))!=GAIM_STATUS_AWAY) + return; + + if(gaim_status_type_get_primitive(gaim_status_get_type(newstatus))==GAIM_STATUS_AWAY) + return; + + for (l = hidden_convwin->gtkconvs; l != NULL; l = l->next) { + gtkconv = l->data; + + conv = gtkconv->active_conv; + + if(gaim_status_type_get_primitive( + gaim_status_get_type(gaim_account_get_active_status( + gaim_conversation_get_account(conv)))) == GAIM_STATUS_AWAY) + continue; + + private_remove_gtkconv(hidden_convwin, gtkconv, FALSE); + gaim_gtkconv_placement_place(gtkconv); + } +} + +static void +hide_new_pref_cb(const char *name, GaimPrefType type, gpointer value, + gpointer data) +{ + GList *l; + GaimConversation *conv = NULL; + GaimGtkConversation *gtkconv; + gboolean when_away = FALSE; + + if(!hidden_convwin) + return; + + if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "always")==0) + return; + + if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away")==0) + when_away = TRUE; + + for (l = hidden_convwin->gtkconvs; l != NULL; l = l->next) { + gtkconv = l->data; + + conv = gtkconv->active_conv; + + if(when_away && gaim_status_type_get_primitive( + gaim_status_get_type(gaim_account_get_active_status( + gaim_conversation_get_account(conv)))) == GAIM_STATUS_AWAY) + continue; + + private_remove_gtkconv(hidden_convwin, gtkconv, FALSE); + gaim_gtkconv_placement_place(gtkconv); + } +} + + +static void conv_placement_pref_cb(const char *name, GaimPrefType type, gpointer value, gpointer data) { @@ -5602,6 +5704,19 @@ gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); gaim_prefs_add_bool("/gaim/gtk/conversations/im/show_buddy_icons", TRUE); + /* convert old queuing prefs to hide_new 3-way pref */ + if(gaim_prefs_exists("/plugins/gtk/docklet/queue_messages") && + gaim_prefs_get_bool("/plugins/gtk/docklet/queue_messages")) { + gaim_prefs_add_string("/gaim/gtk/conversations/im/hide_new", "always"); + } + else if(gaim_prefs_exists("/gaim/gtk/away/queue_messages") && + gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) { + gaim_prefs_add_string("/gaim/gtk/conversations/im/hide_new", "away"); + } + else { + gaim_prefs_add_string("/gaim/gtk/conversations/im/hide_new", "never"); + } + /* Connect callbacks. */ gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/close_on_tabs", close_on_tabs_pref_cb, NULL); @@ -5624,6 +5739,9 @@ animate_buddy_icons_pref_cb, NULL); gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/im/show_buddy_icons", show_buddy_icons_pref_cb, NULL); + gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/im/hide_new", + hide_new_pref_cb, NULL); + /********************************************************************** @@ -5665,6 +5783,12 @@ G_CALLBACK(buddy_update_cb), NULL); gaim_conversations_set_ui_ops(&conversation_ui_ops); + + hidden_convwin = gaim_gtk_conv_window_new(); + window_list = g_list_remove(window_list, hidden_convwin); + + gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed", + handle, GAIM_CALLBACK(account_status_changed_cb), NULL); } void @@ -5673,6 +5797,8 @@ gaim_prefs_disconnect_by_handle(gaim_gtk_conversations_get_handle()); gaim_signals_disconnect_by_handle(gaim_gtk_conversations_get_handle()); gaim_signals_unregister_by_instance(gaim_gtk_conversations_get_handle()); + gaim_gtk_conv_window_destroy(hidden_convwin); + hidden_convwin=NULL; } @@ -6399,8 +6525,6 @@ * GTK+ window ops **************************************************************************/ -static GList *window_list = NULL; - GList * gaim_gtk_conv_windows_get_list() { @@ -6681,8 +6805,8 @@ update_send_to_selection(win); } -void -gaim_gtk_conv_window_remove_gtkconv(GaimGtkWindow *win, GaimGtkConversation *gtkconv) +static void +private_remove_gtkconv(GaimGtkWindow *win, GaimGtkConversation *gtkconv, gboolean destroy_empty) { unsigned int index; GaimConversationType conv_type; @@ -6703,9 +6827,14 @@ win->gtkconvs = g_list_remove(win->gtkconvs, gtkconv); - if (!win->gtkconvs) + if (destroy_empty && !win->gtkconvs) gaim_gtk_conv_window_destroy(win); } +void +gaim_gtk_conv_window_remove_gtkconv(GaimGtkWindow *win, GaimGtkConversation *gtkconv) +{ + private_remove_gtkconv(win, gtkconv, TRUE); +} GaimGtkConversation * gaim_gtk_conv_window_get_gtkconv_at_index(const GaimGtkWindow *win, int index) diff -r e9790eb93216 -r e75ef7aa913e src/gtkconv.h --- a/src/gtkconv.h Wed Nov 16 17:55:26 2005 +0000 +++ b/src/gtkconv.h Wed Nov 16 18:17:01 2005 +0000 @@ -212,6 +212,25 @@ gaim_gtk_conversations_get_first_unseen(GaimConversationType type, GaimUnseenState min_state); +/** + * Presents a gaim conversation to the user. + * + * @param conv The conversation. + */ +void gaim_gtkconv_present_conversation(GaimConversation *conv); + +/** + * Finds the first conversations of the given type which has an + * unseen state greater than or equal to the given minimum + * state. + * + * @param type The type of conversation. + * @param min_state The minimum unseen state. + * @return First conversation matching critera, or NULL. + */ +GaimConversation * gaim_gtk_conversations_get_first_unseen( + GaimConversationType type, GaimUnseenState min_state); + GaimGtkWindow *gaim_gtkconv_get_window(GaimGtkConversation *gtkconv); GdkPixbuf *gaim_gtkconv_get_tab_icon(GaimConversation *conv, gboolean small_icon); void gaim_gtkconv_new(GaimConversation *conv); diff -r e9790eb93216 -r e75ef7aa913e src/gtkdialogs.c --- a/src/gtkdialogs.c Wed Nov 16 17:55:26 2005 +0000 +++ b/src/gtkdialogs.c Wed Nov 16 18:17:01 2005 +0000 @@ -520,7 +520,6 @@ gaim_gtkdialogs_im_with_user(GaimAccount *account, const char *username) { GaimConversation *conv; - GaimGtkWindow *win; g_return_if_fail(account != NULL); g_return_if_fail(username != NULL); @@ -530,11 +529,7 @@ if (conv == NULL) conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, username); - win = GAIM_GTK_CONVERSATION(conv)->win; - - gtk_window_present(GTK_WINDOW(win->window)); - gaim_gtkconv_switch_active_conversation(conv); - gaim_gtk_conv_window_switch_gtkconv(win, GAIM_GTK_CONVERSATION(conv)); + gaim_gtkconv_present_conversation(conv); } static gboolean diff -r e9790eb93216 -r e75ef7aa913e src/gtkdialogs.h --- a/src/gtkdialogs.h Wed Nov 16 17:55:26 2005 +0000 +++ b/src/gtkdialogs.h Wed Nov 16 18:17:01 2005 +0000 @@ -54,19 +54,6 @@ gtk_window_set_type_hint(GTK_WINDOW(x), GDK_WINDOW_TYPE_HINT_DIALOG) #define GAIM_WINDOW_ICONIFIED(x) (gdk_window_get_state(GTK_WIDGET(x)->window) & GDK_WINDOW_STATE_ICONIFIED) - -/* this is used for queuing messages received while away. This is really a UI function - * which is why the struct is here. */ - -struct queued_message { - char name[80]; - char alias[80]; - char *message; - time_t tm; - GaimAccount *account; - GaimMessageFlags flags; -}; - /* Functions in session.c */ extern void session_init(gchar *, gchar *, gchar *); extern void session_end(); diff -r e9790eb93216 -r e75ef7aa913e src/gtkprefs.c --- a/src/gtkprefs.c Wed Nov 16 17:55:26 2005 +0000 +++ b/src/gtkprefs.c Wed Nov 16 18:17:01 2005 +0000 @@ -804,6 +804,13 @@ vbox = gaim_gtk_make_frame(ret, _("Conversations")); + gaim_gtk_prefs_dropdown(vbox, _("_Hide new IM conversations"), + GAIM_PREF_STRING, "/gaim/gtk/conversations/im/hide_new", + _("Never"), "never", + _("When away"), "away", + _("Always"), "always", + NULL); + gaim_gtk_prefs_checkbox(_("Send unknown \"_slash\" commands as messages"), "/gaim/gtk/conversations/passthrough_unknown_commands", vbox); gaim_gtk_prefs_checkbox(_("Show _formatting on incoming messages"), @@ -1660,8 +1667,6 @@ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); vbox = gaim_gtk_make_frame (ret, _("Away")); - gaim_gtk_prefs_checkbox(_("_Queue new messages when away"), - "/gaim/gtk/away/queue_messages", vbox); label = gaim_gtk_prefs_dropdown(vbox, _("_Auto-reply:"), GAIM_PREF_STRING, "/core/away/auto_reply", @@ -1857,10 +1862,6 @@ gaim_prefs_add_none("/gaim/gtk"); gaim_prefs_add_none("/plugins/gtk"); - /* Away Queueing */ - gaim_prefs_add_none("/gaim/gtk/away"); - gaim_prefs_add_bool("/gaim/gtk/away/queue_messages", FALSE); - #ifndef _WIN32 /* Browsers */ gaim_prefs_add_none("/gaim/gtk/browsers"); @@ -1943,4 +1944,6 @@ gaim_prefs_remove("/gaim/gtk/logging/individual_logs"); gaim_prefs_remove("/gaim/gtk/sound/signon"); gaim_prefs_remove("/gaim/gtk/sound/silent_signon"); + gaim_prefs_remove("/gaim/gtk/away/queue_messages"); + gaim_prefs_remove("/plugins/gtk/docklet/queue_messages"); } diff -r e9790eb93216 -r e75ef7aa913e src/gtkstock.c --- a/src/gtkstock.c Wed Nov 16 17:55:26 2005 +0000 +++ b/src/gtkstock.c Wed Nov 16 18:17:01 2005 +0000 @@ -86,6 +86,7 @@ #else { GAIM_STOCK_PAUSE, "buttons", "pause.png" }, #endif + { GAIM_STOCK_PENDING, "gaim", "envelope.png" }, { GAIM_STOCK_OPEN_MAIL, NULL, GTK_STOCK_JUMP_TO }, { GAIM_STOCK_SEND, "buttons", "send-im.png" }, { GAIM_STOCK_SIGN_ON, NULL, GTK_STOCK_EXECUTE }, diff -r e9790eb93216 -r e75ef7aa913e src/gtkstock.h --- a/src/gtkstock.h Wed Nov 16 17:55:26 2005 +0000 +++ b/src/gtkstock.h Wed Nov 16 18:17:01 2005 +0000 @@ -65,6 +65,7 @@ #define GAIM_STOCK_MODIFY "gaim-modify" #define GAIM_STOCK_OPEN_MAIL "gaim-stock-open-mail" #define GAIM_STOCK_PAUSE "gaim-pause" +#define GAIM_STOCK_PENDING "gaim-pending" #define GAIM_STOCK_SEND "gaim-send" #define GAIM_STOCK_SIGN_OFF "gaim-sign-off" #define GAIM_STOCK_SIGN_ON "gaim-sign-on" diff -r e9790eb93216 -r e75ef7aa913e src/server.c --- a/src/server.c Wed Nov 16 17:55:26 2005 +0000 +++ b/src/server.c Wed Nov 16 18:17:01 2005 +0000 @@ -428,47 +428,6 @@ } -#if 0 -int find_queue_row_by_name(char *name) -{ - gchar *temp; - gint i = 0; - gboolean valid; - GtkTreeIter iter; - - valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(awayqueuestore), &iter); - while(valid) { - gtk_tree_model_get(GTK_TREE_MODEL(awayqueuestore), &iter, 0, &temp, -1); - if(!strcmp(name, temp)) - return i; - g_free(temp); - - i++; - valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(awayqueuestore), &iter); - } - - return -1; -} - -int find_queue_total_by_name(char *name) -{ - GSList *templist; - int i = 0; - - templist = message_queue; - - while (templist) { - struct queued_message *qm = (struct queued_message *)templist->data; - if ((qm->flags & GAIM_MESSAGE_RECV) && !strcmp(name, qm->name)) - i++; - - templist = templist->next; - } - - return i; -} -#endif - /* * woo. i'm actually going to comment this function. isn't that fun. make * sure to follow along, kids @@ -553,84 +512,13 @@ struct last_auto_response *lar; const gchar *auto_reply_pref; const char *away_msg; -#if 0 - int row; -#endif + + if (cnv == NULL) + cnv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, name); + + gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, message, msgflags, mtime); /* - * Either we're going to queue it or not. Because of the way - * awayness currently works, this is fucked up. It's possible - * for an account to be away without the imaway dialog being - * shown. In fact, it's possible for *all* the accounts to be - * away without the imaway dialog being shown. So in order for - * this to be queued properly, we have to make sure that the - * imaway dialog actually exists, first. - */ -#if 0 - if (!cnv && awayqueue && - gaim_prefs_get_bool("/gaim/gtk/away/queue_messages")) { - /* - * Alright, so we're going to queue it. Neat, eh? :) - * So first we create something to store the message, and add - * it to our queue. Then we update the away dialog to indicate - * that we've queued something. - */ - struct queued_message *qm; - GtkTreeIter iter; - gchar path[10]; - - qm = g_new0(struct queued_message, 1); - g_snprintf(qm->name, sizeof(qm->name), "%s", name); - if(strcmp(alias, name) != 0) - g_snprintf(qm->alias, sizeof(qm->alias), "(%s)", alias); - qm->message = g_strdup(message); - qm->account = gc->account; - qm->tm = mtime; - qm->flags = msgflags; - message_queue = g_slist_append(message_queue, qm); - - row = find_queue_row_by_name(qm->name); - if (row >= 0) { - char number[32]; - int qtotal; - - qtotal = find_queue_total_by_name(qm->name); - g_snprintf(number, 32, ngettext("(%d message)", - "(%d messages)", qtotal), qtotal); - g_snprintf(path, 10, "%d", row); - gtk_tree_model_get_iter_from_string( - GTK_TREE_MODEL(awayqueuestore), &iter, path); - gtk_list_store_set(awayqueuestore, &iter, - 2, number, -1); - } else { - gtk_tree_model_get_iter_first(GTK_TREE_MODEL(awayqueuestore), - &iter); - gtk_list_store_append(awayqueuestore, &iter); - gtk_list_store_set(awayqueuestore, &iter, - 0, qm->name, - 1, qm->alias, - 2, _("(1 message)"), - -1); - } - } - else -#endif - { - /* - * Make sure the conversation - * exists and is updated (partly handled above already), play - * the receive sound (sound.c will take care of not playing - * while away), and then write it to the convo window. - */ - if (cnv == NULL) - cnv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, name); - - gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, message, msgflags, mtime); - } - - /* - * Regardless of whether we queue it or not, we should send an - * auto-response. That is, of course, unless the horse.... no wait. * Don't autorespond if: * * - it's not supported on this connection