diff options
author | Not Zed <NotZed@Ximian.com> | 2001-02-20 08:19:16 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-02-20 08:19:16 +0800 |
commit | 72bc2233d228d6313a52c6a43e6a22c63067b954 (patch) | |
tree | 383fb692e99459d7520ff575e897460fa3d24781 /camel | |
parent | 269b6e0a439cf55772bc0092fe173d87091097cb (diff) | |
download | gsoc2013-evolution-72bc2233d228d6313a52c6a43e6a22c63067b954.tar.gz gsoc2013-evolution-72bc2233d228d6313a52c6a43e6a22c63067b954.tar.zst gsoc2013-evolution-72bc2233d228d6313a52c6a43e6a22c63067b954.zip |
Take the ^Header: part out of the expression, since we look that up
2001-02-20 Not Zed <NotZed@Ximian.com>
* camel-mime-utils.c (mail_list_magic): Take the ^Header: part out
of the expression, since we look that up ourselves.
(header_raw_check_mailing_list): When getting the match, get match
1, not match 0, we dont want the full string match.
* camel-folder-summary.c (CAMEL_FOLDER_SUMMARY_VERSION): Bumped
for summary change.
(message_info_new): Extract the mlist info from the headers.
(message_info_load): Load mlist from summary.
(message_info_save): Save mlist to summary.
(message_info_free): Save the mlist entry.
(camel_message_info_new_from_header): Extract mailing list header.
(camel_message_info_dup_to): Copy the mlist entry.
(camel_message_info_free): Free mlist.
(message_info_dump): Dump the mlist.
* camel-folder-summary.h: Add an mlist (mailing list) string to
the summary.
svn path=/trunk/; revision=8295
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 21 | ||||
-rw-r--r-- | camel/camel-folder-summary.c | 36 | ||||
-rw-r--r-- | camel/camel-folder-summary.h | 16 | ||||
-rw-r--r-- | camel/camel-mime-utils.c | 18 |
4 files changed, 66 insertions, 25 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 000a26da82..cbbb694398 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,24 @@ +2001-02-20 Not Zed <NotZed@Ximian.com> + + * camel-mime-utils.c (mail_list_magic): Take the ^Header: part out + of the expression, since we look that up ourselves. + (header_raw_check_mailing_list): When getting the match, get match + 1, not match 0, we dont want the full string match. + + * camel-folder-summary.c (CAMEL_FOLDER_SUMMARY_VERSION): Bumped + for summary change. + (message_info_new): Extract the mlist info from the headers. + (message_info_load): Load mlist from summary. + (message_info_save): Save mlist to summary. + (message_info_free): Save the mlist entry. + (camel_message_info_new_from_header): Extract mailing list header. + (camel_message_info_dup_to): Copy the mlist entry. + (camel_message_info_free): Free mlist. + (message_info_dump): Dump the mlist. + + * camel-folder-summary.h: Add an mlist (mailing list) string to + the summary. + 2001-02-19 Not Zed <NotZed@Ximian.com> * providers/vee/camel-vee-folder.c (camel_vee_folder_new): Added diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index 376aea12d8..fe327040b1 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -68,7 +68,7 @@ static pthread_mutex_t info_lock = PTHREAD_MUTEX_INITIALIZER; extern int strdup_count, malloc_count, free_count; #endif -#define CAMEL_FOLDER_SUMMARY_VERSION (11) +#define CAMEL_FOLDER_SUMMARY_VERSION (12) #define _PRIVATE(o) (((CamelFolderSummary *)(o))->priv) @@ -1717,11 +1717,14 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h) e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_TO, msgid); msgid = camel_folder_summary_format_address(h, "cc"); e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_CC, msgid); + msgid = header_raw_check_mailing_list(&h); + e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_MLIST, msgid); #else mi->subject = camel_folder_summary_format_string(h, "subject"); mi->from = camel_folder_summary_format_address(h, "from"); mi->to = camel_folder_summary_format_address(h, "to"); mi->cc = camel_folder_summary_format_address(h, "cc"); + mi->mlist = header_raw_check_mailing_list(&h); #endif mi->user_flags = NULL; mi->user_tags = NULL; @@ -1793,6 +1796,8 @@ message_info_load(CamelFolderSummary *s, FILE *in) e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_TO, tmp); camel_folder_summary_decode_string(in, &tmp); e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_CC, tmp); + camel_folder_summary_decode_string(in, &tmp); + e_strv_set_ref_free(mi->strings, CAMEL_MESSAGE_INFO_MLIST, tmp); #else camel_folder_summary_decode_string(in, &mi->uid); camel_folder_summary_decode_uint32(in, &mi->flags); @@ -1803,6 +1808,7 @@ message_info_load(CamelFolderSummary *s, FILE *in) camel_folder_summary_decode_string(in, &mi->from); camel_folder_summary_decode_string(in, &mi->to); camel_folder_summary_decode_string(in, &mi->cc); + camel_folder_summary_decode_string(in, &mi->mlist); #endif mi->content = NULL; @@ -1871,6 +1877,7 @@ message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi) camel_folder_summary_encode_string(out, camel_message_info_from(mi)); camel_folder_summary_encode_string(out, camel_message_info_to(mi)); camel_folder_summary_encode_string(out, camel_message_info_cc(mi)); + camel_folder_summary_encode_string(out, camel_message_info_mlist(mi)); camel_folder_summary_encode_fixed_int32(out, mi->message_id.id.part.hi); camel_folder_summary_encode_fixed_int32(out, mi->message_id.id.part.lo); @@ -1916,6 +1923,7 @@ message_info_free(CamelFolderSummary *s, CamelMessageInfo *mi) g_free(mi->from); g_free(mi->to); g_free(mi->cc); + g_free(mi->mlist); #endif g_free(mi->references); camel_flag_list_free(&mi->user_flags); @@ -2515,19 +2523,21 @@ CamelMessageInfo * camel_message_info_new_from_header (struct _header_raw *header) { CamelMessageInfo *info; - char *subject, *from, *to, *cc; - - subject = camel_folder_summary_format_string (header, "subject"); - from = camel_folder_summary_format_address (header, "from"); - to = camel_folder_summary_format_address (header, "to"); - cc = camel_folder_summary_format_address (header, "cc"); + char *subject, *from, *to, *cc, *mlist; + subject = camel_folder_summary_format_string(header, "subject"); + from = camel_folder_summary_format_address(header, "from"); + to = camel_folder_summary_format_address(header, "to"); + cc = camel_folder_summary_format_address(header, "cc"); + mlist = header_raw_check_mailing_list(&header); + info = camel_message_info_new(); - camel_message_info_set_subject (info, subject); - camel_message_info_set_from (info, from); - camel_message_info_set_to (info, to); - camel_message_info_set_cc (info, cc); + camel_message_info_set_subject(info, subject); + camel_message_info_set_from(info, from); + camel_message_info_set_to(info, to); + camel_message_info_set_cc(info, cc); + camel_message_info_set_mlist(info, cc); return info; } @@ -2563,12 +2573,14 @@ camel_message_info_dup_to(const CamelMessageInfo *from, CamelMessageInfo *to) e_strv_set(to->strings, CAMEL_MESSAGE_INFO_TO, camel_message_info_to(from)); e_strv_set(to->strings, CAMEL_MESSAGE_INFO_CC, camel_message_info_cc(from)); e_strv_set(to->strings, CAMEL_MESSAGE_INFO_UID, camel_message_info_uid(from)); + e_strv_set(to->strings, CAMEL_MESSAGE_INFO_UID, camel_message_info_mlist(from)); #else to->subject = g_strdup(from->subject); to->from = g_strdup(from->from); to->to = g_strdup(from->to); to->cc = g_strdup(from->cc); to->uid = g_strdup(from->uid); + to->mlist = g_strdup(from->mlist); #endif memcpy(&to->message_id, &from->message_id, sizeof(from->message_id)); @@ -2632,6 +2644,7 @@ camel_message_info_free(CamelMessageInfo *mi) g_free(mi->from); g_free(mi->to); g_free(mi->cc); + g_free(mi->mlist); #endif g_free(mi->references); camel_flag_list_free(&mi->user_flags); @@ -2693,6 +2706,7 @@ message_info_dump(CamelMessageInfo *mi) printf("Subject: %s\n", camel_message_info_subject(mi)); printf("To: %s\n", camel_message_info_to(mi)); printf("Cc: %s\n", camel_message_info_cc(mi)); + printf("mailing list: %s\n", camel_message_info_mlist(mi)); printf("From: %s\n", camel_message_info_from(mi)); printf("UID: %s\n", camel_message_info_uid(mi)); printf("Flags: %04x\n", mi->flags & 0xffff); diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h index 860b9cb8d8..48a9ea4688 100644 --- a/camel/camel-folder-summary.h +++ b/camel/camel-folder-summary.h @@ -103,6 +103,7 @@ enum { CAMEL_MESSAGE_INFO_FROM, CAMEL_MESSAGE_INFO_TO, CAMEL_MESSAGE_INFO_CC, + CAMEL_MESSAGE_INFO_MLIST, CAMEL_MESSAGE_INFO_LAST, }; #endif @@ -113,12 +114,13 @@ struct _CamelMessageInfo { #ifdef DOESTRV struct _EStrv *strings; /* all strings packed into a single compact array */ #else - gchar *subject; - gchar *from; - gchar *to; - gchar *cc; + char *subject; + char *from; + char *to; + char *cc; + char *mlist; - gchar *uid; + char *uid; #endif guint32 flags; guint32 size; @@ -302,6 +304,7 @@ const char *camel_message_info_string(const CamelMessageInfo *mi, int type); #define camel_message_info_to(x) camel_message_info_string((const CamelMessageInfo *)(x), CAMEL_MESSAGE_INFO_TO) #define camel_message_info_cc(x) camel_message_info_string((const CamelMessageInfo *)(x), CAMEL_MESSAGE_INFO_CC) #define camel_message_info_uid(x) camel_message_info_string((const CamelMessageInfo *)(x), CAMEL_MESSAGE_INFO_UID) +#define camel_message_info_mlist(x) camel_message_info_string((const CamelMessageInfo *)(x), CAMEL_MESSAGE_INFO_MLIST) void camel_message_info_set_string(CamelMessageInfo *mi, int type, char *str); #define camel_message_info_set_subject(x, s) camel_message_info_set_string(x, CAMEL_MESSAGE_INFO_SUBJECT, s) @@ -309,6 +312,7 @@ void camel_message_info_set_string(CamelMessageInfo *mi, int type, char *str); #define camel_message_info_set_to(x, s) camel_message_info_set_string(x, CAMEL_MESSAGE_INFO_TO, s) #define camel_message_info_set_cc(x, s) camel_message_info_set_string(x, CAMEL_MESSAGE_INFO_CC, s) #define camel_message_info_set_uid(x, s) camel_message_info_set_string(x, CAMEL_MESSAGE_INFO_UID, s) +#define camel_message_info_set_mlist(x, s) camel_message_info_set_string(x, CAMEL_MESSAGE_INFO_MLIST, s) #else @@ -317,12 +321,14 @@ void camel_message_info_set_string(CamelMessageInfo *mi, int type, char *str); #define camel_message_info_to(x) (((CamelMessageInfo *)(x))->to?((CamelMessageInfo *)(x))->to:"") #define camel_message_info_cc(x) (((CamelMessageInfo *)(x))->cc?((CamelMessageInfo *)(x))->cc:"") #define camel_message_info_uid(x) (((CamelMessageInfo *)(x))->uid?((CamelMessageInfo *)(x))->uid:"") +#define camel_message_info_mlist(x) (((CamelMessageInfo *)(x))->mlist?((CamelMessageInfo *)(x))->mlist:"") #define camel_message_info_set_subject(x, s) (g_free(((CamelMessageInfo *)(x))->subject),((CamelMessageInfo *)(x))->subject = (s)) #define camel_message_info_set_from(x, s) (g_free(((CamelMessageInfo *)(x))->from),((CamelMessageInfo *)(x))->from = (s)) #define camel_message_info_set_to(x, s) (g_free(((CamelMessageInfo *)(x))->to),((CamelMessageInfo *)(x))->to = (s)) #define camel_message_info_set_cc(x, s) (g_free(((CamelMessageInfo *)(x))->cc),((CamelMessageInfo *)(x))->cc = (s)) #define camel_message_info_set_uid(x, s) (g_free(((CamelMessageInfo *)(x))->uid),((CamelMessageInfo *)(x))->uid = (s)) +#define camel_message_info_set_mlist(x, s) (g_free(((CamelMessageInfo *)(x))->mlist),((CamelMessageInfo *)(x))->mlist = (s)) #endif #endif /* ! _CAMEL_FOLDER_SUMMARY_H */ diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index b9a8384f45..448c3dc077 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -2899,12 +2899,12 @@ 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: ([^<]+)" }, + { "Sender", " *owner-([^@]+)" }, + { "X-BeenThere", " *([^@]+)" }, + { "Delivered-To", " *mailing list ([^@]+)" }, + { "X-Mailing-List", " *([^@]+)" }, + { "X-Loop", " *([^@]+)" }, + { "List-Id", " *([^<]+)" }, }; char * @@ -2912,7 +2912,7 @@ header_raw_check_mailing_list(struct _header_raw **list) { const char *v; regex_t pattern; - regmatch_t match[1]; + regmatch_t match[2]; int i; for (i=0;i<sizeof(mail_list_magic)/sizeof(mail_list_magic[0]);i++) { @@ -2922,9 +2922,9 @@ header_raw_check_mailing_list(struct _header_raw **list) } 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) { + if (v != NULL && regexec(&pattern, v, 2, match, 0) == 0 && match[1].rm_so != -1) { regfree(&pattern); - return g_strndup(v+match[0].rm_so, match[0].rm_eo-match[0].rm_so); + return g_strndup(v+match[1].rm_so, match[1].rm_eo-match[1].rm_so); } regfree(&pattern); } |