From ea67447a984c8cf284a1ce85ab92915416a72ecf Mon Sep 17 00:00:00 2001 From: djcb Date: Mon, 13 May 2013 00:02:39 +0300 Subject: [PATCH] * some cleanups --- lib/Makefile.am | 1 - lib/mu-contacts.c | 1 - lib/mu-msg.c | 39 +++++---------------------------------- lib/mu-msg.h | 22 ---------------------- 4 files changed, 5 insertions(+), 58 deletions(-) diff --git a/lib/Makefile.am b/lib/Makefile.am index d12d2a58..14b99f1b 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -83,7 +83,6 @@ libmu_la_SOURCES= \ mu-store-read.cc \ mu-store-write.cc \ mu-store-priv.hh \ - mu-str-normalize.c \ mu-str.c \ mu-str.h \ mu-threader.c \ diff --git a/lib/mu-contacts.c b/lib/mu-contacts.c index 92b330e7..af29305a 100644 --- a/lib/mu-contacts.c +++ b/lib/mu-contacts.c @@ -281,7 +281,6 @@ mu_contacts_add (MuContacts *self, const char *addr, const char *name, * empty name */ group = encode_email_address (addr); - cinfo = (ContactInfo*) g_hash_table_lookup (self->_hash, group); if (!cinfo || (cinfo->_tstamp < tstamp && !mu_str_is_empty(name))) { char *addr_dc; diff --git a/lib/mu-msg.c b/lib/mu-msg.c index 5630fde3..e07796bd 100644 --- a/lib/mu-msg.c +++ b/lib/mu-msg.c @@ -567,40 +567,6 @@ mu_msg_get_field_numeric (MuMsg *self, MuMsgFieldId mfid) } - -MuMsgContact * -mu_msg_contact_new (const char *name, const char *address, - MuMsgContactType type) -{ - MuMsgContact *self; - - g_return_val_if_fail (name, NULL); - g_return_val_if_fail (address, NULL); - g_return_val_if_fail (!mu_msg_contact_type_is_valid(type), - NULL); - - self = g_slice_new (MuMsgContact); - - self->name = g_strdup (name); - self->address = g_strdup (address); - self->type = type; - - return self; -} - - -void -mu_msg_contact_destroy (MuMsgContact *self) -{ - if (!self) - return; - - g_free ((void*)self->name); - g_free ((void*)self->address); - g_slice_free (MuMsgContact, self); -} - - static gboolean fill_contact (MuMsgContact *self, InternetAddress *addr, MuMsgContactType ctype) @@ -620,6 +586,11 @@ fill_contact (MuMsgContact *self, InternetAddress *addr, else self->address = NULL; + /* if there's no address, just a name, it's probably a local + * address (without @) */ + if (self->name && !self->address) + self->address = self->name; + /* note, the address could NULL e.g. when the recipient is something like * 'Undisclosed recipients' */ diff --git a/lib/mu-msg.h b/lib/mu-msg.h index 3c14579b..9f2bf452 100644 --- a/lib/mu-msg.h +++ b/lib/mu-msg.h @@ -511,28 +511,6 @@ struct _MuMsgContact { }; 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