From b0ade8cb328e8948c090f2a1bf269405f6924538 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 14 Feb 2001 23:30:10 +0000 Subject: Rewrite explanatory comments to use normal regexps rather than procmail * mail-mlist-magic.c: Rewrite explanatory comments to use normal regexps rather than procmail weirdness. (check_sender): match "foo-owner" as well as "owner-foo". (check_list_post): (New) Check for "List-Post: + * mail-mlist-magic.c: Rewrite explanatory comments to use normal + regexps rather than procmail weirdness. + (check_sender): match "foo-owner" as well as "owner-foo". + (check_list_post): (New) Check for "List-Post: #endif @@ -57,6 +32,8 @@ #include "mail-mlist-magic.h" +/* FIXME: This really should just use regexps... */ + /* Utility functions. */ @@ -95,32 +72,38 @@ get_header (CamelMimeMessage *message, /* The checks. */ -/* ^Sender: owner-\/[^@]+ */ +/* Sender: (owner-([^@]+)|([^@+]-owner)@ */ static char * check_sender (CamelMimeMessage *message, const char **header_name_return, char **header_value_return) { const char *value; + char *owner, *list_name; value = get_header (message, "Sender"); if (value == NULL) return NULL; - if (strncmp (value, "owner-", 6) != 0) + owner = strstr (value, "owner"); + if (!owner) return NULL; - if (value[6] == '\0' || value[6] == '@') + if (owner == value && value[5] == '-' && value[6] && value[6] != '@') + list_name = extract_until_at_sign (value + 6); + else if (owner > value + 1 && *(owner - 1) == '-' && owner[5] == '@') + list_name = g_strndup (value, owner - 1 - value); + else return NULL; if (header_name_return != NULL) *header_name_return = "Sender"; if (header_value_return != NULL) *header_value_return = g_strdup (value); - return extract_until_at_sign (value + 6); + return list_name; } -/* ^X-BeenThere: \/[^@]+ */ +/* X-BeenThere: ([^@]+) */ static char * check_x_been_there (CamelMimeMessage *message, const char **header_name_return, @@ -140,7 +123,7 @@ check_x_been_there (CamelMimeMessage *message, return extract_until_at_sign (value); } -/* ^Delivered-To: mailing list \/[^@]+ */ +/* Delivered-To: mailing list ([^@]+) */ static char * check_delivered_to (CamelMimeMessage *message, const char **header_name_return, @@ -166,7 +149,7 @@ check_delivered_to (CamelMimeMessage *message, return extract_until_at_sign (value + 13); } -/* X-Mailing-List: <\/[^@]+ */ +/* X-Mailing-List: <([^@]+) */ static char * check_x_mailing_list (CamelMimeMessage *message, const char **header_name_return, @@ -193,7 +176,7 @@ check_x_mailing_list (CamelMimeMessage *message, return extract_until_at_sign (value + 1); } -/* X-Loop: \/[^@]+ */ +/* X-Loop: ([^@]+) */ static char * check_x_loop (CamelMimeMessage *message, const char **header_name_return, @@ -216,6 +199,45 @@ check_x_loop (CamelMimeMessage *message, return extract_until_at_sign (value); } +/* List-Post: