diff plugins/notify.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 e856f985a0b9
children acf22abb86ba
line wrap: on
line diff
--- a/plugins/notify.c	Wed Dec 21 21:18:25 2005 +0000
+++ b/plugins/notify.c	Wed Dec 21 21:48:38 2005 +0000
@@ -87,6 +87,7 @@
 #include "gtkgaim.h"
 #include "gtkprefs.h"
 
+#include "conversation.h"
 #include "prefs.h"
 #include "signals.h"
 #include "version.h"
@@ -238,22 +239,10 @@
 }
 
 static gboolean
-im_recv_im(GaimAccount *account, char *sender, char *message,
-           GaimConversation *conv, int *flags)
+message_displayed_cb(GaimAccount *account, GaimConversation *conv, const char *message, GaimMessageFlags flags)
 {
-	notify(conv, TRUE);
-
-	return FALSE;
-}
-
-static gboolean
-chat_recv_im(GaimAccount *account, char *sender, char *message,
-             GaimConversation *conv, int *flags)
-{
-	if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), sender))
-			return FALSE;
-
-	notify(conv, TRUE);
+	if ((flags & GAIM_MESSAGE_RECV) && !(flags & GAIM_MESSAGE_DELAYED))
+		notify(conv, TRUE);
 
 	return FALSE;
 }
@@ -766,16 +755,14 @@
 {
 	GList *convs = gaim_get_conversations();
 	void *conv_handle = gaim_conversations_get_handle();
-	/*
 	void *gtk_conv_handle = gaim_gtk_conversations_get_handle();
-	*/
 
 	my_plugin = plugin;
 
-	gaim_signal_connect(conv_handle, "received-im-msg", plugin,
-	                    GAIM_CALLBACK(im_recv_im), NULL);
-	gaim_signal_connect(conv_handle, "received-chat-msg", plugin,
-	                    GAIM_CALLBACK(chat_recv_im), NULL);
+	gaim_signal_connect(gtk_conv_handle, "displayed-im-msg", plugin,
+						GAIM_CALLBACK(message_displayed_cb), NULL);
+	gaim_signal_connect(gtk_conv_handle, "displayed-chat-msg", plugin,
+						GAIM_CALLBACK(message_displayed_cb), NULL);
 	gaim_signal_connect(conv_handle, "sent-im-msg", plugin,
 	                    GAIM_CALLBACK(im_sent_im), NULL);
 	gaim_signal_connect(conv_handle, "sent-chat-msg", plugin,