* merge mu-msg-contact.[ch] with mu-msg.[ch]

This commit is contained in:
Dirk-Jan C. Binnema
2011-05-14 18:14:24 +03:00
parent c0a24cf7bc
commit 6f33f76797
7 changed files with 236 additions and 299 deletions

View File

@ -300,6 +300,102 @@ const GSList *mu_msg_get_references (MuMsg *msg);
*/
const char* mu_msg_get_references_str (MuMsg *msg);
enum _MuMsgContactType { /* Reply-To:? */
MU_MSG_CONTACT_TYPE_TO = 0,
MU_MSG_CONTACT_TYPE_FROM,
MU_MSG_CONTACT_TYPE_CC,
MU_MSG_CONTACT_TYPE_BCC,
MU_MSG_CONTACT_TYPE_NUM
};
typedef guint MuMsgContactType;
#define mu_msg_contact_type_is_valid(MCT)\
((MCT) < MU_MSG_CONTACT_TYPE_NUM)
struct _MuMsgContact {
const char *name; /* Foo Bar */
const char *address; /* foo@bar.cuux */
MuMsgContactType type; /* MU_MSG_CONTACT_TYPE_{ TO,
* CC, BCC, FROM} */
};
typedef struct _MuMsgContact MuMsgContact;
/**
* create a new MuMsgContact object; note, in many case, this is not
* needed, any a stack-allocated struct can be uses.
*
* @param name the name of the contact
* @param address the e-mail address of the contact
* @param type the type of contact: cc, bcc, from, to
*
* @return a newly allocated MuMsgConcact or NULL in case of
* error. use mu_msg_contact_destroy to destroy it when it's no longer
* needed.
*/
MuMsgContact *mu_msg_contact_new (const char *name, const char *address,
MuMsgContactType type)
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
/**
* destroy a MuMsgConcact object
*
* @param contact a contact object, or NULL
*/
void mu_msg_contact_destroy (MuMsgContact *contact);
/**
* macro to get the name of a contact
*
* @param ct a MuMsgContact
*
* @return the name
*/
#define mu_msg_contact_name(ct) ((ct)->name)
/**
* macro to get the address of a contact
*
* @param ct a MuMsgContact
*
* @return the address
*/
#define mu_msg_contact_address(ct) ((ct)->address)
/**
* macro to get the contact type
*
* @param ct a MuMsgContact
*
* @return the contact type
*/
#define mu_msg_contact_type(ct) ((ct)->type)
/**
* callback function
*
* @param contact
* @param user_data a user provided data pointer
*
* @return TRUE if we should continue the foreach, FALSE otherwise
*/
typedef gboolean (*MuMsgContactForeachFunc) (MuMsgContact* contact,
gpointer user_data);
/**
* call a function for each of the contacts in a message
*
* @param msg a valid MuMsgGMime* instance
* @param func a callback function to call for each contact; when
* 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
*
*/
void mu_msg_contact_foreach (MuMsg *msg, MuMsgContactForeachFunc func,
gpointer user_data);
G_END_DECLS
#endif /*__MU_MSG_H__*/