* 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) if (!addr)
return FALSE; return FALSE;
contact->name = (char*)internet_address_get_name (addr); contact->name = internet_address_get_name (addr);
contact->type = ctype; contact->type = ctype;
/* we only support internet addresses; /* we only support internet mailbox addresses; if we don't
* if we don't check, g_mime hits an assert * check, g_mime hits an assert
*/ */
contact->address = (char*)internet_address_mailbox_get_addr if (INTERNET_ADDRESS_IS_MAILBOX(addr)) {
(INTERNET_ADDRESS_MAILBOX(addr)); contact->address = internet_address_mailbox_get_addr
(INTERNET_ADDRESS_MAILBOX(addr));
} else
contact->address = NULL;
return TRUE; return TRUE;
} }

View File

@ -35,11 +35,11 @@ typedef enum _MuMsgContactType MuMsgContactType;
struct _MuMsgContact { struct _MuMsgContact {
char *name; /* Foo Bar */ const char *name; /* Foo Bar */
char *address; /* foo@bar.cuux */ const char *address; /* foo@bar.cuux */
MuMsgContactType type; /*MU_MSG_CONTACT_TYPE_{TO,CC,BCC,FROM}*/ 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 * macro to get the name of a contact