diff 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
line wrap: on
line diff
--- a/src/gtkconv.c	Wed Dec 21 21:18:25 2005 +0000
+++ b/src/gtkconv.c	Wed Dec 21 21:48:38 2005 +0000
@@ -4366,7 +4366,10 @@
 	char *str;
 	char *with_font_tag;
 	char *sml_attrib = NULL;
-	size_t length = strlen(message) + 1;
+	size_t length;
+	GaimConversationType type;
+	char *displaying;
+	gboolean plugin_return;
 
 	gtkconv = GAIM_GTK_CONVERSATION(conv);
 
@@ -4376,9 +4379,24 @@
 	/* Set the active conversation to the one that just messaged us. */
 	/* TODO: consider not doing this if the account is offline or something */
 	gaim_gtkconv_set_active_conversation(conv);
+	type = gaim_conversation_get_type(conv);
 
 	gc = gaim_conversation_get_gc(conv);
 	account = gaim_conversation_get_account(conv);
+
+	displaying = g_strdup(message);
+	plugin_return = GPOINTER_TO_INT(gaim_signal_emit_return_1(
+							gaim_gtk_conversations_get_handle(), (type == GAIM_CONV_TYPE_IM ?
+							"displaying-im-msg" : "displaying-chat-msg"),
+							account, conv, &displaying, flags));
+	if (plugin_return)
+	{
+		g_free(displaying);
+		return;
+	}
+	message = displaying;
+	length = strlen(message) + 1;
+
 	win = gtkconv->win;
 	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
@@ -4605,6 +4623,11 @@
 	if(sml_attrib)
 		g_free(sml_attrib);
 
+	gaim_signal_emit(gaim_gtk_conversations_get_handle(),
+		(type == GAIM_CONV_TYPE_IM ? "displayed-im-msg" : "displayed-chat-msg"),
+		account, conv, message, flags);
+	g_free(displaying);
+
 	/* Tab highlighting stuff */
 	if (!gaim_gtkconv_has_focus(conv))
 	{
@@ -6037,6 +6060,46 @@
 	                     gaim_value_new(GAIM_TYPE_SUBTYPE,
 	                                    GAIM_SUBTYPE_CONV_WINDOW));
 
+	gaim_signal_register(handle, "displaying-im-msg",
+						 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT,
+						 gaim_value_new(GAIM_TYPE_BOOLEAN), 4,
+						 gaim_value_new(GAIM_TYPE_SUBTYPE,
+										GAIM_SUBTYPE_ACCOUNT),
+						 gaim_value_new(GAIM_TYPE_SUBTYPE,
+										GAIM_SUBTYPE_CONVERSATION),
+						 gaim_value_new_outgoing(GAIM_TYPE_STRING),
+						 gaim_value_new(G_TYPE_INT));
+
+	gaim_signal_register(handle, "displayed-im-msg",
+						 gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT,
+						 NULL, 4,
+						 gaim_value_new(GAIM_TYPE_SUBTYPE,
+										GAIM_SUBTYPE_ACCOUNT),
+						 gaim_value_new(GAIM_TYPE_SUBTYPE,
+										GAIM_SUBTYPE_CONVERSATION),
+						 gaim_value_new(GAIM_TYPE_STRING),
+						 gaim_value_new(G_TYPE_INT));
+
+	gaim_signal_register(handle, "displaying-chat-msg",
+						 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT,
+						 gaim_value_new(GAIM_TYPE_BOOLEAN), 4,
+						 gaim_value_new(GAIM_TYPE_SUBTYPE,
+										GAIM_SUBTYPE_ACCOUNT),
+						 gaim_value_new(GAIM_TYPE_SUBTYPE,
+										GAIM_SUBTYPE_CONVERSATION),
+						 gaim_value_new_outgoing(GAIM_TYPE_STRING),
+						 gaim_value_new(G_TYPE_INT));
+
+	gaim_signal_register(handle, "displayed-chat-msg",
+						 gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT,
+						 NULL, 4,
+						 gaim_value_new(GAIM_TYPE_SUBTYPE,
+										GAIM_SUBTYPE_ACCOUNT),
+						 gaim_value_new(GAIM_TYPE_SUBTYPE,
+										GAIM_SUBTYPE_CONVERSATION),
+						 gaim_value_new(GAIM_TYPE_STRING),
+						 gaim_value_new(G_TYPE_INT));
+
 	/**********************************************************************
 	 * Register commands
 	 **********************************************************************/