Key to either usage mode for mtaDecodeMessage() is the inspection routine, pointed to with the inspect argument. The mtaDecodeMessage() routine presents each atomic message part to the inspection routine one line at a time. The presentation begins with the part’s header lines. Once all of the header lines have been presented, the lines of content are presented next. The following points should also be noted:
Message parts need not have any content. A common example is a single part message with no content for which the sender used the Subject: header line to express their message.
In the case of a non-multipart message, the message has a single part. The header for this sole part is the header for the message itself. As noted previously, there may or may not be any content to this single part.
In the case of a multipart message, individual parts need not have a part header. In such cases, MIME defaults apply and imply that the content is text/plain using the US-ASCII character set.
Regardless of the value of the Content-transfer-encoding: header line, the content presented will no longer be encoded.
In the case of a multipart message, the outermost header is not presented. However, it may be inspected by means of an output routine. For a discussion of the output routine, see Output Routine that follows.
The following code fragment shows the required syntax of an inspection routine:
int inspection_routine(void *ctx, mta_decode_t *dctx, int data_type, const char *data, size_t data_len); |
The following table lists each of the inspection routine’s arguments, and gives a description of each.