* mu-msg-contact: check for type of internetaddress (fixes some warning) +

small cleanups
This commit is contained in:
Dirk-Jan C. Binnema 2010-09-12 21:00:45 +03:00
parent 5d8499b80e
commit 2fef78abc1
2 changed files with 12 additions and 9 deletions

View File

@ -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;
}

View File

@ -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