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