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.
5 package org.ibex.mail.target;
7 import org.ibex.mail.*;
8 import org.ibex.util.*;
12 import java.util.zip.*;
15 public class MailmanArchives extends Mailbox.Default {
17 public static final String archiveUrl =
18 "http://lists.false-profit.com/mailman/private/us/2004-August.txt.gz?username=adam@false-profit.com&password=bre4kull";
20 public MailmanArchives() {
22 InputStream is = new java.net.URL(archiveUrl).openConnection().getInputStream();
23 BufferedReader br = new BufferedReader(new InputStreamReader(/*new GZIPInputStream(is)*/is));
25 StringBuffer acc = null;
26 for(String s = br.readLine(); ; s = br.readLine()) {
27 if (s == null || s.startsWith("From ")) {
29 Log.warn("[msg]", acc.toString());
30 all.addElement(Message.newMessage(new Fountain.StringFountain(acc.toString())));
33 acc = new StringBuffer();
39 all.copyInto(messages = new Message[all.size()]);
40 } catch (Exception e) {
42 throw new RuntimeException(e);
46 public void add(Message m) { throw new RuntimeException("not supported"); }
47 public void add(Message m, int i) { throw new RuntimeException("not supported"); }
49 public Message[] messages;
51 public int uidValidity() { return 1; }
52 public Mailbox.Iterator iterator() { return new Iterator(); }
53 public int uidNext() { return messages.length; }
55 private class Iterator extends Mailbox.Default.Iterator {
58 public int uid() { return num; }
59 public int num() { return num; }
61 public Message cur() { return messages[num]; }
62 public Headers head() { return messages[num].headers; }
63 public boolean next() { return (++num) < messages.length; }
64 public void delete() { }
66 public void set(String key, String val) { }
67 public String get(String key) { return null; }
68 public boolean seen() { return false; }
69 public boolean deleted() { return false; }
70 public boolean flagged() { return false; }
71 public boolean draft() { return false; }
72 public boolean answered() { return false; }
73 public boolean recent() { return false; }
74 public void seen(boolean on) { }
75 public void deleted(boolean on) { }
76 public void flagged(boolean on) { }
77 public void draft(boolean on) { }
78 public void answered(boolean on) { }
79 public void recent(boolean on) { }
80 public int flags() { return 0; }