aboutsummaryrefslogtreecommitdiffstats
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
parent2319bdca2e42e823c563c03e4fd419a7a7937713 (diff)
downloadgsoc2013-evolution-c789892dc1b1828633c695d7d0d7585fef2e0ba3.tar.gz
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
-rw-r--r--mail/ChangeLog13
-rw-r--r--mail/mail-account-editor.c22
-rw-r--r--mail/mail-config-druid.c38
3 files changed, 68 insertions, 5 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 3c6cc52d55..f7ab2519fd 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,16 @@
+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.
+
2001-02-05 Jeffrey Stedfast <fejj@ximian.com>
* evolution-mbox-importer.c: We are now going to use a file
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);
diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c
index 4e164cccbc..d33247d33a 100644
--- a/mail/mail-config-druid.c
+++ b/mail/mail-config-druid.c
@@ -237,12 +237,34 @@ druid_finish (GnomeDruidPage *page, gpointer arg1, gpointer user_data)
gtk_widget_destroy (GTK_WIDGET (druid));
}
+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;
+}
+
/* Identity Page */
static void
identity_check (MailConfigDruid *druid)
{
- if (gtk_entry_get_text (druid->full_name) &&
- gtk_entry_get_text (druid->email_address))
+ char *address;
+
+ address = gtk_entry_get_text (druid->email_address);
+ if (gtk_entry_get_text (druid->full_name) && is_email (address))
gnome_druid_set_buttons_sensitive (druid->druid, TRUE, TRUE, TRUE);
else
gnome_druid_set_buttons_sensitive (druid->druid, TRUE, FALSE, TRUE);
@@ -769,6 +791,14 @@ provider_compare (const CamelProvider *p1, const CamelProvider *p2)
}
}
+static gboolean
+is_domain (const char *domain)
+{
+ /* domain && *domain should be enough but linux's
+ getdomainname() likes to return "(none)" */
+ return domain && *domain && strcmp (domain, "(none)");
+}
+
static void
set_defaults (MailConfigDruid *druid)
{
@@ -795,8 +825,8 @@ set_defaults (MailConfigDruid *druid)
memset (domain, 0, sizeof (domain));
getdomainname (domain, 1023);
- address = g_strdup_printf ("%s@%s%s%s", user, hostname, domain && *domain ? "." : "",
- domain && *domain ? domain : "");
+ address = g_strdup_printf ("%s@%s%s%s", user, hostname, is_domain (domain) ? "." : "",
+ is_domain (domain) ? domain : "");
gtk_entry_set_text (druid->email_address, address);
g_free (address);
pan>/+48 * - Add ruby 1.9 supportstas2008-04-063-9/+10 * - Update system-config-printer to 0.9.90ahze2008-04-055-14/+26 * Update to 1.9.38ahze2008-04-052-4/+4 * Mark IGNORE if WITH_GHOSTSCRIPT_GNU is definedahze2008-04-051-0/+4 * Error on pre-configure if ghostscript-gnu is installed and warn to use ghosts...ahze2008-04-051-0/+8 * - update to 1.3.7dinoex2008-04-021-1/+1 * - Security update to 1.3.7dinoex2008-04-025-22/+17 * Normalize PAPERSIZE to lowercase before checking to see if "a4" size. Someobrien2008-03-311-1/+1 * - cleanup with GEM macrosdinoex2008-03-292-161/+163 * - update to 1.1.8dinoex2008-03-293-510/+510 * The capabilities of the Color library are limited to pure mathematicaldinoex2008-03-295-0/+310 * Change to new email account.nork2008-03-291-1/+1 * - disable autodection of dbusdinoex2008-03-281-1/+9 * - Update to 2.4.7jadawin2008-03-274-14/+12 * - Chase shlib version of net-mgmt/net-snmp.kuriyama2008-03-272-2/+4 * Fix the plist, bump the PORTREVISION.mezz2008-03-272-1/+3 * - Remove USE_XLIB/USE_X_PREFIX/USE_XPM in favor of USE_XORGmiwi2008-03-263-7/+5 * - Fix buildmiwi2008-03-261-2/+2 * Add desktop-file-utils to BUILD_DEPENDS to fix installahze2008-03-251-1/+2 * - Remove USE_XLIB/USE_X_PREFIX/USE_XPM in favor of USE_XORGmiwi2008-03-254-4/+4 * - Remove USE_XLIB/USE_X_PREFIX/USE_XPM in favor of USE_XORGmiwi2008-03-241-1/+0 * Update to 0.16.0.20080315 (SVN version) to build with new glib 2.16.mezz2008-03-241-1/+0 * The FreeBSD GNOME team is proud to annunce the release of GNOME 2.22.0 formarcus2008-03-2411-56/+69 * - Remove USE_XLIB/USE_X_PREFIX/USE_XPM in favor of USE_XORGmiwi2008-03-241-2/+1 * remove empty patch filenaddy2008-03-241-0/+0 * - Remove USE_XLIB/USE_X_PREFIX/USE_XPM in favor of USE_XORGmiwi2008-03-242-2/+3 * Add system-config-printerahze2008-03-2416-0/+354 * Add py-cupsahze2008-03-245-0/+47 * Update to 3.1.20080320.hrs2008-03-232-38/+38 * - Remove USE_XLIB/USE_X_PREFIX/USE_XPM in favor of USE_XORGmiwi2008-03-234-7/+5 * - USE_LDCONFIGdinoex2008-03-231-1/+1 * - Remove USE_XLIB/USE_X_PREFIX/USE_XPM in favor of USE_XORGmiwi2008-03-221-2/+2 * - Remove USE_XLIB/USE_X_PREFIX/USE_XPM in favor of USE_XORGmiwi2008-03-221-2/+2 * Fix Plistahze2008-03-222-1/+2 * - Remove USE_GETOPT_LONG which is a no-op since March 2007pav2008-03-2010-10/+0 * Update to 5.1.7ahze2008-03-206-15/+517 * Make fetchable again: the FAQ has been updated.thierry2008-03-192-4/+4 * - Fix plist (has been working on the same PR)pav2008-03-171-1/+4 * Upgrade from 1.5.3 to 1.5.4mi2008-03-173-10/+26 * - Update to 2.8.2rafan2008-03-16