* add basic support for X-Label (WIP)
This commit is contained in:
@ -62,9 +62,9 @@ struct _MuMsgField {
|
|||||||
MuMsgFieldId _id; /* the id of the field */
|
MuMsgFieldId _id; /* the id of the field */
|
||||||
MuMsgFieldType _type; /* the type of the field */
|
MuMsgFieldType _type; /* the type of the field */
|
||||||
const char *_name; /* the name of the field */
|
const char *_name; /* the name of the field */
|
||||||
const char _shortcut; /* the shortcut for use in
|
const char _shortcut; /* the shortcut for use in
|
||||||
* --fields and sorting */
|
* --fields and sorting */
|
||||||
const char _xprefix; /* the Xapian-prefix */
|
const char _xprefix; /* the Xapian-prefix */
|
||||||
FieldFlags _flags; /* the flags that tells us
|
FieldFlags _flags; /* the flags that tells us
|
||||||
* what to do */
|
* what to do */
|
||||||
};
|
};
|
||||||
@ -195,17 +195,26 @@ static const MuMsgField FIELD_DATA[] = {
|
|||||||
{
|
{
|
||||||
MU_MSG_FIELD_ID_TIMESTAMP,
|
MU_MSG_FIELD_ID_TIMESTAMP,
|
||||||
MU_MSG_FIELD_TYPE_TIME_T,
|
MU_MSG_FIELD_TYPE_TIME_T,
|
||||||
"timestamp", 'x', 0,
|
"timestamp", 0, 0,
|
||||||
FLAG_GMIME
|
FLAG_GMIME
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
MU_MSG_FIELD_ID_REFS,
|
MU_MSG_FIELD_ID_REFS,
|
||||||
MU_MSG_FIELD_TYPE_STRING_LIST,
|
MU_MSG_FIELD_TYPE_STRING_LIST,
|
||||||
"refs", 'r', 'R',
|
NULL, 'r', 'R',
|
||||||
FLAG_GMIME | FLAG_XAPIAN_VALUE |
|
FLAG_GMIME | FLAG_XAPIAN_VALUE |
|
||||||
FLAG_XAPIAN_PREFIX_ONLY
|
FLAG_XAPIAN_PREFIX_ONLY
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
MU_MSG_FIELD_ID_TAGS,
|
||||||
|
MU_MSG_FIELD_TYPE_STRING_LIST,
|
||||||
|
"tag", 'x', 'X',
|
||||||
|
FLAG_GMIME | FLAG_XAPIAN_TERM | FLAG_XAPIAN_VALUE |
|
||||||
|
FLAG_XAPIAN_PREFIX_ONLY
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* the MsgField data in an array, indexed by the MsgFieldId;
|
/* the MsgField data in an array, indexed by the MsgFieldId;
|
||||||
|
|||||||
@ -44,6 +44,7 @@ enum _MuMsgFieldId {
|
|||||||
|
|
||||||
/* string list items... */
|
/* string list items... */
|
||||||
MU_MSG_FIELD_ID_REFS,
|
MU_MSG_FIELD_ID_REFS,
|
||||||
|
MU_MSG_FIELD_ID_TAGS,
|
||||||
|
|
||||||
/* then the numerical ones */
|
/* then the numerical ones */
|
||||||
MU_MSG_FIELD_ID_DATE,
|
MU_MSG_FIELD_ID_DATE,
|
||||||
|
|||||||
@ -714,6 +714,18 @@ get_references (MuMsgFile *self)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static GSList*
|
||||||
|
get_tags (MuMsgFile *self)
|
||||||
|
{
|
||||||
|
GMimeObject *obj;
|
||||||
|
|
||||||
|
obj = GMIME_OBJECT(self->_mime_msg);
|
||||||
|
|
||||||
|
return mu_str_to_list (g_mime_object_get_header
|
||||||
|
(obj, "X-Label"), ',');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
mu_msg_file_get_str_field (MuMsgFile *self, MuMsgFieldId mfid, gboolean *do_free)
|
mu_msg_file_get_str_field (MuMsgFile *self, MuMsgFieldId mfid, gboolean *do_free)
|
||||||
{
|
{
|
||||||
@ -774,16 +786,15 @@ mu_msg_file_get_str_list_field (MuMsgFile *self, MuMsgFieldId mfid,
|
|||||||
case MU_MSG_FIELD_ID_REFS:
|
case MU_MSG_FIELD_ID_REFS:
|
||||||
*do_free = TRUE;
|
*do_free = TRUE;
|
||||||
return get_references (self);
|
return get_references (self);
|
||||||
|
case MU_MSG_FIELD_ID_TAGS:
|
||||||
|
*do_free = TRUE;
|
||||||
|
return get_tags (self);
|
||||||
default:
|
default:
|
||||||
g_return_val_if_reached (NULL);
|
g_return_val_if_reached (NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gint64
|
gint64
|
||||||
mu_msg_file_get_num_field (MuMsgFile *self, const MuMsgFieldId mfid)
|
mu_msg_file_get_num_field (MuMsgFile *self, const MuMsgFieldId mfid)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -426,6 +426,14 @@ mu_msg_get_references (MuMsg *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const GSList*
|
||||||
|
mu_msg_get_tags (MuMsg *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (self, NULL);
|
||||||
|
return get_str_list_field (self, MU_MSG_FIELD_ID_TAGS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
mu_msg_get_field_string (MuMsg *self, MuMsgFieldId mfid)
|
mu_msg_get_field_string (MuMsg *self, MuMsgFieldId mfid)
|
||||||
{
|
{
|
||||||
|
|||||||
17
src/mu-msg.h
17
src/mu-msg.h
@ -322,14 +322,23 @@ const char* mu_msg_get_header (MuMsg *self, const char *header);
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the list of references as a comma-separated string
|
* get the list of references
|
||||||
*
|
*
|
||||||
* @param msg a valid MuMsg
|
* @param msg a valid MuMsg
|
||||||
*
|
*
|
||||||
* @return a comma-separated string with the references or NULL if
|
* @return a list with the references for this msg. Don't modify/free
|
||||||
* there are none. Don't modify/free
|
|
||||||
*/
|
*/
|
||||||
const char* mu_msg_get_references_str (MuMsg *msg);
|
const GSList* mu_msg_get_references (MuMsg *msg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the list of tags
|
||||||
|
*
|
||||||
|
* @param msg a valid MuMsg
|
||||||
|
*
|
||||||
|
* @return a list with the tags for this msg. Don't modify/free
|
||||||
|
|
||||||
|
*/
|
||||||
|
const GSList* mu_msg_get_tags (MuMsg *self);
|
||||||
|
|
||||||
|
|
||||||
enum _MuMsgContactType { /* Reply-To:? */
|
enum _MuMsgContactType { /* Reply-To:? */
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
/* -*-mode: c++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8-*- */
|
/* -*-mode: c++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8-*- */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Copyright (C) 2008-2011 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
** Copyright (C) 2008-2011 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||||
**
|
**
|
||||||
|
|||||||
Reference in New Issue
Block a user