| 400 } |
401 } |
| 401 |
402 |
| 402 buf2 = g_malloc(limit); |
403 buf2 = g_malloc(limit); |
| 403 |
404 |
| 404 if (gc && gc->flags & OPT_CONN_HTML) { |
405 if (gc && gc->flags & OPT_CONN_HTML) { |
| 405 if (font_options & OPT_FONT_BOLD) { |
406 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) { |
| 406 g_snprintf(buf2, limit, "<B>%s</B>", buf); |
407 g_snprintf(buf2, limit, "<B>%s</B>", buf); |
| 407 strcpy(buf, buf2); |
408 strcpy(buf, buf2); |
| 408 } |
409 } |
| 409 |
410 |
| 410 if (font_options & OPT_FONT_ITALIC) { |
411 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) { |
| 411 g_snprintf(buf2, limit, "<I>%s</I>", buf); |
412 g_snprintf(buf2, limit, "<I>%s</I>", buf); |
| 412 strcpy(buf, buf2); |
413 strcpy(buf, buf2); |
| 413 } |
414 } |
| 414 |
415 |
| 415 if (font_options & OPT_FONT_UNDERLINE) { |
416 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) { |
| 416 g_snprintf(buf2, limit, "<U>%s</U>", buf); |
417 g_snprintf(buf2, limit, "<U>%s</U>", buf); |
| 417 strcpy(buf, buf2); |
418 strcpy(buf, buf2); |
| 418 } |
419 } |
| 419 |
420 |
| 420 if (font_options & OPT_FONT_STRIKE) { |
421 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_strikethrough")) { |
| 421 g_snprintf(buf2, limit, "<STRIKE>%s</STRIKE>", buf); |
422 g_snprintf(buf2, limit, "<STRIKE>%s</STRIKE>", buf); |
| 422 strcpy(buf, buf2); |
423 strcpy(buf, buf2); |
| 423 } |
424 } |
| 424 |
425 |
| 425 if ((font_options & OPT_FONT_FACE) || gtkconv->has_font) { |
426 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font") || |
| |
427 gtkconv->has_font) { |
| |
428 |
| 426 g_snprintf(buf2, limit, |
429 g_snprintf(buf2, limit, |
| 427 "<FONT FACE=\"%s\">%s</FONT>", gtkconv->fontface, buf); |
430 "<FONT FACE=\"%s\">%s</FONT>", gtkconv->fontface, buf); |
| 428 strcpy(buf, buf2); |
431 strcpy(buf, buf2); |
| 429 } |
432 } |
| 430 |
433 |
| 431 if (font_options & OPT_FONT_SIZE) { |
434 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) { |
| 432 g_snprintf(buf2, limit, |
435 g_snprintf(buf2, limit, |
| 433 "<FONT SIZE=\"%d\">%s</FONT>", fontsize, buf); |
436 "<FONT SIZE=\"%d\">%s</FONT>", fontsize, buf); |
| 434 strcpy(buf, buf2); |
437 strcpy(buf, buf2); |
| 435 } |
438 } |
| 436 |
439 |
| 437 if (font_options & OPT_FONT_FGCOL) { |
440 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) { |
| 438 g_snprintf(buf2, limit, |
441 g_snprintf(buf2, limit, |
| 439 "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", |
442 "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", |
| 440 gtkconv->fg_color.red / 256, |
443 gtkconv->fg_color.red / 256, |
| 441 gtkconv->fg_color.green / 256, |
444 gtkconv->fg_color.green / 256, |
| 442 gtkconv->fg_color.blue / 256, buf); |
445 gtkconv->fg_color.blue / 256, buf); |
| 443 strcpy(buf, buf2); |
446 strcpy(buf, buf2); |
| 444 } |
447 } |
| 445 |
448 |
| 446 if (font_options & OPT_FONT_BGCOL) { |
449 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) { |
| 447 g_snprintf(buf2, limit, |
450 g_snprintf(buf2, limit, |
| 448 "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", |
451 "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", |
| 449 gtkconv->bg_color.red / 256, |
452 gtkconv->bg_color.red / 256, |
| 450 gtkconv->bg_color.green / 256, |
453 gtkconv->bg_color.green / 256, |
| 451 gtkconv->bg_color.blue / 256, buf); |
454 gtkconv->bg_color.blue / 256, buf); |
| 980 gtkconv = GAIM_GTK_CONVERSATION(conv); |
986 gtkconv = GAIM_GTK_CONVERSATION(conv); |
| 981 win = gaim_conversation_get_window(conv); |
987 win = gaim_conversation_get_window(conv); |
| 982 gtkwin = GAIM_GTK_WINDOW(win); |
988 gtkwin = GAIM_GTK_WINDOW(win); |
| 983 |
989 |
| 984 if (event->keyval == GDK_Escape) { |
990 if (event->keyval == GDK_Escape) { |
| 985 if (convo_options & OPT_CONVO_ESC_CAN_CLOSE) { |
991 if (gaim_prefs_get_bool("/gaim/gtk/conversations/escape_closes")) { |
| 986 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
992 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
| 987 gaim_conversation_destroy(conv); |
993 gaim_conversation_destroy(conv); |
| 988 } |
994 } |
| 989 } |
995 } |
| 990 else if (event->keyval == GDK_Page_Up) { |
996 else if (event->keyval == GDK_Page_Up) { |
| 997 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
1003 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
| 998 |
1004 |
| 999 if (!(event->state & GDK_CONTROL_MASK)) |
1005 if (!(event->state & GDK_CONTROL_MASK)) |
| 1000 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); |
1006 gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); |
| 1001 } |
1007 } |
| 1002 else if ((event->keyval == GDK_F2) && |
1008 else if (event->keyval == GDK_F2 && |
| 1003 (convo_options & OPT_CONVO_F2_TOGGLES)) { |
1009 gaim_prefs_get_bool("/gaim/gtk/conversations/f2_toggles_timestamps")) { |
| 1004 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), |
1010 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), |
| 1005 !GTK_IMHTML(gtkconv->imhtml)->comments); |
1011 !GTK_IMHTML(gtkconv->imhtml)->comments); |
| 1006 } |
1012 } |
| 1007 else if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) { |
1013 else if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) { |
| 1008 if ((event->state & GDK_CONTROL_MASK) && |
1014 if ((event->state & GDK_CONTROL_MASK) && |
| 1009 (convo_options & OPT_CONVO_CTL_ENTER)) { |
1015 gaim_prefs_get_bool("/gaim/gtk/conversations/ctrl_enter_sends")) { |
| 1010 |
1016 |
| 1011 send_cb(NULL, conv); |
1017 send_cb(NULL, conv); |
| 1012 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
1018 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
| 1013 |
1019 |
| 1014 return TRUE; |
1020 return TRUE; |
| 1015 } |
1021 } |
| 1016 else if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && |
1022 else if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && |
| 1017 (convo_options & OPT_CONVO_ENTER_SENDS)) { |
1023 gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) { |
| 1018 |
1024 |
| 1019 send_cb(NULL, conv); |
1025 send_cb(NULL, conv); |
| 1020 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
1026 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
| 1021 |
1027 |
| 1022 return TRUE; |
1028 return TRUE; |
| 1177 if (event->keyval == 'l') { |
1183 if (event->keyval == 'l') { |
| 1178 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); |
1184 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); |
| 1179 g_string_free(conv->history, TRUE); |
1185 g_string_free(conv->history, TRUE); |
| 1180 conv->history = g_string_new(""); |
1186 conv->history = g_string_new(""); |
| 1181 } |
1187 } |
| 1182 else if ((event->keyval == 'w') && |
1188 else if (event->keyval == 'w' && |
| 1183 (convo_options & OPT_CONVO_CTL_W_CLOSES)) { |
1189 gaim_prefs_get_bool("/gaim/gtk/conversations/ctrl_w_closes")) { |
| 1184 |
1190 |
| 1185 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
1191 g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); |
| 1186 gaim_conversation_destroy(conv); |
1192 gaim_conversation_destroy(conv); |
| 1187 return TRUE; |
1193 return TRUE; |
| 1188 } |
1194 } |
| 2389 } |
2395 } |
| 2390 |
2396 |
| 2391 /* if we're here, it's a possible completion */ |
2397 /* if we're here, it's a possible completion */ |
| 2392 |
2398 |
| 2393 /* if we're doing old-style, just fill in the completion */ |
2399 /* if we're doing old-style, just fill in the completion */ |
| 2394 if (chat_options & OPT_CHAT_OLD_STYLE_TAB) { |
2400 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { |
| 2395 gtk_text_buffer_delete(gtkconv->entry_buffer, |
2401 gtk_text_buffer_delete(gtkconv->entry_buffer, |
| 2396 &word_start, &cursor); |
2402 &word_start, &cursor); |
| 2397 |
2403 |
| 2398 if (strlen(nick) == strlen(entered)) { |
2404 if (strlen(nick) == strlen(entered)) { |
| 2399 nicks = (nicks->next |
2405 nicks = (nicks->next |
| 3004 /* Setup gtkihmtml. */ |
3010 /* Setup gtkihmtml. */ |
| 3005 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); |
3011 gtkconv->imhtml = gtk_imhtml_new(NULL, NULL); |
| 3006 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
3012 gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); |
| 3007 |
3013 |
| 3008 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), |
3014 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), |
| 3009 (convo_options & OPT_CONVO_SHOW_TIME)); |
3015 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); |
| 3010 |
3016 |
| 3011 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", |
3017 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", |
| 3012 G_CALLBACK(entry_stop_rclick_cb), NULL); |
3018 G_CALLBACK(entry_stop_rclick_cb), NULL); |
| 3013 |
3019 |
| 3014 gaim_setup_imhtml(gtkconv->imhtml); |
3020 gaim_setup_imhtml(gtkconv->imhtml); |
| 3140 G_CALLBACK(entry_stop_rclick_cb), NULL); |
3146 G_CALLBACK(entry_stop_rclick_cb), NULL); |
| 3141 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
3147 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
| 3142 G_CALLBACK(entry_key_pressed_cb_2), conv); |
3148 G_CALLBACK(entry_key_pressed_cb_2), conv); |
| 3143 |
3149 |
| 3144 #ifdef USE_GTKSPELL |
3150 #ifdef USE_GTKSPELL |
| 3145 if (convo_options & OPT_CONVO_CHECK_SPELLING) |
3151 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
| 3146 gtkspell_new_attach(GTK_TEXT_VIEW(gtkconv->entry), NULL, NULL); |
3152 gtkspell_new_attach(GTK_TEXT_VIEW(gtkconv->entry), NULL, NULL); |
| 3147 #endif |
3153 #endif |
| 3148 |
3154 |
| 3149 gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(gtkconv->entry)); |
3155 gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(gtkconv->entry)); |
| 3150 gtk_widget_show(gtkconv->entry); |
3156 gtk_widget_show(gtkconv->entry); |
| 3241 G_CALLBACK(insert_text_cb), conv); |
3247 G_CALLBACK(insert_text_cb), conv); |
| 3242 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", |
3248 g_signal_connect(G_OBJECT(gtkconv->entry_buffer), "delete_range", |
| 3243 G_CALLBACK(delete_text_cb), conv); |
3249 G_CALLBACK(delete_text_cb), conv); |
| 3244 |
3250 |
| 3245 #ifdef USE_GTKSPELL |
3251 #ifdef USE_GTKSPELL |
| 3246 if (convo_options & OPT_CONVO_CHECK_SPELLING) |
3252 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
| 3247 gtkspell_new_attach(GTK_TEXT_VIEW(gtkconv->entry), NULL, NULL); |
3253 gtkspell_new_attach(GTK_TEXT_VIEW(gtkconv->entry), NULL, NULL); |
| 3248 #endif |
3254 #endif |
| 3249 |
3255 |
| 3250 gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(gtkconv->entry)); |
3256 gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(gtkconv->entry)); |
| 3251 gtk_widget_show(gtkconv->entry); |
3257 gtk_widget_show(gtkconv->entry); |
| 3369 G_CALLBACK(close_win_cb), win); |
3375 G_CALLBACK(close_win_cb), win); |
| 3370 |
3376 |
| 3371 /* Create the notebook. */ |
3377 /* Create the notebook. */ |
| 3372 gtkwin->notebook = gtk_notebook_new(); |
3378 gtkwin->notebook = gtk_notebook_new(); |
| 3373 |
3379 |
| 3374 pos = ((im_options & OPT_IM_SIDE_TAB) |
3380 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); |
| 3375 ? ((im_options & OPT_IM_BR_TAB) ? GTK_POS_RIGHT : GTK_POS_LEFT) |
|
| 3376 : ((im_options & OPT_IM_BR_TAB) ? GTK_POS_BOTTOM : GTK_POS_TOP)); |
|
| 3377 |
3381 |
| 3378 #if 0 |
3382 #if 0 |
| 3379 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); |
3383 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); |
| 3380 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); |
3384 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(gtkwin->notebook), 0); |
| 3381 #endif |
3385 #endif |
| 3634 |
3638 |
| 3635 /* Pack it all together. */ |
3639 /* Pack it all together. */ |
| 3636 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->tab_label, TRUE, TRUE, 0); |
3640 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->tab_label, TRUE, TRUE, 0); |
| 3637 gtk_widget_show(gtkconv->tab_label); |
3641 gtk_widget_show(gtkconv->tab_label); |
| 3638 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->close, FALSE, FALSE, 0); |
3642 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->close, FALSE, FALSE, 0); |
| 3639 if (!(convo_options & OPT_CONVO_NO_X_ON_TAB)) |
3643 |
| |
3644 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) |
| 3640 gtk_widget_show_all(gtkconv->close); |
3645 gtk_widget_show_all(gtkconv->close); |
| |
3646 |
| 3641 gtk_widget_show(tabby); |
3647 gtk_widget_show(tabby); |
| 3642 |
3648 |
| 3643 |
3649 |
| 3644 /* Add this pane to the conversations notebook. */ |
3650 /* Add this pane to the conversations notebook. */ |
| 3645 gtk_notebook_append_page(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, tabby); |
3651 gtk_notebook_append_page(GTK_NOTEBOOK(gtkwin->notebook), tab_cont, tabby); |
| 3650 |
3656 |
| 3651 if (gaim_window_get_conversation_count(win) == 1) { |
3657 if (gaim_window_get_conversation_count(win) == 1) { |
| 3652 /* Er, bug in notebooks? Switch to the page manually. */ |
3658 /* Er, bug in notebooks? Switch to the page manually. */ |
| 3653 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
3659 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); |
| 3654 |
3660 |
| 3655 if(conv_type == GAIM_CONV_IM) { |
3661 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
| 3656 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
3662 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
| 3657 (im_options & OPT_IM_ONE_WINDOW)); |
3663 } |
| 3658 } else if(conv_type == GAIM_CONV_CHAT) { |
3664 else |
| 3659 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
|
| 3660 (chat_options & OPT_CHAT_ONE_WINDOW)); |
|
| 3661 } |
|
| 3662 } else { |
|
| 3663 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
3665 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); |
| 3664 } |
|
| 3665 |
3666 |
| 3666 focus_conv = g_list_nth_data(gaim_window_get_conversations(win), |
3667 focus_conv = g_list_nth_data(gaim_window_get_conversations(win), |
| 3667 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
3668 gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); |
| 3668 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); |
3669 focus_gtkconv = GAIM_GTK_CONVERSATION(focus_conv); |
| 3669 gtk_widget_grab_focus(focus_gtkconv->entry); |
3670 gtk_widget_grab_focus(focus_gtkconv->entry); |
| 3699 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); |
3700 gtk_notebook_remove_page(GTK_NOTEBOOK(gtkwin->notebook), index); |
| 3700 |
3701 |
| 3701 /* go back to tabless if need be */ |
3702 /* go back to tabless if need be */ |
| 3702 if (gaim_window_get_conversation_count(win) <= 2) { |
3703 if (gaim_window_get_conversation_count(win) <= 2) { |
| 3703 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
3704 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), |
| 3704 ((conv_type == GAIM_CONV_IM && |
3705 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); |
| 3705 (im_options & OPT_IM_ONE_WINDOW)) || |
|
| 3706 (conv_type == GAIM_CONV_CHAT && |
|
| 3707 (im_options & OPT_CHAT_ONE_WINDOW)))); |
|
| 3708 } |
3706 } |
| 3709 |
3707 |
| 3710 |
3708 |
| 3711 /* If this window is setup with an inactive gc, regenerate the menu. */ |
3709 /* If this window is setup with an inactive gc, regenerate the menu. */ |
| 3712 if (conv_type == GAIM_CONV_IM && |
3710 if (conv_type == GAIM_CONV_IM && |
| 3868 { |
3866 { |
| 3869 struct gaim_gtk_conversation *gtkconv; |
3867 struct gaim_gtk_conversation *gtkconv; |
| 3870 |
3868 |
| 3871 gtkconv = GAIM_GTK_CONVERSATION(conv); |
3869 gtkconv = GAIM_GTK_CONVERSATION(conv); |
| 3872 |
3870 |
| |
3871 if (!(flags & WFLAG_NOLOG) && |
| |
3872 gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { |
| |
3873 |
| |
3874 gaim_window_raise(gaim_conversation_get_window(conv)); |
| |
3875 } |
| |
3876 |
| 3873 /* Play a sound, if specified in prefs. */ |
3877 /* Play a sound, if specified in prefs. */ |
| 3874 if (gtkconv->make_sound) { |
3878 if (gtkconv->make_sound) { |
| 3875 if (flags & WFLAG_RECV) { |
3879 if (flags & WFLAG_RECV) { |
| 3876 if (gtkconv->u.im->a_virgin && |
3880 if (gtkconv->u.im->a_virgin && |
| 3877 (sound_options & OPT_SOUND_FIRST_RCV)) { |
3881 gaim_prefs_get_bool("/gaim/gtk/sound/first_im_recv")) { |
| 3878 |
3882 |
| 3879 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
3883 gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); |
| 3880 } |
3884 } |
| 3881 else |
3885 else |
| 3882 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
3886 gaim_sound_play_event(GAIM_SOUND_RECEIVE); |
| 3902 /* Play a sound, if specified in prefs. */ |
3906 /* Play a sound, if specified in prefs. */ |
| 3903 if (gtkconv->make_sound) { |
3907 if (gtkconv->make_sound) { |
| 3904 if (!(flags & WFLAG_WHISPER) && (flags & WFLAG_SEND)) |
3908 if (!(flags & WFLAG_WHISPER) && (flags & WFLAG_SEND)) |
| 3905 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
3909 gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); |
| 3906 else if (flags & WFLAG_RECV) { |
3910 else if (flags & WFLAG_RECV) { |
| 3907 if ((flags & WFLAG_NICK) && (sound_options & OPT_SOUND_CHAT_NICK)) |
3911 if ((flags & WFLAG_NICK) && |
| |
3912 gaim_prefs_get_bool("/gaim/gtk/sound/nick_said")) { |
| |
3913 |
| 3908 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
3914 gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); |
| |
3915 } |
| 3909 else |
3916 else |
| 3910 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
3917 gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); |
| 3911 } |
3918 } |
| 3912 } |
3919 } |
| 3913 |
3920 |
| 3914 if (chat_options & OPT_CHAT_COLORIZE) |
3921 if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) |
| 3915 flags |= WFLAG_COLORIZE; |
3922 flags |= WFLAG_COLORIZE; |
| |
3923 |
| |
3924 /* Raise the window, if specified in prefs. */ |
| |
3925 if (!(flags & WFLAG_NOLOG) && |
| |
3926 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { |
| |
3927 |
| |
3928 gaim_window_raise(gaim_conversation_get_window(conv)); |
| |
3929 } |
| 3916 |
3930 |
| 3917 gaim_conversation_write(conv, who, message, -1, flags, mtime); |
3931 gaim_conversation_write(conv, who, message, -1, flags, mtime); |
| 3918 } |
3932 } |
| 3919 |
3933 |
| 3920 static void |
3934 static void |
| 3921 gaim_gtkconv_write_conv(struct gaim_conversation *conv, const char *who, |
3935 gaim_gtkconv_write_conv(struct gaim_conversation *conv, const char *who, |
| 3922 const char *message, size_t length, int flags, |
3936 const char *message, size_t length, int flags, |
| 3923 time_t mtime) |
3937 time_t mtime) |
| 3924 { |
3938 { |
| 3925 struct gaim_gtk_conversation *gtkconv; |
3939 struct gaim_gtk_conversation *gtkconv; |
| |
3940 struct gaim_window *win; |
| 3926 struct gaim_connection *gc; |
3941 struct gaim_connection *gc; |
| 3927 int gtk_font_options = 0; |
3942 int gtk_font_options = 0; |
| 3928 GString *log_str; |
3943 GString *log_str; |
| 3929 FILE *fd; |
3944 FILE *fd; |
| 3930 char buf[BUF_LONG]; |
3945 char buf[BUF_LONG]; |
| 3939 length = strlen(message) + 1; |
3954 length = strlen(message) + 1; |
| 3940 |
3955 |
| 3941 gtkconv = GAIM_GTK_CONVERSATION(conv); |
3956 gtkconv = GAIM_GTK_CONVERSATION(conv); |
| 3942 gc = gaim_conversation_get_gc(conv); |
3957 gc = gaim_conversation_get_gc(conv); |
| 3943 |
3958 |
| |
3959 win = gaim_conversation_get_window(conv); |
| |
3960 |
| |
3961 if (!(flags & WFLAG_NOLOG) && |
| |
3962 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && |
| |
3963 gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || |
| |
3964 (gaim_conversation_get_type(conv) == GAIM_CONV_IM && |
| |
3965 (gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events") || |
| |
3966 gaim_prefs_get_bool("/gaim/gtk/conversations/im/hide_on_send"))))) { |
| |
3967 |
| |
3968 gaim_window_show(win); |
| |
3969 } |
| |
3970 |
| |
3971 |
| 3944 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
3972 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
| 3945 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); |
3973 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); |
| 3946 else |
3974 else |
| 3947 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); |
3975 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); |
| 3948 |
3976 |
| 3949 if(gc) |
3977 if(gc) |
| 3950 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
3978 sml_attrib = g_strdup_printf("sml=\"%s\"", gc->prpl->info->name); |
| 3951 |
3979 |
| 3952 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
3980 gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; |
| 3953 |
3981 |
| 3954 if (convo_options & OPT_CONVO_IGNORE_COLOUR) |
3982 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) |
| 3955 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
3983 gtk_font_options ^= GTK_IMHTML_NO_COLOURS; |
| 3956 |
3984 |
| 3957 if (convo_options & OPT_CONVO_IGNORE_FONTS) |
3985 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) |
| 3958 gtk_font_options ^= GTK_IMHTML_NO_FONTS; |
3986 gtk_font_options ^= GTK_IMHTML_NO_FONTS; |
| 3959 |
3987 |
| 3960 if (convo_options & OPT_CONVO_IGNORE_SIZES) |
3988 if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) |
| 3961 gtk_font_options ^= GTK_IMHTML_NO_SIZES; |
3989 gtk_font_options ^= GTK_IMHTML_NO_SIZES; |
| 3962 |
3990 |
| 3963 if (!(logging_options & OPT_LOG_STRIP_HTML)) |
3991 if (!gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
| 3964 gtk_font_options ^= GTK_IMHTML_RETURN_LOG; |
3992 gtk_font_options ^= GTK_IMHTML_RETURN_LOG; |
| 3965 if (GAIM_PLUGIN_PROTOCOL_INFO(conv->account->gc->prpl)->options & OPT_PROTO_USE_POINTSIZE) |
3993 |
| |
3994 if (GAIM_PLUGIN_PROTOCOL_INFO(conv->account->gc->prpl)->options & |
| |
3995 OPT_PROTO_USE_POINTSIZE) { |
| |
3996 |
| 3966 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
3997 gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; |
| |
3998 } |
| 3967 |
3999 |
| 3968 if (flags & WFLAG_SYSTEM) { |
4000 if (flags & WFLAG_SYSTEM) { |
| 3969 if (convo_options & OPT_CONVO_SHOW_TIME) |
4001 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
| 3970 g_snprintf(buf, BUF_LONG, "(%s) <B>%s</B>", |
4002 g_snprintf(buf, BUF_LONG, "(%s) <B>%s</B>", |
| 3971 mdate, message); |
4003 mdate, message); |
| 3972 else |
4004 else |
| 3973 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); |
4005 g_snprintf(buf, BUF_LONG, "<B>%s</B>", message); |
| 3974 |
4006 |
| 3976 "<!--(%s) --><B>%s</B><BR>", |
4008 "<!--(%s) --><B>%s</B><BR>", |
| 3977 mdate, message); |
4009 mdate, message); |
| 3978 |
4010 |
| 3979 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, -1, 0); |
4011 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, -1, 0); |
| 3980 |
4012 |
| 3981 if (logging_options & OPT_LOG_STRIP_HTML) { |
4013 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) { |
| 3982 char *t1 = strip_html(buf); |
4014 char *t1 = strip_html(buf); |
| 3983 |
4015 |
| 3984 conv->history = g_string_append(conv->history, t1); |
4016 conv->history = g_string_append(conv->history, t1); |
| 3985 conv->history = g_string_append(conv->history, "\n"); |
4017 conv->history = g_string_append(conv->history, "\n"); |
| 3986 |
4018 |
| 4009 |
4041 |
| 4010 fd = open_log_file(nm, |
4042 fd = open_log_file(nm, |
| 4011 (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)); |
4043 (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)); |
| 4012 |
4044 |
| 4013 if (fd) { |
4045 if (fd) { |
| 4014 if (logging_options & OPT_LOG_STRIP_HTML) |
4046 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
| 4015 fprintf(fd, "%s\n", t1); |
4047 fprintf(fd, "%s\n", t1); |
| 4016 else |
4048 else |
| 4017 fprintf(fd, "%s<BR>\n", t1); |
4049 fprintf(fd, "%s<BR>\n", t1); |
| 4018 |
4050 |
| 4019 fclose(fd); |
4051 fclose(fd); |
| 4020 } |
4052 } |
| 4021 |
4053 |
| 4022 if (logging_options & OPT_LOG_STRIP_HTML) |
4054 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
| 4023 g_free(t1); |
4055 g_free(t1); |
| 4024 } |
4056 } |
| 4025 } |
4057 } |
| 4026 else if (flags & WFLAG_NOLOG) { |
4058 else if (flags & WFLAG_NOLOG) { |
| 4027 g_snprintf(buf, BUF_LONG, |
4059 g_snprintf(buf, BUF_LONG, |
| 4088 else if (flags & WFLAG_SEND) |
4120 else if (flags & WFLAG_SEND) |
| 4089 strcpy(color, "#16569E"); |
4121 strcpy(color, "#16569E"); |
| 4090 } |
4122 } |
| 4091 } |
4123 } |
| 4092 |
4124 |
| 4093 if (convo_options & OPT_CONVO_SHOW_TIME) |
4125 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) |
| 4094 g_snprintf(buf, BUF_LONG, |
4126 g_snprintf(buf, BUF_LONG, |
| 4095 "<FONT COLOR=\"%s\" %s>(%s) " |
4127 "<FONT COLOR=\"%s\" %s>(%s) " |
| 4096 "<B>%s</B></FONT> ", color, |
4128 "<B>%s</B></FONT> ", color, |
| 4097 sml_attrib ? sml_attrib : "", mdate, str); |
4129 sml_attrib ? sml_attrib : "", mdate, str); |
| 4098 else |
4130 else |
| 4171 g_snprintf(nm, sizeof(nm), "%s.chat", |
4203 g_snprintf(nm, sizeof(nm), "%s.chat", |
| 4172 gaim_conversation_get_name(conv)); |
4204 gaim_conversation_get_name(conv)); |
| 4173 else |
4205 else |
| 4174 strncpy(nm, gaim_conversation_get_name(conv), sizeof(nm)); |
4206 strncpy(nm, gaim_conversation_get_name(conv), sizeof(nm)); |
| 4175 |
4207 |
| 4176 if (logging_options & OPT_LOG_STRIP_HTML) { |
4208 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) { |
| 4177 t1 = strip_html(buf); |
4209 t1 = strip_html(buf); |
| 4178 t2 = strip_html(with_font_tag); |
4210 t2 = strip_html(with_font_tag); |
| 4179 } |
4211 } |
| 4180 else { |
4212 else { |
| 4181 t1 = html_logize(buf); |
4213 t1 = html_logize(buf); |
| 4184 |
4216 |
| 4185 fd = open_log_file(nm, |
4217 fd = open_log_file(nm, |
| 4186 (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)); |
4218 (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)); |
| 4187 |
4219 |
| 4188 if (fd) { |
4220 if (fd) { |
| 4189 if (logging_options & OPT_LOG_STRIP_HTML) |
4221 if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) |
| 4190 fprintf(fd, "%s%s\n", t1, t2); |
4222 fprintf(fd, "%s%s\n", t1, t2); |
| 4191 else { |
4223 else { |
| 4192 fprintf(fd, "%s%s%s<BR>\n", t1, t2, log_str->str); |
4224 fprintf(fd, "%s%s%s<BR>\n", t1, t2, log_str->str); |
| 4193 g_string_free(log_str, TRUE); |
4225 g_string_free(log_str, TRUE); |
| 4194 } |
4226 } |
| 4873 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
4905 gtkconv->u.im->icon = gtk_image_new_from_pixmap(pm, bm); |
| 4874 gtk_widget_set_size_request(gtkconv->u.im->icon, sf, sf); |
4906 gtk_widget_set_size_request(gtkconv->u.im->icon, sf, sf); |
| 4875 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); |
4907 gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); |
| 4876 gtk_widget_show(gtkconv->u.im->icon); |
4908 gtk_widget_show(gtkconv->u.im->icon); |
| 4877 |
4909 |
| 4878 if ((im_options & OPT_IM_NO_ANIMATION) || animate == FALSE) |
4910 if (!animate || |
| |
4911 !gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons")) { |
| 4879 stop_anim(NULL, conv); |
4912 stop_anim(NULL, conv); |
| |
4913 } |
| 4880 |
4914 |
| 4881 g_object_unref(G_OBJECT(pm)); |
4915 g_object_unref(G_OBJECT(pm)); |
| 4882 |
4916 |
| 4883 if (bm) |
4917 if (bm) |
| 4884 g_object_unref(G_OBJECT(bm)); |
4918 g_object_unref(G_OBJECT(bm)); |
| 4922 |
4956 |
| 4923 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4957 gtkconv = GAIM_GTK_CONVERSATION(conv); |
| 4924 |
4958 |
| 4925 if (gtkconv->toolbar.bold != NULL) |
4959 if (gtkconv->toolbar.bold != NULL) |
| 4926 gtk_widget_set_sensitive(gtkconv->toolbar.bold, |
4960 gtk_widget_set_sensitive(gtkconv->toolbar.bold, |
| 4927 (!(font_options & OPT_FONT_BOLD))); |
4961 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")); |
| 4928 |
4962 |
| 4929 if (gtkconv->toolbar.italic != NULL) |
4963 if (gtkconv->toolbar.italic != NULL) |
| 4930 gtk_widget_set_sensitive(gtkconv->toolbar.italic, |
4964 gtk_widget_set_sensitive(gtkconv->toolbar.italic, |
| 4931 (!(font_options & OPT_FONT_ITALIC))); |
4965 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")); |
| 4932 |
4966 |
| 4933 if (gtkconv->toolbar.underline != NULL) |
4967 if (gtkconv->toolbar.underline != NULL) |
| 4934 gtk_widget_set_sensitive(gtkconv->toolbar.underline, |
4968 gtk_widget_set_sensitive(gtkconv->toolbar.underline, |
| 4935 (!(font_options & OPT_FONT_UNDERLINE))); |
4969 !gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")); |
| 4936 } |
4970 } |
| 4937 } |
4971 } |
| 4938 |
4972 |
| 4939 void |
4973 void |
| 4940 gaim_gtkconv_update_font_colors(struct gaim_conversation *conv) |
4974 gaim_gtkconv_update_font_colors(struct gaim_conversation *conv) |