[Commits] perl_plugin.c 1.19.2.39 1.19.2.40

holger at claws-mail.org holger at claws-mail.org
Sat Dec 29 02:51:04 CET 2012


Update of /home/claws-mail/plugins/perl/src
In directory srv:/tmp/cvs-serv16970/src

Modified Files:
      Tag: gtk2
	perl_plugin.c 
Log Message:
2012-12-29 [holger]	0.9.20cvs2

	* cm_perl.pod
	* src/perl_plugin.c
		Add possibility to create tags during the filtering process 

Index: perl_plugin.c
===================================================================
RCS file: /home/claws-mail/plugins/perl/src/perl_plugin.c,v
retrieving revision 1.19.2.39
retrieving revision 1.19.2.40
diff -u -d -r1.19.2.39 -r1.19.2.40
--- perl_plugin.c	29 Dec 2012 01:39:41 -0000	1.19.2.39
+++ perl_plugin.c	29 Dec 2012 01:51:02 -0000	1.19.2.40
@@ -947,6 +947,31 @@
 }
 
 
+/* ClawsMail::C::make_sure_tag_exists(char*) */
+static XS(XS_ClawsMail_make_sure_tag_exists)
+{
+  gchar *tag_str;
+  gint tag_id;
+
+  dXSARGS;
+  if(items != 1) {
+    g_warning("Perl Plugin: Wrong number of arguments to ClawsMail::C::make_sure_tag_exists");
+    XSRETURN_UNDEF;
+  }
+
+  tag_str = SvPV_nolen(ST(0));
+
+  if(IS_NOT_RESERVED_TAG(tag_str) == FALSE) {
+    g_warning("Perl Plugin: Trying to create a tag with a reserved name: %s", tag_str);
+    XSRETURN_UNDEF;
+  }
+
+  tags_add_tag(tag_str);
+
+  XSRETURN_YES;
+}
+
+
 
 /* ClawsMail::C::make_sure_folder_exists(char*) */
 static XS(XS_ClawsMail_make_sure_folder_exists)
@@ -968,6 +993,7 @@
     XSRETURN_NO;
 }
 
+
 /* ClawsMail::C::addr_in_addressbook(char* [, char*]) */
 static XS(XS_ClawsMail_addr_in_addressbook)
 {
@@ -1478,6 +1504,7 @@
   newXS("ClawsMail::C::clear_tags",   XS_ClawsMail_clear_tags,   "ClawsMail::C");
   newXS("ClawsMail::C::make_sure_folder_exists",
 	XS_ClawsMail_make_sure_folder_exists,"ClawsMail::C");
+  newXS("ClawsMail::C::make_sure_tag_exists", XS_ClawsMail_make_sure_tag_exists,"ClawsMail::C");
   newXS("ClawsMail::C::addr_in_addressbook",
 	XS_ClawsMail_addr_in_addressbook,"ClawsMail::C");
   newXS("ClawsMail::C::open_mail_file",
@@ -2035,6 +2062,7 @@
 "    	       qw(SA_is_spam extract_addresses move_to_trash abort),\n"
 "    	       qw(addr_in_addressbook from_in_addressbook),\n"
 "    	       qw(get_attribute_value make_sure_folder_exists),\n"
+"            qw(make_sure_tag_exists),\n"
 "    	       );\n"
 "# Spam\n"
 "sub SA_is_spam {\n"
@@ -2063,6 +2091,9 @@
 "sub make_sure_folder_exists {\n"
 "    ClawsMail::C::make_sure_folder_exists(@_);\n"
 "}\n"
+"sub make_sure_tag_exists {\n"
+"    ClawsMail::C::make_sure_tag_exists(@_);\n"
+"}\n"
 "# abort: stop() and do not continue with built-in filtering\n"
 "sub abort {\n"
 "    ClawsMail::C::abort();\n"



More information about the Commits mailing list