Mercurial > pidgin
diff finch/gntconv.c @ 22248:88796aff14d6
Add a finch log viewer. This is largely copied from Pidgin.
The search box must be focused in order to scroll the log or fire up the pager,
and is labelled such. Feel free to come up with a better widget to attach these
to.
author | Richard Nelson <wabz@pidgin.im> |
---|---|
date | Sat, 02 Feb 2008 03:51:19 +0000 |
parents | 797230b3e48e |
children | 40707fbabcbc |
line wrap: on
line diff
--- a/finch/gntconv.c Fri Feb 01 19:35:38 2008 +0000 +++ b/finch/gntconv.c Sat Feb 02 03:51:19 2008 +0000 @@ -36,6 +36,7 @@ #include "gntblist.h" #include "gntconv.h" #include "gntdebug.h" +#include "gntlog.h" #include "gntplugin.h" #include "gntprefs.h" #include "gntsound.h" @@ -468,6 +469,44 @@ } static void +view_log_cb(GntMenuItem *n, gpointer ggc) +{ + FinchConv *fc; + PurpleConversation *conv; + PurpleLogType type; + const char *name; + PurpleAccount *account; + GSList *buddies; + GSList *cur; + + fc = ggc; + conv = fc->active_conv; + + if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) + type = PURPLE_LOG_IM; + else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) + type = PURPLE_LOG_CHAT; + else + return; + + name = purple_conversation_get_name(conv); + account = purple_conversation_get_account(conv); + + buddies = purple_find_buddies(account, name); + for (cur = buddies; cur != NULL; cur = cur->next) { + PurpleBlistNode *node = cur->data; + if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL))) { + finch_log_show_contact((PurpleContact *)node->parent); + g_slist_free(buddies); + return; + } + } + g_slist_free(buddies); + + finch_log_show(type, name, account); +} + +static void generate_send_to_menu(FinchConv *ggc) { GntWidget *sub, *menu = ggc->menu; @@ -569,6 +608,10 @@ generate_send_to_menu(ggc); } + item = gnt_menuitem_new(_("View Log...")); + gnt_menu_add_item(GNT_MENU(sub), item); + gnt_menuitem_set_callback(item, view_log_cb, ggc); + item = gnt_menuitem_check_new(_("Enable Logging")); gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), purple_conversation_is_logging(ggc->active_conv));