* Change to EUID command syntax: returned msg num is now guaranteed to
authorArt Cancro <ajc@citadel.org>
Thu, 6 Oct 2005 19:47:00 +0000 (19:47 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 6 Oct 2005 19:47:00 +0000 (19:47 +0000)
  exist.

citadel/ChangeLog
citadel/euidindex.c
citadel/techdoc/protocol.txt

index 383dbe8c3bcd64d41a9e6cd04d85075f6a7a8264..a38867f8a1799d6a80b6f1f0b575d20790c33cb9 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
+Revision 655.25  2005/10/06 19:47:00  ajc
+* Change to EUID command syntax: returned msg num is now guaranteed to
+  exist.
+
 Revision 655.24  2005/10/06 19:16:31  ajc
 * Added the EUID command to search for a message by EUID
 
@@ -7211,3 +7215,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 cada83ac7591476a300c2c23feba6cefec0d2948..abab0383e49906b9561c1a613b73073174a962be 100644 (file)
@@ -190,16 +190,35 @@ void rebuild_euid_index(void) {
 void cmd_euid(char *cmdbuf) {
        char euid[256];
        long msgnum;
+        struct cdbdata *cdbfr;
+        long *msglist = NULL;
+        int num_msgs = 0;
+       int i;
 
        if (CtdlAccessCheck(ac_logged_in)) return;
 
        extract_token(euid, cmdbuf, 0, '|', sizeof euid);
        msgnum = locate_message_by_euid(euid, &CC->room);
-
-       if (msgnum > 0L) {
-               cprintf("%d %ld\n", CIT_OK, msgnum);
-       }
-       else {
+       if (msgnum <= 0L) {
                cprintf("%d not found\n", ERROR + MESSAGE_NOT_FOUND);
+               return;
+       }
+
+        cdbfr = cdb_fetch(CDB_MSGLISTS, &CC->room.QRnumber, sizeof(long));
+       if (cdbfr != NULL) {
+                num_msgs = cdbfr->len / sizeof(long);
+                msglist = (long *) cdbfr->ptr;
+                for (i = 0; i < num_msgs; ++i) {
+                        if (msglist[i] == msgnum) {
+                               cdb_free(cdbfr);
+                               cprintf("%d %ld\n", CIT_OK, msgnum);
+                               return;
+                       }
+               }
+                cdb_free(cdbfr);
        }
+
+       cprintf("%d not found\n", ERROR + MESSAGE_NOT_FOUND);
 }
+
+
index cc17b6388e31aea2030deb3e4e25e60cd7d18559..7dfcf40246c88165accbb7598d77a3c7b1c62c25 100644 (file)
@@ -2228,9 +2228,7 @@ change even when the message number changes due to an update.
 
  The format of this command is:  EUID <euid>
 
- If successful, EUID returns OK followed by a message number.  The message is
-*not* guaranteed to exist, because EUID indices are not immediately removed
-when a message is deleted.
+ If successful, EUID returns OK followed by a message number.
  If no message exists in the current room with the supplied EUID, the command
 returns ERROR+MESSAGE_NOT_FOUND.