From d47a687a4d6f06f14f536e416c96c8f23d82603a Mon Sep 17 00:00:00 2001 From: djcb Date: Thu, 20 Dec 2012 23:35:53 +0200 Subject: [PATCH] * lib/: add support for getting mailing lists --- lib/mu-msg-fields.c | 16 ++++++++-------- lib/mu-msg-fields.h | 2 +- lib/mu-msg-file.c | 2 +- lib/mu-msg.c | 10 ++++++++++ lib/mu-msg.h | 15 ++++++++++++++- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/lib/mu-msg-fields.c b/lib/mu-msg-fields.c index 28a0a581..11bf2ba5 100644 --- a/lib/mu-msg-fields.c +++ b/lib/mu-msg-fields.c @@ -160,14 +160,6 @@ static const MuMsgField FIELD_DATA[] = { }, - { - MU_MSG_FIELD_ID_LIST, - MU_MSG_FIELD_TYPE_STRING, - "list", 'v', 'L', - FLAG_GMIME | FLAG_XAPIAN_VALUE - }, - - { MU_MSG_FIELD_ID_MAILDIR, MU_MSG_FIELD_TYPE_STRING, @@ -177,6 +169,14 @@ static const MuMsgField FIELD_DATA[] = { }, + { + MU_MSG_FIELD_ID_MAILING_LIST, + MU_MSG_FIELD_TYPE_STRING, + "list", 'v', 'L', + FLAG_GMIME | FLAG_XAPIAN_VALUE + }, + + { MU_MSG_FIELD_ID_MIME, MU_MSG_FIELD_TYPE_STRING, diff --git a/lib/mu-msg-fields.h b/lib/mu-msg-fields.h index e7d93c0d..91c89210 100644 --- a/lib/mu-msg-fields.h +++ b/lib/mu-msg-fields.h @@ -56,7 +56,7 @@ enum _MuMsgFieldId { MU_MSG_FIELD_ID_SIZE, /* add new ones here... */ - MU_MSG_FIELD_ID_LIST, /* mailing list */ + MU_MSG_FIELD_ID_MAILING_LIST, /* mailing list */ MU_MSG_FIELD_ID_NUM diff --git a/lib/mu-msg-file.c b/lib/mu-msg-file.c index 728486eb..b0168d82 100644 --- a/lib/mu-msg-file.c +++ b/lib/mu-msg-file.c @@ -618,7 +618,7 @@ mu_msg_file_get_str_field (MuMsgFile *self, MuMsgFieldId mfid, case MU_MSG_FIELD_ID_PATH: return self->_path; - case MU_MSG_FIELD_ID_LIST: + case MU_MSG_FIELD_ID_MAILING_LIST: *do_free = TRUE; return (char*)get_mailing_list (self); diff --git a/lib/mu-msg.c b/lib/mu-msg.c index 8ba92d03..965516f6 100644 --- a/lib/mu-msg.c +++ b/lib/mu-msg.c @@ -373,6 +373,16 @@ mu_msg_get_msgid (MuMsg *self) return get_str_field (self, MU_MSG_FIELD_ID_MSGID); } + + +const char* +mu_msg_get_mailing_list (MuMsg *self) +{ + g_return_val_if_fail (self, NULL); + return get_str_field (self, MU_MSG_FIELD_ID_MAILING_LIST); +} + + const char* mu_msg_get_maildir (MuMsg *self) { diff --git a/lib/mu-msg.h b/lib/mu-msg.h index 4af6c36b..50871b22 100644 --- a/lib/mu-msg.h +++ b/lib/mu-msg.h @@ -261,13 +261,26 @@ const char* mu_msg_get_subject (MuMsg *msg); * * @param msg a valid MuMsg* instance * - * @return the Message-Id of this Message (without the enclosing <>) + * @return the Message-Id of this message (without the enclosing <>) * or NULL in case of error or if there is none. the returned string * should *not* be modified or freed. */ const char* mu_msg_get_msgid (MuMsg *msg); +/** + * get the mailing list for a message, i.e. the mailing-list + * identifier in the List-Id header. + * + * @param msg a valid MuMsg* instance + * + * @return the mailing list id for this message (without the enclosing <>) + * or NULL in case of error or if there is none. the returned string + * should *not* be modified or freed. + */ +const char* mu_msg_get_mailing_list (MuMsg *msg); + + /** * get any arbitrary header from this message *