static void conv_switched(PurpleConversation *conv) { #if 0 PidginWindow *purplewin = purple_conversation_get_window(new_conv); #endif /* * If the conversation was switched, then make sure we re-notify * because Purple will have overwritten our custom window title. */ notify(conv, FALSE); #if 0 printf("conv_switched - %p - %p\n", old_conv, new_conv); printf("count - %d\n", count_messages(purplewin)); if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")) unnotify(new_conv, FALSE); else { /* if we don't have notification on the window then we don't want to * re-notify it */ if (count_messages(purplewin)) notify_win(purplewin); } #endif }
static int unnotify_cb(GtkWidget *widget, gpointer data, PurpleConversation *conv) { if (GPOINTER_TO_INT(purple_conversation_get_data(conv, "notify-message-count")) != 0) unnotify(conv, TRUE); return 0; }
static void chat_sent_im(PurpleAccount *account, const char *message, int id) { PurpleConversation *conv = NULL; if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { conv = purple_find_chat(purple_account_get_connection(account), id); unnotify(conv, TRUE); } }
static void im_sent_im(PurpleAccount *account, const char *receiver, const char *message) { PurpleConversation *conv = NULL; if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, receiver, account); unnotify(conv, TRUE); } }
static void chat_sent_im(PurpleAccount *account, const char *message, int id) { PurpleChatConversation *chat = NULL; if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { chat = purple_conversations_find_chat(purple_account_get_connection(account), id); unnotify(PURPLE_CONVERSATION(chat), TRUE); } }
static void im_sent_im(PurpleAccount *account, const char *receiver, const char *message) { PurpleIMConversation *im = NULL; if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { im = purple_conversations_find_im_with_account(receiver, account); unnotify(PURPLE_CONVERSATION(im), TRUE); } }
static void apply_method() { GList *convs; for (convs = purple_conversations_get_all(); convs != NULL; convs = convs->next) { PurpleConversation *conv = (PurpleConversation *)convs->data; /* remove notifications */ unnotify(conv, FALSE); if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), "notify-message-count")) != 0) /* reattach appropriate notifications */ notify(conv, FALSE); } }
static void apply_method() { GList *convs; PidginWindow *purplewin = NULL; for (convs = purple_get_conversations(); convs != NULL; convs = convs->next) { PurpleConversation *conv = (PurpleConversation *)convs->data; /* remove notifications */ unnotify(conv, FALSE); purplewin = PIDGIN_CONVERSATION(conv)->win; if (GPOINTER_TO_INT(purple_conversation_get_data(conv, "notify-message-count")) != 0) /* reattach appropriate notifications */ notify(conv, FALSE); } }
static int notify(PurpleConversation *conv, gboolean increment) { gint count; gboolean has_focus; PidginWindow *purplewin = NULL; if (conv == NULL || PIDGIN_CONVERSATION(conv) == NULL) return 0; /* We want to remove the notifications, but not reset the counter */ unnotify(conv, FALSE); purplewin = PIDGIN_CONVERSATION(conv)->win; /* If we aren't doing notifications for this type of conversation, return */ if (((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) && !purple_prefs_get_bool("/plugins/gtk/X11/notify/type_im")) || ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) && !purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat"))) return 0; g_object_get(G_OBJECT(purplewin->window), "has-toplevel-focus", &has_focus, NULL); if (purple_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") || !has_focus) { if (increment) { count = GPOINTER_TO_INT(purple_conversation_get_data(conv, "notify-message-count")); count++; purple_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(count)); } notify_win(purplewin, conv); } return 0; }