// Licensed under the Apache Public Source License 2.0 ("the License").
// You may not use this file except in compliance with the License.
-package org.ibex.mail.target;
+package org.ibex.mail;
import org.prevayler.*;
import org.ibex.mail.*;
import org.ibex.util.*;
// Licensed under the Apache Public Source License 2.0 ("the License").
// You may not use this file except in compliance with the License.
-package org.ibex.mail.protocol;
+package org.ibex.mail;
import org.ibex.crypto.*;
import org.ibex.mail.protocol.*;
import org.ibex.jinetd.Listener;
-import org.ibex.mail.*;
import org.ibex.util.*;
import org.ibex.net.*;
import org.ibex.js.*;
// Licensed under the Apache Public Source License 2.0 ("the License").
// You may not use this file except in compliance with the License.
-package org.ibex.mail.protocol;
+package org.ibex.mail;
import org.ibex.io.*;
import org.ibex.crypto.*;
import org.ibex.jinetd.Listener;
Vec.Int vec = new Vec.Int();
for(Mailbox.Iterator it = selected().iterator(q); it.next();) {
vec.addElement(uid ? it.uid() : it.imapNumber());
- it.setFlag(Mailbox.Flag.RECENT, false);
+ it.setFlags(it.getFlags() & ~Mailbox.Flag.RECENT);
}
return vec.dump();
}
public void removeFlags(Query q, int f, boolean uid, boolean silent) { doFlags(q, f, uid, -1, silent); }
private void doFlags(Query q, int flags, boolean uid, int style, boolean silent) {
for(Mailbox.Iterator it = selected().iterator(q);it.next();) {
- boolean recent = it.getFlag(Mailbox.Flag.RECENT);
+ // FIXME: what's going on here with the recent flag?
+ //boolean recent = it.getFlag(Mailbox.Flag.RECENT);
try { throw new Exception("flags " + flags); } catch (Exception e) { Log.error(this, e); }
- for(int flag : Mailbox.Flag.all)
- if (style == -1) { if ((flags & flag)!=0) it.setFlag(flag, false); }
- else if (style == 0) { it.setFlag(flag, ((flags & flag)!=0)); }
- else if (style == 1) { if ((flags & flag)!=0) it.setFlag(flag, true); }
- it.setFlag(Mailbox.Flag.RECENT, recent);
- if (!silent) client.fetch(it.imapNumber(), flags(it), -1, null, it.uid());
+ if (style == -1) it.setFlags(it.getFlags() & ~flags);
+ else if (style == 0) it.setFlags(flags);
+ else if (style == 1) it.setFlags(it.getFlags() | flags);
+ //it.setFlag(Mailbox.Flag.RECENT, recent);
+ if (!silent) client.fetch(it.imapNumber(), it.getFlags(), -1, null, it.uid());
}
}
Message message = ((spec & (BODYSTRUCTURE | ENVELOPE | INTERNALDATE | FIELDS | FIELDSNOT | RFC822 |
RFC822TEXT | RFC822SIZE | HEADERNOT | HEADER)) != 0) ? it.cur() : null;
int size = message == null ? 0 : message.getLength();
- client.fetch(it.imapNumber(), flags(it), size, message, it.uid());
- it.setFlag(Mailbox.Flag.RECENT, false);
+ client.fetch(it.imapNumber(), it.getFlags(), size, message, it.uid());
+ it.setFlags(it.getFlags() & ~Mailbox.Flag.RECENT);
}
}
}
- private static int flags(Mailbox.Iterator it) {
- int ret = 0;
- for(int flag : Mailbox.Flag.all)
- if (it.getFlag(flag))
- ret |= flag;
- return ret;
- }
-
// Single Session Handler //////////////////////////////////////////////////////////////////////////////
/** takes an IMAP.Server and exposes it to the world as an IMAP server on a TCP socket */
}
static String flags(Mailbox.Iterator it) {
return
- (it.getFlag(Mailbox.Flag.DELETED) ? "\\Deleted " : "") +
- (it.getFlag(Mailbox.Flag.SEEN) ? "\\Seen " : "") +
- (it.getFlag(Mailbox.Flag.FLAGGED) ? "\\Flagged " : "") +
- (it.getFlag(Mailbox.Flag.DRAFT) ? "\\Draft " : "") +
- (it.getFlag(Mailbox.Flag.ANSWERED) ? "\\Answered " : "") +
- (it.getFlag(Mailbox.Flag.RECENT) ? "\\Recent " : "");
+ ((it.getFlags() & Mailbox.Flag.DELETED)!=0 ? "\\Deleted " : "") +
+ ((it.getFlags() & Mailbox.Flag.SEEN)!=0 ? "\\Seen " : "") +
+ ((it.getFlags() & Mailbox.Flag.FLAGGED)!=0 ? "\\Flagged " : "") +
+ ((it.getFlags() & Mailbox.Flag.DRAFT)!=0 ? "\\Draft " : "") +
+ ((it.getFlags() & Mailbox.Flag.ANSWERED)!=0 ? "\\Answered " : "") +
+ ((it.getFlags() & Mailbox.Flag.RECENT)!=0 ? "\\Recent " : "");
}
static String flags(int flags) {
String ret = "(" +
// Licensed under the Apache Public Source License 2.0 ("the License").
// You may not use this file except in compliance with the License.
-package org.ibex.mail.target;
+package org.ibex.mail;
import org.ibex.mail.*;
import org.ibex.util.*;
import org.ibex.mail.*;
public abstract Mailbox.Iterator iterator(Query q);
public abstract void insert(Message message, int flags);
+ public abstract void post(Message message);
public abstract void move(Query q, Mailbox dest);
public abstract void copy(Query q, Mailbox dest);
public abstract int count(Query q);
public void destroy(boolean recursive) { throw new MailException("not supported"); }
public Mailbox slash(String name, boolean create) { return null; }
public String[] children() { return new String[] { }; }
+ public void post(Message message) { insert(message, Flag.RECENT); }
public void move(Query q, Mailbox dest) {
for(Mailbox.Iterator it = iterator(q);it.next();) { dest.insert(it.cur(), it.getFlags()); it.delete(); }
}
public static abstract class Iterator implements Mailbox.Iterator {
public int nntpNumber() { throw new MailException("not supported"); }
public int getFlags() { return 0; }
- public boolean getFlag(int flag) { return false; }
- public void setFlag(int flag, boolean set) { throw new RuntimeException("not implemented"); }
+ public void setFlags(int flags) { throw new MailException("not supported"); }
}
}
public abstract int nntpNumber();
public abstract int getFlags();
- public abstract boolean getFlag(int flag);
- public abstract void setFlag(int flag, boolean set);
+ public abstract void setFlags(int flags);
public static class Wrapper implements Iterator {
private Iterator it;
public int imapNumber() { return it.imapNumber(); }
public void delete() { it.delete(); }
public int getFlags() { return it.getFlags(); }
- public boolean getFlag(int flag) { return it.getFlag(flag); }
- public void setFlag(int flag, boolean set) { it.setFlag(flag, set); }
+ public void setFlags(int flags) { it.setFlags(flags); }
}
class QueryIterator extends Mailbox.Iterator.Wrapper {
public boolean phantom() { return m.phantom(); }
public Mailbox.Iterator iterator(Query q) { return m.iterator(q); }
public void insert(Message message, int flags) { m.insert(message, flags); }
+ public void post(Message message) { m.insert(message, Flag.RECENT); }
public void move(Query q, Mailbox dest) { m.move(q, dest); }
public void copy(Query q, Mailbox dest) { m.copy(q, dest); }
public int count(Query q) { return m.count(q); }
// Copyright 2000-2005 the Contributors, as shown in the revision logs.
// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
+// You may not use this file except in compliance with the License
-package org.ibex.mail.target;
+package org.ibex.mail;
import org.ibex.io.*;
import org.ibex.mail.*;
import org.ibex.util.*;
// Licensed under the Apache Public Source License 2.0 ("the License").
// You may not use this file except in compliance with the License.
-package org.ibex.mail.target;
-import org.ibex.mail.*;
+package org.ibex.mail;
import org.ibex.util.*;
import org.ibex.mail.*;
import java.io.*;
// 503 optional subfeature not supported
// Xref header
// LIST EXTENSIONS is probably incomplete
+// pull mode (ie suck)
+// control message processing?
-package org.ibex.mail.protocol;
+package org.ibex.mail;
import org.ibex.util.*;
import org.ibex.io.*;
-import org.ibex.mail.*;
import org.ibex.mail.target.*;
import org.ibex.jinetd.*;
import java.io.*;
public MailboxWrapper(Mailbox root) { this(root, false); }
public MailboxWrapper(Mailbox root, boolean post) { this.root = root; this.post = post; }
public boolean postok() { return post; }
- public void post(Message m) throws IOException { current.accept(m); }
+ public void post(Message m) throws IOException { current.post(m); }
public Group group(String s) {
ptr = 0;
Group g = getgroup(s);
// Licensed under the Apache Public Source License 2.0 ("the License").
// You may not use this file except in compliance with the License.
-package org.ibex.mail.protocol;
+package org.ibex.mail;
import org.ibex.util.*;
import org.ibex.io.*;
-import org.ibex.mail.*;
import org.ibex.mail.target.*;
import org.ibex.jinetd.*;
import java.io.*;
(earliest == null || it.cur().arrival.after(earliest));
case HEADER: return it.cur().headers.get(key) != null &&
((String)it.cur().headers.get(key)).toLowerCase().indexOf(text.toLowerCase()) != -1;
- case DELETED: return it.getFlag(Mailbox.Flag.DELETED);
- case SEEN: return it.getFlag(Mailbox.Flag.SEEN);
- case FLAGGED: return it.getFlag(Mailbox.Flag.FLAGGED);
- case DRAFT: return it.getFlag(Mailbox.Flag.DRAFT);
- case ANSWERED: return it.getFlag(Mailbox.Flag.ANSWERED);
- case RECENT: return it.getFlag(Mailbox.Flag.RECENT);
+ case DELETED: return (it.getFlags() & Mailbox.Flag.DELETED) !=0;
+ case SEEN: return (it.getFlags() & Mailbox.Flag.SEEN)!=0;
+ case FLAGGED: return (it.getFlags() & Mailbox.Flag.FLAGGED)!=0;
+ case DRAFT: return (it.getFlags() & Mailbox.Flag.DRAFT)!=0;
+ case ANSWERED: return (it.getFlags() & Mailbox.Flag.ANSWERED)!=0;
+ case RECENT: return (it.getFlags() & Mailbox.Flag.RECENT)!=0;
// FIXME: super inefficient
case BODY: throw new RuntimeException("BODY searches are not supported because they are slow");
// Licensed under the Apache Public Source License 2.0 ("the License").
// You may not use this file except in compliance with the License.
-package org.ibex.mail.protocol;
-import org.ibex.mail.*;
+package org.ibex.mail;
import org.ibex.mail.target.*;
import org.ibex.util.*;
import org.ibex.net.*;
import javax.naming.*;
import javax.naming.directory.*;
+// Note: we can't actually use status codes for feedback if we accept
+// multiple destination addresses... a failure on one and success on
+// the other...
+
// FIXME: logging: current logging sucks
// FIXME: loop prevention
// FIXME: probably need some throttling on outbound mail
conn.println("250 message accepted");
conn.flush();
from = null; to = new Vector();
- } catch (Reject.RejectException re) {
+ } catch (MailException.Malformed mfe) { conn.println("501 " + mfe.toString());
+ } catch (MailException.MailboxFull mbf) { conn.println("452 " + mbf);
+ } catch (Script.Later.LaterException le) { conn.println("453 try again later");
+ } catch (Script.Reject.RejectException re) {
Log.warn(SMTP.class, "rejecting message due to: " + re.reason + "\n " + re.m.summary());
conn.println("501 " + re.reason);
- } catch (MailException.Malformed mfe) { conn.println("501 " + mfe.toString());
- } catch (MailException.MailboxFull mbf) { conn.println("452 " + mbf);
- } catch (Later.LaterException le) { conn.println("453 try again later");
}
} else { conn.println("500 unrecognized command"); }
} catch (Message.Malformed e) { conn.println("501 " + e.toString()); }
// Licensed under the Apache Public Source License 2.0 ("the License").
// You may not use this file except in compliance with the License.
-package org.ibex.mail.target;
+package org.ibex.mail;
import org.ibex.js.*;
import org.ibex.io.*;
import org.ibex.util.*;
-import org.ibex.mail.*;
import org.ibex.mail.filter.*;
import org.ibex.mail.target.*;
import java.io.*;
import java.util.*;
+import java.text.*;
public class Script extends JS.Obj implements Target {
case "m": return m;
case "ibex": return env;
default: return null;
- //#end
- return null;
+ //#end
+ return null;
}
}
public class ScriptEnv extends JS.Obj {
private PropertyFile prefs = null;
- /*
- static {
- try {
- // FIXME
- prefs = new PropertyFile(new File("/etc/org.ibex.mail.properties"));
- } catch (IOException e) {
- Log.error(ScriptEnv.class, e);
- }
- }
- */
+ /*
+ static {
+ try {
+ // FIXME
+ 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.Immutable {
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"));
+ return new org.ibex.js.Directory(new File("/etc/org.ibex.mail.prefs"));
} catch (IOException e) { throw new JSExn(e.toString()); }
- case "mail.whitelist": return JSReflection.wrap(org.ibex.mail.protocol.SMTP.whitelist);
+ 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);
case "mail.list": return METHOD;
- //#end
- return super.get(name);
+ //#end
+ return super.get(name);
}
public JS call(JS name0, JS[] args) throws JSExn {
boolean ok = false;
try {
if (attempt) {
- org.ibex.mail.protocol.SMTP.Outgoing.attempt(message);
+ org.ibex.mail.SMTP.Outgoing.attempt(message);
} else {
- org.ibex.mail.protocol.SMTP.Outgoing.accept(message);
+ org.ibex.mail.SMTP.Outgoing.accept(message);
}
ok = true;
} catch (Exception ex) {
public void accept(Message m) throws MailException {
try {
Message m2 = m.bounce(JSU.toString(a));
- org.ibex.mail.protocol.SMTP.Outgoing.accept(m2);
+ org.ibex.mail.SMTP.Outgoing.accept(m2);
Log.error(this, "BOUNCING! " + m2.summary());
} catch (Exception e) {
Log.warn(this, e);
Message m2 = Message.newMessage(new org.ibex.io.Fountain.StringFountain(m.toString()),
m.envelopeFrom,
new Address(JSU.toString(a)));
- org.ibex.mail.protocol.SMTP.Outgoing.accept(m2);
+ org.ibex.mail.SMTP.Outgoing.accept(m2);
} catch (Exception e) {
Log.warn(this, e);
throw new JSExn(e.toString());
}
if (name.equals("mail.forward") || name.equals("forward")) {
Message m2 = Message.newMessage(Script.this.m, Script.this.m.envelopeFrom, new Address(JSU.toString(a)));
- org.ibex.mail.protocol.SMTP.Outgoing.attempt(m2, false);
+ org.ibex.mail.SMTP.Outgoing.attempt(m2, false);
return Drop.instance;
}
if (name.equals("mail.reject"))
if (name.equals("log.warn") || name.equals("warn")) { JSU.warn(a== null ? "**null**" : JSU.toString(a)); return null; }
if (name.equals("log.error") || name.equals("error")) { JSU.error(a== null ? "**null**" : JSU.toString(a)); return null; }
switch (nargs) {
- case 1:
- if (name.equals("regexp")) {return new JSRegexp(a, null); }
- break;
- case 2:
- if (name.equals("regexp")) {return new JSRegexp(a, b); }
+ case 1:
+ if (name.equals("regexp")) {return new JSRegexp(a, null); }
+ break;
+ case 2:
+ if (name.equals("regexp")) {return new JSRegexp(a, b); }
}
} catch (MailException e) { throw e;
} catch (Exception e) {
public JS get(JS name) throws JSExn {
// FIXME!!!
/*
- case "isNaN": return gs.get(name);
- case "isFinite": return gs.get(name);
- case "NaN": return gs.get(name);
- case "Infinity": return gs.get(name);
+ case "isNaN": return gs.get(name);
+ case "isFinite": return gs.get(name);
+ case "NaN": return gs.get(name);
+ case "Infinity": return gs.get(name);
*/
return null;
}
public JS get(JS name) throws JSExn {
// FIXME!!!
/*
- case "parseInt": return gs.get(JSU.S("parseInt"));
- case "parseFloat": return gs.get(JSU.S("parseFloat"));
- case "decodeURI": return gs.get(JSU.S("decodeURI"));
- case "decodeURIComponent": return gs.get(JSU.S("decodeURIComponent"));
- case "encodeURI": return gs.get(JSU.S("encodeURI"));
- case "encodeURIComponent": return gs.get(JSU.S("encodeURIComponent"));
- case "escape": return gs.get(JSU.S("escape"));
- case "unescape": return gs.get(JSU.S("unescape"));
- case "fromCharCode": return gs.get(JSU.S("stringFromCharCode"));
+ case "parseInt": return gs.get(JSU.S("parseInt"));
+ case "parseFloat": return gs.get(JSU.S("parseFloat"));
+ case "decodeURI": return gs.get(JSU.S("decodeURI"));
+ case "decodeURIComponent": return gs.get(JSU.S("decodeURIComponent"));
+ case "encodeURI": return gs.get(JSU.S("encodeURI"));
+ case "encodeURIComponent": return gs.get(JSU.S("encodeURIComponent"));
+ case "escape": return gs.get(JSU.S("escape"));
+ case "unescape": return gs.get(JSU.S("unescape"));
+ case "fromCharCode": return gs.get(JSU.S("stringFromCharCode"));
*/
return null;
}
}
private static abstract class JSTarget extends JS.Obj implements Target { }
+
+ public static class Drop extends JS.Obj implements Target {
+ public static final Drop instance = new Drop();
+ public final String reason;
+ public Drop() { this(null); }
+ public Drop(String reason) { this.reason = reason; }
+ public void accept(Message m) throws IOException, MailException {
+ Log.warn(this, "dropping" +(reason==null?"":(" because "+reason))+ ": " + m.summary());
+ }
+ }
+
+ public static class Later extends JS.Obj implements Target {
+ public static final Later instance = new Later();
+ public static class LaterException extends RuntimeException { }
+ public void accept(Message m) throws IOException, MailException {
+ Log.warn(this, "delaying message " + m.summary());
+ throw new LaterException();
+ }
+ }
+
+ /** a fast-write, slow-read place to stash all messages we touch -- in case of a major f*ckup */
+ public static class Transcript implements Target {
+
+ public static final Transcript transcript = new Transcript(Mailbox.STORAGE_ROOT + File.separatorChar + "transcript");
+
+ private String path;
+ public Transcript(String path) { new File(this.path = path).mkdirs(); }
+ private static String lastTime = null;
+ private static int lastCounter = 0;
+
+ public synchronized void accept(Message message) {
+ try {
+ File today = new File(path + File.separatorChar + (new SimpleDateFormat("yy-MMM-dd").format(new Date())));
+ today.mkdirs();
+
+ String time = new SimpleDateFormat("HH:mm:ss").format(new Date());
+ synchronized (Transcript.class) {
+ if (lastTime != null && lastTime.equals(time)) {
+ time += "." + (++lastCounter);
+ } else {
+ lastTime = time;
+ lastCounter = 0;
+ }
+ }
+
+ File target = new File(today.getPath() + File.separatorChar + time + ".txt");
+ OutputStream os = new FileOutputStream(target);
+ try {
+ message.getStream().transcribe(new Stream(os));
+ os.flush();
+ } finally { os.close(); }
+ } catch (IOException e) { throw new MailException.IOException(e); }
+ }
+ }
+
+ public static class Reject extends JS.Obj implements Target {
+ public final String reason;
+ public Reject(String reason) { this.reason = reason; }
+ public void accept(Message m) throws IOException, MailException {
+ throw new RejectException(m, reason);
+ }
+ public static class RejectException extends RuntimeException {
+ public final Message m;
+ public final String reason;
+ public RejectException(Message m, String reason) { this.m = m; this.reason = reason; }
+ }
+ }
+
+
}
-package org.ibex.mail.target;
+package org.ibex.mail;
-import org.ibex.mail.*;
import org.ibex.io.Fountain;
import org.ibex.io.Stream;
import java.sql.Timestamp;
import java.io.*;
import java.util.*;
+// nntpNumber (column)
+// uid (column)
+// uidvalidity
public class SqliteJdbcMailbox extends Mailbox.Default {
private Connection conn;
+ private static final String columns = "messageid_,from_,to_,date_,subject_,headers_,body_,flags_";
public SqliteJdbcMailbox(String filename) {
try {
Class.forName("org.sqlite.JDBC");
conn = DriverManager.getConnection("jdbc:sqlite:"+filename);
- conn.prepareStatement("create table if not exists "+
- "'mail' (messageid_,from_,to_,date_,subject_,headers_,body_,PRIMARY KEY(messageid_))").executeUpdate();
+ conn.prepareStatement("create virtual table if not exists "+
+ "'mail' using FTS1("+columns+",PRIMARY KEY(messageid_))").executeUpdate();
}
catch (SQLException e) { throw new RuntimeException(e); }
catch (ClassNotFoundException e) { throw new RuntimeException(e); }
}
- public Mailbox.Iterator iterator() { return new SqliteJdbcIterator(); }
+ public int uidNext() { throw new RuntimeException("not supported"); }
+ public Mailbox.Iterator iterator() { return new SqliteJdbcIterator(); }
public void insert(Message m, int flags) {
// FIXME: flags
try {
- PreparedStatement add = conn.prepareStatement("insert into 'mail' values (?,?,?,?,?,?,?)");
+ PreparedStatement add =
+ conn.prepareStatement("insert into 'mail' ("+columns+") values (?,?,?,?,?,?,?,?)");
add.setString(1, m.messageid+"");
add.setString(2, m.from+"");
add.setString(3, m.to+"");
add.setString(5, m.subject+"");
add.setString(6, streamToString(m.headers.getStream()));
add.setString(7, streamToString(m.getBody().getStream()));
+ add.setInt (8, flags);
add.executeUpdate();
} catch (Exception e) { throw new RuntimeException(e); }
}
- public int uidNext() { throw new RuntimeException("not supported"); }
private class SqliteJdbcIterator extends Mailbox.Default.Iterator {
+ // could be more efficient in a ton of ways
private ResultSet rs;
- private int count=1;
- private Message m = null;
+ private int count = 1;
+ private int flags;
+ private Message m = null;
public SqliteJdbcIterator() {
try {
PreparedStatement query = conn.prepareStatement("select messageid_ from 'mail'");
try {
if (m!=null) return m;
rs.next();
- PreparedStatement query = conn.prepareStatement("select headers_,body_ from 'mail' where messageid_=?");
+ PreparedStatement query = conn.prepareStatement("select headers_,body_,flags_ from 'mail' where messageid_=?");
query.setString(1, rs.getString(1));
ResultSet rs2 = query.executeQuery();
if (!rs.next()) return null;
m = Message.newMessage(new Fountain.StringFountain(rs.getString(1) + "\r\n\r\n" + rs.getString(2)));
+ flags = rs.getInt(3);
return m;
} catch (Exception e) { throw new RuntimeException(e); }
}
- public Headers head() { return cur().headers; }
- public boolean next() { try { m = null; count++; return rs.next(); } catch (Exception e) { throw new RuntimeException(e); } }
- public int uid() { throw new RuntimeException("not supported"); }
- public int nntpNumber() { throw new RuntimeException("not supported"); }
+ public int getFlags() { if (m==null) /* could be more efficient */ cur(); return flags; }
+ public Headers head() { return cur().headers; }
+ public boolean next() { try { m = null; count++; return rs.next(); } catch (Exception e) { throw new RuntimeException(e); } }
+ public int uid() { throw new RuntimeException("not supported"); }
public int imapNumber() { return count; }
+ public int nntpNumber() { throw new RuntimeException("not supported"); }
public void delete() { throw new RuntimeException("not supported"); }
}
return b.toString();
}
-}
\ No newline at end of file
+}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.filter;
-import org.ibex.mail.*;
-/** anonymizes mail messages */
-public class Anonymizer extends Filter {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.filter;
-import org.ibex.mail.*;
-/** implements the Distributed Checksum Clearinghouse spam filtering protocol */
-public class DCC extends SpamFilter {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.filter;
-import org.ibex.mail.*;
-/** converts text/html parts into nice ASCII text for mutt/gnus/pine/etc */
-public class HTML2Text extends Filter {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.filter;
-import org.ibex.mail.*;
-/** checks PGP signatures on incoming mail */
-public class PGP extends Filter {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.filter;
-import org.ibex.mail.*;
-/** sticks a 1x1 gif in outbound messages so we can tell when the message is read */
-public class ReturnReciept extends Filter {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.filter;
-import org.ibex.mail.*;
-/** a flexible, regexp-based email address rewriting engine */
-public class RewriteFilter extends Filter {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.filter;
-import org.ibex.mail.*;
-/** tags outgoing messages with a single-use email address */
-public class SingleUse extends Filter {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.filter;
-import org.ibex.mail.*;
-/** invokes SpamAssassin */
-public class SpamAssassin extends SpamFilter {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.filter;
-import org.ibex.mail.*;
-/** base class for spam filters */
-public class SpamFilter extends Filter {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.filter;
-import org.ibex.mail.*;
-/** invokes Vipul's Razor */
-public class VipulsRazor extends SpamFilter {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.protocol;
-/** Fax send/recieve/gateway */
-public class Fax {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.protocol;
-import org.ibex.mail.*;
-import org.ibex.mail.target.*;
-import java.io.*;
-
-public class Incoming {
- protected void accept(Message m) throws IOException, MailException {
- Transcript.transcript.accept(m); // currently, we write all inbound messages to the transcript
- Target.root.accept(m);
- }
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.protocol;
-import org.ibex.io.*;
-import org.ibex.crypto.*;
-import org.ibex.jinetd.Listener;
-import org.ibex.mail.*;
-import org.ibex.util.*;
-import org.ibex.mail.target.*;
-import java.util.*;
-import java.net.*;
-import java.text.*;
-import java.io.*;
-
-public class Mbox {
- public static Message[] parse(Stream stream) {
- StringBuffer buf = null;
- Vec vec = new Vec();
- for(String s = stream.readln(); ; s = stream.readln()) {
- if (s == null || s.startsWith("From ")) {
- try {
- if (buf != null) vec.addElement(Message.newMessage(new Fountain.StringFountain(buf.toString())));
- } catch (Exception e) { Log.warn(Mbox.class, e); }
- if (s == null) break;
- buf = new StringBuffer();
- } else if (buf != null) {
- if (buf.length() == 0 && s.length() == 0) continue; // skip blank line after From
- buf.append(s);
- buf.append("\r\n");
- }
- }
- return (Message[])vec.copyInto(new Message[vec.size()]);
- }
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.protocol;
-/** RSS send/recieve/gateway */
-public class RSS {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.protocol;
-/** SMS send/recieve/gateway */
-public class SMS {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.protocol;
-public class VERP {
- // http://cr.yp.to/proto/verp.txt
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.protocol;
-/** a nice WebMail GUI */
-public class WebMail {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.target;
-import org.ibex.mail.*;
-/** bounces a message */
-public abstract class Bounce implements Target {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.target;
-import org.ibex.mail.*;
-/** simple class to handle darcs patches */
-public abstract class Darcs extends Pipe {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.target;
-import java.io.*;
-import org.ibex.js.*;
-import org.ibex.util.*;
-import org.ibex.mail.*;
-import org.ibex.mail.target.*;
-
-public class Drop extends JS.Obj implements Target {
- public static final Drop instance = new Drop();
- public final String reason;
- public Drop() { this(null); }
- public Drop(String reason) { this.reason = reason; }
- public void accept(Message m) throws IOException, MailException {
- Log.warn(this, "dropping" +(reason==null?"":(" because "+reason))+ ": " + m.summary());
- }
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.target;
-import org.ibex.mail.*;
-/** implementation of the Local Mail Transport Protocol */
-public abstract class LMTP implements Target {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.target;
-import java.io.*;
-import org.ibex.js.*;
-import org.ibex.util.*;
-import org.ibex.mail.*;
-import org.ibex.mail.target.*;
-
-public class Later extends JS.Obj implements Target {
- public static final Later instance = new Later();
- public static class LaterException extends RuntimeException { }
- public void accept(Message m) throws IOException, MailException {
- Log.warn(this, "delaying message " + m.summary());
- throw new LaterException();
- }
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.target;
-import org.ibex.mail.*;
-/** A full-featured mailing list manager */
-public abstract class List implements Target {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.target;
-
-/** implementation of the MBX mailbox format; only documentation is in UW imapd in src/osdep/unix/mbx.c */
-public class MBX {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.target;
-import org.ibex.mail.*;
-/** generic pipe-the-message-to-a-file target */
-public abstract class Pipe implements Target {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.target;
-import org.ibex.mail.*;
-/** callout to support legacy .procmailrc files */
-public abstract class Procmail extends Pipe {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.target;
-import java.io.*;
-import org.ibex.js.*;
-import org.ibex.util.*;
-import org.ibex.mail.*;
-import org.ibex.mail.target.*;
-
-public class Reject extends JS.Obj implements Target {
- public final String reason;
- public Reject(String reason) { this.reason = reason; }
- public void accept(Message m) throws IOException, MailException {
- throw new RejectException(m, reason);
- }
- public static class RejectException extends RuntimeException {
- public final Message m;
- public final String reason;
- public RejectException(Message m, String reason) { this.m = m; this.reason = reason; }
- }
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.target;
-import org.ibex.mail.*;
-import org.ibex.util.*;
-import org.ibex.io.*;
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.text.*;
-
-/** a fast-write, slow-read place to stash all messages we touch -- in case of a major f*ckup */
-public class Transcript implements Target {
-
- public static final Transcript transcript = new Transcript(Mailbox.STORAGE_ROOT + File.separatorChar + "transcript");
-
- private String path;
- public Transcript(String path) { new File(this.path = path).mkdirs(); }
- private static String lastTime = null;
- private static int lastCounter = 0;
-
- public synchronized void accept(Message message) {
- try {
- File today = new File(path + File.separatorChar + (new SimpleDateFormat("yy-MMM-dd").format(new Date())));
- today.mkdirs();
-
- String time = new SimpleDateFormat("HH:mm:ss").format(new Date());
- synchronized (Transcript.class) {
- if (lastTime != null && lastTime.equals(time)) {
- time += "." + (++lastCounter);
- } else {
- lastTime = time;
- lastCounter = 0;
- }
- }
-
- File target = new File(today.getPath() + File.separatorChar + time + ".txt");
- OutputStream os = new FileOutputStream(target);
- try {
- message.getStream().transcribe(new Stream(os));
- os.flush();
- } finally { os.close(); }
- } catch (IOException e) { throw new MailException.IOException(e); }
- }
-}
-
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.target;
-import org.ibex.mail.*;
-/** functionality similar to the UNIX vacation command */
-public abstract class Vacation implements Target {
-}
+++ /dev/null
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the Apache Public Source License 2.0 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.mail.target;
-import org.ibex.mail.*;
-/** an XML-RPC <i>server</i> which accepts requests sent via SMTP */
-public abstract class XMLRPC implements Target {
-}