* mu-msg: small improvements, cosmetics

This commit is contained in:
Dirk-Jan C. Binnema
2011-06-18 18:48:59 +03:00
parent d2d94f291e
commit f2a0e19626
2 changed files with 16 additions and 7 deletions

View File

@ -62,14 +62,14 @@ mu_msg_new_from_file (const char *path, const char *mdir, GError **err)
return NULL; return NULL;
self = msg_new (); self = msg_new ();
self->_file = msgfile; self->_file = msgfile;
return self; return self;
} }
MuMsg* MuMsg*
mu_msg_new_from_doc (const XapianDocument* doc, GError **err) mu_msg_new_from_doc (XapianDocument *doc, GError **err)
{ {
MuMsg *self; MuMsg *self;
MuMsgDoc *msgdoc; MuMsgDoc *msgdoc;
@ -81,7 +81,7 @@ mu_msg_new_from_doc (const XapianDocument* doc, GError **err)
return NULL; return NULL;
self = msg_new (); self = msg_new ();
self->_doc = msgdoc; self->_doc = msgdoc;
return self; return self;
} }
@ -241,7 +241,7 @@ get_str_field (MuMsg *self, MuMsgFieldId mfid)
val = NULL; val = NULL;
if (self->_doc && mu_msg_field_xapian_value (mfid)) if (self->_doc && mu_msg_field_xapian_value (mfid))
val = mu_msg_doc_get_str_field (self->_doc, mfid, &do_free); val = mu_msg_doc_get_str_field (self->_doc, mfid, &do_free);
else { else if (mu_msg_field_gmime (mfid)) {
/* if we don't have a file object yet, we need to /* if we don't have a file object yet, we need to
* create it from the file on disk */ * create it from the file on disk */
if (!self->_file) if (!self->_file)
@ -249,6 +249,9 @@ get_str_field (MuMsg *self, MuMsgFieldId mfid)
if (!self->_file && !(self->_file = get_msg_file (self))) if (!self->_file && !(self->_file = get_msg_file (self)))
return NULL; return NULL;
val = mu_msg_file_get_str_field (self->_file, mfid, &do_free); val = mu_msg_file_get_str_field (self->_file, mfid, &do_free);
} else {
g_warning ("%s: cannot retrieve field", __FUNCTION__);
return NULL;
} }
/* if we get a string that needs freeing, we tell the cache to /* if we get a string that needs freeing, we tell the cache to

View File

@ -56,14 +56,15 @@ MuMsg *mu_msg_new_from_file (const char* filepath, const char *maildir,
* create a new MuMsg* instance based on a Xapian::Document * create a new MuMsg* instance based on a Xapian::Document
* *
* @param doc a ptr to a Xapian::Document (but cast to XapianDocument, * @param doc a ptr to a Xapian::Document (but cast to XapianDocument,
* because this is C not C++) * because this is C not C++). MuMsg takes _ownership_ of this pointer;
* don't touch it afterwards
* @param err receive error information, or NULL. There * @param err receive error information, or NULL. There
* will only be err info if the function returns NULL * will only be err info if the function returns NULL
* *
* @return a new MuMsg instance or NULL in case of error; call * @return a new MuMsg instance or NULL in case of error; call
* mu_msg_unref when done with this message * mu_msg_unref when done with this message
*/ */
MuMsg *mu_msg_new_from_doc (const XapianDocument* doc, GError **err) MuMsg *mu_msg_new_from_doc (XapianDocument* doc, GError **err)
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
@ -323,7 +324,9 @@ const char* mu_msg_get_header (MuMsg *self, const char *header);
/** /**
* get the list of references, with the direct parent as the final * get the list of references, with the direct parent as the final
* one; this final one is typically the 'In-reply-to' field * one; this final one is typically the 'In-reply-to' field. Note, any
* reference (message-id) will appear at most once, duplicates are
* filtered out.
* *
* @param msg a valid MuMsg * @param msg a valid MuMsg
* *
@ -332,6 +335,9 @@ const char* mu_msg_get_header (MuMsg *self, const char *header);
const GSList* mu_msg_get_references (MuMsg *msg); const GSList* mu_msg_get_references (MuMsg *msg);
/** /**
* get the list of tags (ie., X-Label) * get the list of tags (ie., X-Label)
* *