reshuffling of file locations to make package structure flatter
[org.ibex.mail.git] / src / org / ibex / mail / POP3.java
diff --git a/src/org/ibex/mail/POP3.java b/src/org/ibex/mail/POP3.java
new file mode 100644 (file)
index 0000000..2a31425
--- /dev/null
@@ -0,0 +1,48 @@
+// 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;
+import org.ibex.util.*;
+import org.ibex.io.*;
+import org.ibex.mail.target.*;
+import org.ibex.jinetd.*;
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+public interface POP3 {
+
+    public static interface Server {
+        public void     userpass(String user, String pass);
+        public void     apop(String user, String digest);
+        public Stream   top(int m, int maxlines);
+        public Stream   retr(int m);
+        public long     stat();        // top 32 bits is number of messages, bottom 32 is total size
+        public long[]   list();        // top 32 bits is message number, bottom 32 is size
+        public long     list(int m);
+        public void     dele(int m);
+        public void     noop(int m);
+        public void     rset(int m);
+        public String   uidl(int m);
+        public String[] uidl();         // FIXME, also needs message number
+    }
+
+    public static class Listener {
+        Server api = null;
+        public void handleRequest(Connection conn) {
+            conn.setTimeout(30 * 60 * 1000);
+            conn.println("+OK " + conn.vhost + " [" + POP3.class.getName() + "] ready");
+            String user = null;
+            String pass = null;
+            for(String line = conn.readln(); line != null; line = conn.readln()) {
+                StringTokenizer st = new StringTokenizer(line, " ");
+                String command = st.nextToken().toUpperCase();
+                if        (command.equals("USER")) {
+                } else if (command.equals("PASS")) {
+                } else if (command.equals("QUIT")) {
+                }
+            }
+        }
+    }
+}