* mu-msg-fields.[ch]: reindent, remove MU_MSG_FIELD_ID_SUMMARY

This commit is contained in:
Dirk-Jan C. Binnema 2011-05-14 18:06:33 +03:00
parent 3607459771
commit 81f43467eb
2 changed files with 215 additions and 196 deletions

View File

@ -41,9 +41,10 @@ enum _FieldFlags {
* e-mail-addresses */
FLAG_XAPIAN_ESCAPE = 1 << 5, /* field needs escaping for
* xapian */
FLAG_NORMALIZE = 1 << 6 /* field needs flattening for
FLAG_NORMALIZE = 1 << 6, /* field needs flattening for
* case/accents */
FLAG_DONT_CACHE = 1 << 7 /* don't cache this field in
* the MuMsg cache */
};
typedef enum _FieldFlags FieldFlags;
@ -78,14 +79,15 @@ static const MuMsgField FIELD_DATA[] = {
MU_MSG_FIELD_ID_BODY_TEXT,
MU_MSG_FIELD_TYPE_STRING,
"body", 'b', 'B',
FLAG_GMIME | FLAG_XAPIAN_INDEX | FLAG_NORMALIZE
FLAG_GMIME | FLAG_XAPIAN_INDEX | FLAG_NORMALIZE |
FLAG_DONT_CACHE
},
{
MU_MSG_FIELD_ID_BODY_HTML,
MU_MSG_FIELD_TYPE_STRING,
"bodyhtml", 'h', 0,
FLAG_GMIME
FLAG_GMIME | FLAG_DONT_CACHE
},
{
@ -180,13 +182,6 @@ static const MuMsgField FIELD_DATA[] = {
MU_MSG_FIELD_TYPE_STRING,
"refs", 'r', 'R',
FLAG_GMIME | FLAG_XAPIAN_VALUE
},
{
MU_MSG_FIELD_ID_SUMMARY,
MU_MSG_FIELD_TYPE_STRING,
NULL, 0, 0,
FLAG_GMIME
}
};
@ -282,6 +277,15 @@ mu_msg_field_xapian_term (MuMsgFieldId id)
return mu_msg_field(id)->_flags & FLAG_XAPIAN_TERM;
}
gboolean
mu_msg_field_is_cacheable (MuMsgFieldId id)
{
g_return_val_if_fail (mu_msg_field_id_is_valid(id),FALSE);
return mu_msg_field(id)->_flags & FLAG_DONT_CACHE ? FALSE : TRUE;
}
gboolean
mu_msg_field_xapian_contact (MuMsgFieldId id)
{

View File

@ -28,23 +28,26 @@ G_BEGIN_DECLS
* are used in the database */
enum _MuMsgFieldId {
/* first all the string-based ones */
MU_MSG_FIELD_ID_BCC = 0,
MU_MSG_FIELD_ID_BODY_TEXT,
MU_MSG_FIELD_ID_BODY_HTML,
MU_MSG_FIELD_ID_BODY_TEXT,
MU_MSG_FIELD_ID_CC,
MU_MSG_FIELD_ID_DATE,
MU_MSG_FIELD_ID_FLAGS,
MU_MSG_FIELD_ID_FROM,
MU_MSG_FIELD_ID_PATH,
MU_MSG_FIELD_ID_MAILDIR,
MU_MSG_FIELD_ID_PRIO,
MU_MSG_FIELD_ID_SIZE,
MU_MSG_FIELD_ID_MSGID,
MU_MSG_FIELD_ID_PATH,
MU_MSG_FIELD_ID_REFS,
MU_MSG_FIELD_ID_SUBJECT,
MU_MSG_FIELD_ID_TO,
MU_MSG_FIELD_ID_MSGID,
/* MU_MSG_STRING_FIELD_ID_NUM, see below */
/* then the numerical ones */
MU_MSG_FIELD_ID_DATE,
MU_MSG_FIELD_ID_FLAGS,
MU_MSG_FIELD_ID_PRIO,
MU_MSG_FIELD_ID_SIZE,
MU_MSG_FIELD_ID_TIMESTAMP,
MU_MSG_FIELD_ID_REFS,
MU_MSG_FIELD_ID_SUMMARY,
MU_MSG_FIELD_ID_NUM,
@ -57,6 +60,8 @@ typedef enum _MuMsgFieldId MuMsgFieldId;
/* some specials... */
static const MuMsgFieldId MU_MSG_FIELD_ID_NONE = (MuMsgFieldId)-1;
#define MU_MSG_STRING_FIELD_ID_NUM (MU_MSG_FIELD_ID_TO + 1)
#define mu_msg_field_id_is_valid(MFID) \
((MFID) < MU_MSG_FIELD_ID_NUM)
@ -149,6 +154,16 @@ MuMsgFieldType mu_msg_field_type (MuMsgFieldId id) G_GNUC_PURE;
gboolean mu_msg_field_is_numeric (MuMsgFieldId id) G_GNUC_PURE;
/**
* whether the field value should be cached (in MuMsg) -- we cache
* values so we can use the MuMsg without needing to keep the
* underlying data source (the GMimeMessage or the database ptr) alive
* in practice, the fields we *don't* cache are the message body
* (html, txt), because they take too much memory
*/
gboolean mu_msg_field_is_cacheable (MuMsgFieldId id) G_GNUC_PURE;
/**
* is the field Xapian-indexable? That is, should this field be
* indexed in the in the Xapian database, so we can use the all the