memset(&ird, 0, sizeof ird);
strcpy(ird.desired_partnum, partnum);
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_locate_part, /* callback function */
- NULL, NULL,
- (void *) &ird, /* user data */
- 0
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_locate_part, /* callback function */
+ NULL, NULL,
+ (void *) &ird, /* user data */
+ 0
);
/* We're done with the incoming message, because we now have a
return(2); /* internal error */
}
oec.c = NULL;
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_locate_original_event, /* callback function */
- NULL, NULL,
- &oec, /* user data */
- 0
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_locate_original_event, /* callback function */
+ NULL, NULL,
+ &oec, /* user data */
+ 0
);
CM_Free(msg);
memset(&ird, 0, sizeof ird);
strcpy(ird.desired_partnum, partnum);
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_locate_part, /* callback function */
- NULL, NULL,
- (void *) &ird, /* user data */
- 0
- );
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_locate_part, /* callback function */
+ NULL, NULL,
+ (void *) &ird, /* user data */
+ 0
+ );
/* We're done with the incoming message, because we now have a
* calendar object in memory.
if (msg == NULL) return;
memset(&ird, 0, sizeof ird);
strcpy(ird.desired_partnum, "_HUNT_");
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_locate_part, /* callback function */
- NULL, NULL,
- (void *) &ird, /* user data */
- 0
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_locate_part, /* callback function */
+ NULL, NULL,
+ (void *) &ird, /* user data */
+ 0
);
CM_Free(msg);
memset(&ird, 0, sizeof ird);
strcpy(ird.desired_partnum, partnum);
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_locate_part, /* callback function */
- NULL, NULL,
- (void *) &ird, /* user data */
- 0
- );
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_locate_part, /* callback function */
+ NULL, NULL,
+ (void *) &ird, /* user data */
+ 0
+ );
CM_Free(msg);
if (msg == NULL) return;
memset(&ird, 0, sizeof ird);
strcpy(ird.desired_partnum, "_HUNT_");
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_locate_part, /* callback function */
- NULL, NULL,
- (void *) &ird, /* user data */
- 0
- );
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_locate_part, /* callback function */
+ NULL, NULL,
+ (void *) &ird, /* user data */
+ 0
+ );
CM_Free(msg);
if (ird.cal) {
if (msg == NULL) return;
memset(&ird, 0, sizeof ird);
strcpy(ird.desired_partnum, "_HUNT_");
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_locate_part, /* callback function */
- NULL, NULL,
- (void *) &ird, /* user data */
- 0
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_locate_part, /* callback function */
+ NULL, NULL,
+ (void *) &ird, /* user data */
+ 0
);
CM_Free(msg);
}
/* Do all of our lovely back-end parsing */
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_obj_beforesave_backend,
- NULL, NULL,
- (void *)msg,
- 0
- );
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_obj_beforesave_backend,
+ NULL, NULL,
+ (void *)msg,
+ 0
+ );
return(0);
}
if (CM_IsEmpty(msg, eMesageText)) return(1);
/* Now recurse through it looking for our icalendar data */
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *ical_obj_aftersave_backend,
- NULL, NULL,
- NULL,
- 0
- );
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *ical_obj_aftersave_backend,
+ NULL, NULL,
+ NULL,
+ 0
+ );
return(0);
}
* (Note value of 1 passed as 'dont_decode' so client gets it encoded)
*/
else {
- mime_parser(msg->cm_fields[eMesageText], NULL,
+ mime_parser(CM_RANGE(msg, eMesageText),
*imap_load_part, NULL, NULL,
section,
1
/* For messages already stored in RFC822 format, we have to parse. */
IAPuts("BODYSTRUCTURE ");
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *imap_fetch_bodystructure_part, /* part */
- *imap_fetch_bodystructure_pre, /* pre-multi */
- *imap_fetch_bodystructure_post, /* post-multi */
- NULL,
- 1); /* don't decode -- we want it as-is */
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *imap_fetch_bodystructure_part, /* part */
+ *imap_fetch_bodystructure_pre, /* pre-multi */
+ *imap_fetch_bodystructure_post, /* post-multi */
+ NULL,
+ 1); /* don't decode -- we want it as-is */
}
/* Modern clients are using vNote format. Check for one... */
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *notes_extract_vnote,
- NULL, NULL,
- &v, /* user data ptr - put the vnote here */
- 0
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *notes_extract_vnote,
+ NULL, NULL,
+ &v, /* user data ptr - put the vnote here */
+ 0
);
if (v == NULL) return(0); /* no vNotes were found in this message */
if (CM_IsEmpty(msg, eMesageText)) return(0);
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *vcard_extract_vcard,
- NULL, NULL,
- &v, /* user data ptr - put the vcard here */
- 0
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *vcard_extract_vcard,
+ NULL, NULL,
+ &v, /* user data ptr - put the vcard here */
+ 0
);
if (v == NULL) return(0); /* no vCards were found in this message */
msg = CtdlFetchMessage(msgnum, 1);
if (msg == NULL) return;
- mime_parser(msg->cm_fields[eMesageText],
- NULL,
- *dvca_mime_callback, /* callback function */
- NULL, NULL,
- NULL, /* user data */
- 0
- );
+ mime_parser(CM_RANGE(msg, eMesageText),
+ *dvca_mime_callback, /* callback function */
+ NULL, NULL,
+ NULL, /* user data */
+ 0
+ );
CM_Free(msg);
}
cprintf("%d Revision history for '%s'\n", LISTING_FOLLOWS, pagename);
- mime_parser(msg->cm_fields[eMesageText], NULL, *wiki_history_callback, NULL, NULL, NULL, 0);
+ mime_parser(CM_RANGE(msg, eMesageText), *wiki_history_callback, NULL, NULL, NULL, 0);
cprintf("000\n");
CM_Free(msg);
hecbd.stop_when = rev;
striplt(hecbd.stop_when);
- mime_parser(msg->cm_fields[eMesageText], NULL, *wiki_rev_callback, NULL, NULL, (void *)&hecbd, 0);
+ mime_parser(CM_RANGE(msg, eMesageText), *wiki_rev_callback, NULL, NULL, (void *)&hecbd, 0);
CM_Free(msg);
/* Were we successful? */
if (section) if (!IsEmptyStr(section)) if (strcmp(section, "0")) {
memset(&encap, 0, sizeof encap);
safestrncpy(encap.desired_section, section, sizeof encap.desired_section);
- mime_parser(TheMessage->cm_fields[eMesageText],
- NULL,
- *extract_encapsulated_message,
- NULL, NULL, (void *)&encap, 0
- );
+ mime_parser(CM_RANGE(TheMessage, eMesageText),
+ *extract_encapsulated_message,
+ NULL, NULL, (void *)&encap, 0
+ );
if ((Author != NULL) && (*Author == NULL))
{
) {
struct CitContext *CCC = CC;
int i;
- char *mptr = NULL;
const char *nl; /* newline string */
struct ma_info ma;
ERROR + RESOURCE_BUSY);
} else {
/* Parse the message text component */
- mptr = TheMessage->cm_fields[eMesageText];
- mime_parser(mptr, NULL, *mime_download, NULL, NULL, NULL, 0);
+ mime_parser(CM_RANGE(TheMessage, eMesageText),
+ *mime_download, NULL, NULL, NULL, 0);
/* If there's no file open by this time, the requested
* section wasn't found, so print an error
*/
/* Parse the message text component */
int found_it = 0;
- mptr = TheMessage->cm_fields[eMesageText];
- mime_parser(mptr, NULL, *mime_spew_section, NULL, NULL, (void *)&found_it, 0);
+ mime_parser(CM_RANGE(TheMessage, eMesageText),
+ *mime_spew_section, NULL, NULL, (void *)&found_it, 0);
/* If section wasn't found, print an error
*/
if (!found_it) {
/* Tell the client about the MIME parts in this message */
if (TheMessage->cm_format_type == FMT_RFC822) {
if ( (mode == MT_CITADEL) || (mode == MT_MIME) ) {
- mptr = TheMessage->cm_fields[eMesageText];
memset(&ma, 0, sizeof(struct ma_info));
- mime_parser(mptr, NULL,
+ mime_parser(CM_RANGE(TheMessage, eMesageText),
(do_proto ? *list_this_part : NULL),
(do_proto ? *list_this_pref : NULL),
(do_proto ? *list_this_suff : NULL),
* message to the reader's screen width.
*/
if (TheMessage->cm_format_type == FMT_CITADEL) {
- mptr = TheMessage->cm_fields[eMesageText];
-
if (mode == MT_MIME) {
cprintf("Content-type: text/x-citadel-variformat\n\n");
}
- memfmout(mptr, nl);
+ memfmout(TheMessage->cm_fields[eMesageText], nl);
}
/* If the message on disk is format 4 (MIME), we've gotta hand it
strcpy(ma.chosen_part, "1");
ma.chosen_pref = 9999;
ma.dont_decode = CCC->msg4_dont_decode;
- mime_parser(mptr, NULL,
- *choose_preferred, *fixed_output_pre,
- *fixed_output_post, (void *)&ma, 1);
- mime_parser(mptr, NULL,
- *output_preferred, NULL, NULL, (void *)&ma, 1);
+ mime_parser(CM_RANGE(TheMessage, eMesageText),
+ *choose_preferred, *fixed_output_pre,
+ *fixed_output_post, (void *)&ma, 1);
+ mime_parser(CM_RANGE(TheMessage, eMesageText),
+ *output_preferred, NULL, NULL, (void *)&ma, 1);
}
else {
ma.use_fo_hooks = 1;
- mime_parser(mptr, NULL,
- *fixed_output, *fixed_output_pre,
- *fixed_output_post, (void *)&ma, 0);
+ mime_parser(CM_RANGE(TheMessage, eMesageText),
+ *fixed_output, *fixed_output_pre,
+ *fixed_output_post, (void *)&ma, 0);
}
}
int CM_IsValidMsg (struct CtdlMessage *msg);
#define CM_KEY(Message, Which) Message->cm_fields[Which], Message->cm_lengths[Which]
+#define CM_RANGE(Message, Which) Message->cm_fields[Which], \
+ Message->cm_fields[Which] + Message->cm_lengths[Which]
void CtdlSerializeMessage(struct ser_ret *, struct CtdlMessage *);
void ReplicationChecks(struct CtdlMessage *);