$Log$
+Revision 655.24 2005/10/06 19:16:31 ajc
+* Added the EUID command to search for a message by EUID
+
Revision 655.23 2005/10/06 17:14:41 ajc
* newinstall.sh: prefer curl over wget
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
#include "policy.h"
#include "control.h"
#include "tools.h"
+#include "euidindex.h"
#ifndef HAVE_SNPRINTF
#include "snprintf.h"
cmd_rdir();
}
+ else if (!strncasecmp(cmdbuf,"EUID",4)) {
+ cmd_euid(&cmdbuf[5]);
+ }
+
else if (!strncasecmp(cmdbuf,"MSG0",4)) {
cmd_msg0(&cmdbuf[5]);
}
ForEachRoom(rebuild_euid_index_for_room, NULL); /* enumerate the room names */
rebuild_euid_index_for_room(NULL, NULL); /* now do indexing on them */
}
+
+
+
+/*
+ * Server command to fetch a message number given an euid.
+ */
+void cmd_euid(char *cmdbuf) {
+ char euid[256];
+ long msgnum;
+
+ 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 {
+ cprintf("%d not found\n", ERROR + MESSAGE_NOT_FOUND);
+ }
+}
long locate_message_by_euid(char *euid, struct ctdlroom *qrbuf);
void index_message_by_euid(char *euid, struct ctdlroom *qrbuf, long msgnum);
void rebuild_euid_index(void);
+void cmd_euid(char *cmdbuf);
+
Again, keep in mind that this is a temporary implementation and is not
guaranteed to continue to exist in this form.
+
+
+EUID (get message number using an EUID)}
+
+ Returns the message number, if present, of the message in the current room
+which is indexed using the supplied EUID (exclusive message ID). There can be
+only one message in a room with any given EUID; if another message arrives
+with the same EUID, the existing one is replaced. This makes it possible to
+reference things like calendar items using an immutable URL that does not
+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 no message exists in the current room with the supplied EUID, the command
+returns ERROR+MESSAGE_NOT_FOUND.
+