Simple cleanup of the LIBBALSA_MESSAGE_FLAG's



There are macro's to test for the flags, use them.

-- 
When a guy says "the last thing I'd wanna do is hurt you" it just means
he's gotta do other things first.
Fingerprint = CD4D 5601 287D F075 6F96  6157 99F9 E56A 4B08 6D06
diff -r -u balsa-cvs-arch/libbalsa/filter.c balsa-flags/libbalsa/filter.c
--- balsa-cvs-arch/libbalsa/filter.c	2003-02-26 19:57:32.000000000 +0100
+++ balsa-flags/libbalsa/filter.c	2003-03-01 16:39:15.000000000 +0100
@@ -607,7 +607,7 @@
 	LibBalsaMessage * message = LIBBALSA_MESSAGE(messages->data);
 	HEADER * cur;
 
-	if (!message->header->old) {
+	if (!LIBBALSA_MESSAGE_IS_RECENT(message)) {
 	    extracted = g_list_prepend(extracted, message);
 	    cur = message->header;
 	    mutt_set_flag(CLIENT_CONTEXT(message->mailbox), cur, M_OLD, TRUE);
diff -r -u balsa-cvs-arch/libbalsa/mailbox.c balsa-flags/libbalsa/mailbox.c
--- balsa-cvs-arch/libbalsa/mailbox.c	2003-02-26 19:57:32.000000000 +0100
+++ balsa-flags/libbalsa/mailbox.c	2003-03-01 16:24:07.000000000 +0100
@@ -746,9 +746,9 @@
     msg->mailbox = mailbox;
     mailbox->message_list = g_list_prepend(mailbox->message_list, msg);
     
-    if (msg->flags & LIBBALSA_MESSAGE_FLAG_DELETED)
+    if (LIBBALSA_MESSAGE_IS_DELETED(msg))
         return;
-    if (msg->flags & LIBBALSA_MESSAGE_FLAG_NEW)
+    if (LIBBALSA_MESSAGE_IS_UNREAD(msg))
         mailbox->unread_messages++;
     mailbox->total_messages++;
 }
@@ -978,7 +978,7 @@
     for (message_list = mailbox->message_list; message_list;
          message_list = g_list_next(message_list)) {
 	current_message = LIBBALSA_MESSAGE(message_list->data);
-	if (current_message->flags & LIBBALSA_MESSAGE_FLAG_DELETED) {
+	if (LIBBALSA_MESSAGE_IS_DELETED(current_message)) {
 	    p=g_list_prepend(p, current_message);
             if (delete)
                 q = g_list_prepend(q, message_list);
@@ -1076,13 +1078,11 @@
     switch (flag) {
     case LIBBALSA_MESSAGE_FLAG_DELETED:
         /* Deleted state has changed, update counts */
-        new_state = (LIBBALSA_MESSAGE(messages->data)->flags
-                     & LIBBALSA_MESSAGE_FLAG_DELETED);
+        new_state = (LIBBALSA_MESSAGE_IS_DELETED(messages->data));
 
         for (; messages; messages = g_list_next(messages)) {
             nb_in_list++;
-            if (LIBBALSA_MESSAGE(messages->data)->flags
-                & LIBBALSA_MESSAGE_FLAG_NEW)
+	    if (LIBBALSA_MESSAGE_IS_UNREAD(messages->data))
                 new_in_list++;
         }
 
@@ -1105,22 +1105,19 @@
         }
         break;
     case LIBBALSA_MESSAGE_FLAG_NEW:
-        if (LIBBALSA_MESSAGE(messages->data)->flags
-            & LIBBALSA_MESSAGE_FLAG_NEW) {
+	if (LIBBALSA_MESSAGE_IS_UNREAD(messages->data)) {
             gboolean unread_before = mb->unread_messages > 0;
 
             /* Count only messages with the deleted flag not set */
             for (lst = messages; lst; lst = g_list_next(lst))
-                if (!(LIBBALSA_MESSAGE(lst->data)->flags
-                      & LIBBALSA_MESSAGE_FLAG_DELETED))
+		if (!LIBBALSA_MESSAGE_IS_DELETED(lst->data))
                     mb->unread_messages++;
             if (!unread_before && mb->unread_messages > 0)
                 libbalsa_mailbox_set_unread_messages_flag(mb, TRUE);
         } else {
             /* Count only messages with the deleted flag not set */
             for (lst = messages; lst; lst = g_list_next(lst))
-                if (!(LIBBALSA_MESSAGE(lst->data)->flags
-                      & LIBBALSA_MESSAGE_FLAG_DELETED))
+		if (!LIBBALSA_MESSAGE_IS_DELETED(lst->data))
                     mb->unread_messages--;
             if (mb->unread_messages <= 0)
                 libbalsa_mailbox_set_unread_messages_flag(mb, FALSE);
diff -r -u balsa-cvs-arch/libbalsa/mailbox_imap.c balsa-flags/libbalsa/mailbox_imap.c
--- balsa-cvs-arch/libbalsa/mailbox_imap.c	2003-02-26 19:57:32.000000000 +0100
+++ balsa-flags/libbalsa/mailbox_imap.c	2003-03-01 16:26:46.000000000 +0100
@@ -405,13 +405,13 @@
     sprintf(buf, "%d", msg->lines_len); 
     append_string('L',data, &alen, &len, buf);
     buf[0] ='\0';
-    if(msg->flags & LIBBALSA_MESSAGE_FLAG_NEW)
+    if (LIBBALSA_MESSAGE_IS_UNREAD(msg))
         append_string('n',data, &alen, &len, buf);
-    if(msg->flags & LIBBALSA_MESSAGE_FLAG_DELETED)
+    if (LIBBALSA_MESSAGE_IS_DELETED(msg))
         append_string('d',data, &alen, &len, buf);
-    if(msg->flags & LIBBALSA_MESSAGE_FLAG_FLAGGED)
+    if (LIBBALSA_MESSAGE_IS_FLAGGED(msg))
         append_string('f',data, &alen, &len, buf);
-    if(msg->flags & LIBBALSA_MESSAGE_FLAG_REPLIED)
+    if (LIBBALSA_MESSAGE_IS_REPLIED(msg))
         append_string('r',data, &alen, &len, buf);
     sprintf(buf, "%ld", msg->date); 
     append_string('D',data, &alen, &len, buf);
diff -r -u balsa-cvs-arch/libbalsa/message.c balsa-flags/libbalsa/message.c
--- balsa-cvs-arch/libbalsa/message.c	2003-02-26 19:57:32.000000000 +0100
+++ balsa-flags/libbalsa/message.c	2003-03-01 16:25:24.000000000 +0100
@@ -610,8 +610,8 @@
     /* Construct the list of messages that actually change state */
     while (messages) {
 	message = LIBBALSA_MESSAGE(messages->data);
-	if ( (set && (message->flags & LIBBALSA_MESSAGE_FLAG_NEW)) ||
-	     (!set && !(message->flags & LIBBALSA_MESSAGE_FLAG_NEW)) )
+	if ( (set && (LIBBALSA_MESSAGE_IS_UNREAD(message))) ||
+	     (!set && !(LIBBALSA_MESSAGE_IS_UNREAD(message))) )
 	    notif_list = g_list_prepend(notif_list, message);
 	messages = g_list_next(messages);
     }
@@ -660,8 +660,8 @@
     /* Construct the list of messages that actually change state */
     while (messages) {
 	message = LIBBALSA_MESSAGE(messages->data);
-	if ( (flag && !(message->flags & LIBBALSA_MESSAGE_FLAG_FLAGGED)) ||
-	     (!flag && (message->flags & LIBBALSA_MESSAGE_FLAG_FLAGGED)) )
+	if ( (flag && !(LIBBALSA_MESSAGE_IS_FLAGGED(message))) ||
+	     (!flag && (LIBBALSA_MESSAGE_IS_FLAGGED(message))) )
 	    notif_list = g_list_prepend(notif_list, message);
 	messages = g_list_next(messages);
     }
@@ -707,8 +707,8 @@
     /* Construct the list of messages that actually change state */
     while (messages) {
         message = LIBBALSA_MESSAGE(messages->data);
-        if ((del && !(message->flags & LIBBALSA_MESSAGE_FLAG_DELETED))
-            || (!del && (message->flags & LIBBALSA_MESSAGE_FLAG_DELETED)))
+        if ((del && !(LIBBALSA_MESSAGE_IS_DELETED(message)))
+            || (!del && (LIBBALSA_MESSAGE_IS_DELETED(message))))
             notif_list = g_list_prepend(notif_list, message);
         messages = g_list_next(messages);
     }
@@ -871,7 +871,7 @@
     /*
      * emit read message
      */
-    if ((message->flags & LIBBALSA_MESSAGE_FLAG_NEW) && read) {
+    if ((LIBBALSA_MESSAGE_IS_UNREAD(message)) && read) {
 	GList * messages = g_list_prepend(NULL, message);
 	
 	libbalsa_messages_read(messages, TRUE);
diff -r -u balsa-cvs-arch/libbalsa/message.h balsa-flags/libbalsa/message.h
--- balsa-cvs-arch/libbalsa/message.h	2003-01-28 21:01:10.000000000 +0100
+++ balsa-flags/libbalsa/message.h	2003-03-01 16:40:04.000000000 +0100
@@ -138,6 +138,8 @@
     LIBBALSA_MESSAGE_HAS_FLAG(message, LIBBALSA_MESSAGE_FLAG_REPLIED)
 #define LIBBALSA_MESSAGE_IS_FLAGGED(message) \
     LIBBALSA_MESSAGE_HAS_FLAG(message, LIBBALSA_MESSAGE_FLAG_FLAGGED)
+#define LIBBALSA_MESSAGE_IS_SEEN(message) \
+    ((message)->header->old)
 
 struct _LibBalsaMessageClass {
     GObjectClass parent_class;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]