1 // Copyright 2000-2005 the Contributors, as shown in the revision logs.
2 // Licensed under the Apache Public Source License 2.0 ("the License").
3 // You may not use this file except in compliance with the License.
6 import org.ibex.util.*;
8 import org.ibex.mail.target.*;
9 import org.ibex.jinetd.*;
14 public interface POP3 {
16 public static interface Server {
17 public void userpass(String user, String pass);
18 public void apop(String user, String digest);
19 public Stream top(int m, int maxlines);
20 public Stream retr(int m);
21 public long stat(); // top 32 bits is number of messages, bottom 32 is total size
22 public long[] list(); // top 32 bits is message number, bottom 32 is size
23 public long list(int m);
24 public void dele(int m);
25 public void noop(int m);
26 public void rset(int m);
27 public String uidl(int m);
28 public String[] uidl(); // FIXME, also needs message number
31 public static class Listener {
33 public void handleRequest(Connection conn) {
34 conn.setTimeout(30 * 60 * 1000);
35 conn.println("+OK " + conn.vhost + " [" + POP3.class.getName() + "] ready");
38 for(String line = conn.readln(); line != null; line = conn.readln()) {
39 StringTokenizer st = new StringTokenizer(line, " ");
40 String command = st.nextToken().toUpperCase();
41 if (command.equals("USER")) {
42 } else if (command.equals("PASS")) {
43 } else if (command.equals("QUIT")) {