Accidentally merged the configdb branch into master. Reverting.
[citadel.git] / citadel / modules / imap / imap_search.c
index 387e747c9e080eb67a353b9418cff4b1872bf8a5..cad499ceb63ad2091768ae552a5d8c99b2243758 100644 (file)
@@ -142,7 +142,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
                        need_to_free_msg = 1;
                }
                if (msg != NULL) {
-                       if (msg->cm_fields[eTimestamp] != NULL) {
+                       if (!CM_IsEmpty(msg, eTimestamp)) {
                                if (imap_datecmp(itemlist[pos+1].Key,
                                                atol(msg->cm_fields[eTimestamp])) < 0) {
                                        match = 1;
@@ -281,7 +281,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
                        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;
                        }
                }
@@ -308,7 +308,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
                        need_to_free_msg = 1;
                }
                if (msg != NULL) {
-                       if (msg->cm_fields[eTimestamp] != NULL) {
+                       if (!CM_IsEmpty(msg, eTimestamp)) {
                                if (imap_datecmp(itemlist[pos+1].Key,
                                                atol(msg->cm_fields[eTimestamp])) == 0) {
                                        match = 1;
@@ -338,7 +338,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
                        need_to_free_msg = 1;
                }
                if (msg != NULL) {
-                       if (msg->cm_fields[eTimestamp] != NULL) {
+                       if (!CM_IsEmpty(msg, eTimestamp)) {
                                if (imap_datecmp(itemlist[pos+1].Key,
                                                atol(msg->cm_fields[eTimestamp])) < 0) {
                                        match = 1;
@@ -354,7 +354,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
                        need_to_free_msg = 1;
                }
                if (msg != NULL) {
-                       if (msg->cm_fields[eTimestamp] != NULL) {
+                       if (!CM_IsEmpty(msg, eTimestamp)) {
                                if (imap_datecmp(itemlist[pos+1].Key,
                                                atol(msg->cm_fields[eTimestamp])) == 0) {
                                        match = 1;
@@ -370,7 +370,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
                        need_to_free_msg = 1;
                }
                if (msg != NULL) {
-                       if (msg->cm_fields[eTimestamp] != NULL) {
+                       if (!CM_IsEmpty(msg, eTimestamp)) {
                                if (imap_datecmp(itemlist[pos+1].Key,
                                                atol(msg->cm_fields[eTimestamp])) >= 0) {
                                        match = 1;
@@ -386,7 +386,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
                        need_to_free_msg = 1;
                }
                if (msg != NULL) {
-                       if (msg->cm_fields[eTimestamp] != NULL) {
+                       if (!CM_IsEmpty(msg, eTimestamp)) {
                                if (imap_datecmp(itemlist[pos+1].Key,
                                                atol(msg->cm_fields[eTimestamp])) >= 0) {
                                        match = 1;
@@ -402,7 +402,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
                        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;
                        }
                }
@@ -531,7 +531,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
        }
 
        if (need_to_free_msg) {
-               CtdlFreeMessage(msg);
+               CM_Free(msg);
        }
        return(match);
 }