From abd81a81c1b3e9109e9ba680978e49c383fb8968 Mon Sep 17 00:00:00 2001 From: Bradley Young Date: Wed, 17 Dec 2008 00:39:06 +0000 Subject: [PATCH] Update the domain validator to accept ip addresses and "localhost" --- src/com/fsck/k9/Utility.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/com/fsck/k9/Utility.java b/src/com/fsck/k9/Utility.java index 579d06177..70ca3ac37 100644 --- a/src/com/fsck/k9/Utility.java +++ b/src/com/fsck/k9/Utility.java @@ -88,6 +88,12 @@ public class Utility { if (s.matches("^([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}$")) { return true; } + if (s.matches("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$")) { + return true; + } + if ((s.equalsIgnoreCase("localhost"))||(s.equalsIgnoreCase("localhost.localdomain"))) { + return true; + } } return false; }