aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-08-11 10:22:48 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-08-11 10:22:48 +0800
commit315563e5cff2a4b7027a607bf9e46b336ac8c6d9 (patch)
treecfa863957bb8f6870d4a7eb6ca366c449f3382c2 /addressbook/gui
parent645b837f4d3fd5f81e78676b87e1f905024bac69 (diff)
downloadgsoc2013-evolution-315563e5cff2a4b7027a607bf9e46b336ac8c6d9.tar
gsoc2013-evolution-315563e5cff2a4b7027a607bf9e46b336ac8c6d9.tar.gz
gsoc2013-evolution-315563e5cff2a4b7027a607bf9e46b336ac8c6d9.tar.bz2
gsoc2013-evolution-315563e5cff2a4b7027a607bf9e46b336ac8c6d9.tar.lz
gsoc2013-evolution-315563e5cff2a4b7027a607bf9e46b336ac8c6d9.tar.xz
gsoc2013-evolution-315563e5cff2a4b7027a607bf9e46b336ac8c6d9.tar.zst
gsoc2013-evolution-315563e5cff2a4b7027a607bf9e46b336ac8c6d9.zip
Remove single- or double-quotes from names before sticking them into the
2001-08-10 Jon Trowbridge <trow@ximian.com> * gui/contact-editor/e-contact-quick-add.c (e_contact_quick_add): Remove single- or double-quotes from names before sticking them into the addressbook. (Bug #6499) svn path=/trunk/; revision=11909
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/contact-editor/e-contact-quick-add.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c
index daed820b6c..a94153720f 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -313,19 +313,32 @@ build_quick_add_dialog (QuickAdd *qa)
}
void
-e_contact_quick_add (const gchar *name, const gchar *email,
+e_contact_quick_add (const gchar *in_name, const gchar *email,
EContactQuickAddCallback cb, gpointer closure)
{
QuickAdd *qa;
GtkWidget *dialog;
+ gchar *name;
+ gint len;
/* We need to have *something* to work with. */
- if (name == NULL && email == NULL) {
+ if (in_name == NULL && email == NULL) {
if (cb)
cb (NULL, closure);
return;
}
+ name = g_strdup (in_name);
+
+ /* Remove extra whitespace and the quotes some mailers put around names. */
+ g_strstrip (name);
+ len = strlen (name);
+ if ((name[0] == '\'' && name[len-1] == '\'') || (name[0] == '"' && name[len-1] == '"')) {
+ name[0] = ' ';
+ name[len-1] = ' ';
+ }
+ g_strstrip (name);
+
qa = quick_add_new ();
qa->cb = cb;
qa->closure = closure;
@@ -336,6 +349,8 @@ e_contact_quick_add (const gchar *name, const gchar *email,
dialog = build_quick_add_dialog (qa);
gtk_widget_show_all (dialog);
+
+ g_free (name);
}
void
@@ -394,9 +409,6 @@ e_contact_quick_add_free_form (const gchar *text, EContactQuickAddCallback cb, g
name = g_strdup (text);
- /* Clean up name */
- if (name && *name)
- g_strstrip (name);
/* Clean up email, remove bracketing <>s */
if (email && *email) {