| 68 static int color_message_send; |
67 static int color_message_send; |
| 69 static int color_message_highlight; |
68 static int color_message_highlight; |
| 70 static int color_message_action; |
69 static int color_message_action; |
| 71 static int color_timestamp; |
70 static int color_timestamp; |
| 72 |
71 |
| 73 static PurpleBuddy * |
|
| 74 find_buddy_for_conversation(PurpleConversation *conv) |
|
| 75 { |
|
| 76 return purple_blist_find_buddy(purple_conversation_get_account(conv), |
|
| 77 purple_conversation_get_name(conv)); |
|
| 78 } |
|
| 79 |
|
| 80 static PurpleChat * |
72 static PurpleChat * |
| 81 find_chat_for_conversation(PurpleConversation *conv) |
73 find_chat_for_conversation(PurpleConversation *conv) |
| 82 { |
74 { |
| 83 return purple_blist_find_chat(purple_conversation_get_account(conv), |
75 return purple_blist_find_chat(purple_conversation_get_account(conv), |
| 84 purple_conversation_get_name(conv)); |
76 purple_conversation_get_name(conv)); |
| 85 } |
|
| 86 |
|
| 87 static PurpleBlistNode * |
|
| 88 get_conversation_blist_node(PurpleConversation *conv) |
|
| 89 { |
|
| 90 PurpleBlistNode *node = NULL; |
|
| 91 |
|
| 92 if (PURPLE_IS_IM_CONVERSATION(conv)) { |
|
| 93 node = (PurpleBlistNode*)find_buddy_for_conversation(conv); |
|
| 94 node = node ? purple_blist_node_get_parent(node) : NULL; |
|
| 95 } else if (PURPLE_IS_CHAT_CONVERSATION(conv)) { |
|
| 96 node = (PurpleBlistNode*)find_chat_for_conversation(conv); |
|
| 97 } |
|
| 98 |
|
| 99 return node; |
|
| 100 } |
77 } |
| 101 |
78 |
| 102 static void |
79 static void |
| 103 send_typing_notification(GntWidget *w, FinchConv *ggconv) |
80 send_typing_notification(GntWidget *w, FinchConv *ggconv) |
| 104 { |
81 { |
| 500 purple_conversation_set_logging(iter->data, logging); |
477 purple_conversation_set_logging(iter->data, logging); |
| 501 } |
478 } |
| 502 } |
479 } |
| 503 |
480 |
| 504 static void |
481 static void |
| 505 toggle_sound_cb(GntMenuItem *item, gpointer ggconv) |
|
| 506 { |
|
| 507 FinchConv *fc = ggconv; |
|
| 508 PurpleBlistNode *node = get_conversation_blist_node(fc->active_conv); |
|
| 509 fc->flags ^= FINCH_CONV_NO_SOUND; |
|
| 510 if (node) |
|
| 511 purple_blist_node_set_bool(node, "gnt-mute-sound", !!(fc->flags & FINCH_CONV_NO_SOUND)); |
|
| 512 } |
|
| 513 |
|
| 514 static void |
|
| 515 send_to_cb(GntMenuItem *m, gpointer n) |
482 send_to_cb(GntMenuItem *m, gpointer n) |
| 516 { |
483 { |
| 517 PurpleAccount *account = g_object_get_data(G_OBJECT(m), "purple_account"); |
484 PurpleAccount *account = g_object_get_data(G_OBJECT(m), "purple_account"); |
| 518 gchar *buddy = g_object_get_data(G_OBJECT(m), "purple_buddy_name"); |
485 gchar *buddy = g_object_get_data(G_OBJECT(m), "purple_buddy_name"); |
| 519 PurpleIMConversation *im = purple_im_conversation_new(account, buddy); |
486 PurpleIMConversation *im = purple_im_conversation_new(account, buddy); |
| 690 item = gnt_menuitem_check_new(_("Enable Logging")); |
657 item = gnt_menuitem_check_new(_("Enable Logging")); |
| 691 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), |
658 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), |
| 692 purple_conversation_is_logging(ggc->active_conv)); |
659 purple_conversation_is_logging(ggc->active_conv)); |
| 693 gnt_menu_add_item(GNT_MENU(sub), item); |
660 gnt_menu_add_item(GNT_MENU(sub), item); |
| 694 gnt_menuitem_set_callback(item, toggle_logging_cb, ggc); |
661 gnt_menuitem_set_callback(item, toggle_logging_cb, ggc); |
| 695 |
|
| 696 item = gnt_menuitem_check_new(_("Enable Sounds")); |
|
| 697 gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item), |
|
| 698 !(ggc->flags & FINCH_CONV_NO_SOUND)); |
|
| 699 gnt_menu_add_item(GNT_MENU(sub), item); |
|
| 700 gnt_menuitem_set_callback(item, toggle_sound_cb, ggc); |
|
| 701 |
662 |
| 702 item = gnt_menuitem_new(_("Plugins")); |
663 item = gnt_menuitem_new(_("Plugins")); |
| 703 gnt_menu_add_item(GNT_MENU(menu), item); |
664 gnt_menu_add_item(GNT_MENU(menu), item); |
| 704 ggc->plugins = item; |
665 ggc->plugins = item; |
| 705 |
666 |
| 886 g_signal_connect(G_OBJECT(ggc->tv), "size_changed", G_CALLBACK(size_changed_cb), NULL); |
847 g_signal_connect(G_OBJECT(ggc->tv), "size_changed", G_CALLBACK(size_changed_cb), NULL); |
| 887 g_signal_connect(G_OBJECT(ggc->window), "position_set", G_CALLBACK(save_position_cb), NULL); |
848 g_signal_connect(G_OBJECT(ggc->window), "position_set", G_CALLBACK(save_position_cb), NULL); |
| 888 |
849 |
| 889 if (PURPLE_IS_IM_CONVERSATION(conv)) |
850 if (PURPLE_IS_IM_CONVERSATION(conv)) |
| 890 g_signal_connect(G_OBJECT(ggc->entry), "text_changed", G_CALLBACK(send_typing_notification), ggc); |
851 g_signal_connect(G_OBJECT(ggc->entry), "text_changed", G_CALLBACK(send_typing_notification), ggc); |
| 891 |
|
| 892 convnode = get_conversation_blist_node(conv); |
|
| 893 if ((convnode && purple_blist_node_get_bool(convnode, "gnt-mute-sound")) || |
|
| 894 !finch_sound_is_enabled()) |
|
| 895 ggc->flags |= FINCH_CONV_NO_SOUND; |
|
| 896 |
852 |
| 897 gg_create_menu(ggc); |
853 gg_create_menu(ggc); |
| 898 gg_setup_commands(ggc, FALSE); |
854 gg_setup_commands(ggc, FALSE); |
| 899 |
855 |
| 900 purple_signal_connect(purple_cmds_get_handle(), "cmd-added", ggc, |
856 purple_signal_connect(purple_cmds_get_handle(), "cmd-added", ggc, |