/*
* Implements IMAP's gratuitously complex SEARCH command.
*
+ * Copyright (c) 2001-2012 by the citadel.org team
*
- * Copyright (c) 2001-2009 by the citadel.org team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
+ * 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.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ *
+ *
*/
#include "ctdl_module.h"
need_to_free_msg = 1;
}
if (msg != NULL) {
- fieldptr = rfc822_fetch_field(msg->cm_fields['M'], "Bcc");
+ fieldptr = rfc822_fetch_field(msg->cm_fields[eMesageText], "Bcc");
if (fieldptr != NULL) {
if (bmstrcasestr(fieldptr, itemlist[pos+1].Key)) {
match = 1;
need_to_free_msg = 1;
}
if (msg != NULL) {
- if (msg->cm_fields['T'] != NULL) {
+ if (!CM_IsEmpty(msg, eTimestamp)) {
if (imap_datecmp(itemlist[pos+1].Key,
- atol(msg->cm_fields['T'])) < 0) {
+ atol(msg->cm_fields[eTimestamp])) < 0) {
match = 1;
}
}
need_to_free_msg = 1;
}
if (msg != NULL) {
- if (bmstrcasestr(msg->cm_fields['M'], itemlist[pos+1].Key)) {
+ if (bmstrcasestr(msg->cm_fields[eMesageText], itemlist[pos+1].Key)) {
match = 1;
}
}
need_to_free_msg = 1;
}
if (msg != NULL) {
- fieldptr = msg->cm_fields['Y'];
+ fieldptr = msg->cm_fields[eCarbonCopY];
if (fieldptr != NULL) {
if (bmstrcasestr(fieldptr, itemlist[pos+1].Key)) {
match = 1;
}
}
else {
- fieldptr = rfc822_fetch_field(msg->cm_fields['M'], "Cc");
+ fieldptr = rfc822_fetch_field(msg->cm_fields[eMesageText], "Cc");
if (fieldptr != NULL) {
if (bmstrcasestr(fieldptr, itemlist[pos+1].Key)) {
match = 1;
need_to_free_msg = 1;
}
if (msg != NULL) {
- if (bmstrcasestr(msg->cm_fields['A'], itemlist[pos+1].Key)) {
+ if (bmstrcasestr(msg->cm_fields[eAuthor], itemlist[pos+1].Key)) {
match = 1;
}
- if (bmstrcasestr(msg->cm_fields['F'], itemlist[pos+1].Key)) {
+ if (bmstrcasestr(msg->cm_fields[erFc822Addr], itemlist[pos+1].Key)) {
match = 1;
}
}
need_to_free_msg = 1;
}
if (msg != NULL) {
- if (strlen(msg->cm_fields['M']) > atoi(itemlist[pos+1].Key)) {
+ if (msg->cm_lengths[eMesageText] > atoi(itemlist[pos+1].Key)) {
match = 1;
}
}
need_to_free_msg = 1;
}
if (msg != NULL) {
- if (msg->cm_fields['T'] != NULL) {
+ if (!CM_IsEmpty(msg, eTimestamp)) {
if (imap_datecmp(itemlist[pos+1].Key,
- atol(msg->cm_fields['T'])) == 0) {
+ atol(msg->cm_fields[eTimestamp])) == 0) {
match = 1;
}
}
need_to_free_msg = 1;
}
if (msg != NULL) {
- if (msg->cm_fields['T'] != NULL) {
+ if (!CM_IsEmpty(msg, eTimestamp)) {
if (imap_datecmp(itemlist[pos+1].Key,
- atol(msg->cm_fields['T'])) < 0) {
+ atol(msg->cm_fields[eTimestamp])) < 0) {
match = 1;
}
}
need_to_free_msg = 1;
}
if (msg != NULL) {
- if (msg->cm_fields['T'] != NULL) {
+ if (!CM_IsEmpty(msg, eTimestamp)) {
if (imap_datecmp(itemlist[pos+1].Key,
- atol(msg->cm_fields['T'])) == 0) {
+ atol(msg->cm_fields[eTimestamp])) == 0) {
match = 1;
}
}
need_to_free_msg = 1;
}
if (msg != NULL) {
- if (msg->cm_fields['T'] != NULL) {
+ if (!CM_IsEmpty(msg, eTimestamp)) {
if (imap_datecmp(itemlist[pos+1].Key,
- atol(msg->cm_fields['T'])) >= 0) {
+ atol(msg->cm_fields[eTimestamp])) >= 0) {
match = 1;
}
}
need_to_free_msg = 1;
}
if (msg != NULL) {
- if (msg->cm_fields['T'] != NULL) {
+ if (!CM_IsEmpty(msg, eTimestamp)) {
if (imap_datecmp(itemlist[pos+1].Key,
- atol(msg->cm_fields['T'])) >= 0) {
+ atol(msg->cm_fields[eTimestamp])) >= 0) {
match = 1;
}
}
need_to_free_msg = 1;
}
if (msg != NULL) {
- if (strlen(msg->cm_fields['M']) < atoi(itemlist[pos+1].Key)) {
+ if (msg->cm_lengths[eMesageText] < atoi(itemlist[pos+1].Key)) {
match = 1;
}
}
need_to_free_msg = 1;
}
if (msg != NULL) {
- if (bmstrcasestr(msg->cm_fields['U'], itemlist[pos+1].Key)) {
+ if (bmstrcasestr(msg->cm_fields[eMsgSubject], itemlist[pos+1].Key)) {
match = 1;
}
}
need_to_free_msg = 1;
}
if (msg != NULL) {
- if (bmstrcasestr(msg->cm_fields['R'], itemlist[pos+1].Key)) {
+ if (bmstrcasestr(msg->cm_fields[eRecipient], itemlist[pos+1].Key)) {
match = 1;
}
}
}
if (need_to_free_msg) {
- CtdlFreeMessage(msg);
+ CM_Free(msg);
}
return(match);
}