bug-buddy r2581 - in trunk: . src



Author: cosimoc
Date: Thu Jul 31 17:55:17 2008
New Revision: 2581
URL: http://svn.gnome.org/viewvc/bug-buddy?rev=2581&view=rev

Log:
2008-07-31  Cosimo Cecchi  <cosimoc gnome org>

	* src/bug-buddy.c: (email_domain_is_valid):
	Activate the send button only if the domain part contains
	at least a dot (#437333).


Modified:
   trunk/ChangeLog
   trunk/src/bug-buddy.c

Modified: trunk/src/bug-buddy.c
==============================================================================
--- trunk/src/bug-buddy.c	(original)
+++ trunk/src/bug-buddy.c	Thu Jul 31 17:55:17 2008
@@ -864,6 +864,7 @@
 {
 	char **labels;
 	char **this_label;
+	gboolean retval = FALSE;
 	
 	/* If there is no domain, there are no domain labels and the domain is
 	 * not valid. */ 
@@ -872,16 +873,22 @@
 
 	/* Split the domain on the dot to validate labels. */
 	labels = g_strsplit (domain, ".", 0);
+	if (g_strv_length (labels) == 1) {
+		/* the domain doesn't contain any dot: it's not valid */
+		goto out;
+	}
 
 	for (this_label = labels; *this_label; this_label++) {
 		if (!email_domain_label_is_valid (*this_label)) {
-			g_strfreev (labels);
-			return FALSE;
+			goto out;
 		}
 	}
 
+	retval = TRUE;
+
+out:
 	g_strfreev (labels);
-	return TRUE;
+	return retval;
 }
 
 /* Check for *simple* email addresses of the form user host, with checks



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]