1 package org.ibex.mail.target;
3 import org.ibex.mail.*;
4 import org.ibex.util.*;
8 import java.util.zip.*;
11 public class MailmanArchives extends Mailbox.Default {
13 public static final String archiveUrl =
14 "http://lists.false-profit.com/mailman/private/us/2004-August.txt.gz?username=adam@false-profit.com&password=bre4kull";
16 public MailmanArchives() {
18 InputStream is = new java.net.URL(archiveUrl).openConnection().getInputStream();
19 BufferedReader br = new BufferedReader(new InputStreamReader(/*new GZIPInputStream(is)*/is));
21 StringBuffer acc = null;
22 for(String s = br.readLine(); ; s = br.readLine()) {
23 if (s == null || s.startsWith("From ")) {
25 Log.warn("[msg]", acc.toString());
26 all.addElement(Message.newMessage(new Stream(acc.toString())));
29 acc = new StringBuffer();
35 all.copyInto(messages = new Message[all.size()]);
36 } catch (Exception e) {
38 throw new RuntimeException(e);
42 public void add(Message m) { throw new RuntimeException("not supported"); }
43 public void add(Message m, int i) { throw new RuntimeException("not supported"); }
45 public Message[] messages;
47 public int uidValidity() { return 1; }
48 public Mailbox.Iterator iterator() { return new Iterator(); }
49 public int uidNext() { return messages.length; }
51 private class Iterator extends Mailbox.Default.Iterator {
54 public int uid() { return num; }
55 public int num() { return num; }
57 public Message cur() { return messages[num]; }
58 public MIME.Headers head() { return messages[num].headers; }
59 public boolean next() { return (++num) < messages.length; }
60 public void delete() { }
62 public void set(String key, String val) { }
63 public String get(String key) { return null; }
64 public boolean seen() { return false; }
65 public boolean deleted() { return false; }
66 public boolean flagged() { return false; }
67 public boolean draft() { return false; }
68 public boolean answered() { return false; }
69 public boolean recent() { return false; }
70 public void seen(boolean on) { }
71 public void deleted(boolean on) { }
72 public void flagged(boolean on) { }
73 public void draft(boolean on) { }
74 public void answered(boolean on) { }
75 public void recent(boolean on) { }
76 public int flags() { return 0; }