From 0fb5338232a4bf51b97efd6e156be1081559b93e Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sat, 5 Aug 2006 04:13:47 +0000 Subject: [PATCH] * MOVE command can now move multiple messages at a time * Bumped internal version number to 6.83 --- citadel/citadel.h | 4 ++-- citadel/msgbase.c | 37 ++++++++++++++++++++++++++++++------ citadel/serv_newuser.c | 1 - citadel/techdoc/protocol.txt | 5 ++++- 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/citadel/citadel.h b/citadel/citadel.h index 8229d9d97..e4e5d894c 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -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 */ diff --git a/citadel/msgbase.c b/citadel/msgbase.c index c70b08e76..c91ead1c1 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -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; iroom.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") ); } diff --git a/citadel/serv_newuser.c b/citadel/serv_newuser.c index da223f59f..b1dc2d5bf 100644 --- a/citadel/serv_newuser.c +++ b/citadel/serv_newuser.c @@ -59,7 +59,6 @@ void CopyNewUserGreetings(void) { struct cdbdata *cdbfr; long *msglist = NULL; int num_msgs = 0; - int i; char mailboxname[ROOMNAMELEN]; diff --git a/citadel/techdoc/protocol.txt b/citadel/techdoc/protocol.txt index 7bf2fffb8..9fb0e3e80 100644 --- a/citadel/techdoc/protocol.txt +++ b/citadel/techdoc/protocol.txt @@ -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) -- 2.39.2