]> code.citadel.org Git - citadel.git/commitdiff
Merge branch 'IMAP_Flag_and_Purge_Fixes' into 'master'
authorArt Cancro <ajc@citadel.org>
Fri, 2 Jun 2023 19:23:41 +0000 (19:23 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 2 Jun 2023 19:23:41 +0000 (19:23 +0000)
Fixed imap_append() from clearing all flags on messages and avoid purge_user() from purging the wrong Visit records.

See merge request citadel/citadel!1

citadel/server/modules/imap/imap_misc.c
citadel/server/user_ops.c
citadel/utils/ctdl3264_prep.sh

index 8d785cb61784fc5b014f92a467c246ca5e7c600f..e91d748aaa0b1a77aa55697ea9092357757d27cd 100644 (file)
@@ -384,6 +384,9 @@ void imap_append(int num_parms, ConstStr *Params) {
                        new_msgnum = CtdlSubmitMsg(msg, NULL, "");
                }
                if (new_msgnum >= 0L) {
+                       if (IsEmptyStr(new_message_flags)) {
+                                       imap_do_append_flags(new_msgnum, new_message_flags);
+                       }
                        IReplyPrintf("OK [APPENDUID %ld %ld] APPEND completed",
                                     GLOBAL_UIDVALIDITY_VALUE, new_msgnum);
                }
@@ -405,8 +408,4 @@ void imap_append(int num_parms, ConstStr *Params) {
 
        /* We don't need this buffer anymore */
        CM_Free(msg);
-
-       if (IsEmptyStr(new_message_flags)) {
-               imap_do_append_flags(new_msgnum, new_message_flags);
-       }
 }
index e5eddf0698a0b854f3392429015921f0ddce5319..1a0aadf99dd0add90bf85ba875c04c8a31f7e27a 100644 (file)
@@ -871,7 +871,11 @@ int purge_user(char pname[]) {
        PerformUserHooks(&usbuf, EVT_PURGEUSER);
 
        // delete any existing user/room relationships
-       cdb_delete(CDB_VISIT, &usbuf.usernum, sizeof(long));
+       // Commenting out since it was assuming the user number was
+       //   at the top of the index.  Room number is actually first.
+       //   Auto-Purge will clean up the records later, so not worth
+       //   scanning all the records here.
+       //cdb_delete(CDB_VISIT, &usbuf.usernum, sizeof(long));
 
        // delete the users-by-number index record
        cdb_delete(CDB_USERSBYNUMBER, &usbuf.usernum, sizeof(long));
index 8a1cffc9d102048c5dd04ad27647e73d11344964..cb3a5bbd268c5b382e7c034a7dd8dd2fb7d345cd 100755 (executable)
@@ -6,11 +6,17 @@
 # Source our data structures from the real live working code
 SERVER_H=server/server.h
 
+tail_opt=
+tail +1 ${SERVER_H} > /dev/null 2>&1
+if [ $? != 0 ] ; then
+       tail_opt=-n
+fi
+
 # Generate the "32-bit" versions of these structures.
 # Note that this is specifically for converting "32-bit to 64-bit" -- NOT "any-to-any"
 convert_struct() {
        start_line=$(cat ${SERVER_H} | egrep -n "^struct $1 {" | cut -d: -f1)
-       tail +${start_line} ${SERVER_H} | sed '/};/q' \
+       tail ${tail_opt} +${start_line} ${SERVER_H} | sed '/};/q' \
        | sed s/"^struct $1 {"/"struct ${1}_32 {"/g \
        | sed s/"long "/"int32_t "/g \
        | sed s/"time_t "/"int32_t "/g \