Mercurial > pidgin
comparison src/gtkconv.c @ 12604:71299d63801d
[gaim-migrate @ 14939]
SF Patch #1383857 from Sadrul
"This patch makes the display-msg signals to be emitted
from gtkconv instead of conversation. The display-msg
signals were not too useful before, especially because
they were being emitted right after writing-msg
signals, and not being emitted for messages being sent
at all.
This patch also makes necessary changes in the plugins,
and in Changelog.API. With this change, the notify
plugin can set the URGENT hint for a new received
message which creates a conversation.
marv and charkins seemed to think this was a good thing
to do."
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Wed, 21 Dec 2005 21:48:38 +0000 |
parents | e63fb8e9f4ac |
children | eee2042ad4f4 |
comparison
equal
deleted
inserted
replaced
12603:e4e47871c373 | 12604:71299d63801d |
---|---|
4364 char mdate[64]; | 4364 char mdate[64]; |
4365 char color[10]; | 4365 char color[10]; |
4366 char *str; | 4366 char *str; |
4367 char *with_font_tag; | 4367 char *with_font_tag; |
4368 char *sml_attrib = NULL; | 4368 char *sml_attrib = NULL; |
4369 size_t length = strlen(message) + 1; | 4369 size_t length; |
4370 GaimConversationType type; | |
4371 char *displaying; | |
4372 gboolean plugin_return; | |
4370 | 4373 |
4371 gtkconv = GAIM_GTK_CONVERSATION(conv); | 4374 gtkconv = GAIM_GTK_CONVERSATION(conv); |
4372 | 4375 |
4373 if(gaim_prefs_get_bool("/gaim/gtk/conversations/use_smooth_scrolling")) | 4376 if(gaim_prefs_get_bool("/gaim/gtk/conversations/use_smooth_scrolling")) |
4374 gtk_font_options_all |= GTK_IMHTML_USE_SMOOTHSCROLLING; | 4377 gtk_font_options_all |= GTK_IMHTML_USE_SMOOTHSCROLLING; |
4375 | 4378 |
4376 /* Set the active conversation to the one that just messaged us. */ | 4379 /* Set the active conversation to the one that just messaged us. */ |
4377 /* TODO: consider not doing this if the account is offline or something */ | 4380 /* TODO: consider not doing this if the account is offline or something */ |
4378 gaim_gtkconv_set_active_conversation(conv); | 4381 gaim_gtkconv_set_active_conversation(conv); |
4382 type = gaim_conversation_get_type(conv); | |
4379 | 4383 |
4380 gc = gaim_conversation_get_gc(conv); | 4384 gc = gaim_conversation_get_gc(conv); |
4381 account = gaim_conversation_get_account(conv); | 4385 account = gaim_conversation_get_account(conv); |
4386 | |
4387 displaying = g_strdup(message); | |
4388 plugin_return = GPOINTER_TO_INT(gaim_signal_emit_return_1( | |
4389 gaim_gtk_conversations_get_handle(), (type == GAIM_CONV_TYPE_IM ? | |
4390 "displaying-im-msg" : "displaying-chat-msg"), | |
4391 account, conv, &displaying, flags)); | |
4392 if (plugin_return) | |
4393 { | |
4394 g_free(displaying); | |
4395 return; | |
4396 } | |
4397 message = displaying; | |
4398 length = strlen(message) + 1; | |
4399 | |
4382 win = gtkconv->win; | 4400 win = gtkconv->win; |
4383 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | 4401 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4384 | 4402 |
4385 line_count = gtk_text_buffer_get_line_count( | 4403 line_count = gtk_text_buffer_get_line_count( |
4386 gtk_text_view_get_buffer(GTK_TEXT_VIEW( | 4404 gtk_text_view_get_buffer(GTK_TEXT_VIEW( |
4602 g_free(new_message); | 4620 g_free(new_message); |
4603 } | 4621 } |
4604 | 4622 |
4605 if(sml_attrib) | 4623 if(sml_attrib) |
4606 g_free(sml_attrib); | 4624 g_free(sml_attrib); |
4625 | |
4626 gaim_signal_emit(gaim_gtk_conversations_get_handle(), | |
4627 (type == GAIM_CONV_TYPE_IM ? "displayed-im-msg" : "displayed-chat-msg"), | |
4628 account, conv, message, flags); | |
4629 g_free(displaying); | |
4607 | 4630 |
4608 /* Tab highlighting stuff */ | 4631 /* Tab highlighting stuff */ |
4609 if (!gaim_gtkconv_has_focus(conv)) | 4632 if (!gaim_gtkconv_has_focus(conv)) |
4610 { | 4633 { |
4611 GaimUnseenState unseen = GAIM_UNSEEN_NONE; | 4634 GaimUnseenState unseen = GAIM_UNSEEN_NONE; |
6034 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, | 6057 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, |
6035 gaim_value_new(GAIM_TYPE_SUBTYPE, | 6058 gaim_value_new(GAIM_TYPE_SUBTYPE, |
6036 GAIM_SUBTYPE_CONV_WINDOW), | 6059 GAIM_SUBTYPE_CONV_WINDOW), |
6037 gaim_value_new(GAIM_TYPE_SUBTYPE, | 6060 gaim_value_new(GAIM_TYPE_SUBTYPE, |
6038 GAIM_SUBTYPE_CONV_WINDOW)); | 6061 GAIM_SUBTYPE_CONV_WINDOW)); |
6062 | |
6063 gaim_signal_register(handle, "displaying-im-msg", | |
6064 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT, | |
6065 gaim_value_new(GAIM_TYPE_BOOLEAN), 4, | |
6066 gaim_value_new(GAIM_TYPE_SUBTYPE, | |
6067 GAIM_SUBTYPE_ACCOUNT), | |
6068 gaim_value_new(GAIM_TYPE_SUBTYPE, | |
6069 GAIM_SUBTYPE_CONVERSATION), | |
6070 gaim_value_new_outgoing(GAIM_TYPE_STRING), | |
6071 gaim_value_new(G_TYPE_INT)); | |
6072 | |
6073 gaim_signal_register(handle, "displayed-im-msg", | |
6074 gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT, | |
6075 NULL, 4, | |
6076 gaim_value_new(GAIM_TYPE_SUBTYPE, | |
6077 GAIM_SUBTYPE_ACCOUNT), | |
6078 gaim_value_new(GAIM_TYPE_SUBTYPE, | |
6079 GAIM_SUBTYPE_CONVERSATION), | |
6080 gaim_value_new(GAIM_TYPE_STRING), | |
6081 gaim_value_new(G_TYPE_INT)); | |
6082 | |
6083 gaim_signal_register(handle, "displaying-chat-msg", | |
6084 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT, | |
6085 gaim_value_new(GAIM_TYPE_BOOLEAN), 4, | |
6086 gaim_value_new(GAIM_TYPE_SUBTYPE, | |
6087 GAIM_SUBTYPE_ACCOUNT), | |
6088 gaim_value_new(GAIM_TYPE_SUBTYPE, | |
6089 GAIM_SUBTYPE_CONVERSATION), | |
6090 gaim_value_new_outgoing(GAIM_TYPE_STRING), | |
6091 gaim_value_new(G_TYPE_INT)); | |
6092 | |
6093 gaim_signal_register(handle, "displayed-chat-msg", | |
6094 gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT, | |
6095 NULL, 4, | |
6096 gaim_value_new(GAIM_TYPE_SUBTYPE, | |
6097 GAIM_SUBTYPE_ACCOUNT), | |
6098 gaim_value_new(GAIM_TYPE_SUBTYPE, | |
6099 GAIM_SUBTYPE_CONVERSATION), | |
6100 gaim_value_new(GAIM_TYPE_STRING), | |
6101 gaim_value_new(G_TYPE_INT)); | |
6039 | 6102 |
6040 /********************************************************************** | 6103 /********************************************************************** |
6041 * Register commands | 6104 * Register commands |
6042 **********************************************************************/ | 6105 **********************************************************************/ |
6043 gaim_cmd_register("say", "S", GAIM_CMD_P_DEFAULT, | 6106 gaim_cmd_register("say", "S", GAIM_CMD_P_DEFAULT, |