commit-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Mailutils branch, master, updated. rel-2_1-93-g8e227e9


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. rel-2_1-93-g8e227e9
Date: Tue, 07 Sep 2010 10:39:16 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=8e227e9b65a9e74450a81d200a99d5539f0ab93f

The branch, master has been updated
       via  8e227e9b65a9e74450a81d200a99d5539f0ab93f (commit)
      from  1cb4b8d7631f3a7a675510ddf3332bc28ddc5d2d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8e227e9b65a9e74450a81d200a99d5539f0ab93f
Author: Sergey Poznyakoff <address@hidden>
Date:   Tue Sep 7 13:39:07 2010 +0300

    imap4d: fetch body with a nonempty section spec returns section body 
without headers.
    
    * imap4d/fetch.c (fetch_function_closure) <section_tag>: New member.
    (_frt_body_text): Output ffc->section_tag after the secion part by
    default.
    (_frt_header, _frt_mime): Remove.
    (_frt_header0): Rewrite as a general-purpose _frt_header function.
    (parse_section_text): Set _frt_header as a driver function and
    set section_tag accordingly, instead of selecting _frt_header/_frt_mime.
    Set section_tag when selecting _frt_body_text.
    (parse_section): Default to _frt_body_text and fall back to _frt_body
    only when an empty section specifier is given.
    * imap4d/testsuite/imap4d/fetch.exp: Update accordingly.

-----------------------------------------------------------------------

Summary of changes:
 imap4d/fetch.c                    |   39 ++++++++++++++----------------------
 imap4d/testsuite/imap4d/fetch.exp |    7 +-----
 2 files changed, 16 insertions(+), 30 deletions(-)

diff --git a/imap4d/fetch.c b/imap4d/fetch.c
index c84fc6d..ef7d6ce 100644
--- a/imap4d/fetch.c
+++ b/imap4d/fetch.c
@@ -49,6 +49,7 @@ struct fetch_function_closure
 {
   fetch_function_t fun;            /* Handler function */
   const char *name;                /* Response tag */
+  const char *section_tag;          
   size_t *section_part;            /* Section-part */
   size_t nset;                     /* Number of elements in section_part */
   int peek;
@@ -906,7 +907,7 @@ _frt_body_text (struct fetch_function_closure *ffc,
   if (ffc->name)
     util_send ("%s",  ffc->name);
   else
-    fetch_send_section_part (ffc, "TEXT", 1);
+    fetch_send_section_part (ffc, ffc->section_tag, 1);
   msg = fetch_get_part (ffc, frt);
   if (!msg)
     {
@@ -935,9 +936,8 @@ _frt_size (struct fetch_function_closure *ffc,
 }
 
 static int
-_frt_header0 (struct fetch_function_closure *ffc,
-             struct fetch_runtime_closure *frt,
-             const char *suffix)
+_frt_header (struct fetch_function_closure *ffc,
+            struct fetch_runtime_closure *frt)
 {
   mu_message_t msg;
   mu_header_t header = NULL;
@@ -946,9 +946,9 @@ _frt_header0 (struct fetch_function_closure *ffc,
   
   set_seen (ffc, frt);
   if (ffc->name)
-    util_send ("%s",  ffc->name);
+    util_send ("%s", ffc->name);
   else
-    fetch_send_section_part (ffc, suffix, 1);
+    fetch_send_section_part (ffc, ffc->section_tag, 1);
 
   msg = fetch_get_part (ffc, frt);
   if (!msg)
@@ -964,20 +964,6 @@ _frt_header0 (struct fetch_function_closure *ffc,
 }
 
 static int
-_frt_header (struct fetch_function_closure *ffc,
-            struct fetch_runtime_closure *frt)
-{
-  return _frt_header0 (ffc, frt, "HEADER");
-}
-
-static int
-_frt_mime (struct fetch_function_closure *ffc,
-          struct fetch_runtime_closure *frt)
-{
-  return _frt_header0 (ffc, frt, "MIME");
-}
-
-static int
 _send_header_name (void *item, void *data)
 {
   int *pf = data;
@@ -1291,17 +1277,22 @@ parse_section_text (imap4d_parsebuf_t p, struct 
fetch_function_closure *ffc,
          parse_header_list (p, ffc);
        }
       else
-       ffc->fun = _frt_header;
+       {
+         ffc->fun = _frt_header;
+         ffc->section_tag = "HEADER";
+       }
     }
   else if (mu_c_strcasecmp (p->token, "TEXT") == 0)
     {
       imap4d_parsebuf_next (p, 1);
       ffc->fun = _frt_body_text;
+      ffc->section_tag = "TEXT";
     }
   else if (allow_mime && mu_c_strcasecmp (p->token, "MIME") == 0)
     {
       imap4d_parsebuf_next (p, 1);
-      ffc->fun = _frt_mime;
+      ffc->fun = _frt_header;
+      ffc->section_tag = "MIME";
     }
   else
     return 1;
@@ -1375,12 +1366,12 @@ parse_section (imap4d_parsebuf_t p, struct 
fetch_function_closure *ffc)
     return 1;
   ffc_init (ffc);
   ffc->name = NULL;
-  ffc->fun = _frt_body;
+  ffc->fun = _frt_body_text;
   imap4d_parsebuf_next (p, 1);
   if (parse_section_text (p, ffc, 0))
     {
       if (p->token[0] == ']')
-       /* OK */;
+       ffc->fun = _frt_body;
       else if (mu_isdigit (p->token[0]))
        {
          parse_section_part (p, ffc);
diff --git a/imap4d/testsuite/imap4d/fetch.exp 
b/imap4d/testsuite/imap4d/fetch.exp
index bc3aabf..e61f3b5 100644
--- a/imap4d/testsuite/imap4d/fetch.exp
+++ b/imap4d/testsuite/imap4d/fetch.exp
@@ -330,13 +330,8 @@ imap4d_test "FETCH 3 BODY\[1.MIME\]"\
 "OK"
 
 imap4d_test "FETCH 4 BODY\[2.2.1\]"\
-"4 FETCH (FLAGS (\\Seen) BODY\[2.2.1\] {680}"\
+"4 FETCH (FLAGS (\\Seen) BODY\[2.2.1\] {490}"\
 -literal\
-"Content-Type: application/octet-stream; name=\"msg.23\""\
-"Content-ID: <address@hidden>"\
-"Content-Description: Father William Part III"\
-"Content-Transfer-Encoding: base64"\
-""\
 "YFlvdSBhcmUgb2xkLCcgc2FpZCB0aGUgeW91dGgsIGBhbmQgeW91ciBqYXdzIGFyZSB0b28gd2Vh"\
 "awpGb3IgYW55dGhpbmcgdG91Z2hlciB0aGFuIHN1ZXQ7CllldCB5b3UgZmluaXNoZWQgdGhlIGdv"\
 "b3NlLCB3aXRoIHRoZSBib25lcyBhbmQgdGhlIGJlYWstLQpQcmF5IGhvdyBkaWQgeW91IG1hbmFn"\


hooks/post-receive
-- 
GNU Mailutils



reply via email to

[Prev in Thread] Current Thread [Next in Thread]