}
public static class Address extends JSReflection {
- public String coerceToString() {
+ public String coerceToString() { return toString(); }
+ public String toString() {
if (description == null || description.equals("")) return user +"@"+ host;
return description + " " + "<" + user +"@"+ host + ">";
}
headers.put(lastKey, headers.get(lastKey) + s);
continue;
}
- if (s.indexOf(':') == -1) { /* FIXME */ }
+ if (s.indexOf(':') == -1) {
+ /* FIXME */
+ break;
+ }
- key = s.substring(0, s.indexOf(':'));
+ lastKey = key = s.substring(0, s.indexOf(':'));
String val = s.substring(0, s.indexOf(':') + 1);
while(Character.isSpace(val.charAt(0))) val = val.substring(1);
headers.put(key, val);
}
+
allHeaders = all.toString();
+
StringBuffer body = new StringBuffer();
- for(String s = rs.readLine(); s != null && !s.equals(""); s = rs.readLine()) body.append(s);
+ for(String s = rs.readLine();; s = rs.readLine()) {
+ if (s == null || (dotTerminatedLikeSMTP && s.equals("."))) break;
+ body.append(s);
+ }
+
this.body = body.toString();
}
int c = read();
if (c == -1) throw new EOFException();
if (c == '\n') return ret.toString();
- //if (c == '\r') return ret.toString();
+ if (c == '\r') continue; //return ret.toString();
ret.append((char)c);
}
}
ws.flush();
continue;
}
- command = command.substring(10).trim();
+ command = command.substring(9).trim();
if(command.indexOf(' ') != -1) command = command.substring(0, command.indexOf(' '));
Message.Address addr = new Message.Address(command);
to.addElement(addr);
public static class FileBased extends MessageStore {
private String path;
private FileBased(String path) throws IOException { new File(this.path = path).mkdirs(); }
- public FileBased slash(String name) throws IOException { return new FileBased(path + "/" + name); }
+ public MessageStore slash(String name) throws IOException { return new FileBased(path + "/" + name); }
public int[] list() {
String[] names = new File(path).list();
if (name.equals("log.error")) { JS.error(a== null ? "**null**" : a.toString()); return null; }
switch (nargs) {
case 1:
- if (name.equals("regexp")) { return new JSRegexp(a, null); }
+ if (name.equals("regexp")) {return new JSRegexp(a, null); }
break;
case 2:
- if (name.equals("regexp")) { return new JSRegexp(a, b); }
+ if (name.equals("regexp")) {return new JSRegexp(a, b); }
}
} catch (RuntimeException e) {
// FIXME: maybe JSExn should take a second argument, Exception