static void notify_new_message_cb (PurpleAccount *account, const gchar *sender, const gchar *message, int flags, gpointer data) { PurpleConversation *conv; if (!purple_prefs_get_bool ("/plugins/gtk/libnotify/newmsg")) return; conv = purple_find_conversation_with_account (PURPLE_CONV_TYPE_IM, sender, account); #ifndef DEBUG /* in debug mode, always show notifications */ if (conv && purple_conversation_has_focus (conv)) { purple_debug_info (PLUGIN_ID, "Conversation has focus 0x%lx\n", (unsigned long)conv); return; } #endif if (conv && purple_prefs_get_bool ("/plugins/gtk/libnotify/newconvonly")) { purple_debug_info (PLUGIN_ID, "Conversation is not new 0x%lx\n", (unsigned long)conv); return; } if (!should_notify_unavailable (account)) return; notify_msg_sent (account, conv, sender, message); }
static void notify_chat_nick (PurpleAccount *account, const gchar *sender, const gchar *message, PurpleConversation *conv, gpointer data) { gchar *nick; nick = (gchar *)purple_conv_chat_get_nick (PURPLE_CONV_CHAT(conv)); #ifndef DEBUG /* in debug mode, always show notifications */ if (nick && !strcmp (sender, nick)) return; #else purple_debug_info (PLUGIN_ID, "Message would be suppressed normally because you said it yourself"); #endif int triggermessagefound = 0; int i; for (i = 0; words[i]; i++ ) { if (g_strstr_len(message, strlen(message), words[i])) { triggermessagefound=1; purple_debug_info (PLUGIN_ID, "found triggermessage in chat"); break; } } if (!triggermessagefound){ purple_debug_info (PLUGIN_ID, "no triggermessage found in chat"); } if (!triggermessagefound && !g_strstr_len(message, strlen(message), nick) && !purple_prefs_get_bool("/plugins/gtk/libnotify/othermsgs")) return; notify_msg_sent (account, conv, sender, message); }
static void notify_chat_nick (PurpleAccount *account, const gchar *sender, const gchar *message, PurpleConversation *conv, gpointer data) { gchar *nick; nick = (gchar *)purple_conv_chat_get_nick (PURPLE_CONV_CHAT(conv)); if (nick && !strcmp (sender, nick)) return; if (!g_strstr_len (message, strlen(message), nick)) return; notify_msg_sent (account, conv, sender, message); }