예제 #1
0
GList *get_pending_list(guint max) {
	const char *im=purple_prefs_get_string("/plugins/gtk/gtk-sarah-barnot/im");
	const char *chat=purple_prefs_get_string(
	                                     "/plugins/gtk/gtk-sarah-barnot/chat");
	GList *l_im = NULL;
	GList *l_chat = NULL;

	
	if (im != NULL && strcmp(im, "always") == 0) {
		l_im = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM,
		                                             PIDGIN_UNSEEN_TEXT,
		                                             FALSE, max);
	} else if (im != NULL && strcmp(im, "hidden") == 0) {
		l_im = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM,
		                                             PIDGIN_UNSEEN_TEXT,
		                                             TRUE, max);
	}

	if (chat != NULL && strcmp(chat, "always") == 0) {
		l_chat = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT,
		                                               PIDGIN_UNSEEN_TEXT,
		                                               FALSE, max);
	} else if (chat != NULL && strcmp(chat, "nick") == 0) {
		l_chat = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT,
		                                               PIDGIN_UNSEEN_NICK,
		                                               FALSE, max);
	}

	if (l_im != NULL && l_chat != NULL)
		return g_list_concat(l_im, l_chat);
	else if (l_im != NULL)
		return l_im;
	else
		return l_chat;
}
예제 #2
0
void get_pending_events(gboolean* unread, gboolean* important) {
	const char *im=purple_prefs_get_string("/plugins/gtk/ftdi-hwnotify/im");
	const char *chat=purple_prefs_get_string("/plugins/gtk/ftdi-hwnotify/chat");
	GList *l_im = NULL;
	GList *l_chat = NULL;

        *unread = FALSE;
        *important = FALSE;
	
	if (im != NULL && strcmp(im, "always") == 0) {
		l_im = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM,
		                                             PIDGIN_UNSEEN_TEXT,
		                                             FALSE, 1);
	} else if (im != NULL && strcmp(im, "hidden") == 0) {
		l_im = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM,
		                                             PIDGIN_UNSEEN_TEXT,
		                                             TRUE, 1);
	}

        // check for chat
	if (chat != NULL && strcmp(chat, "always") == 0) {
		l_chat = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT,
		                                               PIDGIN_UNSEEN_TEXT,
		                                               FALSE, 1);
	} else if (chat != NULL && strcmp(chat, "nick") == 0) {
		l_chat = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT,
		                                               PIDGIN_UNSEEN_NICK,
		                                               FALSE, 1);
	}

        gboolean unimportant = FALSE;

        // check for important contacts
        if (l_im != NULL && color_important != LED_NONE) {
            GList* p = l_im;

            while (p != NULL) {
                PurpleConversation* conv = (PurpleConversation*)p->data;
                if (is_important (conv->account->username))
                    *important = TRUE;
                else
                    unimportant = TRUE;
                p = p->next;
            }
        }

        if (!*important)
            unimportant = TRUE;

        if (l_im != NULL || l_chat != NULL)
            *unread = unimportant;

        if (l_im != NULL)
            g_list_free (l_im);

        if (l_chat != NULL)
            g_list_free (l_chat);
}