struct imap_fetch_part {
- char desired_section[256];
+ char desired_section[SIZ];
FILE *output_fp;
};
}
void imap_fetch_internaldate(struct CtdlMessage *msg) {
- char buf[256];
+ char buf[SIZ];
time_t msgdate;
if (msg->cm_fields['T'] != NULL) {
* so we don't have to check for that condition like we do elsewhere.
*/
void imap_fetch_envelope(long msgnum, struct CtdlMessage *msg) {
- char datestringbuf[256];
+ char datestringbuf[SIZ];
time_t msgdate;
char *fieldptr = NULL;
if (partial[i]=='>') partial[i] = 0;
}
if (is_partial == 0) strcpy(partial, "");
- lprintf(9, "Partial is %s\n", partial);
+ if (strlen(partial) > 0) lprintf(9, "Partial is %s\n", partial);
tmp = tmpfile();
if (tmp == NULL) {
imfp.output_fp = tmp;
mime_parser(msg->cm_fields['M'], NULL,
- *imap_load_part,
+ *imap_load_part, NULL, NULL,
(void *)&imfp,
1);
}
}
}
+/*
+ * Called immediately before outputting a multipart bodystructure
+ */
+void imap_fetch_bodystructure_pre(
+ char *name, char *filename, char *partnum, char *disp,
+ void *content, char *cbtype, size_t length, char *encoding,
+ void *cbuserdata
+ ) {
+
+ cprintf("(");
+}
+
+
+
+/*
+ * Called immediately after outputting a multipart bodystructure
+ */
+void imap_fetch_bodystructure_post(
+ char *name, char *filename, char *partnum, char *disp,
+ void *content, char *cbtype, size_t length, char *encoding,
+ void *cbuserdata
+ ) {
+
+ char subtype[SIZ];
+
+ extract_token(subtype, cbtype, 1, '/');
+ imap_strout(subtype);
+ cprintf(")");
+}
+
+
+
+/*
+ * Output the info for a MIME part in the format required by BODYSTRUCTURE.
+ *
+ * FIXME .... this needs oodles of work to get completed.
+ */
+void imap_fetch_bodystructure_part(
+ char *name, char *filename, char *partnum, char *disp,
+ void *content, char *cbtype, size_t length, char *encoding,
+ void *cbuserdata
+ ) {
+
+ char buf[SIZ];
+
+ cprintf("(");
+
+ if (cbtype == NULL) {
+ cprintf("\"TEXT\" \"PLAIN\" ");
+ }
+ else {
+ extract_token(buf, cbtype, 0, '/');
+ imap_strout(buf);
+ cprintf(" ");
+ extract_token(buf, cbtype, 1, '/');
+ imap_strout(buf);
+ cprintf(" ");
+ }
+
+ cprintf("(\"CHARSET\" \"US-ASCII\"");
+
+ if (name != NULL) {
+ cprintf(" \"NAME\" ");
+ imap_strout(name);
+ }
+
+ if (filename != NULL) {
+ cprintf(" \"FILENAME\" ");
+ imap_strout(name);
+ }
+
+ cprintf(") ");
+
+ cprintf("NIL NIL ");
+
+ if (encoding != NULL) {
+ imap_strout(encoding);
+ }
+ else {
+ imap_strout("7BIT");
+ }
+ cprintf(" ");
+
+ cprintf("%ld ", length); /* bytes */
+ cprintf("NIL) "); /* lines */
+
+}
+
+
/*
* Spew the BODYSTRUCTURE data for a message. (Do you need a silencer if
cprintf("BODYSTRUCTURE (\"TEXT\" \"PLAIN\" "
"(\"CHARSET\" \"US-ASCII\") NIL NIL "
- "\"7BIT\" %ld %ld) ", bytes, lines);
+ "\"7BIT\" %ld %ld)", bytes, lines);
return;
}
/* For messages already stored in RFC822 format, we have to parse. */
- /* FIXME do this! */
-
-
+ cprintf("BODYSTRUCTURE ");
+ mime_parser(msg->cm_fields['M'],
+ NULL,
+ *imap_fetch_bodystructure_part, /* part */
+ *imap_fetch_bodystructure_pre, /* pre-multi */
+ *imap_fetch_bodystructure_post, /* post-multi */
+ NULL,
+ 0);
}
*/
void imap_fetch(int num_parms, char *parms[]) {
char items[1024];
- char *itemlist[256];
+ char *itemlist[SIZ];
int num_items;
int i;
*/
void imap_uidfetch(int num_parms, char *parms[]) {
char items[1024];
- char *itemlist[256];
+ char *itemlist[SIZ];
int num_items;
int i;
int have_uid_item = 0;