major simplifications to Iterator api
[org.ibex.mail.git] / src / org / ibex / mail / 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;
6 import org.ibex.util.*;
7 import org.ibex.io.*;
8 import org.ibex.mail.target.*;
9 import org.ibex.jinetd.*;
10 import java.io.*;
11 import java.net.*;
12 import java.util.*;
13
14 public interface POP3 {
15
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
29     }
30
31     public static class Listener {
32         Server api = null;
33         public void handleRequest(Connection conn) {
34             conn.setTimeout(30 * 60 * 1000);
35             conn.println("+OK " + conn.vhost + " [" + POP3.class.getName() + "] ready");
36             String user = null;
37             String pass = null;
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")) {
44                 }
45             }
46         }
47     }
48 }