diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-01-21 08:14:46 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-02-03 07:29:47 +0800 |
commit | 6db981fa566574d16f4664687d26147acde7ad80 (patch) | |
tree | 3b233b5a2876db9983153b8cc3c02a49270600a3 /addressbook/gui | |
parent | 0727097ac13ad746184ba0580247bff70cefbb68 (diff) | |
download | gsoc2013-evolution-6db981fa566574d16f4664687d26147acde7ad80.tar.gz gsoc2013-evolution-6db981fa566574d16f4664687d26147acde7ad80.tar.zst gsoc2013-evolution-6db981fa566574d16f4664687d26147acde7ad80.zip |
Bug 607520 - 'Add to Address Book' fails when address has space
Diffstat (limited to 'addressbook/gui')
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-quick-add.c | 25 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-quick-add.h | 2 |
2 files changed, 27 insertions, 0 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c index 6525738fed..36bd4ed948 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.c +++ b/addressbook/gui/contact-editor/e-contact-quick-add.c @@ -589,6 +589,31 @@ e_contact_quick_add_free_form (const gchar *text, EContactQuickAddCallback cb, g } void +e_contact_quick_add_email (const gchar *email, EContactQuickAddCallback cb, gpointer closure) +{ + gchar *name = NULL; + gchar *addr = NULL; + gchar *lt, *gt; + + /* Handle something of the form "Foo <foo@bar.com>". This is more + * more forgiving than the free-form parser, allowing for unquoted + * whitespace since we know the whole string is an email address. */ + + lt = (email != NULL) ? strchr (email, '<') : NULL; + gt = (lt != NULL) ? strchr (email, '>') : NULL; + + if (lt != NULL && gt != NULL && (gt - lt) > 0) { + name = g_strndup (email, lt - email); + addr = g_strndup (lt + 1, gt - lt - 1); + } + + e_contact_quick_add (name, addr, cb, closure); + + g_free (name); + g_free (addr); +} + +void e_contact_quick_add_vcard (const gchar *vcard, EContactQuickAddCallback cb, gpointer closure) { QuickAdd *qa; diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.h b/addressbook/gui/contact-editor/e-contact-quick-add.h index e58722b4a2..a4d06ef12a 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.h +++ b/addressbook/gui/contact-editor/e-contact-quick-add.h @@ -32,6 +32,8 @@ void e_contact_quick_add (const gchar *name, const gchar *email, void e_contact_quick_add_free_form (const gchar *text, EContactQuickAddCallback cb, gpointer closure); +void e_contact_quick_add_email (const gchar *email, EContactQuickAddCallback cb, gpointer closure); + void e_contact_quick_add_vcard (const gchar *vcard, EContactQuickAddCallback cb, gpointer closure); #endif /* __E_CONTACT_QUICK_ADD_H__ */ |