Mercurial > pidgin.yaz
comparison src/gtkconv.c @ 12553:9d7fb0b21d9f
[gaim-migrate @ 14871]
one reactionary pref down, eleventy billion to go
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Mon, 19 Dec 2005 05:55:30 +0000 |
parents | f4efe0c0de88 |
children | 5e81ae0736c9 |
comparison
equal
deleted
inserted
replaced
12552:5e6c3f539eb6 | 12553:9d7fb0b21d9f |
---|---|
4288 GaimGtkWindow *win; | 4288 GaimGtkWindow *win; |
4289 GaimConnection *gc; | 4289 GaimConnection *gc; |
4290 GaimAccount *account; | 4290 GaimAccount *account; |
4291 GaimPluginProtocolInfo *prpl_info; | 4291 GaimPluginProtocolInfo *prpl_info; |
4292 int gtk_font_options = 0; | 4292 int gtk_font_options = 0; |
4293 int gtk_font_options_all = 0; | |
4293 int max_scrollback_lines = gaim_prefs_get_int( | 4294 int max_scrollback_lines = gaim_prefs_get_int( |
4294 "/gaim/gtk/conversations/scrollback_lines"); | 4295 "/gaim/gtk/conversations/scrollback_lines"); |
4295 int line_count; | 4296 int line_count; |
4296 char buf2[BUF_LONG]; | 4297 char buf2[BUF_LONG]; |
4297 char mdate[64]; | 4298 char mdate[64]; |
4301 char *sml_attrib = NULL; | 4302 char *sml_attrib = NULL; |
4302 size_t length = strlen(message) + 1; | 4303 size_t length = strlen(message) + 1; |
4303 | 4304 |
4304 gtkconv = GAIM_GTK_CONVERSATION(conv); | 4305 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4305 | 4306 |
4307 if(gaim_prefs_get_bool("/gaim/gtk/conversations/use_smooth_scrolling")) | |
4308 gtk_font_options_all |= GTK_IMHTML_USE_SMOOTHSCROLLING; | |
4309 | |
4306 /* Set the active conversation to the one that just messaged us. */ | 4310 /* Set the active conversation to the one that just messaged us. */ |
4307 /* TODO: consider not doing this if the account is offline or something */ | 4311 /* TODO: consider not doing this if the account is offline or something */ |
4308 gaim_gtkconv_set_active_conversation(conv); | 4312 gaim_gtkconv_set_active_conversation(conv); |
4309 | 4313 |
4310 gc = gaim_conversation_get_gc(conv); | 4314 gc = gaim_conversation_get_gc(conv); |
4329 (line_count - max_scrollback_lines)); | 4333 (line_count - max_scrollback_lines)); |
4330 gtk_imhtml_delete(GTK_IMHTML(gtkconv->imhtml), &start, &end); | 4334 gtk_imhtml_delete(GTK_IMHTML(gtkconv->imhtml), &start, &end); |
4331 } | 4335 } |
4332 | 4336 |
4333 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) | 4337 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) |
4334 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); | 4338 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", gtk_font_options_all); |
4335 | 4339 |
4336 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ | 4340 if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ |
4337 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); | 4341 strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); |
4338 else | 4342 else |
4339 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | 4343 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); |
4351 /* this is gonna crash one day, I can feel it. */ | 4355 /* this is gonna crash one day, I can feel it. */ |
4352 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & | 4356 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & |
4353 OPT_PROTO_USE_POINTSIZE) { | 4357 OPT_PROTO_USE_POINTSIZE) { |
4354 gtk_font_options |= GTK_IMHTML_USE_POINTSIZE; | 4358 gtk_font_options |= GTK_IMHTML_USE_POINTSIZE; |
4355 } | 4359 } |
4360 | |
4356 | 4361 |
4357 /* TODO: These colors should not be hardcoded so log.c can use them */ | 4362 /* TODO: These colors should not be hardcoded so log.c can use them */ |
4358 if (flags & GAIM_MESSAGE_SYSTEM) { | 4363 if (flags & GAIM_MESSAGE_SYSTEM) { |
4359 g_snprintf(buf2, sizeof(buf2), | 4364 g_snprintf(buf2, sizeof(buf2), |
4360 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", | 4365 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", |
4361 sml_attrib ? sml_attrib : "", mdate, message); | 4366 sml_attrib ? sml_attrib : "", mdate, message); |
4362 | 4367 |
4363 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); | 4368 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); |
4364 | 4369 |
4365 } else if (flags & GAIM_MESSAGE_ERROR) { | 4370 } else if (flags & GAIM_MESSAGE_ERROR) { |
4366 g_snprintf(buf2, sizeof(buf2), | 4371 g_snprintf(buf2, sizeof(buf2), |
4367 "<FONT COLOR=\"#ff0000\"><FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT></FONT>", | 4372 "<FONT COLOR=\"#ff0000\"><FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT></FONT>", |
4368 sml_attrib ? sml_attrib : "", mdate, message); | 4373 sml_attrib ? sml_attrib : "", mdate, message); |
4369 | 4374 |
4370 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); | 4375 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); |
4371 | 4376 |
4372 } else if (flags & GAIM_MESSAGE_NO_LOG) { | 4377 } else if (flags & GAIM_MESSAGE_NO_LOG) { |
4373 g_snprintf(buf2, BUF_LONG, | 4378 g_snprintf(buf2, BUF_LONG, |
4374 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>", | 4379 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>", |
4375 sml_attrib ? sml_attrib : "", message); | 4380 sml_attrib ? sml_attrib : "", message); |
4376 | 4381 |
4377 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); | 4382 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); |
4378 } else if (flags & GAIM_MESSAGE_RAW) { | 4383 } else if (flags & GAIM_MESSAGE_RAW) { |
4379 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), message, 0); | 4384 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), message, gtk_font_options_all); |
4380 } else { | 4385 } else { |
4381 char *new_message = g_memdup(message, length); | 4386 char *new_message = g_memdup(message, length); |
4382 char *alias_escaped = (alias ? g_markup_escape_text(alias, strlen(alias)) : g_strdup("")); | 4387 char *alias_escaped = (alias ? g_markup_escape_text(alias, strlen(alias)) : g_strdup("")); |
4383 /* The initial offset is to deal with | 4388 /* The initial offset is to deal with |
4384 * escaped entities making the string longer */ | 4389 * escaped entities making the string longer */ |
4477 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" | 4482 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
4478 "<B>%s</B></FONT> ", | 4483 "<B>%s</B></FONT> ", |
4479 color, sml_attrib ? sml_attrib : "", mdate, str); | 4484 color, sml_attrib ? sml_attrib : "", mdate, str); |
4480 } | 4485 } |
4481 | 4486 |
4482 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, 0); | 4487 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); |
4483 | 4488 |
4484 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT && | 4489 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT && |
4485 !(flags & GAIM_MESSAGE_SEND)) { | 4490 !(flags & GAIM_MESSAGE_SEND)) { |
4486 | 4491 |
4487 GtkTextIter start, end; | 4492 GtkTextIter start, end; |
4523 } | 4528 } |
4524 else | 4529 else |
4525 with_font_tag = g_memdup(new_message, length); | 4530 with_font_tag = g_memdup(new_message, length); |
4526 | 4531 |
4527 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), | 4532 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
4528 with_font_tag, gtk_font_options); | 4533 with_font_tag, gtk_font_options | gtk_font_options_all); |
4529 | 4534 |
4530 g_free(with_font_tag); | 4535 g_free(with_font_tag); |
4531 g_free(new_message); | 4536 g_free(new_message); |
4532 } | 4537 } |
4533 | 4538 |
5874 void *handle = gaim_gtk_conversations_get_handle(); | 5879 void *handle = gaim_gtk_conversations_get_handle(); |
5875 void *blist_handle = gaim_blist_get_handle(); | 5880 void *blist_handle = gaim_blist_get_handle(); |
5876 | 5881 |
5877 /* Conversations */ | 5882 /* Conversations */ |
5878 gaim_prefs_add_none("/gaim/gtk/conversations"); | 5883 gaim_prefs_add_none("/gaim/gtk/conversations"); |
5884 gaim_prefs_add_bool("/gaim/gtk/conversations/use_smooth_scrolling", TRUE); | |
5879 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); | 5885 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); |
5880 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); | 5886 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); |
5881 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); | 5887 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); |
5882 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); | 5888 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); |
5883 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); | 5889 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); |