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
7 import org.ibex.mail.*;
8 import org.ibex.util.*;
12 import java.util.zip.*;
15 /** designed to make a set of HTTP-accessible Mailman archives appear as a mailbox */
16 public class MailmanArchives extends Mailbox.Default {
18 public static final String archiveUrl = "";
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 insert(Message m, int i) { throw new RuntimeException("not supported"); }
48 public Message[] messages;
50 public int uidValidity() { return 1; }
51 public Mailbox.Iterator iterator() { return new Iterator(); }
52 public int uidNext() { return messages.length; }
54 private class Iterator extends Mailbox.Default.Iterator {
56 public int uid() { return num; }
57 public int nntpNumber() { return num; }
58 public int imapNumber() { return num; }
59 public Message cur() { return messages[num]; }
60 public Headers head() { return messages[num].headers; }
61 public boolean next() { return (++num) < messages.length; }
62 public void delete() { }