Address.toString() now offers long and short forms
[org.ibex.mail.git] / 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); } }