diff options
author | Not Zed <NotZed@Ximian.com> | 2001-02-06 10:38:19 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-02-06 10:38:19 +0800 |
commit | b8af62e80361d12c4ecc9279817be30df2ebf538 (patch) | |
tree | 8e4835aa83fcada2184825d51a0fbccdec1e4eb7 /camel/camel-mime-utils.c | |
parent | 2fd6f5acb552cbdc7a65536260b973512bb845b6 (diff) | |
download | gsoc2013-evolution-b8af62e80361d12c4ecc9279817be30df2ebf538.tar gsoc2013-evolution-b8af62e80361d12c4ecc9279817be30df2ebf538.tar.gz gsoc2013-evolution-b8af62e80361d12c4ecc9279817be30df2ebf538.tar.bz2 gsoc2013-evolution-b8af62e80361d12c4ecc9279817be30df2ebf538.tar.lz gsoc2013-evolution-b8af62e80361d12c4ecc9279817be30df2ebf538.tar.xz gsoc2013-evolution-b8af62e80361d12c4ecc9279817be30df2ebf538.tar.zst gsoc2013-evolution-b8af62e80361d12c4ecc9279817be30df2ebf538.zip |
Removed unwanted header. It was never put in for a reason. Stop fixing
2001-02-06 Not Zed <NotZed@Ximian.com>
* camel-search-private.c: Removed unwanted header. It was never
put in for a reason. Stop fixing irrelevant warnings.
(camel_ustrstrcase): Our own strstrcase impl for utf8 strings.
(camel_ustrcasecmp): Ditto for strcasecmp.
(camel_ustrncasecmp): And strncasecmp.
(utf8_get): Simpler interface to utf8 string processing.
(camel_search_header_match): Use the new things.
2001-02-05 Not Zed <NotZed@Ximian.com>
* camel-folder.c (get_summary): Removed some old variables/a small
memleak.
(free_summary): Removed old variables.
* camel-mime-utils.c (header_raw_check_mailing_list): New utility
function to get the mailing list (if any) that a set of headers
came from.
svn path=/trunk/; revision=8008
Diffstat (limited to 'camel/camel-mime-utils.c')
-rw-r--r-- | camel/camel-mime-utils.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 0b77dbe9c8..7b63baae14 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -41,6 +41,8 @@ #include <ctype.h> #include <errno.h> +#include <regex.h> + #include "camel-mime-utils.h" #include "camel-charset-map.h" @@ -2892,6 +2894,42 @@ header_raw_clear(struct _header_raw **list) *list = NULL; } +static struct { + char *name; + char *pattern; +} mail_list_magic[] = { + { "Sender", "^Sender: owner-([^@]+)" }, + { "X-BeenThere", "^X-BeenThere: ([^@]+)" }, + { "Delivered-To", "^Delivered-To: mailing list ([^@]+)" }, + { "X-Mailing-List", "^X-Mailing-List: ([^@]+)" }, + { "X-Loop", "^X-Loop: ([^@]+)" }, + { "List-Id", "^List-Id: ([^<]+)" }, +}; + +char * +header_raw_check_mailing_list(struct _header_raw **list) +{ + const char *v; + regex_t pattern; + regmatch_t match[1]; + int i; + + for (i=0;i<sizeof(mail_list_magic)/sizeof(mail_list_magic[0]);i++) { + if (regcomp(&pattern, mail_list_magic[i].pattern, REG_EXTENDED|REG_ICASE) == -1) { + g_warning("Internal error, compiling regex failed: %s: %s", mail_list_magic[i].pattern, strerror(errno)); + continue; + } + + v = header_raw_find(list, mail_list_magic[i].name, NULL); + if (v != NULL && regexec(&pattern, v, 1, match, 0) == 0 && match[0].rm_so != -1) { + regfree(&pattern); + return g_strndup(v+match[0].rm_so, match[0].rm_eo-match[0].rm_so); + } + regfree(&pattern); + } + + return NULL; +} /* ok, here's the address stuff, what a mess ... */ struct _header_address *header_address_new(void) |