/*
* Implements IMAP's gratuitously complex SEARCH command.
*
- * Copyright (c) 2001-2012 by the citadel.org team
+ * Copyright (c) 2001-2015 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.
- *
- *
+ * 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.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- *
- *
- *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*/
#include "ctdl_module.h"
else if (!strcasecmp(itemlist[pos].Key, "BCC")) {
if (msg == NULL) {
- msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+ msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
need_to_free_msg = 1;
}
if (msg != NULL) {
else if (!strcasecmp(itemlist[pos].Key, "BEFORE")) {
if (msg == NULL) {
- msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+ msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
need_to_free_msg = 1;
}
if (msg != NULL) {
/* If fulltext indexing is active, on this server,
* all messages have already been qualified.
*/
- if (config.c_enable_fulltext) {
+ if (CtdlGetConfigInt("c_enable_fulltext")) {
match = 1;
}
/* Otherwise, we have to do a slow search. */
else {
if (msg == NULL) {
- msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+ msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
need_to_free_msg = 1;
}
if (msg != NULL) {
else if (!strcasecmp(itemlist[pos].Key, "CC")) {
if (msg == NULL) {
- msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+ msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
need_to_free_msg = 1;
}
if (msg != NULL) {
else if (!strcasecmp(itemlist[pos].Key, "FROM")) {
if (msg == NULL) {
- msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+ msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
need_to_free_msg = 1;
}
if (msg != NULL) {
* examining the message body.
*/
if (msg == NULL) {
- msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+ msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
need_to_free_msg = 1;
}
else if (!strcasecmp(itemlist[pos].Key, "LARGER")) {
if (msg == NULL) {
- msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+ msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
need_to_free_msg = 1;
}
if (msg != NULL) {
- if (strlen(msg->cm_fields[eMesageText]) > atoi(itemlist[pos+1].Key)) {
+ if (msg->cm_lengths[eMesageText] > atoi(itemlist[pos+1].Key)) {
match = 1;
}
}
else if (!strcasecmp(itemlist[pos].Key, "ON")) {
if (msg == NULL) {
- msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+ msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
need_to_free_msg = 1;
}
if (msg != NULL) {
else if (!strcasecmp(itemlist[pos].Key, "SENTBEFORE")) {
if (msg == NULL) {
- msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+ msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
need_to_free_msg = 1;
}
if (msg != NULL) {
else if (!strcasecmp(itemlist[pos].Key, "SENTON")) {
if (msg == NULL) {
- msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+ msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
need_to_free_msg = 1;
}
if (msg != NULL) {
else if (!strcasecmp(itemlist[pos].Key, "SENTSINCE")) {
if (msg == NULL) {
- msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+ msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
need_to_free_msg = 1;
}
if (msg != NULL) {
else if (!strcasecmp(itemlist[pos].Key, "SINCE")) {
if (msg == NULL) {
- msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+ msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
need_to_free_msg = 1;
}
if (msg != NULL) {
else if (!strcasecmp(itemlist[pos].Key, "SMALLER")) {
if (msg == NULL) {
- msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+ msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
need_to_free_msg = 1;
}
if (msg != NULL) {
- if (strlen(msg->cm_fields[eMesageText]) < atoi(itemlist[pos+1].Key)) {
+ if (msg->cm_lengths[eMesageText] < atoi(itemlist[pos+1].Key)) {
match = 1;
}
}
else if (!strcasecmp(itemlist[pos].Key, "SUBJECT")) {
if (msg == NULL) {
- msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+ msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
need_to_free_msg = 1;
}
if (msg != NULL) {
else if (!strcasecmp(itemlist[pos].Key, "TEXT")) {
if (msg == NULL) {
- msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+ msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
need_to_free_msg = 1;
}
if (msg != NULL) {
else if (!strcasecmp(itemlist[pos].Key, "TO")) {
if (msg == NULL) {
- msg = CtdlFetchMessage(Imap->msgids[seq-1], 1);
+ msg = CtdlFetchMessage(Imap->msgids[seq-1], 1, 1);
need_to_free_msg = 1;
}
if (msg != NULL) {
* text index to disqualify messages that don't have any chance of
* matching. (Only do this if the index is enabled!!)
*/
- if (config.c_enable_fulltext) for (i=0; i<(num_items-1); ++i) {
+ if (CtdlGetConfigInt("c_enable_fulltext")) for (i=0; i<(num_items-1); ++i) {
if (!strcasecmp(itemlist[i].Key, "BODY")) {
CtdlModuleDoSearch(&fts_num_msgs, &fts_msgs, itemlist[i+1].Key, "fulltext");
if (fts_num_msgs > 0) {