summaryrefslogtreecommitdiff
path: root/imap/src
diff options
context:
space:
mode:
Diffstat (limited to 'imap/src')
-rw-r--r--imap/src/c-client/mail.c33
-rw-r--r--imap/src/c-client/mail.h1
2 files changed, 25 insertions, 9 deletions
diff --git a/imap/src/c-client/mail.c b/imap/src/c-client/mail.c
index 871d07eb..03952d2e 100644
--- a/imap/src/c-client/mail.c
+++ b/imap/src/c-client/mail.c
@@ -2723,21 +2723,18 @@ void mail_gc_body (BODY *body)
if (body->mime.text.data) fs_give ((void **) &body->mime.text.data);
if (body->contents.text.data) fs_give ((void **) &body->contents.text.data);
}
-
-/* Mail get body part
- * Accepts: mail stream
- * message number
- * section specifier
- * Returns: pointer to body
+/* Mail get body section
+ * Accepts: body of message
+ * section specifier
+ * Returns: pointer to body at given section
*/
-BODY *mail_body (MAILSTREAM *stream,unsigned long msgno,unsigned char *section)
+BODY *mail_body_section (BODY *b, unsigned char *section)
{
- BODY *b = NIL;
PART *pt;
unsigned long i;
/* make sure have a body */
- if (section && *section && mail_fetchstructure (stream,msgno,&b) && b)
+ if (section && *section && b)
while (*section) { /* find desired section */
if (isdigit (*section)) { /* get section specifier */
/* make sure what follows is valid */
@@ -2768,6 +2765,24 @@ BODY *mail_body (MAILSTREAM *stream,unsigned long msgno,unsigned char *section)
else return NIL; /* unknown section specifier */
}
return b;
+}
+
+/* Mail get body part
+ * Accepts: mail stream
+ * message number
+ * section specifier
+ * Returns: pointer to body
+ */
+
+BODY *mail_body (MAILSTREAM *stream,unsigned long msgno,unsigned char *section)
+{
+ BODY *b = NIL;
+ PART *pt;
+ unsigned long i;
+ /* make sure have a body */
+ if (section && *section && mail_fetchstructure (stream,msgno,&b) && b)
+ return mail_body_section(b, section);
+ return b;
}
/* Mail output date from elt fields
diff --git a/imap/src/c-client/mail.h b/imap/src/c-client/mail.h
index fe7eaa77..2accc85b 100644
--- a/imap/src/c-client/mail.h
+++ b/imap/src/c-client/mail.h
@@ -1704,6 +1704,7 @@ void mail_gc (MAILSTREAM *stream,long gcflags);
void mail_gc_msg (MESSAGE *msg,long gcflags);
void mail_gc_body (BODY *body);
+BODY *mail_body_section (BODY *b, unsigned char *section);
BODY *mail_body (MAILSTREAM *stream,unsigned long msgno,
unsigned char *section);
char *mail_date (char *string,MESSAGECACHE *elt);