* MOVE command can now move multiple messages at a time
authorArt Cancro <ajc@citadel.org>
Sat, 5 Aug 2006 04:13:47 +0000 (04:13 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 5 Aug 2006 04:13:47 +0000 (04:13 +0000)
* Bumped internal version number to 6.83

citadel/citadel.h
citadel/msgbase.c
citadel/serv_newuser.c
citadel/techdoc/protocol.txt

index 8229d9d97af3b1ca7f3a49a8229be66838256478..e4e5d894c3d7b433562d59e4ab6c2d0f40b2aeb9 100644 (file)
@@ -33,7 +33,7 @@ extern "C" {
 /*
  * Text description of this software
  */
-#define CITADEL        "Citadel 6.82"
+#define CITADEL        "Citadel 6.83"
 
 /*
  * 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      682             /* This version */
+#define REV_LEVEL      683             /* This version */
 #define REV_MIN                591             /* Oldest compatible database */
 #define EXPORT_REV_MIN 655             /* Oldest compatible export files */
 
index c70b08e763acb934567ead79729eab0b3261d449..c91ead1c1bd3cdbc58c4d432759205d1148c9aff 100644 (file)
@@ -3474,15 +3474,26 @@ int CtdlCopyMsgsToRoom(long *msgnums, int num_msgs, char *dest) {
  */
 void cmd_move(char *args)
 {
-       long num;
+       char msgset[SIZ];
+       char msgtok[32];
+       long *msgs;
+       int num_msgs = 0;
+
        char targ[ROOMNAMELEN];
        struct ctdlroom qtemp;
        int err;
        int is_copy = 0;
        int ra;
        int permit = 0;
+       int i;
+
+       extract_token(msgset, args, 0, '|', sizeof msgset);
+       num_msgs = num_tokens(msgset, ',');
+       if (num_msgs < 1) {
+               cprintf("%d Nothing to do.\n", CIT_OK);
+               return;
+       }
 
-       num = extract_long(args, 0);
        extract_token(targ, args, 1, '|', sizeof targ);
        convert_room_name_macros(targ, sizeof targ);
        targ[ROOMNAMELEN - 1] = 0;
@@ -3526,10 +3537,23 @@ void cmd_move(char *args)
                return;
        }
 
-       err = CtdlCopyMsgsToRoom(&num, 1, targ);
+       /*
+        * Build our message set to be moved/copied
+        */
+       msgs = malloc(num_msgs * sizeof(long));
+       for (i=0; i<num_msgs; ++i) {
+               extract_token(msgtok, msgset, i, ',', sizeof msgtok);
+               msgs[i] = atol(msgtok);
+       }
+
+       /*
+        * Do the copy
+        */
+       err = CtdlCopyMsgsToRoom(msgs, num_msgs, targ);
        if (err != 0) {
-               cprintf("%d Cannot store message in %s: error %d\n",
+               cprintf("%d Cannot store message(s) in %s: error %d\n",
                        err, targ, err);
+               free(msgs);
                return;
        }
 
@@ -3537,10 +3561,11 @@ void cmd_move(char *args)
         * if this is a 'move' rather than a 'copy' operation.
         */
        if (is_copy == 0) {
-               CtdlDeleteMessages(CC->room.QRname, &num, 1, "", 0);
+               CtdlDeleteMessages(CC->room.QRname, msgs, num_msgs, "", 0);
        }
+       free(msgs);
 
-       cprintf("%d Message %s.\n", CIT_OK, (is_copy ? "copied" : "moved") );
+       cprintf("%d Message(s) %s.\n", CIT_OK, (is_copy ? "copied" : "moved") );
 }
 
 
index da223f59fb6b1d9cf41d89c7c46eecd9bc1841b6..b1dc2d5bfc993479be52b1d04bf62395bb22cdb2 100644 (file)
@@ -59,7 +59,6 @@ void CopyNewUserGreetings(void) {
        struct cdbdata *cdbfr;
        long *msglist = NULL;
        int num_msgs = 0;
-       int i;
        char mailboxname[ROOMNAMELEN];
 
 
index 7bf2fffb8bfe45ad68688a8660326233b2ec41b1..9fb0e3e80e039a11ead4b89405035b16119a87f9 100644 (file)
@@ -904,7 +904,7 @@ base.
 
  Move or copy a message to a different room.  This command expects to be
 passed three arguments:
- 0: the message number of the message to be moved or copied.
+ 0: the message number(s) of the message to be moved or copied.
  1: the name of the target room.
  2: flag: 0 to move the message, 1 to copy it without deleting from the
     source room.
@@ -912,6 +912,9 @@ passed three arguments:
  This command never creates or deletes copies of a message; it merely moves
 around links.  When a message is moved, its reference count remains the same.
 When a message is copied, its reference count is incremented.
+ You can move/copy multiple messages with a single command by separating the
+message numbers with commas; for example:  MOVE 112,113,114|Trash|0
 
 
  KILL   (KILL current room)