X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fmail%2FScript.java;h=f7b259dbd6d72a41728031dcb563426b6815de37;hb=f44b297a36dbce9cc17c55df1de195aadcffc398;hp=f3a189cfe5513d3f430c1ab0e2d4f2bc7ebd03d8;hpb=c173ef6beb59eca7da43b01632381a5dcf3235be;p=org.ibex.mail.git diff --git a/src/org/ibex/mail/Script.java b/src/org/ibex/mail/Script.java index f3a189c..f7b259d 100644 --- a/src/org/ibex/mail/Script.java +++ b/src/org/ibex/mail/Script.java @@ -147,8 +147,8 @@ public class Script extends JS.Obj implements Target { } catch (IOException e) { throw new JSExn(e.toString()); } case "mail.whitelist": return JSReflection.wrap(org.ibex.mail.SMTP.whitelist); case "mail.my.mailbox": - Mailbox root = FileBasedMailbox.getFileBasedMailbox(Mailbox.STORAGE_ROOT, true); - return root.slash("user", true).slash("megacz", true); + MailTree root = FileBasedMailbox.getFileBasedMailbox(Mailbox.STORAGE_ROOT, true); + return (JS)root.slash("user", true).slash("megacz", true); case "mail.list": return METHOD; //#end return super.get(name); @@ -243,7 +243,37 @@ public class Script extends JS.Obj implements Target { StringBuffer ret = new StringBuffer(); new Stream(p.getInputStream()).transcribe(ret); p.waitFor(); - return JSU.S(ret.toString()); + String result = ret.toString(); + Log.warn("dcc", ((Message)args[0]).summary() + ":\n " + result); + int body = 0; + int fuz1 = 0; + int fuz2 = 0; + int i_body = result.indexOf("Body="); + int i_fuz1 = result.indexOf("Fuz1="); + int i_fuz2 = result.indexOf("Fuz2="); + if (i_body != -1) try { + String s = result.substring(i_body+5); + if (s.indexOf(' ') != -1) s = s.substring(0, s.indexOf(' ')); + if (s.indexOf('\n') != -1) s = s.substring(0, s.indexOf('\n')); + body = s.equals("many") ? 999 : Integer.parseInt(s.trim()); + } catch (Exception e) { Log.error("", e); } + if (i_fuz1 != -1) try { + String s = result.substring(i_fuz1+5); + if (s.indexOf(' ') != -1) s = s.substring(0, s.indexOf(' ')); + if (s.indexOf('\n') != -1) s = s.substring(0, s.indexOf('\n')); + fuz1 = s.equals("many") ? 999 : Integer.parseInt(s.trim()); + } catch (Exception e) { Log.error("", e); } + if (i_fuz2 != -1) try { + String s = result.substring(i_fuz2+5); + if (s.indexOf(' ') != -1) s = s.substring(0, s.indexOf(' ')); + if (s.indexOf('\n') != -1) s = s.substring(0, s.indexOf('\n')); + fuz2 = s.equals("many") ? 999 : Integer.parseInt(s.trim()); + } catch (Exception e) { Log.error("", e); } + JSArray jsa = new JSArray(); + jsa.put(JSU.N(0), JSU.N(body)); + jsa.put(JSU.N(1), JSU.N(fuz1)); + jsa.put(JSU.N(2), JSU.N(fuz2)); + return jsa; } if (name.equals("mail.drop")) { return args.length==0 ? new Drop() : new Drop(JSU.toString(args[0]));