* Fixed bug #149 (incorrect sequence set optimization, resulting in
authorArt Cancro <ajc@citadel.org>
Wed, 6 Jul 2005 21:41:18 +0000 (21:41 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 6 Jul 2005 21:41:18 +0000 (21:41 +0000)
  messages being marked as read/unread incorrectly during IMAP sessions)

citadel/ChangeLog
citadel/citadel.h
citadel/citadel.nsi
citadel/citadel.spec
citadel/msgbase.c

index 96cf16a5e2c44801701bfdf167fae9eb7ed18d7c..0d0c6fa8d4c2ea335f0ff5f1227799048c01bdb0 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
+Revision 652.1  2005/07/06 21:41:17  ajc
+* Fixed bug #149 (incorrect sequence set optimization, resulting in
+  messages being marked as read/unread incorrectly during IMAP sessions)
+
 Revision 652.0  2005/07/06 02:28:38  ajc
 * THIS IS 6.52
 
@@ -6909,3 +6913,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index 8907a4000098f5236d493617a752cea04295804e..468244b8f912548b1f82253b90ef7cd036e34e8b 100644 (file)
@@ -33,7 +33,7 @@ extern "C" {
 /*
  * Text description of this software
  */
-#define CITADEL        "Citadel 6.52"
+#define CITADEL        "Citadel 6.53"
 
 /*
  * REV_LEVEL is the current version number (multiplied by 100 to avoid having
@@ -45,7 +45,7 @@ extern "C" {
  * usually more strict because you're not really supposed to dump/load and
  * upgrade at the same time.
  */
-#define REV_LEVEL      652             /* This version */
+#define REV_LEVEL      653             /* This version */
 #define REV_MIN                591             /* Oldest compatible database */
 #define EXPORT_REV_MIN 652             /* Oldest compatible export files */
 
index e4ef32dc60e962040817e6f2851bf5702a476891..da8a79fec7e5b34e454276d57d9385b9bc4453b5 100644 (file)
@@ -4,7 +4,7 @@
 
 !include "${NSISDIR}\Contrib\Modern UI\System.nsh"
 !define MUI_PRODUCT "Citadel"
-!define MUI_VERSION "6.52"
+!define MUI_VERSION "6.53"
 !define MUI_WELCOMEPAGE
 !define MUI_LICENSEPAGE
 !define MUI_COMPONENTSPAGE
@@ -18,7 +18,7 @@
 ;!define MUI_ICON "${NSISDIR}\Contrib\Icons\modern-install.ico"
 ;!define MUI_UNICON "${NSISDIR}\Contrib\Icons\modern-uninstall.ico"
 
-OutFile "citadel-6.52.exe"
+OutFile "citadel-6.53.exe"
 BGGradient off
 
 LangString DESC_Citadel ${LANG_ENGLISH} "Citadel client and core libraries (required)"
index 64cdd7ecc3d1beb3246d216d76686b019dcfb175..96e6b807fc0cdacc6407f1a2d1020100dbe0a01f 100644 (file)
@@ -1,7 +1,7 @@
 # $Id$
 Summary: Citadel, the flexible, powerful way to build online communities
 Name: citadel
-Version: 6.52
+Version: 6.53
 Release: 1
 Copyright: GPL
 Group: Applications/Communications
index 1f351773849800d01f7a52019c7c22f96c389efb..f03ed44a2728ab6ede2a91b35ee54ff4835df70d 100644 (file)
@@ -311,7 +311,7 @@ void CtdlSetSeen(long target_msgnum, int target_setting, int which_set,
        struct cdbdata *cdbfr;
        int i, j;
        int is_seen = 0;
-       int was_seen = 1;
+       int was_seen = 0;
        long lo = (-1L);
        long hi = (-1L);
        long t = (-1L);
@@ -324,6 +324,7 @@ void CtdlSetSeen(long target_msgnum, int target_setting, int which_set,
        int num_sets;
        int s;
        char setstr[SIZ], lostr[SIZ], histr[SIZ];
+       size_t tmp;
 
        lprintf(CTDL_DEBUG, "CtdlSetSeen(%ld, %d, %d)\n",
                target_msgnum, target_setting, which_set);
@@ -358,7 +359,7 @@ void CtdlSetSeen(long target_msgnum, int target_setting, int which_set,
                        break;
        }
 
-       lprintf(CTDL_DEBUG, "before optimize: %s\n", vset);
+       /* lprintf(CTDL_DEBUG, "before optimize: %s\n", vset); */
 
        /* Translate the existing sequence set into an array of booleans */
        num_sets = num_tokens(vset, ',');
@@ -387,6 +388,8 @@ void CtdlSetSeen(long target_msgnum, int target_setting, int which_set,
 
        /* Now translate the array of booleans back into a sequence set */
        strcpy(vset, "");
+       lo = (-1L);
+       hi = (-1L);
 
        for (i=0; i<num_msgs; ++i) {
                is_seen = 0;
@@ -395,19 +398,18 @@ void CtdlSetSeen(long target_msgnum, int target_setting, int which_set,
                        is_seen = target_setting;
                }
                else {
-                       if (is_set[i]) {
-                               is_seen = 1;
-                       }
+                       is_seen = is_set[i];
                }
 
-               if (is_seen == 1) {
+               if (is_seen) {
                        if (lo < 0L) lo = msglist[i];
                        hi = msglist[i];
                }
+
                if (  ((is_seen == 0) && (was_seen == 1))
                   || ((is_seen == 1) && (i == num_msgs-1)) ) {
-                       size_t tmp;
 
+                       /* begin trim-o-matic code */
                        j=9;
                        trimming = 0;
                        while ( (strlen(vset) + 20) > sizeof vset) {
@@ -423,17 +425,19 @@ void CtdlSetSeen(long target_msgnum, int target_setting, int which_set,
                                        "1:%ld,%s", t, vset);
                                safestrncpy(vset, lostr, sizeof vset);
                        }
+                       /* end trim-o-matic code */
+
                        tmp = strlen(vset);
                        if (tmp > 0) {
                                strcat(vset, ",");
-                               tmp++;
+                               ++tmp;
                        }
                        if (lo == hi) {
-                               snprintf(&vset[tmp], sizeof vset - tmp,
+                               snprintf(&vset[tmp], (sizeof vset) - tmp,
                                         "%ld", lo);
                        }
                        else {
-                               snprintf(&vset[tmp], sizeof vset - tmp,
+                               snprintf(&vset[tmp], (sizeof vset) - tmp,
                                         "%ld:%ld", lo, hi);
                        }
                        lo = (-1L);
@@ -454,7 +458,7 @@ void CtdlSetSeen(long target_msgnum, int target_setting, int which_set,
        }
        free(is_set);
 
-       lprintf(CTDL_DEBUG, " after optimize: %s\n", vset);
+       /* lprintf(CTDL_DEBUG, " after optimize: %s\n", vset); */
        free(msglist);
        CtdlSetRelationship(&vbuf,
                ((which_user != NULL) ? which_user : &CC->user),