comparison 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
comparison
equal deleted inserted replaced
12603:e4e47871c373 12604:71299d63801d
85 85
86 #include "internal.h" 86 #include "internal.h"
87 #include "gtkgaim.h" 87 #include "gtkgaim.h"
88 #include "gtkprefs.h" 88 #include "gtkprefs.h"
89 89
90 #include "conversation.h"
90 #include "prefs.h" 91 #include "prefs.h"
91 #include "signals.h" 92 #include "signals.h"
92 #include "version.h" 93 #include "version.h"
93 #include "debug.h" 94 #include "debug.h"
94 95
236 237
237 return 0; 238 return 0;
238 } 239 }
239 240
240 static gboolean 241 static gboolean
241 im_recv_im(GaimAccount *account, char *sender, char *message, 242 message_displayed_cb(GaimAccount *account, GaimConversation *conv, const char *message, GaimMessageFlags flags)
242 GaimConversation *conv, int *flags) 243 {
243 { 244 if ((flags & GAIM_MESSAGE_RECV) && !(flags & GAIM_MESSAGE_DELAYED))
244 notify(conv, TRUE); 245 notify(conv, TRUE);
245
246 return FALSE;
247 }
248
249 static gboolean
250 chat_recv_im(GaimAccount *account, char *sender, char *message,
251 GaimConversation *conv, int *flags)
252 {
253 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), sender))
254 return FALSE;
255
256 notify(conv, TRUE);
257 246
258 return FALSE; 247 return FALSE;
259 } 248 }
260 249
261 static void 250 static void
764 static gboolean 753 static gboolean
765 plugin_load(GaimPlugin *plugin) 754 plugin_load(GaimPlugin *plugin)
766 { 755 {
767 GList *convs = gaim_get_conversations(); 756 GList *convs = gaim_get_conversations();
768 void *conv_handle = gaim_conversations_get_handle(); 757 void *conv_handle = gaim_conversations_get_handle();
769 /*
770 void *gtk_conv_handle = gaim_gtk_conversations_get_handle(); 758 void *gtk_conv_handle = gaim_gtk_conversations_get_handle();
771 */
772 759
773 my_plugin = plugin; 760 my_plugin = plugin;
774 761
775 gaim_signal_connect(conv_handle, "received-im-msg", plugin, 762 gaim_signal_connect(gtk_conv_handle, "displayed-im-msg", plugin,
776 GAIM_CALLBACK(im_recv_im), NULL); 763 GAIM_CALLBACK(message_displayed_cb), NULL);
777 gaim_signal_connect(conv_handle, "received-chat-msg", plugin, 764 gaim_signal_connect(gtk_conv_handle, "displayed-chat-msg", plugin,
778 GAIM_CALLBACK(chat_recv_im), NULL); 765 GAIM_CALLBACK(message_displayed_cb), NULL);
779 gaim_signal_connect(conv_handle, "sent-im-msg", plugin, 766 gaim_signal_connect(conv_handle, "sent-im-msg", plugin,
780 GAIM_CALLBACK(im_sent_im), NULL); 767 GAIM_CALLBACK(im_sent_im), NULL);
781 gaim_signal_connect(conv_handle, "sent-chat-msg", plugin, 768 gaim_signal_connect(conv_handle, "sent-chat-msg", plugin,
782 GAIM_CALLBACK(chat_sent_im), NULL); 769 GAIM_CALLBACK(chat_sent_im), NULL);
783 gaim_signal_connect(conv_handle, "conversation-created", plugin, 770 gaim_signal_connect(conv_handle, "conversation-created", plugin,