From: Art Cancro Date: Wed, 4 Jan 2017 04:16:49 +0000 (-0500) Subject: Add hashes of message id and references to msgs commands with headers X-Git-Tag: v939~645 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=aa7209ff1c55e3aa78df4ba4818237f18d259c0f Add hashes of message id and references to msgs commands with headers --- diff --git a/citadel/citadel.h b/citadel/citadel.h index 19c159ca2..a21b32e6f 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -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 903 /* This version */ +#define REV_LEVEL 904 /* This version */ #define REV_MIN 591 /* Oldest compatible database */ #define EXPORT_REV_MIN 760 /* Oldest compatible export files */ #define LIBCITADEL_MIN 903 /* Minimum required version of libcitadel */ diff --git a/citadel/modules/ctdlproto/serv_messages.c b/citadel/modules/ctdlproto/serv_messages.c index a6ebdc4e1..dc221d66d 100644 --- a/citadel/modules/ctdlproto/serv_messages.c +++ b/citadel/modules/ctdlproto/serv_messages.c @@ -1,7 +1,7 @@ /* * represent messages to the citadel clients * - * Copyright (c) 1987-2015 by the citadel.org team + * Copyright (c) 1987-2017 by the citadel.org team * * This program is open source software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3. @@ -43,18 +43,33 @@ void headers_listing(long msgnum, void *userdata) msg = CtdlFetchMessage(msgnum, 0, 1); if (msg == NULL) { - cprintf("%ld|0|||||\n", msgnum); + cprintf("%ld|0|||||||\n", msgnum); return; } - cprintf("%ld|%s|%s|%s|%s|%s|\n", + // output all fields except the references hash + cprintf("%ld|%s|%s|%s|%s|%s|%d|", msgnum, (!CM_IsEmpty(msg, eTimestamp) ? msg->cm_fields[eTimestamp] : "0"), (!CM_IsEmpty(msg, eAuthor) ? msg->cm_fields[eAuthor] : ""), (!CM_IsEmpty(msg, eNodeName) ? msg->cm_fields[eNodeName] : ""), (!CM_IsEmpty(msg, erFc822Addr) ? msg->cm_fields[erFc822Addr] : ""), - (!CM_IsEmpty(msg, eMsgSubject) ? msg->cm_fields[eMsgSubject] : "") + (!CM_IsEmpty(msg, eMsgSubject) ? msg->cm_fields[eMsgSubject] : ""), + (!CM_IsEmpty(msg, emessageId) ? HashLittle(msg->cm_fields[emessageId],strlen(msg->cm_fields[emessageId])) : 0) ); + + // output the references hash (yes it's ok that we're trashing the source buffer by doing this) + if (!CM_IsEmpty(msg, eWeferences)) { + char *token; + char *rest = msg->cm_fields[eWeferences]; + char *prev = rest; + while((token = strtok_r(rest, "|", &rest))) { + cprintf("%d%s", HashLittle(token,rest-prev-(*rest==0?0:1)), (*rest==0?"":",")); + prev = rest; + } + } + + cprintf("|\n"); CM_Free(msg); }