update Mail for new JS API
[org.ibex.mail.git] / src / org / ibex / mail / MIME.java
index 67ee72d..d5018e0 100644 (file)
@@ -179,8 +179,8 @@ public class MIME {
         public final int lines;
         public final String raw;
         public String toString() { return raw; }
-        public Object get(Object s) { return head.get(((String)s).toLowerCase()); }
-        public String gets(String s) { return (String)get(s); }
+        public JS get(JS s) throws JSExn { return JSU.S((String)head.get(JSU.toString(s).toLowerCase())); }
+        public String gets(String s) { return (String)head.get(s.toLowerCase()); }
         public static String uncomment(String val) {
             boolean inquotes = false;
             for(int i=0; i<val.length(); i++) {
@@ -209,7 +209,7 @@ public class MIME {
                     if (key.charAt(i) < 33 || key.charAt(i) > 126)
                         throw new MailException.Malformed("Header key \""+key+"\" contains invalid character \"" + key.charAt(i) + "\"");
                 String val = s.substring(s.indexOf(':') + 1).trim();
-                if (get(key) != null) val = get(key) + " " + val; // just append it to the previous one;
+                if (gets(key) != null) val = gets(key) + " " + val; // just append it to the previous one;
                 head.put(key, val);
             }
             this.raw = all.toString();