aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-account-editor.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-02-07 07:15:06 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-02-07 07:15:06 +0800
commitc789892dc1b1828633c695d7d0d7585fef2e0ba3 (patch)
treeefd320e312e199ba2b3317cf0d7f478d63c32139 /mail/mail-account-editor.c
parent2319bdca2e42e823c563c03e4fd419a7a7937713 (diff)
downloadgsoc2013-evolution-c789892dc1b1828633c695d7d0d7585fef2e0ba3.tar
gsoc2013-evolution-c789892dc1b1828633c695d7d0d7585fef2e0ba3.tar.gz
gsoc2013-evolution-c789892dc1b1828633c695d7d0d7585fef2e0ba3.tar.bz2
gsoc2013-evolution-c789892dc1b1828633c695d7d0d7585fef2e0ba3.tar.lz
gsoc2013-evolution-c789892dc1b1828633c695d7d0d7585fef2e0ba3.tar.xz
gsoc2013-evolution-c789892dc1b1828633c695d7d0d7585fef2e0ba3.tar.zst
gsoc2013-evolution-c789892dc1b1828633c695d7d0d7585fef2e0ba3.zip
Updated to checkfor "(none)".
2001-02-06 Jeffrey Stedfast <fejj@ximian.com> * mail-config-druid.c (set_defaults): Updated to checkfor "(none)". * mail-account-editor.c (entry_changed): Make sure the email address is valid. * mail-config-druid.c (identity_check): Check to make sure we have a valid email address. (is_email): New function to check a string to see if it's a valid email address. svn path=/trunk/; revision=8034
Diffstat (limited to 'mail/mail-account-editor.c')
-rw-r--r--mail/mail-account-editor.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c
index 4d73acb009..886b696218 100644
--- a/mail/mail-account-editor.c
+++ b/mail/mail-account-editor.c
@@ -86,6 +86,26 @@ mail_account_editor_finalise (GtkObject *obj)
((GtkObjectClass *)(parent_class))->finalize (obj);
}
+static gboolean
+is_email (const char *address)
+{
+ const char *at, *hname;
+
+ g_return_val_if_fail (address != NULL, FALSE);
+
+ at = strchr (address, '@');
+ /* make sure we have an '@' and that it's not the first or last char */
+ if (!at || at == address || *(at + 1) == '\0')
+ return FALSE;
+
+ hname = at + 1;
+ /* make sure the first and last chars aren't '.' */
+ if (*hname == '.' || hname[strlen (hname) - 1] == '.')
+ return FALSE;
+
+ return strchr (hname, '.') != NULL;
+}
+
/* callbacks */
static void
entry_changed (GtkEntry *entry, gpointer data)
@@ -98,7 +118,7 @@ entry_changed (GtkEntry *entry, gpointer data)
name = gtk_entry_get_text (editor->name);
address = gtk_entry_get_text (editor->email);
- sensitive = account_name && *account_name && name && *name && address && *address;
+ sensitive = account_name && *account_name && name && *name && is_email (address);
gnome_dialog_set_sensitive (GNOME_DIALOG (editor), 0, sensitive);
gnome_dialog_set_sensitive (GNOME_DIALOG (editor), 1, sensitive);