private static final JS.Method METHOD = new JS.Method();
private static Script root = null;
- private static final String DEFAULT_CONF = File.separatorChar + "etc" + File.separatorChar + "org.ibex.mail.conf";
+ private static final String DEFAULT_CONF = Mailbox.STORAGE_ROOT + "conf" + File.separatorChar + "inbound.js";
public static Script root() {
try {
if (root == null) root = new Script(System.getProperty("ibex.mail.conf", DEFAULT_CONF));
case "mail.bounce": return METHOD;
case "mail.reject": return METHOD;
case "mail.my": return getSub("mail.my");
+ case "mail.dir": return METHOD;
+ case "mail.shell": return METHOD;
case "mail.my.prefs": try {
return new org.ibex.js.Directory(new File("/etc/org.ibex.mail.prefs"));
} catch (IOException e) { throw new JSExn(e.toString()); }
case "mail.my.mailbox":
FileBasedMailbox root = FileBasedMailbox.getFileBasedMailbox(Mailbox.STORAGE_ROOT, true);
- return root.slash("user", true).slash("megacz", true).slash("newmail", true);
+ return root.slash("user", true).slash("megacz", true);
case "mail.list": return METHOD;
//#end
return super.get(name);
try {
if (name.equals("url.encode")) return JSU.S(java.net.URLEncoder.encode(JSU.toString(args[0])));
if (name.equals("mail.list")) return JSReflection.wrap(MailingList.getMailingList(JSU.toString(args[0])));
+ if (name.equals("mail.dir")) {
+ return new org.ibex.js.Directory(new File(JSU.toString(args[0])));
+ }
+ if (name.equals("mail.shell")) {
+ // FIXME: EEEEEVIL!
+ Log.warn("dbug", args[0].getClass().getName());
+ Log.warn("dbug", args[1].getClass().getName());
+ final Process p = Runtime.getRuntime().exec(JSU.toString(args[1]));
+ Message m = (Message)args[0];
+ new Thread() {
+ public void run() {
+ try {
+ BufferedReader br = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+ String s = null;
+ while((s = br.readLine())!=null)
+ Log.warn("shell", s);
+ } catch (Exception e) { e.printStackTrace(); }
+ }
+ }.start();
+ OutputStream os = p.getOutputStream();
+ Stream stream = new Stream(os);
+ m.getStream().transcribe(stream);
+ stream.close();
+ p.waitFor();
+ return null;
+ }
if (name.equals("date")) { return new JSDate(args); }
if (name.equals("mail.send") || name.equals("send") || name.equals("mail.attempt") || name.equals("attempt")) {
boolean attempt = name.equals("mail.attempt") || name.equals("attempt");