commit-mailutils
[Top][All Lists]
Advanced

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

[SCM] GNU Mailutils branch, master, updated. release-2.2-619-gca45a7a


From: Wojciech Polak
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-619-gca45a7a
Date: Tue, 17 Jul 2012 21:00:13 +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=ca45a7aad841db4231bdd598e9a977a36dbf90c3

The branch, master has been updated
       via  ca45a7aad841db4231bdd598e9a977a36dbf90c3 (commit)
      from  240e03b918f7e91f652e9c597b9af1fe644e8666 (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 ca45a7aad841db4231bdd598e9a977a36dbf90c3
Author: Wojciech Polak <address@hidden>
Date:   Tue Jul 17 22:52:34 2012 +0200

    Update C++ and Python interfaces.
    
    * include/mailutils/prog.h: Add extern "C".
    * include/mailutils/wordsplit.h: Likewise.
    * libmu_cpp/address.cc (Address::to_string): Use mu_address_sget_printable.
    * libmu_cpp/filter.cc (FilterIconvStream): Use mu_filter_create_args.
    * python/mailutils/folder.py (get_stream, set_stream): Remove.

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

Summary of changes:
 .gitignore                    |    2 ++
 examples/cpp/listop.cc        |   40 ++++++++++++++++++++++------------------
 examples/cpp/mimetest.cc      |    4 ++--
 examples/cpp/msg-send.cc      |    4 ++--
 include/mailutils/cpp/list.h  |    3 +--
 include/mailutils/prog.h      |    8 ++++++++
 include/mailutils/wordsplit.h |    7 +++++++
 libmu_cpp/address.cc          |    7 ++++---
 libmu_cpp/filter.cc           |   10 ++++++----
 libmu_cpp/list.cc             |    2 +-
 python/mailutils/folder.py    |   11 -----------
 11 files changed, 55 insertions(+), 43 deletions(-)

diff --git a/.gitignore b/.gitignore
index f99f881..a1b6218 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,8 @@
 *.la
 *.lo
 *.o
+*.pyc
+*.pyo
 *.so
 *~
 .bootstrap
diff --git a/examples/cpp/listop.cc b/examples/cpp/listop.cc
index 30af69f..fc39c4f 100644
--- a/examples/cpp/listop.cc
+++ b/examples/cpp/listop.cc
@@ -221,9 +221,10 @@ shell (List& lst)
     {
       char *text;
       char buf[80];
-      int argc;
-      char **argv;
-      
+      int wsflags = MU_WRDSF_DEFFLAGS | MU_WRDSF_COMMENT;
+      struct mu_wordsplit ws;
+      ws.ws_comment = "#";
+
       try {
        itr[num]->current ((void**) &text);
       }
@@ -235,40 +236,43 @@ shell (List& lst)
       if (cin.getline (buf, sizeof (buf)).eof ())
        return;
 
-      rc = mu_argcv_get (buf, "", "#", &argc, &argv);
-      if (rc)
-       cerr << "mu_argcv_get: " << rc << endl;
+      if (mu_wordsplit (buf, &ws, wsflags))
+       {
+         mu_error ("cannot split line `%s': %s", buf,
+                   mu_wordsplit_strerror (&ws));
+         continue;
+       }
 
-      if (argc > 0)
+      if (ws.ws_wordc > 0)
        {
-         string cmd (argv[0]);
+         string cmd (ws.ws_wordv[0]);
 
          if (cmd == "next")
-           next (itr[num], argv[1]);
+           next (itr[num], ws.ws_wordv[1]);
          else if (cmd == "first")
            itr[num]->first ();
          else if (cmd == "del")
-           del (lst, argc, argv);
+           del (lst, ws.ws_wordc, ws.ws_wordv);
          else if (cmd == "add")
-           add (lst, argc, argv);
+           add (lst, ws.ws_wordc, ws.ws_wordv);
          else if (cmd == "prep")
-           prep (lst, argc, argv);
+           prep (lst, ws.ws_wordc, ws.ws_wordv);
          else if (cmd == "repl")
-           repl (lst, argc, argv);
+           repl (lst, ws.ws_wordc, ws.ws_wordv);
          else if (cmd == "print")
            print (lst);
          else if (cmd == "quit")
            return;
          else if (cmd == "iter")
-           iter (&num, argc, argv);
+           iter (&num, ws.ws_wordc, ws.ws_wordv);
          else if (cmd == "find")
-           find (itr[num], argv[1]);
+           find (itr[num], ws.ws_wordv[1]);
          else if (cmd == "help")
            help ();
-         else if (argc == 1)
+         else if (ws.ws_wordc == 1)
            {
              char* p;
-             size_t n = strtoul (argv[0], &p, 0);
+             size_t n = strtoul (ws.ws_wordv[0], &p, 0);
              if (*p != 0)
                cerr << "?" << endl;
              else
@@ -287,7 +291,7 @@ shell (List& lst)
          else
            cerr << "?" << endl;
        }
-      mu_argcv_free (argc, argv);
+       mu_wordsplit_free (&ws);
     }
 }
 
diff --git a/examples/cpp/mimetest.cc b/examples/cpp/mimetest.cc
index 6d36320..0c1d465 100644
--- a/examples/cpp/mimetest.cc
+++ b/examples/cpp/mimetest.cc
@@ -75,8 +75,8 @@ main (int argc, char **argv)
   /* Debugging trace. */
   if (debug)
     {
-      Debug debug = mbox.get_debug ();
-      debug.set_level (MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT));
+      mu_debug_set_category_level (MU_DEBCAT_MAILBOX, 
+                                  MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT));
     }
 
   /* Open the mailbox for reading only. */
diff --git a/examples/cpp/msg-send.cc b/examples/cpp/msg-send.cc
index 71aa076..8e75270 100644
--- a/examples/cpp/msg-send.cc
+++ b/examples/cpp/msg-send.cc
@@ -95,8 +95,8 @@ main (int argc, char *argv[])
     Mailer mailer (optmailer);
     if (optdebug)
       {
-       Debug debug = mailer.get_debug ();
-       debug.set_level (MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT));
+       mu_debug_set_category_level (MU_DEBCAT_MAILER, 
+                                    MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT));
       }
     mailer.open ();
     mailer.send_message (msg, from, to);
diff --git a/include/mailutils/cpp/list.h b/include/mailutils/cpp/list.h
index 8bb6adc..a7e2068 100644
--- a/include/mailutils/cpp/list.h
+++ b/include/mailutils/cpp/list.h
@@ -25,7 +25,6 @@
 #include <mailutils/cpp/error.h>
 #include <mailutils/cpp/iterator.h>
 
-typedef int mu_list_action_t (void*, void*);
 typedef int (*mu_list_comparator_t) (const void*, const void*);
 
 namespace mailutils
@@ -64,7 +63,7 @@ class List
   void to_array (void** array, size_t count, size_t* pcount);
   void locate (void* item, void** ret_item);
 
-  void apply (mu_list_action_t* action, void* cbdata);
+  void apply (mu_list_action_t action, void* cbdata);
   mu_list_comparator_t set_comparator (mu_list_comparator_t comp);
   mu_list_destroy_item_t set_destroy_item (mu_list_destroy_item_t 
mu_destroy_item);
 
diff --git a/include/mailutils/prog.h b/include/mailutils/prog.h
index 77cd6e1..89d9a3e 100644
--- a/include/mailutils/prog.h
+++ b/include/mailutils/prog.h
@@ -21,6 +21,10 @@
 #include <sys/resource.h>
 #include <mailutils/types.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define MU_PROG_LIMIT_AS      0
 #define MU_PROG_LIMIT_CPU     1
 #define MU_PROG_LIMIT_DATA    2
@@ -66,5 +70,9 @@ int mu_prog_stream_create (mu_stream_t *pstream,
 int mu_command_stream_create (mu_stream_t *pstream, const char *command,
                              int flags);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
diff --git a/include/mailutils/wordsplit.h b/include/mailutils/wordsplit.h
index 2538da6..5da3803 100644
--- a/include/mailutils/wordsplit.h
+++ b/include/mailutils/wordsplit.h
@@ -19,6 +19,10 @@
 
 #include <stddef.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct mu_wordsplit
 {
   size_t ws_wordc;
@@ -155,5 +159,8 @@ void mu_wordsplit_c_quote_copy (char *dst, const char *src, 
int quote_hex);
 void mu_wordsplit_perror (struct mu_wordsplit *ws);
 const char *mu_wordsplit_strerror (struct mu_wordsplit *ws);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif
diff --git a/libmu_cpp/address.cc b/libmu_cpp/address.cc
index 9bd08f3..ba2d695 100644
--- a/libmu_cpp/address.cc
+++ b/libmu_cpp/address.cc
@@ -172,12 +172,13 @@ std::string
 Address :: to_string ()
 {
   size_t n;
-  char buf[1024];
-  int status = mu_address_to_string (addr, buf, sizeof (buf), &n);
+  char const *sptr;
+
+  int status = mu_address_sget_printable (addr, &sptr);
   if (status)
     throw Exception ("Address::to_string", status);
 
-  return std::string (buf);
+  return std::string (sptr);
 }
 
 namespace mailutils
diff --git a/libmu_cpp/filter.cc b/libmu_cpp/filter.cc
index 821cd8f..ef97505 100644
--- a/libmu_cpp/filter.cc
+++ b/libmu_cpp/filter.cc
@@ -47,10 +47,12 @@ FilterIconvStream :: FilterIconvStream (Stream& transport,
                                        int flags,
                                        enum mu_iconv_fallback_mode fm)
 {
-  int status = mu_filter_iconv_create (&this->stm, transport.stm,
-                                      fromcode.c_str (),
-                                      tocode.c_str (),
-                                      flags, fm);
+  const char *argv[4] = { "iconv", NULL, NULL, NULL };
+  argv[1] = fromcode.c_str ();
+  argv[2] = tocode.c_str ();
+
+  int status = mu_filter_create_args (&this->stm, transport.stm, argv[0], 3,
+                                     argv, MU_FILTER_DECODE, flags);
   if (status)
     throw Exception ("FilterIconvStream::FilterIconvStream", status);
   this->input = new Stream (transport);
diff --git a/libmu_cpp/list.cc b/libmu_cpp/list.cc
index d341a1c..0e4c0e0 100644
--- a/libmu_cpp/list.cc
+++ b/libmu_cpp/list.cc
@@ -199,7 +199,7 @@ List :: size ()
 }
 
 void
-List :: apply (mu_list_action_t* action, void* cbdata)
+List :: apply (mu_list_action_t action, void* cbdata)
 {
   int status = mu_list_foreach (mu_list, action, cbdata);
   if (status)
diff --git a/python/mailutils/folder.py b/python/mailutils/folder.py
index 07dc76e..ed98fa4 100644
--- a/python/mailutils/folder.py
+++ b/python/mailutils/folder.py
@@ -49,17 +49,6 @@ class Folder:
         if status:
             raise FolderError (status)
 
-    def get_stream (self):
-        status, stream = folder.get_stream (self.folder)
-        if status:
-            raise FolderError (status)
-        return stream.Stream (stm)
-
-    def set_stream (self, stream):
-        status = folder.set_stream (self.folder, stream.stm)
-        if status:
-            raise FolderError (status)
-
     def get_authority (self):
         status, authority = folder.get_authority (self.folder)
         if status:


hooks/post-receive
-- 
GNU Mailutils



reply via email to

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