[PATCH 2/4] ruby: Add wrappers for maildir sync. interface
authorAli Polatel <alip@exherbo.org>
Mon, 10 Jan 2011 14:39:26 +0000 (16:39 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:37:41 +0000 (09:37 -0800)
0e/57d3e1c808b7b1008de46567573e3a595aefe0 [new file with mode: 0644]

diff --git a/0e/57d3e1c808b7b1008de46567573e3a595aefe0 b/0e/57d3e1c808b7b1008de46567573e3a595aefe0
new file mode 100644 (file)
index 0000000..de77934
--- /dev/null
@@ -0,0 +1,145 @@
+Return-Path: <alip@exherbo.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id BBAD1431FB6\r
+       for <notmuch@notmuchmail.org>; Mon, 10 Jan 2011 06:39:29 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id iJD4KgtISaZy for <notmuch@notmuchmail.org>;\r
+       Mon, 10 Jan 2011 06:39:28 -0800 (PST)\r
+Received: from bach.exherbo.org (bach.exherbo.org [78.47.197.147])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 51BD1431FD0\r
+       for <notmuch@notmuchmail.org>; Mon, 10 Jan 2011 06:39:27 -0800 (PST)\r
+Received: from localhost ([127.0.0.1] helo=karatren.karatren.ev ident=alip)\r
+       by bach.exherbo.org with esmtpa (Exim 4.71)\r
+       (envelope-from <alip@exherbo.org>)\r
+       id 1PcIu0-0006iv-Pk; Mon, 10 Jan 2011 14:39:21 +0000\r
+Received: by karatren.karatren.ev (Postfix, from userid 1000)\r
+       id 6150F1BAA28; Mon, 10 Jan 2011 16:39:28 +0200 (EET)\r
+From: Ali Polatel <alip@exherbo.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/4] ruby: Add wrappers for maildir sync. interface\r
+Date: Mon, 10 Jan 2011 16:39:26 +0200\r
+Message-Id:\r
+ <b958b56b5bfd9a30be0936a07416965b01c3029e.1294669955.git.alip@exherbo.org>\r
+X-Mailer: git-send-email 1.7.3.5\r
+In-Reply-To: <cover.1294669955.git.alip@exherbo.org>\r
+References: <cover.1294669955.git.alip@exherbo.org>\r
+In-Reply-To: <cover.1294669955.git.alip@exherbo.org>\r
+References: <cover.1294669955.git.alip@exherbo.org>\r
+Organization: Pink Floyd\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 10 Jan 2011 14:39:30 -0000\r
+\r
+New wrappers:\r
+notmuch_message_maildir_flags_to_tags(): MESSAGE.maildir_flags_to_tags\r
+notmuch_message_tags_to_maildir_flags(): MESSAGE.tags_to_maildir_flags\r
+---\r
+ bindings/ruby/defs.h    |    6 ++++++\r
+ bindings/ruby/init.c    |    2 ++\r
+ bindings/ruby/message.c |   38 ++++++++++++++++++++++++++++++++++++++\r
+ 3 files changed, 46 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h\r
+index db53096..1f52988 100644\r
+--- a/bindings/ruby/defs.h\r
++++ b/bindings/ruby/defs.h\r
+@@ -293,6 +293,12 @@ VALUE\r
+ notmuch_rb_message_remove_all_tags(VALUE self);\r
\r
+ VALUE\r
++notmuch_rb_message_maildir_flags_to_tags(VALUE self);\r
++\r
++VALUE\r
++notmuch_rb_message_tags_to_maildir_flags(VALUE self);\r
++\r
++VALUE\r
+ notmuch_rb_message_freeze(VALUE self);\r
\r
+ VALUE\r
+diff --git a/bindings/ruby/init.c b/bindings/ruby/init.c\r
+index 63ab205..4a63ba0 100644\r
+--- a/bindings/ruby/init.c\r
++++ b/bindings/ruby/init.c\r
+@@ -273,6 +273,8 @@ Init_notmuch(void)\r
+     rb_define_alias(notmuch_rb_cMessage, "<<", "add_tag");\r
+     rb_define_method(notmuch_rb_cMessage, "remove_tag", notmuch_rb_message_remove_tag, 1);\r
+     rb_define_method(notmuch_rb_cMessage, "remove_all_tags", notmuch_rb_message_remove_all_tags, 0);\r
++    rb_define_method(notmuch_rb_cMessage, "maildir_flags_to_tags", notmuch_rb_message_maildir_flags_to_tags, 0);\r
++    rb_define_method(notmuch_rb_cMessage, "tags_to_maildir_flags", notmuch_rb_message_tags_to_maildir_flags, 0);\r
+     rb_define_method(notmuch_rb_cMessage, "freeze", notmuch_rb_message_freeze, 0);\r
+     rb_define_method(notmuch_rb_cMessage, "thaw", notmuch_rb_message_thaw, 0);\r
\r
+diff --git a/bindings/ruby/message.c b/bindings/ruby/message.c\r
+index f97e1a4..1b2c01e 100644\r
+--- a/bindings/ruby/message.c\r
++++ b/bindings/ruby/message.c\r
+@@ -284,6 +284,44 @@ notmuch_rb_message_remove_all_tags(VALUE self)\r
+ }\r
\r
+ /*\r
++ * call-seq: MESSAGE.maildir_flags_to_tags => true\r
++ *\r
++ * Add/remove tags according to maildir flags in the message filename(s)\r
++ */\r
++VALUE\r
++notmuch_rb_message_maildir_flags_to_tags(VALUE self)\r
++{\r
++    notmuch_status_t ret;\r
++    notmuch_message_t *message;\r
++\r
++    Data_Get_Notmuch_Message(self, message);\r
++\r
++    ret = notmuch_message_maildir_flags_to_tags(message);\r
++    notmuch_rb_status_raise(ret);\r
++\r
++    return Qtrue;\r
++}\r
++\r
++/*\r
++ * call-seq: MESSAGE.tags_to_maildir_flags => true\r
++ *\r
++ * Rename message filename(s) to encode tags as maildir flags\r
++ */\r
++VALUE\r
++notmuch_rb_message_tags_to_maildir_flags(VALUE self)\r
++{\r
++    notmuch_status_t ret;\r
++    notmuch_message_t *message;\r
++\r
++    Data_Get_Notmuch_Message(self, message);\r
++\r
++    ret = notmuch_message_tags_to_maildir_flags(message);\r
++    notmuch_rb_status_raise(ret);\r
++\r
++    return Qtrue;\r
++}\r
++\r
++/*\r
+  * call-seq: MESSAGE.freeze => true\r
+  *\r
+  * Freeze the 'message'\r
+-- \r
+1.7.3.5\r
+\r