major simplifications to Iterator api
[org.ibex.mail.git] / src / org / ibex / mail / protocol / POP3.java
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.
4
5 package org.ibex.mail.protocol;
6 import org.ibex.util.*;
7 import org.ibex.io.*;
8 import org.ibex.mail.*;
9 import org.ibex.mail.target.*;
10 import org.ibex.jinetd.*;
11 import java.io.*;
12 import java.net.*;
13 import java.util.*;
14
15 public interface POP3 {
16
17     public static interface Server {
18         public void     userpass(String user, String pass);
19         public void     apop(String user, String digest);
20         public Stream   top(int m, int maxlines);
21         public Stream   retr(int m);
22         public long     stat();        // top 32 bits is number of messages, bottom 32 is total size
23         public long[]   list();        // top 32 bits is message number, bottom 32 is size
24         public long     list(int m);
25         public void     dele(int m);
26         public void     noop(int m);
27         public void     rset(int m);
28         public String   uidl(int m);
29         public String[] uidl();         // FIXME, also needs message number
30     }
31
32     public static class Listener {
33         Server api = null;
34         public void handleRequest(Connection conn) {
35             conn.setTimeout(30 * 60 * 1000);
36             conn.println("+OK " + conn.vhost + " [" + POP3.class.getName() + "] ready");
37             String user = null;
38             String pass = null;
39             for(String line = conn.readln(); line != null; line = conn.readln()) {
40                 StringTokenizer st = new StringTokenizer(line, " ");
41                 String command = st.nextToken().toUpperCase();
42                 if        (command.equals("USER")) {
43                 } else if (command.equals("PASS")) {
44                 } else if (command.equals("QUIT")) {
45                 }
46             }
47         }
48     }
49 }