summaryrefslogtreecommitdiff
path: root/src/contact.c
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-08-16 11:01:00 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2011-08-16 12:07:41 +0100
commit4296af242825c610a57224c082922299001e15e8 (patch)
treed46d971b8f0ee982711c963956714e2914c10ae3 /src/contact.c
parenta5d63dcf86593359ddfa739a0f02d519255c991c (diff)
downloadtelepathy-salut-4296af242825c610a57224c082922299001e15e8.tar.gz
ContactInfo: ignore empty name, jid and email fields.
When I tested this branch out for real, I found that a few people on the network were publishing empty JIDs and email addresses, rather than omitting them. This is probably also a bug in Salut. But we should cope anyway.
Diffstat (limited to 'src/contact.c')
-rw-r--r--src/contact.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/contact.c b/src/contact.c
index 42e40855..66f090af 100644
--- a/src/contact.c
+++ b/src/contact.c
@@ -533,6 +533,12 @@ salut_contact_change_real_name (
const gchar *first,
const gchar *last)
{
+ if (tp_str_empty (first))
+ first = NULL;
+
+ if (tp_str_empty (last))
+ last = NULL;
+
if (tp_strdiff (self->first, first) || tp_strdiff (self->last, last))
{
g_free (self->first);
@@ -542,11 +548,11 @@ salut_contact_change_real_name (
g_free (self->full_name);
- if (!tp_str_empty (first) && !tp_str_empty (last))
+ if (first != NULL && last != NULL)
self->full_name = g_strdup_printf ("%s %s", first, last);
- else if (!tp_str_empty (first))
+ else if (first != NULL)
self->full_name = g_strdup (first);
- else if (!tp_str_empty (last))
+ else if (last != NULL)
self->full_name = g_strdup (last);
else
self->full_name = NULL;
@@ -604,6 +610,9 @@ salut_contact_change_avatar_token (SalutContact *self,
void
salut_contact_change_email (SalutContact *self, gchar *email)
{
+ if (tp_str_empty (email))
+ email = NULL;
+
if (tp_strdiff (self->email, email))
{
g_free (self->email);
@@ -615,6 +624,9 @@ salut_contact_change_email (SalutContact *self, gchar *email)
void
salut_contact_change_jid (SalutContact *self, gchar *jid)
{
+ if (tp_str_empty (jid))
+ jid = NULL;
+
if (tp_strdiff (self->jid, jid))
{
g_free (self->jid);