* some cleanups

This commit is contained in:
djcb
2013-05-13 00:02:39 +03:00
parent d26f3c0bae
commit ea67447a98
4 changed files with 5 additions and 58 deletions

View File

@ -83,7 +83,6 @@ libmu_la_SOURCES= \
mu-store-read.cc \ mu-store-read.cc \
mu-store-write.cc \ mu-store-write.cc \
mu-store-priv.hh \ mu-store-priv.hh \
mu-str-normalize.c \
mu-str.c \ mu-str.c \
mu-str.h \ mu-str.h \
mu-threader.c \ mu-threader.c \

View File

@ -281,7 +281,6 @@ mu_contacts_add (MuContacts *self, const char *addr, const char *name,
* empty name */ * empty name */
group = encode_email_address (addr); group = encode_email_address (addr);
cinfo = (ContactInfo*) g_hash_table_lookup (self->_hash, group); cinfo = (ContactInfo*) g_hash_table_lookup (self->_hash, group);
if (!cinfo || (cinfo->_tstamp < tstamp && !mu_str_is_empty(name))) { if (!cinfo || (cinfo->_tstamp < tstamp && !mu_str_is_empty(name))) {
char *addr_dc; char *addr_dc;

View File

@ -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 static gboolean
fill_contact (MuMsgContact *self, InternetAddress *addr, fill_contact (MuMsgContact *self, InternetAddress *addr,
MuMsgContactType ctype) MuMsgContactType ctype)
@ -620,6 +586,11 @@ fill_contact (MuMsgContact *self, InternetAddress *addr,
else else
self->address = NULL; 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 /* note, the address could NULL e.g. when the recipient is something like
* 'Undisclosed recipients' * 'Undisclosed recipients'
*/ */

View File

@ -511,28 +511,6 @@ struct _MuMsgContact {
}; };
typedef struct _MuMsgContact 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 * macro to get the name of a contact