if we hit an invalid message pointer during a search operation.
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
- fieldptr = rfc822_fetch_field(msg->cm_fields['M'], "Bcc");
- if (fieldptr != NULL) {
- if (bmstrcasestr(fieldptr, itemlist[pos+1])) {
- match = 1;
+ if (msg != NULL) {
+ fieldptr = rfc822_fetch_field(msg->cm_fields['M'], "Bcc");
+ if (fieldptr != NULL) {
+ if (bmstrcasestr(fieldptr, itemlist[pos+1])) {
+ match = 1;
+ }
+ free(fieldptr);
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
- if (msg->cm_fields['T'] != NULL) {
- if (imap_datecmp(itemlist[pos+1],
- atol(msg->cm_fields['T'])) < 0) {
- match = 1;
+ if (msg != NULL) {
+ if (msg->cm_fields['T'] != NULL) {
+ if (imap_datecmp(itemlist[pos+1],
+ atol(msg->cm_fields['T'])) < 0) {
+ match = 1;
+ }
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
- if (bmstrcasestr(msg->cm_fields['M'], itemlist[pos+1])) {
- match = 1;
+ if (msg != NULL) {
+ if (bmstrcasestr(msg->cm_fields['M'], itemlist[pos+1])) {
+ match = 1;
+ }
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
- fieldptr = msg->cm_fields['Y'];
- if (fieldptr != NULL) {
- if (bmstrcasestr(fieldptr, itemlist[pos+1])) {
- match = 1;
- }
- }
- else {
- fieldptr = rfc822_fetch_field(msg->cm_fields['M'], "Cc");
+ if (msg != NULL) {
+ fieldptr = msg->cm_fields['Y'];
if (fieldptr != NULL) {
if (bmstrcasestr(fieldptr, itemlist[pos+1])) {
match = 1;
}
if (fieldptr != NULL) {
if (bmstrcasestr(fieldptr, itemlist[pos+1])) {
match = 1;
}
+ }
+ else {
+ fieldptr = rfc822_fetch_field(msg->cm_fields['M'], "Cc");
+ if (fieldptr != NULL) {
+ if (bmstrcasestr(fieldptr, itemlist[pos+1])) {
+ match = 1;
+ }
+ free(fieldptr);
+ }
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
- if (bmstrcasestr(msg->cm_fields['A'], itemlist[pos+1])) {
- match = 1;
- }
- if (bmstrcasestr(msg->cm_fields['F'], itemlist[pos+1])) {
- match = 1;
+ if (msg != NULL) {
+ if (bmstrcasestr(msg->cm_fields['A'], itemlist[pos+1])) {
+ match = 1;
+ }
+ if (bmstrcasestr(msg->cm_fields['F'], itemlist[pos+1])) {
+ match = 1;
+ }
- CC->redirect_buffer = malloc(SIZ);
- CC->redirect_len = 0;
- CC->redirect_alloc = SIZ;
- CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ONLY, 0, 1);
-
- fieldptr = rfc822_fetch_field(CC->redirect_buffer, itemlist[pos+1]);
- if (fieldptr != NULL) {
- if (bmstrcasestr(fieldptr, itemlist[pos+2])) {
- match = 1;
+ if (msg != NULL) {
+
+ CC->redirect_buffer = malloc(SIZ);
+ CC->redirect_len = 0;
+ CC->redirect_alloc = SIZ;
+ CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ONLY, 0, 1);
+
+ fieldptr = rfc822_fetch_field(CC->redirect_buffer, itemlist[pos+1]);
+ if (fieldptr != NULL) {
+ if (bmstrcasestr(fieldptr, itemlist[pos+2])) {
+ match = 1;
+ }
+ free(fieldptr);
+
+ free(CC->redirect_buffer);
+ CC->redirect_buffer = NULL;
+ CC->redirect_len = 0;
+ CC->redirect_alloc = 0;
- free(CC->redirect_buffer);
- CC->redirect_buffer = NULL;
- CC->redirect_len = 0;
- CC->redirect_alloc = 0;
-
pos += 3; /* Yes, three */
}
else if (!strcasecmp(itemlist[pos], "KEYWORD")) {
pos += 3; /* Yes, three */
}
else if (!strcasecmp(itemlist[pos], "KEYWORD")) {
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
- if (strlen(msg->cm_fields['M']) > atoi(itemlist[pos+1])) {
- match = 1;
+ if (msg != NULL) {
+ if (strlen(msg->cm_fields['M']) > atoi(itemlist[pos+1])) {
+ match = 1;
+ }
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
- if (msg->cm_fields['T'] != NULL) {
- if (imap_datecmp(itemlist[pos+1],
- atol(msg->cm_fields['T'])) == 0) {
- match = 1;
+ if (msg != NULL) {
+ if (msg->cm_fields['T'] != NULL) {
+ if (imap_datecmp(itemlist[pos+1],
+ atol(msg->cm_fields['T'])) == 0) {
+ match = 1;
+ }
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
- if (msg->cm_fields['T'] != NULL) {
- if (imap_datecmp(itemlist[pos+1],
- atol(msg->cm_fields['T'])) < 0) {
- match = 1;
+ if (msg != NULL) {
+ if (msg->cm_fields['T'] != NULL) {
+ if (imap_datecmp(itemlist[pos+1],
+ atol(msg->cm_fields['T'])) < 0) {
+ match = 1;
+ }
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
- if (msg->cm_fields['T'] != NULL) {
- if (imap_datecmp(itemlist[pos+1],
- atol(msg->cm_fields['T'])) == 0) {
- match = 1;
+ if (msg != NULL) {
+ if (msg->cm_fields['T'] != NULL) {
+ if (imap_datecmp(itemlist[pos+1],
+ atol(msg->cm_fields['T'])) == 0) {
+ match = 1;
+ }
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
- if (msg->cm_fields['T'] != NULL) {
- if (imap_datecmp(itemlist[pos+1],
- atol(msg->cm_fields['T'])) >= 0) {
- match = 1;
+ if (msg != NULL) {
+ if (msg->cm_fields['T'] != NULL) {
+ if (imap_datecmp(itemlist[pos+1],
+ atol(msg->cm_fields['T'])) >= 0) {
+ match = 1;
+ }
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
- if (msg->cm_fields['T'] != NULL) {
- if (imap_datecmp(itemlist[pos+1],
- atol(msg->cm_fields['T'])) >= 0) {
- match = 1;
+ if (msg != NULL) {
+ if (msg->cm_fields['T'] != NULL) {
+ if (imap_datecmp(itemlist[pos+1],
+ atol(msg->cm_fields['T'])) >= 0) {
+ match = 1;
+ }
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
- if (strlen(msg->cm_fields['M']) < atoi(itemlist[pos+1])) {
- match = 1;
+ if (msg != NULL) {
+ if (strlen(msg->cm_fields['M']) < atoi(itemlist[pos+1])) {
+ match = 1;
+ }
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
- if (bmstrcasestr(msg->cm_fields['U'], itemlist[pos+1])) {
- match = 1;
+ if (msg != NULL) {
+ if (bmstrcasestr(msg->cm_fields['U'], itemlist[pos+1])) {
+ match = 1;
+ }
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
- for (i='A'; i<='Z'; ++i) {
- if (bmstrcasestr(msg->cm_fields[i], itemlist[pos+1])) {
- match = 1;
+ if (msg != NULL) {
+ for (i='A'; i<='Z'; ++i) {
+ if (bmstrcasestr(msg->cm_fields[i], itemlist[pos+1])) {
+ match = 1;
+ }
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
msg = CtdlFetchMessage(IMAP->msgids[seq-1], 1);
need_to_free_msg = 1;
}
- if (bmstrcasestr(msg->cm_fields['R'], itemlist[pos+1])) {
- match = 1;
+ if (msg != NULL) {
+ if (bmstrcasestr(msg->cm_fields['R'], itemlist[pos+1])) {
+ match = 1;
+ }
/* Here it is ... do each message! */
for (i=0; i<ft_num_msgs; ++i) {
/* Here it is ... do each message! */
for (i=0; i<ft_num_msgs; ++i) {
- if ((time(NULL) - last_progress) > 10) {
+ if (time(NULL) != last_progress) {
lprintf(CTDL_DEBUG,
"Indexed %d of %d messages (%d%%)\n",
i, ft_num_msgs,
lprintf(CTDL_DEBUG,
"Indexed %d of %d messages (%d%%)\n",
i, ft_num_msgs,
-
-
-/* temporary function to insert a bogus pointer in the lobbie */
-
-void cmd_bgus(char *argbuf)
-{
- long bogus = 9999999;
- CtdlSaveMsgPointersInRoom("Lobby", &bogus, 1, 0, NULL);
- cprintf("%d bogus\n", CIT_OK);
-}
-
-
-
/*
* This function is called to register the IMAP extension with Citadel.
*/
/*
* This function is called to register the IMAP extension with Citadel.
*/
NULL, imaps_greeting, imap_command_loop, NULL);
#endif
CtdlRegisterSessionHook(imap_cleanup_function, EVT_STOP);
NULL, imaps_greeting, imap_command_loop, NULL);
#endif
CtdlRegisterSessionHook(imap_cleanup_function, EVT_STOP);
- CtdlRegisterProtoHook(cmd_bgus, "BGUS", "bogus");