From 252b61d61416a302548866728084dc0e21feea16 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 10 Nov 2009 03:58:32 +0000 Subject: [PATCH] * Added a new message field '1' which may be set by BeforeSave hooks. The presence of this field excludes the message from being included in the full text index. * Set this field on wiki history pages. --- citadel/modules/fulltext/serv_fulltext.c | 16 +++++++++++++++- citadel/modules/wiki/serv_wiki.c | 1 + citadel/techdoc/hack.txt | 11 +++-------- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/citadel/modules/fulltext/serv_fulltext.c b/citadel/modules/fulltext/serv_fulltext.c index d6d9d6439..c76671d8e 100644 --- a/citadel/modules/fulltext/serv_fulltext.c +++ b/citadel/modules/fulltext/serv_fulltext.c @@ -125,6 +125,19 @@ void ft_index_message(long msgnum, int op) { struct cdbdata *cdb_bucket; char *msgtext; int tok; + struct CtdlMessage *msg = NULL; + + msg = CtdlFetchMessage(msgnum, 1); + if (msg == NULL) { + CtdlLogPrintf(CTDL_ERR, "ft_index_message() could not load msg %ld\n", msgnum); + return; + } + + if (msg->cm_fields['1'] != NULL) { + CtdlLogPrintf(CTDL_DEBUG, "ft_index_message() excluded msg %ld\n", msgnum); + CtdlFreeMessage(msg); + return; + } CtdlLogPrintf(CTDL_DEBUG, "ft_index_message() %s msg %ld\n", (op ? "adding" : "removing") , msgnum @@ -136,7 +149,8 @@ void ft_index_message(long msgnum, int op) { CC->redirect_buffer = malloc(SIZ); CC->redirect_len = 0; CC->redirect_alloc = SIZ; - CtdlOutputMsg(msgnum, MT_CITADEL, HEADERS_ALL, 0, 1, NULL, 0); + CtdlOutputPreLoadedMsg(msg, MT_CITADEL, HEADERS_ALL, 0, 1, 0); + CtdlFreeMessage(msg); msgtext = CC->redirect_buffer; CC->redirect_buffer = NULL; CC->redirect_len = 0; diff --git a/citadel/modules/wiki/serv_wiki.c b/citadel/modules/wiki/serv_wiki.c index d3d071b41..b9e3ad454 100644 --- a/citadel/modules/wiki/serv_wiki.c +++ b/citadel/modules/wiki/serv_wiki.c @@ -218,6 +218,7 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) { history_msg->cm_fields['R'] = strdup(CCC->room.QRname); history_msg->cm_fields['E'] = strdup(history_page); history_msg->cm_fields['U'] = strdup(history_page); + history_msg->cm_fields['1'] = strdup("1"); /* suppress full text indexing */ snprintf(boundary, sizeof boundary, "Citadel--Multipart--%04x--%08lx", getpid(), time(NULL)); history_msg->cm_fields['M'] = malloc(1024); snprintf(history_msg->cm_fields['M'], 1024, diff --git a/citadel/techdoc/hack.txt b/citadel/techdoc/hack.txt index 52bbcb0e5..bf6715c5e 100644 --- a/citadel/techdoc/hack.txt +++ b/citadel/techdoc/hack.txt @@ -36,8 +36,6 @@ struct ctdluser { /* User record */ time_t lastcall; /* Last time the user called */ int USuserpurge; /* Purge time (in days) for user */ char fullname[64]; /* Name for Citadel messages & mail */ - CIT_UBYTE USscreenwidth; /* Screen width (for textmode users)*/ - CIT_UBYTE USscreenheight; /* Screen height(for textmode users)*/ }; Most fields here should be fairly self-explanatory. The ones that might @@ -53,11 +51,6 @@ important because it allows us to use this number in other data structures without having to worry about users being added/removed later on, as you'll see later in this document. - The screenwidth and screenheight fields are almost never used anymore. Back -when people were calling into dialup systems we had no way of knowing the -user's screen dimensions, but modern networks almost always transmit this -information so we set it up dynamically. - ROOM RECORDS ------------ @@ -276,7 +269,7 @@ S Special field Only meaningful for messages being spooled over a a message, but rather some other network function: -> "S" followed by "FILE" (followed by a null, of course) means that the message text is actually an - IGnet/Open file transfer. + IGnet/Open file transfer. (OBSOLETE) -> "S" followed by "CANCEL" means that this message should be deleted from the local message base once it has been replicated to all network systems. @@ -295,6 +288,8 @@ Y carbon copY Optional, and only in Mail messages. expected to fill in this field when rejecting a message with an explanation as to what happened (virus found, message looks like spam, etc.) +1 suppress index The presence of this field indicates that the message is + disqualified from being added to the full text index. EXAMPLE -- 2.30.2