diff --git a/src/mu-msg-contact.c b/src/mu-msg-contact.c index 1724baaa..f715be07 100644 --- a/src/mu-msg-contact.c +++ b/src/mu-msg-contact.c @@ -39,14 +39,17 @@ fill_contact (MuMsgContact *contact, InternetAddress *addr, if (!addr) return FALSE; - contact->name = (char*)internet_address_get_name (addr); + contact->name = internet_address_get_name (addr); contact->type = ctype; - /* we only support internet addresses; - * if we don't check, g_mime hits an assert + /* we only support internet mailbox addresses; if we don't + * check, g_mime hits an assert */ - contact->address = (char*)internet_address_mailbox_get_addr - (INTERNET_ADDRESS_MAILBOX(addr)); + if (INTERNET_ADDRESS_IS_MAILBOX(addr)) { + contact->address = internet_address_mailbox_get_addr + (INTERNET_ADDRESS_MAILBOX(addr)); + } else + contact->address = NULL; return TRUE; } diff --git a/src/mu-msg-contact.h b/src/mu-msg-contact.h index b81db37d..87b509b3 100644 --- a/src/mu-msg-contact.h +++ b/src/mu-msg-contact.h @@ -35,11 +35,11 @@ typedef enum _MuMsgContactType MuMsgContactType; struct _MuMsgContact { - char *name; /* Foo Bar */ - char *address; /* foo@bar.cuux */ - MuMsgContactType type; /*MU_MSG_CONTACT_TYPE_{TO,CC,BCC,FROM}*/ + 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; +typedef struct _MuMsgContact MuMsgContact; /** * macro to get the name of a contact