pretty much working
[org.ibex.mail.git] / src / org / ibex / mail / target / Script.java
index 65746b3..4e06040 100644 (file)
@@ -55,6 +55,15 @@ public class Script extends Target {
     // FIXME: this should extend org.ibex.core.Ibex
     public static class ScriptEnv extends JS {
 
+        private static PropertyFile prefs;
+        static {
+            try {
+                prefs = new PropertyFile(new File("/etc/org.ibex.mail.properties"));
+            } catch (IOException e) {
+                Log.error(ScriptEnv.class, e);
+            }
+        }
+
         /** lets us put multi-level get/put/call keys all in the same method */
         private class Sub extends JS {
             String key;
@@ -80,6 +89,10 @@ public class Script extends Target {
             if (name.equals("log.info")) { return METHOD; }
             if (name.equals("log.warn")) { return METHOD; }
             if (name.equals("log.error")) { return METHOD; }
+            if (name.equals("mail")) { return getSub("mail"); }
+            if (name.equals("mail.my")) { return getSub("mail.my"); }
+            if (name.equals("mail.my.prefs")) { return prefs; }
+            if (name.equals("mail.my.mailbox")) { return FileSystem.Mailbox.getForUser("megacz"); }
             return super.get(name);
         }