* lib/: add support for getting mailing lists

This commit is contained in:
djcb 2012-12-20 23:35:53 +02:00
parent edb73a742f
commit d47a687a4d
5 changed files with 34 additions and 11 deletions

View File

@ -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,

View File

@ -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

View File

@ -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);

View File

@ -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)
{

View File

@ -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
*