On Sat, 2006-07-22 at 18:18 +0200, Paul J Stevens wrote:

> trying to build against 2.1.10 fails at this moment.
> 
> Afaict, the only disparity between sieve-2.1.10 and 2.1.11 is the
> SIEVE2_MESSAGE_GETSUBADDRESS, so if I comment out that line in the
> callback setup all should work as expected right?

I have libSieve 2.1.12 uploaded now. The GETSUBADDRESS callback is going
to be part of the stable libSieve 2.2 API, so backwards compatibility
isn't something that I was looking at here.

I've also got a small patch to add g_strcasestr to misc.c; there's no
portable implementation of strcasestr anyplace, needed for the imap
flags support (which works, I really did test it a lot). Try this:

  require ["fileinto", "imap4flags"];

  fileinto :flags "\urgent" "INBOX/Bar/Baz/Qux/Jazz/Shoop.box";

Aaron
Index: misc.h
===================================================================
--- misc.h	(revision 2203)
+++ misc.h	(working copy)
@@ -105,6 +105,7 @@
 GString * g_list_join(GList * list, const gchar * sep);
 GList * g_string_split(GString * string, const gchar * sep);
 GList * g_list_append_printf(GList * list, char * format, ...);
+char * g_strcasestr(const char *haystack, const char *needle);
 
 gint ucmp(const u64_t *a, const u64_t *b);
 void g_list_destroy(GList *list);
Index: modules/sortsieve.c
===================================================================
--- modules/sortsieve.c	(revision 2204)
+++ modules/sortsieve.c	(working copy)
@@ -205,8 +205,7 @@
 
 		for (i = 0; flags[i]; i++) { // Loop through all script/user-specified flags.
 			for (j = 0; imap_flag_desc[j]; i++) { // Find the ones we support.
-				// FIXME: We should be ASCII-case-insensitive.
-				if (g_strstr(imap_flag_desc[j], flags[i])) {
+				if (g_strcasestr(imap_flag_desc[j], flags[i])) {
 					msgflags[i] = 1;
 				}
 			}
Index: db.h
===================================================================
--- db.h	(revision 2204)
+++ db.h	(working copy)
@@ -1005,7 +1005,7 @@
  *    - -1 on error
  */
 int db_imap_split_mailbox(const char *mailbox, u64_t owner_idnr,
-		GList ** mailboxes, const char ** errmsg)
+		GList ** mailboxes, const char ** errmsg);
 
 /**
  * \brief set permission on a mailbox (readonly/readwrite)
Index: misc.c
===================================================================
--- misc.c	(revision 2203)
+++ misc.c	(working copy)
@@ -422,6 +422,17 @@
 	return g_list_append(list, g_strdup_vprintf(format, argp));
 }
 
+char * g_strcasestr(const char *haystack, const char *needle)
+{
+	// Like strstr, but case insensitive.
+	for (; *haystack; haystack++) {
+		if (g_ascii_strcasecmp(haystack, needle) == 0)
+			return (char *)haystack;
+	}
+
+	return NULL;
+}
+
 /* 
  * return newly allocated escaped strings
  */

Reply via email to