Address.toString() now offers long and short forms
authoradam <adam@megacz.com>
Tue, 3 Aug 2004 07:17:25 +0000 (07:17 +0000)
committeradam <adam@megacz.com>
Tue, 3 Aug 2004 07:17:25 +0000 (07:17 +0000)
darcs-hash:20040803071725-5007d-52ab990f08b0f70ac26d8b477c162560125a13ea.gz

src/org/ibex/mail/Address.java

index 4b3732a..c6cf90f 100644 (file)
@@ -26,7 +26,9 @@ public class Address extends JSReflection {
         user = s.substring(0, s.indexOf('@'));
         host = s.substring(s.indexOf('@')+1);
     }
-    public String toString() { return description.equals("") ? (user +"@"+ host) : description+" <" + user +"@"+ host + ">"; }
+    public String toString() { return user + "@" + host; }
+    public String toString(boolean desc) {
+        return desc && description != null && description.length() > 0 ? (description+" <" + toString() + ">") : toString(); }
     public String coerceToString() { return toString(); }
     public static class Malformed extends Message.Malformed { public Malformed(String s) { super(s); } }