$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
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
+
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);
}
+
+
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.