comparison src/gtkconv.c @ 11672:04e0189bb519

[gaim-migrate @ 13958] (contact-aware conversation)-aware logging: When the active buddy changes, a new log is opened. This way, the logs (on-disk, assuming a file-based logger) always correspond to the buddy that send/received the messages. Given that we already have contactized logging, the logs will all be shown in the same log viewer. Also, if you use Options -> Enable Logging to change the default logging mode for a perticular conversation or part of a conversation, that setting will be preserved even if the active buddy changes. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sun, 16 Oct 2005 18:15:47 +0000
parents 4ebd27e664c4
children c1906dc6257c
comparison
equal deleted inserted replaced
11671:4ebd27e664c4 11672:04e0189bb519
1889 1889
1890 return TRUE; 1890 return TRUE;
1891 } 1891 }
1892 1892
1893 static void 1893 static void
1894 gaim_gtkconv_set_active_conversation(GaimConversation *conv)
1895 {
1896 GaimGtkConversation *gtkconv;
1897
1898 g_return_if_fail(conv != NULL);
1899
1900 gtkconv = GAIM_GTK_CONVERSATION(conv);
1901
1902 if (gtkconv->active_conv == conv)
1903 return;
1904
1905 gaim_conversation_close_logs(gtkconv->active_conv);
1906
1907 gtkconv->active_conv = conv;
1908
1909 gaim_conversation_set_logging(conv,
1910 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging)));
1911 }
1912
1913 static void
1894 gaim_gtkconv_switch_active_conversation(GaimConversation *conv) 1914 gaim_gtkconv_switch_active_conversation(GaimConversation *conv)
1895 { 1915 {
1896 GaimGtkConversation *gtkconv; 1916 GaimGtkConversation *gtkconv;
1897 1917
1898 g_return_if_fail(conv != NULL); 1918 g_return_if_fail(conv != NULL);
1899 1919
1900 gtkconv = GAIM_GTK_CONVERSATION(conv); 1920 gtkconv = GAIM_GTK_CONVERSATION(conv);
1901 1921
1902 gtkconv->active_conv = conv; 1922 gaim_gtkconv_set_active_conversation(conv);
1903 1923
1904 gray_stuff_out(gtkconv); 1924 gray_stuff_out(gtkconv);
1905 update_typing_icon(gtkconv); 1925 update_typing_icon(gtkconv);
1906
1907 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging),
1908 gaim_conversation_is_logging(conv));
1909 1926
1910 gtk_window_set_title(GTK_WINDOW(gtkconv->win->window), 1927 gtk_window_set_title(GTK_WINDOW(gtkconv->win->window),
1911 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); 1928 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)));
1912 1929
1913 gaim_conversation_update(conv, GAIM_CONV_UPDATE_ACCOUNT); 1930 gaim_conversation_update(conv, GAIM_CONV_UPDATE_ACCOUNT);
3897 time_t mtime) 3914 time_t mtime)
3898 { 3915 {
3899 GaimGtkConversation *gtkconv; 3916 GaimGtkConversation *gtkconv;
3900 3917
3901 gtkconv = GAIM_GTK_CONVERSATION(conv); 3918 gtkconv = GAIM_GTK_CONVERSATION(conv);
3902 gtkconv->active_conv = conv; 3919 gaim_gtkconv_set_active_conversation(conv);
3903 3920
3904 gtkconv->u.im->a_virgin = FALSE; 3921 gtkconv->u.im->a_virgin = FALSE;
3905 3922
3906 gaim_conversation_write(conv, who, message, flags, mtime); 3923 gaim_conversation_write(conv, who, message, flags, mtime);
3907 } 3924 }
3911 const char *message, GaimMessageFlags flags, time_t mtime) 3928 const char *message, GaimMessageFlags flags, time_t mtime)
3912 { 3929 {
3913 GaimGtkConversation *gtkconv; 3930 GaimGtkConversation *gtkconv;
3914 3931
3915 gtkconv = GAIM_GTK_CONVERSATION(conv); 3932 gtkconv = GAIM_GTK_CONVERSATION(conv);
3916 gtkconv->active_conv = conv; 3933 gaim_gtkconv_set_active_conversation(conv);
3917 3934
3918 flags |= GAIM_MESSAGE_COLORIZE; 3935 flags |= GAIM_MESSAGE_COLORIZE;
3919 3936
3920 gaim_conversation_write(conv, who, message, flags, mtime); 3937 gaim_conversation_write(conv, who, message, flags, mtime);
3921 } 3938 }
4023 4040
4024 gtkconv = GAIM_GTK_CONVERSATION(conv); 4041 gtkconv = GAIM_GTK_CONVERSATION(conv);
4025 4042
4026 /* Set the active conversation to the one that just messaged us. */ 4043 /* Set the active conversation to the one that just messaged us. */
4027 /* TODO: consider not doing this if the account is offline or something */ 4044 /* TODO: consider not doing this if the account is offline or something */
4028 gtkconv->active_conv = conv; 4045 gaim_gtkconv_set_active_conversation(conv);
4029 4046
4030 gc = gaim_conversation_get_gc(conv); 4047 gc = gaim_conversation_get_gc(conv);
4031 account = gaim_conversation_get_account(conv); 4048 account = gaim_conversation_get_account(conv);
4032 win = gtkconv->win; 4049 win = gtkconv->win;
4033 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 4050 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
6093 if (gaim_gtk_conv_window_has_focus(win)) 6110 if (gaim_gtk_conv_window_has_focus(win))
6094 gtkconv_set_unseen(gtkconv, GAIM_UNSEEN_NONE); 6111 gtkconv_set_unseen(gtkconv, GAIM_UNSEEN_NONE);
6095 6112
6096 /* Update the menubar */ 6113 /* Update the menubar */
6097 6114
6115 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging),
6116 gaim_conversation_is_logging(conv));
6117
6098 generate_send_to_items(win); 6118 generate_send_to_items(win);
6099 6119
6100 gaim_gtkconv_switch_active_conversation(conv); 6120 gaim_gtkconv_switch_active_conversation(conv);
6101 6121
6102 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), 6122 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),