* mu-msg-doc.cc, mu-msg-iter.cc, mu-msg.h: cosmetics

This commit is contained in:
Dirk-Jan C. Binnema
2011-09-03 10:48:36 +03:00
parent 9cb879ab64
commit 8ab3ff1fec
3 changed files with 97 additions and 95 deletions

View File

@ -30,12 +30,12 @@
#include "mu-date.h" #include "mu-date.h"
struct _MuMsgDoc { struct _MuMsgDoc {
_MuMsgDoc (Xapian::Document *doc) : _doc (doc) {}
~_MuMsgDoc () { delete _doc; } _MuMsgDoc (Xapian::Document *doc): _doc (doc) { }
~_MuMsgDoc () { delete _doc; }
const Xapian::Document doc() const { return *_doc; } const Xapian::Document doc() const { return *_doc; }
private: private:
Xapian::Document *_doc; Xapian::Document *_doc;
}; };
@ -43,10 +43,10 @@ MuMsgDoc*
mu_msg_doc_new (XapianDocument *doc, GError **err) mu_msg_doc_new (XapianDocument *doc, GError **err)
{ {
g_return_val_if_fail (doc, NULL); g_return_val_if_fail (doc, NULL);
try { try {
return new MuMsgDoc ((Xapian::Document*)doc); return new MuMsgDoc ((Xapian::Document*)doc);
} MU_XAPIAN_CATCH_BLOCK_G_ERROR_RETURN(err, MU_ERROR_XAPIAN, NULL); } MU_XAPIAN_CATCH_BLOCK_G_ERROR_RETURN(err, MU_ERROR_XAPIAN, NULL);
return FALSE; return FALSE;
@ -57,7 +57,7 @@ mu_msg_doc_destroy (MuMsgDoc *self)
{ {
try { try {
delete self; delete self;
} MU_XAPIAN_CATCH_BLOCK; } MU_XAPIAN_CATCH_BLOCK;
} }
@ -71,11 +71,11 @@ mu_msg_doc_get_str_field (MuMsgDoc *self, MuMsgFieldId mfid,
g_return_val_if_fail (mu_msg_field_is_string(mfid), NULL); g_return_val_if_fail (mu_msg_field_is_string(mfid), NULL);
*do_free = TRUE; *do_free = TRUE;
try { try {
const std::string s (self->doc().get_value(mfid)); const std::string s (self->doc().get_value(mfid));
return s.empty() ? NULL : g_strdup (s.c_str()); return s.empty() ? NULL : g_strdup (s.c_str());
} MU_XAPIAN_CATCH_BLOCK_RETURN(NULL); } MU_XAPIAN_CATCH_BLOCK_RETURN(NULL);
} }
@ -87,14 +87,14 @@ mu_msg_doc_get_str_list_field (MuMsgDoc *self, MuMsgFieldId mfid,
g_return_val_if_fail (self, NULL); g_return_val_if_fail (self, NULL);
g_return_val_if_fail (mu_msg_field_id_is_valid(mfid), NULL); g_return_val_if_fail (mu_msg_field_id_is_valid(mfid), NULL);
g_return_val_if_fail (mu_msg_field_is_string_list(mfid), NULL); g_return_val_if_fail (mu_msg_field_is_string_list(mfid), NULL);
*do_free = TRUE; *do_free = TRUE;
try { try {
/* return a comma-separated string as a GSList */ /* return a comma-separated string as a GSList */
const std::string s (self->doc().get_value(mfid)); const std::string s (self->doc().get_value(mfid));
return s.empty() ? NULL : mu_str_to_list(s.c_str(),',',TRUE); return s.empty() ? NULL : mu_str_to_list(s.c_str(),',',TRUE);
} MU_XAPIAN_CATCH_BLOCK_RETURN(NULL); } MU_XAPIAN_CATCH_BLOCK_RETURN(NULL);
} }
@ -105,9 +105,9 @@ mu_msg_doc_get_num_field (MuMsgDoc *self, MuMsgFieldId mfid)
g_return_val_if_fail (self, -1); g_return_val_if_fail (self, -1);
g_return_val_if_fail (mu_msg_field_id_is_valid(mfid), -1); g_return_val_if_fail (mu_msg_field_id_is_valid(mfid), -1);
g_return_val_if_fail (mu_msg_field_is_numeric(mfid), -1); g_return_val_if_fail (mu_msg_field_is_numeric(mfid), -1);
/* date is a special case, because we store dates as /* date is a special case, because we store dates as
* strings */ * strings */
try { try {
const std::string s (self->doc().get_value(mfid)); const std::string s (self->doc().get_value(mfid));
if (s.empty()) if (s.empty())
@ -119,8 +119,8 @@ mu_msg_doc_get_num_field (MuMsgDoc *self, MuMsgFieldId mfid)
} else { } else {
return static_cast<gint64>(Xapian::sortable_unserialise(s)); return static_cast<gint64>(Xapian::sortable_unserialise(s));
} }
} MU_XAPIAN_CATCH_BLOCK_RETURN(-1); } MU_XAPIAN_CATCH_BLOCK_RETURN(-1);
} }

View File

@ -53,7 +53,7 @@ struct _MuMsgIter {
public: public:
_MuMsgIter (Xapian::Enquire &enq, size_t maxnum, _MuMsgIter (Xapian::Enquire &enq, size_t maxnum,
gboolean threads, MuMsgFieldId sortfield): gboolean threads, MuMsgFieldId sortfield):
_enq(enq), _thread_hash (0), _msg(0) { _enq(enq), _thread_hash (0), _msg(0) {
_matches = _enq.get_mset (0, maxnum); _matches = _enq.get_mset (0, maxnum);
@ -80,10 +80,11 @@ public:
~_MuMsgIter () { ~_MuMsgIter () {
if (_thread_hash) if (_thread_hash)
g_hash_table_destroy (_thread_hash); g_hash_table_destroy (_thread_hash);
set_msg (NULL); set_msg (NULL);
} }
const Xapian::Enquire& enquire() { return _enq; } const Xapian::Enquire& enquire() const { return _enq; }
Xapian::MSet& matches() { return _matches; } Xapian::MSet& matches() { return _matches; }
Xapian::MSet::const_iterator cursor () const { return _cursor; } Xapian::MSet::const_iterator cursor () const { return _cursor; }
@ -98,6 +99,7 @@ public:
mu_msg_unref (_msg); mu_msg_unref (_msg);
return _msg = msg; return _msg = msg;
} }
private: private:
const Xapian::Enquire _enq; const Xapian::Enquire _enq;
Xapian::MSet _matches; Xapian::MSet _matches;
@ -146,7 +148,7 @@ mu_msg_iter_get_msg_floating (MuMsgIter *iter)
docp = new Xapian::Document(iter->cursor().get_document()); docp = new Xapian::Document(iter->cursor().get_document());
err = NULL; err = NULL;
msg = iter->set_msg (mu_msg_new_from_doc ((XapianDocument*)docp, &err)); msg = iter->set_msg (mu_msg_new_from_doc((XapianDocument*)docp, &err));
if (!msg) if (!msg)
MU_HANDLE_G_ERROR(err); MU_HANDLE_G_ERROR(err);

View File

@ -6,16 +6,16 @@
** it under the terms of the GNU General Public License as published by ** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 3 of the License, or ** the Free Software Foundation; either version 3 of the License, or
** (at your option) any later version. ** (at your option) any later version.
** **
** This program is distributed in the hope that it will be useful, ** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details. ** GNU General Public License for more details.
** **
** You should have received a copy of the GNU General Public License ** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software Foundation, ** along with this program; if not, write to the Free Software Foundation,
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
** **
*/ */
#ifndef __MU_MSG_H__ #ifndef __MU_MSG_H__
@ -24,7 +24,7 @@
#include <mu-flags.h> #include <mu-flags.h>
#include <mu-msg-fields.h> #include <mu-msg-fields.h>
#include <mu-msg-prio.h> #include <mu-msg-prio.h>
#include <mu-util.h> /* for MuResult, MuError and XapianDocument */ #include <mu-util.h> /* for MuError and XapianDocument */
G_BEGIN_DECLS G_BEGIN_DECLS
@ -43,7 +43,7 @@ typedef struct _MuMsg MuMsg;
* @param err receive error information (MU_ERROR_FILE or * @param err receive error information (MU_ERROR_FILE or
* MU_ERROR_GMIME), or NULL. There will only be err info if the * MU_ERROR_GMIME), or NULL. There will only be err info if the
* function returns NULL * 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
*/ */
@ -55,23 +55,23 @@ 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 store a MuStore ptr
* @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++). MuMsg takes _ownership_ of this pointer; * because this is C not C++). MuMsg takes _ownership_ of this pointer;
* don't touch it afterwards * 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 (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;
/** /**
* increase the reference count for this message * increase the reference count for this message
* *
* @param msg a message * @param msg a message
* *
* @return the message with its reference count increased, or NULL in * @return the message with its reference count increased, or NULL in
@ -82,7 +82,7 @@ MuMsg *mu_msg_ref (MuMsg *msg);
/** /**
* decrease the reference count for this message. if the reference * decrease the reference count for this message. if the reference
* count reaches 0, the message will be destroyed. * count reaches 0, the message will be destroyed.
* *
* @param msg a message * @param msg a message
*/ */
void mu_msg_unref (MuMsg *msg); void mu_msg_unref (MuMsg *msg);
@ -92,7 +92,7 @@ void mu_msg_unref (MuMsg *msg);
/** /**
* cache the values from the backend (file or db), so we don't the * cache the values from the backend (file or db), so we don't the
* backend anymore * backend anymore
* *
* @param self a message * @param self a message
*/ */
void mu_msg_cache_values (MuMsg *self); void mu_msg_cache_values (MuMsg *self);
@ -102,7 +102,7 @@ void mu_msg_cache_values (MuMsg *self);
* get the plain text body of this message * get the plain text body of this message
* *
* @param msg a valid MuMsg* instance * @param msg a valid MuMsg* instance
* *
* @return the plain text body or NULL in case of error or if there is no * @return the plain text body or NULL in case of error or if there is no
* such body. the returned string should *not* be modified or freed. * such body. the returned string should *not* be modified or freed.
* The returned data is in UTF8 or NULL. * The returned data is in UTF8 or NULL.
@ -114,7 +114,7 @@ const char* mu_msg_get_body_text (MuMsg *msg);
* get the html body of this message * get the html body of this message
* *
* @param msg a valid MuMsg* instance * @param msg a valid MuMsg* instance
* *
* @return the html body or NULL in case of error or if there is no * @return the html body or NULL in case of error or if there is no
* such body. the returned string should *not* be modified or freed. * such body. the returned string should *not* be modified or freed.
*/ */
@ -124,8 +124,8 @@ const char* mu_msg_get_body_html (MuMsg *msg);
* get the sender (From:) of this message * get the sender (From:) of this message
* *
* @param msg a valid MuMsg* instance * @param msg a valid MuMsg* instance
* *
* @return the sender of this Message or NULL in case of error or if there * @return the sender of this Message or NULL in case of error or if there
* is no sender. the returned string should *not* be modified or freed. * is no sender. the returned string should *not* be modified or freed.
*/ */
const char* mu_msg_get_from (MuMsg *msg); const char* mu_msg_get_from (MuMsg *msg);
@ -135,8 +135,8 @@ const char* mu_msg_get_from (MuMsg *msg);
* get the recipients (To:) of this message * get the recipients (To:) of this message
* *
* @param msg a valid MuMsg* instance * @param msg a valid MuMsg* instance
* *
* @return the sender of this Message or NULL in case of error or if there * @return the sender of this Message or NULL in case of error or if there
* are no recipients. the returned string should *not* be modified or freed. * are no recipients. the returned string should *not* be modified or freed.
*/ */
const char* mu_msg_get_to (MuMsg *msg); const char* mu_msg_get_to (MuMsg *msg);
@ -146,9 +146,9 @@ const char* mu_msg_get_to (MuMsg *msg);
* get the carbon-copy recipients (Cc:) of this message * get the carbon-copy recipients (Cc:) of this message
* *
* @param msg a valid MuMsg* instance * @param msg a valid MuMsg* instance
* *
* @return the Cc: recipients of this Message or NULL in case of error or if * @return the Cc: recipients of this Message or NULL in case of error or if
* there are no such recipients. the returned string should *not* be modified * there are no such recipients. the returned string should *not* be modified
* or freed. * or freed.
*/ */
const char* mu_msg_get_cc (MuMsg *msg); const char* mu_msg_get_cc (MuMsg *msg);
@ -159,7 +159,7 @@ const char* mu_msg_get_cc (MuMsg *msg);
* field usually only appears in outgoing messages * field usually only appears in outgoing messages
* *
* @param msg a valid MuMsg* instance * @param msg a valid MuMsg* instance
* *
* @return the Bcc: recipients of this Message or NULL in case of * @return the Bcc: recipients of this Message or NULL in case of
* error or if there are no such recipients. the returned string * error or if there are no such recipients. the returned string
* should *not* be modified or freed. * should *not* be modified or freed.
@ -170,8 +170,8 @@ const char* mu_msg_get_bcc (MuMsg *msg);
* get the file system path of this message * get the file system path of this message
* *
* @param msg a valid MuMsg* instance * @param msg a valid MuMsg* instance
* *
* @return the path of this Message or NULL in case of error. * @return the path of this Message or NULL in case of error.
* the returned string should *not* be modified or freed. * the returned string should *not* be modified or freed.
*/ */
const char* mu_msg_get_path (MuMsg *msg); const char* mu_msg_get_path (MuMsg *msg);
@ -182,7 +182,7 @@ const char* mu_msg_get_path (MuMsg *msg);
* ~/Maildir/foo/bar/cur/msg, the maildir would be foo/bar * ~/Maildir/foo/bar/cur/msg, the maildir would be foo/bar
* *
* @param msg a valid MuMsg* instance * @param msg a valid MuMsg* instance
* *
* @return the maildir requested or NULL in case of error. The returned * @return the maildir requested or NULL in case of error. The returned
* string should *not* be modified or freed. * string should *not* be modified or freed.
*/ */
@ -193,8 +193,8 @@ const char* mu_msg_get_maildir (MuMsg *msg);
* get the subject of this message * get the subject of this message
* *
* @param msg a valid MuMsg* instance * @param msg a valid MuMsg* instance
* *
* @return the subject of this Message or NULL in case of error or if there * @return the subject of this Message or NULL in case of error or if there
* is no subject. the returned string should *not* be modified or freed. * is no subject. the returned string should *not* be modified or freed.
*/ */
const char* mu_msg_get_subject (MuMsg *msg); const char* mu_msg_get_subject (MuMsg *msg);
@ -203,7 +203,7 @@ const char* mu_msg_get_subject (MuMsg *msg);
* get the Message-Id of this message * get the Message-Id of this message
* *
* @param msg a valid MuMsg* instance * @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 * or NULL in case of error or if there is none. the returned string
* should *not* be modified or freed. * should *not* be modified or freed.
@ -216,19 +216,19 @@ const char* mu_msg_get_msgid (MuMsg *msg);
* *
* @param msg a valid MuMsg* instance * @param msg a valid MuMsg* instance
* @header the header requested * @header the header requested
* *
* @return the header requested or NULL in case of error or if there * @return the header requested or NULL in case of error or if there
* is no such header. the returned string should *not* be modified or freed. * is no such header. the returned string should *not* be modified or freed.
*/ */
const char* mu_msg_get_header (MuMsg *msg, const char* mu_msg_get_header (MuMsg *msg,
const char* header); const char* header);
/** /**
* get the message date/time (the Date: field) as time_t, using UTC * get the message date/time (the Date: field) as time_t, using UTC
* *
* @param msg a valid MuMsg* instance * @param msg a valid MuMsg* instance
* *
* @return message date/time or 0 in case of error or if there * @return message date/time or 0 in case of error or if there
* is no such header. * is no such header.
*/ */
time_t mu_msg_get_date (MuMsg *msg); time_t mu_msg_get_date (MuMsg *msg);
@ -237,7 +237,7 @@ time_t mu_msg_get_date (MuMsg *msg);
* get the flags for this message * get the flags for this message
* *
* @param msg valid MuMsg* instance * @param msg valid MuMsg* instance
* *
* @return the fileflags as logically OR'd #Mu MsgFlags or 0 if * @return the fileflags as logically OR'd #Mu MsgFlags or 0 if
* there are none. * there are none.
*/ */
@ -248,18 +248,18 @@ MuFlags mu_msg_get_flags (MuMsg *msg);
* get the file size in bytes of this message * get the file size in bytes of this message
* *
* @param msg a valid MuMsg* instance * @param msg a valid MuMsg* instance
* *
* @return the filesize * @return the filesize
*/ */
size_t mu_msg_get_size (MuMsg *msg); size_t mu_msg_get_size (MuMsg *msg);
/** /**
* get some field value as string * get some field value as string
* *
* @param msg a valid MuMsg instance * @param msg a valid MuMsg instance
* @param field the field to retrieve; it must be a string-typed field * @param field the field to retrieve; it must be a string-typed field
* *
* @return a string that should not be freed * @return a string that should not be freed
*/ */
const char* mu_msg_get_field_string (MuMsg *msg, MuMsgFieldId mfid); const char* mu_msg_get_field_string (MuMsg *msg, MuMsgFieldId mfid);
@ -267,20 +267,20 @@ const char* mu_msg_get_field_string (MuMsg *msg, MuMsgFieldId mfid);
/** /**
* get some field value as string-list * get some field value as string-list
* *
* @param msg a valid MuMsg instance * @param msg a valid MuMsg instance
* @param field the field to retrieve; it must be a string-list-typed field * @param field the field to retrieve; it must be a string-list-typed field
* *
* @return a list that should not be freed * @return a list that should not be freed
*/ */
const GSList* mu_msg_get_field_string_list (MuMsg *self, MuMsgFieldId mfid); const GSList* mu_msg_get_field_string_list (MuMsg *self, MuMsgFieldId mfid);
/** /**
* get some field value as string * get some field value as string
* *
* @param msg a valid MuMsg instance * @param msg a valid MuMsg instance
* @param field the field to retrieve; it must be a numeric field * @param field the field to retrieve; it must be a numeric field
* *
* @return a string that should not be freed * @return a string that should not be freed
*/ */
gint64 mu_msg_get_field_numeric (MuMsg *msg, MuMsgFieldId mfid); gint64 mu_msg_get_field_numeric (MuMsg *msg, MuMsgFieldId mfid);
@ -293,16 +293,16 @@ gint64 mu_msg_get_field_numeric (MuMsg *msg, MuMsgFieldId mfid);
* MU_MSG_PRIO_NORMAL is assumed * MU_MSG_PRIO_NORMAL is assumed
* *
* @param msg a valid MuMsg* instance * @param msg a valid MuMsg* instance
* *
* @return the message priority (!= 0) or 0 in case of error * @return the message priority (!= 0) or 0 in case of error
*/ */
MuMsgPrio mu_msg_get_prio (MuMsg *msg); MuMsgPrio mu_msg_get_prio (MuMsg *msg);
/** /**
* get the timestamp (mtime) for the file containing this message * get the timestamp (mtime) for the file containing this message
* *
* @param msg a valid MuMsg* instance * @param msg a valid MuMsg* instance
* *
* @return the timestamp or 0 in case of error * @return the timestamp or 0 in case of error
*/ */
time_t mu_msg_get_timestamp (MuMsg *msg); time_t mu_msg_get_timestamp (MuMsg *msg);
@ -312,10 +312,10 @@ time_t mu_msg_get_timestamp (MuMsg *msg);
/** /**
* get a specific header from the message. This value will _not_ be * get a specific header from the message. This value will _not_ be
* cached * cached
* *
* @param self a MuMsg instance * @param self a MuMsg instance
* @param header a specific header (like 'X-Mailer' or 'Organization') * @param header a specific header (like 'X-Mailer' or 'Organization')
* *
* @return a header string which is valid as long as this MuMsg is * @return a header string which is valid as long as this MuMsg is
*/ */
const char* mu_msg_get_header (MuMsg *self, const char *header); const char* mu_msg_get_header (MuMsg *self, const char *header);
@ -327,18 +327,18 @@ const char* mu_msg_get_header (MuMsg *self, const char *header);
* one; this final one is typically the 'In-reply-to' field. Note, any * one; this final one is typically the 'In-reply-to' field. Note, any
* reference (message-id) will appear at most once, duplicates are * reference (message-id) will appear at most once, duplicates are
* filtered out. * filtered out.
* *
* @param msg a valid MuMsg * @param msg a valid MuMsg
* *
* @return a list with the references for this msg. Don't modify/free * @return a list with the references for this msg. Don't modify/free
*/ */
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)
* *
* @param msg a valid MuMsg * @param msg a valid MuMsg
* *
* @return a list with the tags for this msg. Don't modify/free * @return a list with the tags for this msg. Don't modify/free
*/ */
const GSList* mu_msg_get_tags (MuMsg *self); const GSList* mu_msg_get_tags (MuMsg *self);
@ -346,11 +346,11 @@ const GSList* mu_msg_get_tags (MuMsg *self);
/** /**
* compare two messages for sorting * compare two messages for sorting
* *
* @param m1 a message * @param m1 a message
* @param m2 another message * @param m2 another message
* @param mfid the message to use for the comparison * @param mfid the message to use for the comparison
* *
* @return negative if m1 is smaller, positive if m1 is smaller, 0 if * @return negative if m1 is smaller, positive if m1 is smaller, 0 if
* they are equal * they are equal
*/ */
@ -359,10 +359,10 @@ int mu_msg_cmp (MuMsg *m1, MuMsg *m2, MuMsgFieldId mfid);
/** /**
* check whether there there's a readable file behind this message * check whether there there's a readable file behind this message
* *
* @param self a MuMsg* * @param self a MuMsg*
* *
* @return TRUE if the message file is readable, FALSE otherwise * @return TRUE if the message file is readable, FALSE otherwise
*/ */
gboolean mu_msg_is_readable (MuMsg *self); gboolean mu_msg_is_readable (MuMsg *self);
@ -374,13 +374,13 @@ struct _MuMsgIterThreadInfo;
/** /**
* convert the msg to a Lisp symbolic expression (for further processing in * convert the msg to a Lisp symbolic expression (for further processing in
* e.g. emacs) * e.g. emacs)
* *
* @param msg a valid message * @param msg a valid message
* @param ti thread info for the current message, or NULL * @param ti thread info for the current message, or NULL
* @param dbonly if TRUE, only include message fields which can be * @param dbonly if TRUE, only include message fields which can be
* obtained from the database (this is much faster if the MuMsg is * obtained from the database (this is much faster if the MuMsg is
* database-backed, so no file needs to be opened) * database-backed, so no file needs to be opened)
* *
* @return a string with the sexp (free with g_free) or NULL in case of error * @return a string with the sexp (free with g_free) or NULL in case of error
*/ */
char* mu_msg_to_sexp (MuMsg *msg, const struct _MuMsgIterThreadInfo *ti, char* mu_msg_to_sexp (MuMsg *msg, const struct _MuMsgIterThreadInfo *ti,
@ -388,7 +388,7 @@ char* mu_msg_to_sexp (MuMsg *msg, const struct _MuMsgIterThreadInfo *ti,
/** /**
* move a message to another maildir * move a message to another maildir
* *
* @param msg a message with an existing file system path in an actual * @param msg a message with an existing file system path in an actual
* maildir * maildir
* @param targetmdir the target maildir; note that this the base-level * @param targetmdir the target maildir; note that this the base-level
@ -404,8 +404,8 @@ char* mu_msg_to_sexp (MuMsg *msg, const struct _MuMsgIterThreadInfo *ti,
* @param err (may be NULL) may contain error information; note if the * @param err (may be NULL) may contain error information; note if the
* function return FALSE, err is not set for all error condition * function return FALSE, err is not set for all error condition
* (ie. not for parameter error * (ie. not for parameter error
* *
* @return TRUE if it worked, FALSE otherwise * @return TRUE if it worked, FALSE otherwise
*/ */
gboolean mu_msg_move_to_maildir (MuMsg *msg, const char* targetmdir, gboolean mu_msg_move_to_maildir (MuMsg *msg, const char* targetmdir,
MuFlags flags, gboolean ignore_dups, MuFlags flags, gboolean ignore_dups,
@ -414,10 +414,10 @@ gboolean mu_msg_move_to_maildir (MuMsg *msg, const char* targetmdir,
enum _MuMsgContactType { /* Reply-To:? */ enum _MuMsgContactType { /* Reply-To:? */
MU_MSG_CONTACT_TYPE_TO = 0, MU_MSG_CONTACT_TYPE_TO = 0,
MU_MSG_CONTACT_TYPE_FROM, MU_MSG_CONTACT_TYPE_FROM,
MU_MSG_CONTACT_TYPE_CC, MU_MSG_CONTACT_TYPE_CC,
MU_MSG_CONTACT_TYPE_BCC, MU_MSG_CONTACT_TYPE_BCC,
MU_MSG_CONTACT_TYPE_NUM MU_MSG_CONTACT_TYPE_NUM
}; };
typedef guint MuMsgContactType; typedef guint MuMsgContactType;
@ -429,18 +429,18 @@ struct _MuMsgContact {
const char *name; /* Foo Bar */ const char *name; /* Foo Bar */
const char *address; /* foo@bar.cuux */ const char *address; /* foo@bar.cuux */
MuMsgContactType type; /* MU_MSG_CONTACT_TYPE_{ TO, MuMsgContactType type; /* MU_MSG_CONTACT_TYPE_{ TO,
* CC, BCC, FROM} */ * CC, BCC, FROM} */
}; };
typedef struct _MuMsgContact MuMsgContact; typedef struct _MuMsgContact MuMsgContact;
/** /**
* create a new MuMsgContact object; note, in many case, this is not * create a new MuMsgContact object; note, in many case, this is not
* needed, any a stack-allocated struct can be uses. * needed, any a stack-allocated struct can be uses.
* *
* @param name the name of the contact * @param name the name of the contact
* @param address the e-mail address of the contact * @param address the e-mail address of the contact
* @param type the type of contact: cc, bcc, from, to * @param type the type of contact: cc, bcc, from, to
* *
* @return a newly allocated MuMsgConcact or NULL in case of * @return a newly allocated MuMsgConcact or NULL in case of
* error. use mu_msg_contact_destroy to destroy it when it's no longer * error. use mu_msg_contact_destroy to destroy it when it's no longer
* needed. * needed.
@ -451,34 +451,34 @@ MuMsgContact *mu_msg_contact_new (const char *name, const char *address,
/** /**
* destroy a MuMsgConcact object * destroy a MuMsgConcact object
* *
* @param contact a contact object, or NULL * @param contact a contact object, or NULL
*/ */
void mu_msg_contact_destroy (MuMsgContact *contact); void mu_msg_contact_destroy (MuMsgContact *contact);
/** /**
* macro to get the name of a contact * macro to get the name of a contact
* *
* @param ct a MuMsgContact * @param ct a MuMsgContact
* *
* @return the name * @return the name
*/ */
#define mu_msg_contact_name(ct) ((ct)->name) #define mu_msg_contact_name(ct) ((ct)->name)
/** /**
* macro to get the address of a contact * macro to get the address of a contact
* *
* @param ct a MuMsgContact * @param ct a MuMsgContact
* *
* @return the address * @return the address
*/ */
#define mu_msg_contact_address(ct) ((ct)->address) #define mu_msg_contact_address(ct) ((ct)->address)
/** /**
* macro to get the contact type * macro to get the contact type
* *
* @param ct a MuMsgContact * @param ct a MuMsgContact
* *
* @return the contact type * @return the contact type
*/ */
#define mu_msg_contact_type(ct) ((ct)->type) #define mu_msg_contact_type(ct) ((ct)->type)
@ -503,7 +503,7 @@ typedef gboolean (*MuMsgContactForeachFunc) (MuMsgContact* contact,
* @param func a callback function to call for each contact; when * @param func a callback function to call for each contact; when
* the callback does not return TRUE, it won't be called again * the callback does not return TRUE, it won't be called again
* @param user_data a user-provide pointer that will be passed to the callback * @param user_data a user-provide pointer that will be passed to the callback
* *
*/ */
void mu_msg_contact_foreach (MuMsg *msg, MuMsgContactForeachFunc func, void mu_msg_contact_foreach (MuMsg *msg, MuMsgContactForeachFunc func,
gpointer user_data); gpointer user_data);