From freemail at freenetproject.org Mon Oct 1 11:41:31 2007 From: freemail at freenetproject.org (freemail at freenetproject.org) Date: Mon, 1 Oct 2007 11:41:31 +0000 (UTC) Subject: [Freemail] Fall Clearance Message-ID: <20071001044259.10380.qmail@agrodim.client.kv.chereda.net> An HTML attachment was scrubbed... URL: http://emu.freenetproject.org/pipermail/freemail/attachments/20071001/ec3c3e38/attachment.htm From freemail at freenetproject.org Mon Oct 8 16:07:03 2007 From: freemail at freenetproject.org (freemail at freenetproject.org) Date: Mon, 8 Oct 2007 16:07:03 +0000 (UTC) Subject: [Freemail] *****SPAM***** Check out what's new Message-ID: <20071008070703.2295.qmail@bpi72.neoplus.adsl.tpnet.pl> An embedded and charset-unspecified text was scrubbed... Name: not available Url: http://emu.freenetproject.org/pipermail/freemail/attachments/20071008/61404b3e/attachment.txt -------------- next part -------------- An embedded message was scrubbed... From: Subject: Check out what's new Date: Mon, 8 Oct 2007 16:07:03 +0000 (UTC) Size: 7915 Url: http://emu.freenetproject.org/pipermail/freemail/attachments/20071008/61404b3e/attachment.eml From dbkr at freenetproject.org Tue Oct 9 08:28:14 2007 From: dbkr at freenetproject.org (Dave Baker) Date: Tue, 9 Oct 2007 09:28:14 +0100 Subject: [Freemail] Freenet Freemail fix for the current mail sending problem In-Reply-To: <470A89F7.3000403@myrealbox.com> References: <470A89F7.3000403@myrealbox.com> Message-ID: <200710090928.15221.dbkr@freenetproject.org> On Monday 08 October 2007 20:50:15 you wrote: > Hello Dave, > > Toad asked me to send you a mail about my commit to Freemail, I recently > investigated the problem that Freemail cannot send mails to new > addresses. There were a reports about this in the frost boards, but > since I didn't use Freemail for a while I hadn't noticed myself. > As it turns out, the protocol was changed slightly in a previous update > of freenet that broke the way Freemail accesses the mailsite for a user, > there was a report about this by toad in July, so I assume it was broken > then. > > The problem come from a change in handling keys that use a sub-path or > filename even though there is only one document in the site (like > Freemail mailsites), the key is redirected to a key with the sub-path > removed, but this is not redirect permanent but another error with a > RedirectURI field. This was considered a fatal error by Freemail and so > it could not retrieve any mailsite and send mail. > > I have fixed this by handling the error as redirect as well, now > Freemail works again. > > > I have commited the fix on September 28th and the current jar is > working, however I cannot change the status of the bugs issue. Could you > please close the issue 1749 and 1543? Done. I marked 1543 as a duplicate: I assume that's correct? Well done for fixing that! Dave From freemail at freenetproject.org Mon Oct 15 08:33:26 2007 From: freemail at freenetproject.org (freemail at freenetproject.org) Date: Mon, 15 Oct 2007 08:33:26 +0000 (UTC) Subject: [Freemail] Get 15% OFF Message-ID: <20071015143327.3919.qmail@softbank126112026042.bbtec.net> An HTML attachment was scrubbed... URL: http://emu.freenetproject.org/pipermail/freemail/attachments/20071015/1baf6302/attachment.htm From toad at amphibian.dyndns.org Tue Oct 23 14:30:04 2007 From: toad at amphibian.dyndns.org (Matthew Toseland) Date: Tue, 23 Oct 2007 15:30:04 +0100 Subject: [Freemail] Fall Clearance In-Reply-To: <20071001044259.10380.qmail@agrodim.client.kv.chereda.net> References: <20071001044259.10380.qmail@agrodim.client.kv.chereda.net> Message-ID: <200710231530.09524.toad@amphibian.dyndns.org> On Monday 01 October 2007 12:41, freemail at freenetproject.org wrote: [ delete spam ] Sorry, we have reconfigured the mailing list software, hopefully spam won't get through on this list anymore. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://emu.freenetproject.org/pipermail/freemail/attachments/20071023/14e6fe5b/attachment.pgp From toad at amphibian.dyndns.org Tue Oct 23 16:24:08 2007 From: toad at amphibian.dyndns.org (Matthew Toseland) Date: Tue, 23 Oct 2007 17:24:08 +0100 Subject: [Freemail] From Frost: ET's patch to make Freemail a plugin Message-ID: <200710231724.09601.toad@amphibian.dyndns.org> ----- ET at mj+bSV4hxRMtCj9fcwy4Ww9_3mc ----- 2007.10.02 - 21:16:23GMT ----- Hello, i send you patch for use freemail with freenet plugin. It's not finish but work with FCP acces. I've send too on your freemail address. -------------- next part -------------- Index: D:/Project/Freemail-latest/src/freemail/MailHeaderFilter.java =================================================================== --- D:/Project/Freemail-latest/src/freemail/MailHeaderFilter.java (revision 15425) +++ D:/Project/Freemail-latest/src/freemail/MailHeaderFilter.java (working copy) @@ -29,7 +29,6 @@ import java.io.BufferedReader; import java.io.IOException; import java.lang.StringBuffer; -import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; Index: D:/Project/Freemail-latest/src/freemail/smtp/SMTPListener.java =================================================================== --- D:/Project/Freemail-latest/src/freemail/smtp/SMTPListener.java (revision 15425) +++ D:/Project/Freemail-latest/src/freemail/smtp/SMTPListener.java (working copy) @@ -30,6 +30,21 @@ import freemail.config.Configurator; public class SMTPListener implements Runnable,ConfigClient { + /** + * Object that is used for syncing purposes. + */ + protected final Object syncObject = new Object(); + + /** + * Whether the thread this service runs in should stop. + */ + protected volatile boolean stopping = false; + + /** + * The currently running threads. + */ + private Thread thread; + private ServerSocket sock; private static final int LISTENPORT = 3025; private final MessageSender msgsender; private String bindaddress; @@ -42,12 +57,37 @@ } public void run() { + thread = Thread.currentThread(); try { this.realrun(); } catch (IOException ioe) { System.out.println("Error in SMTP server - "+ioe.getMessage()); } + synchronized (syncObject) { + thread = null; + syncObject.notify(); + } } + + /** + * This method will block until the + * thread has exited. + */ + public void kill() { + synchronized (syncObject) { + stopping = true; + try { + sock.close(); + } catch (IOException ioe) { } + while (thread != null) { + syncObject.notify(); + try { + syncObject.wait(1000); + } catch (InterruptedException ie1) { + } + } + } + } public void setConfigProp(String key, String val) { if (key.equalsIgnoreCase("smtp_bind_address")) { @@ -58,9 +98,8 @@ } public void realrun() throws IOException { - ServerSocket sock = new ServerSocket(this.bindport, 10, InetAddress.getByName(this.bindaddress)); - - while (!sock.isClosed()) { + sock = new ServerSocket(this.bindport, 10, InetAddress.getByName(this.bindaddress)); + while (!sock.isClosed() && !stopping) { try { SMTPHandler newcli = new SMTPHandler(sock.accept(), this.msgsender); Thread newthread = new Thread(newcli); Index: D:/Project/Freemail-latest/src/freemail/imap/IMAPListener.java =================================================================== --- D:/Project/Freemail-latest/src/freemail/imap/IMAPListener.java (revision 15425) +++ D:/Project/Freemail-latest/src/freemail/imap/IMAPListener.java (working copy) @@ -23,12 +23,28 @@ import java.net.ServerSocket; import java.net.InetAddress; +import java.net.SocketTimeoutException; import java.io.IOException; import freemail.config.Configurator; import freemail.config.ConfigClient; public class IMAPListener implements Runnable,ConfigClient { + /** + * Object that is used for syncing purposes. + */ + protected final Object syncObject = new Object(); + + /** + * Whether the thread this service runs in should stop. + */ + protected volatile boolean stopping = false; + + /** + * The currently running threads. + */ + private Thread thread; + private ServerSocket sock; private static final int LISTENPORT = 3143; private String bindaddress; private int bindport; @@ -47,22 +63,49 @@ } public void run() { + thread = Thread.currentThread(); try { this.realrun(); } catch (IOException ioe) { System.out.println("Error in IMAP server - "+ioe.getMessage()); } + synchronized (syncObject) { + thread = null; + syncObject.notify(); + } } + /** + * This method will block until the + * thread has exited. + */ + public void kill() { + synchronized (syncObject) { + stopping = true; + try { + sock.close(); + } catch (IOException ioe) { } + while (thread != null) { + syncObject.notify(); + try { + syncObject.wait(1000); + } catch (InterruptedException ie1) { + } + } + } + } + public void realrun() throws IOException { - ServerSocket sock = new ServerSocket(this.bindport, 10, InetAddress.getByName(this.bindaddress)); - - while (!sock.isClosed()) { + sock = new ServerSocket(this.bindport, 10, InetAddress.getByName(this.bindaddress)); + sock.setSoTimeout(60000); + while (!sock.isClosed() && !stopping) { try { IMAPHandler newcli = new IMAPHandler(sock.accept()); Thread newthread = new Thread(newcli); newthread.setDaemon(true); newthread.start(); + } catch (SocketTimeoutException ste) { + } catch (IOException ioe) { } Index: D:/Project/Freemail-latest/src/freemail/RTSFetcher.java =================================================================== --- D:/Project/Freemail-latest/src/freemail/RTSFetcher.java (revision 15425) +++ D:/Project/Freemail-latest/src/freemail/RTSFetcher.java (working copy) @@ -22,6 +22,8 @@ package freemail; import freemail.fcp.HighLevelFCPClient; +import freemail.support.io.LineReadingInputStream; +import freemail.support.io.TooLongException; import freemail.utils.DateStringFactory; import freemail.utils.PropsFile; @@ -50,8 +52,6 @@ import org.bouncycastle.crypto.modes.CBCBlockCipher; import org.bouncycastle.crypto.DataLengthException; -import freenet.support.io.LineReadingInputStream; -import freenet.support.io.TooLongException; import org.archive.util.Base32; Index: D:/Project/Freemail-latest/src/freemail/SingleAccountWatcher.java =================================================================== --- D:/Project/Freemail-latest/src/freemail/SingleAccountWatcher.java (revision 15425) +++ D:/Project/Freemail-latest/src/freemail/SingleAccountWatcher.java (working copy) @@ -28,6 +28,20 @@ import freemail.utils.EmailAddress; public class SingleAccountWatcher implements Runnable { + /** + * Object that is used for syncing purposes. + */ + protected final Object syncObject = new Object(); + + /** + * Whether the thread this service runs in should stop. + */ + protected volatile boolean stopping = false; + + /** + * The currently running threads. + */ + private Thread thread; public static final String CONTACTS_DIR = "contacts"; public static final String INBOUND_DIR = "inbound"; public static final String OUTBOUND_DIR = "outbound"; @@ -85,7 +99,8 @@ } public void run() { - while (true) { + thread = Thread.currentThread(); + while (!stopping) { long start = System.currentTimeMillis(); // is it time we inserted the mailsite? @@ -95,7 +110,9 @@ this.mailsite_last_upload = System.currentTimeMillis(); } } - + if(stopping) { + break; + } // send any messages queued in contact outboxes File[] obcontacts = this.obctdir.listFiles(); if (obcontacts != null) { @@ -106,12 +123,13 @@ obct.doComm(); } } - if (this.nf != null) { nf.fetch(); } - this.rtsf.poll(); + if(stopping) { + break; + } // poll for incoming message from all inbound contacts File[] ibcontacts = this.ibctdir.listFiles(); @@ -125,7 +143,10 @@ ibct.fetch(this.mb); } } - + if(stopping) { + break; + } + long runtime = System.currentTimeMillis() - start; if (MIN_POLL_DURATION - runtime > 0) { @@ -135,5 +156,27 @@ } } } + synchronized (syncObject) { + thread = null; + syncObject.notify(); + } + } + + /** + * This method will block until the + * thread has exited. + */ + public void kill() { + synchronized (syncObject) { + stopping = true; + while (thread != null) { + syncObject.notify(); + try { + syncObject.wait(1000); + } catch (InterruptedException ie1) { + } + } + } + } } Index: D:/Project/Freemail-latest/src/freemail/Freemail.java =================================================================== --- D:/Project/Freemail-latest/src/freemail/Freemail.java (revision 15425) +++ D:/Project/Freemail-latest/src/freemail/Freemail.java (working copy) @@ -23,6 +23,8 @@ import java.io.File; import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; import freemail.fcp.FCPContext; import freemail.fcp.FCPConnection; @@ -30,8 +32,16 @@ import freemail.smtp.SMTPListener; import freemail.config.Configurator; import freemail.config.ConfigClient; +import freenet.pluginmanager.FredPlugin; +import freenet.pluginmanager.FredPluginHTTP; +import freenet.pluginmanager.FredPluginHTTPAdvanced; +import freenet.pluginmanager.FredPluginThreadless; +import freenet.pluginmanager.PluginHTTPException; +import freenet.pluginmanager.PluginRespirator; +import freenet.support.HTMLNode; +import freenet.support.api.HTTPRequest; -public class Freemail implements ConfigClient { +public class Freemail implements ConfigClient, FredPlugin, FredPluginHTTP, FredPluginHTTPAdvanced, FredPluginThreadless { // version info public static final int VER_MAJOR = 0; public static final int VER_MINOR = 1; @@ -48,6 +58,15 @@ private static File tempdir; private static FCPConnection fcpconn; + + //Plugin + private static PluginRespirator pr; + private ArrayList singleAccountWatcherList = new ArrayList(); + private MessageSender sender; + private SMTPListener smtpl; + private AckProcrastinator ackinserter; + private IMAPListener imapl; + public static File getTempDir() { return Freemail.tempdir; } @@ -222,4 +241,156 @@ Freemail.globaldatadir = new File(val); } } + + // Plugin + public void runPlugin(PluginRespirator pr) { + Freemail.pr = pr; + String cfgfile = CFGFILE; + Configurator cfg = new Configurator(new File(cfgfile)); + FCPContext fcpctx = new FCPContext(); + + cfg.register("fcp_host", fcpctx, "localhost"); + cfg.register("fcp_port", fcpctx, "9481"); + + Freemail.fcpconn = new FCPConnection(fcpctx); + Thread fcpthread = new Thread(fcpconn, "Freemail FCP Connection"); + fcpthread.setDaemon(true); + fcpthread.start(); + cfg.register("globaldatadir", new Freemail(), GLOBALDATADIR); + if (!globaldatadir.exists()) { + if(!globaldatadir.mkdir()) { + System.out.println("Freemail plugin: Couldn't create global data directory. Please ensure that the user you are running Freemail as has write access to its working directory"); + return; + } + } + cfg.register("datadir", new Freemail(), Freemail.DATADIR); + if (!Freemail.datadir.exists()) { + if (!Freemail.datadir.mkdir()) { + System.out.println("Freemail plugin: Couldn't create data directory. Please ensure that the user you are running Freemail as has write access to its working directory"); + return; + } + } + cfg.register("tempdir", new Freemail(), Freemail.TEMPDIRNAME); + if (!Freemail.tempdir.exists()) { + if (!Freemail.tempdir.mkdir()) { + System.out.println("Freemail plugin: Couldn't create temporary directory. Please ensure that the user you are running Freemail as has write access to its working directory"); + return; + } + } + File[] files = Freemail.datadir.listFiles(); + for (int i = 0; i < files.length; i++) { + if (files[i].getName().equals(".") || files[i].getName().equals("..")) + continue; + if (!files[i].isDirectory()) continue; + + SingleAccountWatcher saw = new SingleAccountWatcher(files[i]); + singleAccountWatcherList.add(saw); + Thread t = new Thread(saw, "Freemail Account Watcher for "+files[i].getName()); + t.setDaemon(true); + t.start(); + } + + // and a sender thread + sender = new MessageSender(Freemail.datadir); + Thread senderthread = new Thread(sender, "Freemail Message sender"); + senderthread.setDaemon(true); + senderthread.start(); + + // start the SMTP Listener + smtpl = new SMTPListener(sender, cfg); + Thread smtpthread = new Thread(smtpl, "Freemail SMTP Listener"); + smtpthread.setDaemon(true); + smtpthread.start(); + + // start the delayed ACK inserter + File ackdir = new File(globaldatadir, ACKDIR); + AckProcrastinator.setAckDir(ackdir); + ackinserter = new AckProcrastinator(); + Thread ackinsthread = new Thread(ackinserter, "Freemail Delayed ACK Inserter"); + ackinsthread.setDaemon(true); + ackinsthread.start(); + + // start the IMAP listener + imapl = new IMAPListener(cfg); + Thread imaplthread = new Thread(imapl, "Freemail IMAP Listener"); + imaplthread.setDaemon(true); + imaplthread.start(); + } + + public void terminate() { + Iterator it = singleAccountWatcherList.iterator(); + while(it.hasNext()) { + ((SingleAccountWatcher)it.next()).kill(); + it.remove(); + } + sender.kill(); + ackinserter.kill(); + smtpl.kill(); + imapl.kill(); + fcpconn.kill(); + return; + } + + public String handleHTTPGet(HTTPRequest request) throws PluginHTTPException { + HTMLNode pageNode = pr.getPageMaker().getPageNode("Freemail plugin", false, null); + HTMLNode contentNode = pr.getPageMaker().getContentNode(pageNode); + + if(request.getParam("add").equals("Add account")) { + if(!(request.getParam("name").equals("") || request.getParam("password").equals(""))) { + try { + AccountManager.Create(request.getParam("name")); + AccountManager.ChangePassword(request.getParam("name"), request.getParam("password")); + if(!request.getParam("domain").equals("")) { + AccountManager.addShortAddress(request.getParam("name"), request.getParam("domain")); + } + Thread t = new Thread(new SingleAccountWatcher(new File(DATADIR, request.getParam("name"))), "Account Watcher for "+request.getParam("name")); + t.setDaemon(true); + t.start(); + HTMLNode addedBox = contentNode.addChild("div", "class", "infobox"); + addedBox.addChild("div", "class", "infobox-header", "Added account"); + addedBox.addChild("div", "class", "infobox-content", "Account for " + request.getParam("name") + " is created"); + + } catch (IOException ioe) { + HTMLNode errorBox = contentNode.addChild("div", "class", "infobox-error"); + errorBox.addChild("div", "class", "infobox-header", "IO Error"); + errorBox.addChild("div", "class", "infobox-content", "Couldn't create account. Please check write access to Freemail's working directory. If you want to overwrite your account, delete the appropriate directory manually in 'data' first. Freemail will intentionally not overwrite it. Error: "+ioe.getMessage()); + } catch (Exception e) { + HTMLNode errorBox = contentNode.addChild("div", "class", "infobox-error"); + errorBox.addChild("div", "class", "infobox-header", "Error"); + errorBox.addChild("div", "class", "infobox-content", "Couldn't change password for "+request.getParam("name")+". "+e.getMessage()); + } + } else { + HTMLNode errorBox = contentNode.addChild("div", "class", "infobox-error"); + errorBox.addChild("div", "class", "infobox-header", "Error"); + errorBox.addChild("div", "class", "infobox-content", "Couldn't create account, name or password is missing"); + } + } + + HTMLNode addBox = contentNode.addChild("div", "class", "infobox"); + addBox.addChild("div", "class", "infobox-header", "Add account"); + HTMLNode table = addBox.addChild("div", "class", "infobox-content").addChild("form").addChild("table", "class", "plugintable"); + HTMLNode tableRowName = table.addChild("tr"); + tableRowName.addChild("td", "Name"); + tableRowName.addChild("td").addChild("input", new String[] { "type", "name", "value", "size" }, new String[] { "text", "name", "", "30" }); + HTMLNode tableRowPassword = table.addChild("tr"); + tableRowPassword.addChild("td", "Password"); + tableRowPassword.addChild("td").addChild("input", new String[] { "type", "name", "value", "size" }, new String[] { "password", "password", "", "30" }); + HTMLNode tableRowDomain = table.addChild("tr"); + tableRowDomain.addChild("td", "Domain"); + tableRowDomain.addChild("td").addChild("input", new String[] { "type", "name", "value", "size" }, new String[] { "text", "domain", "", "30" }); + HTMLNode tableRowSubmit = table.addChild("tr"); + tableRowSubmit.addChild("td"); + tableRowSubmit.addChild("td").addChild("input", new String[] { "type", "name", "value" }, new String[] { "submit", "add", "Add account"}); + + return pageNode.generate(); + } + + public String handleHTTPPost(HTTPRequest request) throws PluginHTTPException { + return null; + } + + public String handleHTTPPut(HTTPRequest request) throws PluginHTTPException { + return null; + } + } Index: D:/Project/Freemail-latest/src/freemail/MessageSender.java =================================================================== --- D:/Project/Freemail-latest/src/freemail/MessageSender.java (revision 15425) +++ D:/Project/Freemail-latest/src/freemail/MessageSender.java (working copy) @@ -33,6 +33,20 @@ import freemail.utils.DateStringFactory; public class MessageSender implements Runnable { + /** + * Object that is used for syncing purposes. + */ + protected final Object syncObject = new Object(); + + /** + * Whether the thread this service runs in should stop. + */ + protected volatile boolean stopping = false; + + /** + * The currently running threads. + */ + private Thread thread; public static final String OUTBOX_DIR = "outbox"; private static final int MIN_RUN_TIME = 60000; public static final String NIM_KEY_PREFIX = "KSK at freemail-nim-"; @@ -92,12 +106,16 @@ public void run() { this.senderthread = Thread.currentThread(); - while (true) { + thread = Thread.currentThread(); + while (!stopping) { long start = System.currentTimeMillis(); // iterate through users File[] files = this.datadir.listFiles(); for (int i = 0; i < files.length; i++) { + if(stopping) { + break; + } if (files[i].getName().startsWith(".")) continue; File outbox = new File(files[i], OUTBOX_DIR); @@ -108,6 +126,10 @@ } // don't spin around the loop if nothing's // going on + if(stopping) { + break; + } + long runtime = System.currentTimeMillis() - start; if (MIN_RUN_TIME - runtime > 0) { @@ -117,7 +139,28 @@ } } } + synchronized (syncObject) { + thread = null; + syncObject.notify(); + } } + + /** + * This method will block until the + * thread has exited. + */ + public void kill() { + synchronized (syncObject) { + stopping = true; + while (thread != null) { + syncObject.notify(); + try { + syncObject.wait(1000); + } catch (InterruptedException ie1) { + } + } + } + } private void sendDir(File accdir, File dir) { File[] files = dir.listFiles(); Index: D:/Project/Freemail-latest/src/freemail/fcp/FCPConnection.java =================================================================== --- D:/Project/Freemail-latest/src/freemail/fcp/FCPConnection.java (revision 15425) +++ D:/Project/Freemail-latest/src/freemail/fcp/FCPConnection.java (working copy) @@ -29,6 +29,21 @@ import java.util.Iterator; public class FCPConnection implements Runnable { + /** + * Object that is used for syncing purposes. + */ + protected final Object syncObject = new Object(); + + /** + * Whether the thread this service runs in should stop. + */ + protected volatile boolean stopping = false; + + /** + * The currently running threads. + */ + private Thread thread; + private final FCPContext fcpctx; private OutputStream os; private InputStream is; @@ -76,10 +91,11 @@ } public void run() { - while (true) { + thread = Thread.currentThread(); + while (!stopping) { try { this.tryConnect(); - if (this.conn == null) throw new IOException(); + if (this.conn == null || stopping) throw new IOException(); FCPMessage msg = this.getMessage(); if (msg.getType() == null) throw new IOException("Connection closed"); @@ -102,8 +118,33 @@ } } } + synchronized (syncObject) { + thread = null; + syncObject.notify(); + } } + /** + * This method will block until the + * thread has exited. + */ + public void kill() { + synchronized (syncObject) { + stopping = true; + try { + finalize(); + } catch (Throwable t) { + } + while (thread != null) { + syncObject.notify(); + try { + syncObject.wait(1000); + } catch (InterruptedException ie1) { + } + } + } + } + protected void finalize() throws Throwable { try { this.conn.close(); Index: D:/Project/Freemail-latest/src/freemail/fcp/FCPMessage.java =================================================================== --- D:/Project/Freemail-latest/src/freemail/fcp/FCPMessage.java (revision 15425) +++ D:/Project/Freemail-latest/src/freemail/fcp/FCPMessage.java (working copy) @@ -31,9 +31,9 @@ import java.util.Collections; import freemail.Freemail; +import freemail.support.io.LineReader; +import freemail.support.io.LineReadingInputStream; -import freenet.support.io.LineReader; -import freenet.support.io.LineReadingInputStream; public class FCPMessage { private String messagetype; Index: D:/Project/Freemail-latest/src/freemail/AckProcrastinator.java =================================================================== --- D:/Project/Freemail-latest/src/freemail/AckProcrastinator.java (revision 15425) +++ D:/Project/Freemail-latest/src/freemail/AckProcrastinator.java (working copy) @@ -39,6 +39,20 @@ * Freemail is run more or less permanantly. */ public class AckProcrastinator implements Runnable { + /** + * Object that is used for syncing purposes. + */ + protected final Object syncObject = new Object(); + + /** + * Whether the thread this service runs in should stop. + */ + protected volatile boolean stopping = false; + + /** + * The currently running threads. + */ + private Thread thread; private static final long MAX_DELAY = 12 * 60 * 60 * 1000; private static final int RANDOM_ACK_SIZE = 512; @@ -65,7 +79,8 @@ } public void run() { - while (true) { + thread = Thread.currentThread(); + while (!stopping) { File[] acks = getAckDir().listFiles(); int i; @@ -116,8 +131,30 @@ } catch (InterruptedException ie) { } } + synchronized (syncObject) { + thread = null; + syncObject.notify(); + } + } + /** + * This method will block until the + * thread has exited. + */ + public void kill() { + synchronized (syncObject) { + stopping = true; + while (thread != null) { + syncObject.notify(); + try { + syncObject.wait(1000); + } catch (InterruptedException ie1) { + } + } + } + } + /** As put(String key, String data), but insert random data */ public static synchronized void put(String key) { Index: D:/Project/Freemail-latest/src/freemail/support/io/TooLongException.java =================================================================== --- D:/Project/Freemail-latest/src/freemail/support/io/TooLongException.java (revision 0) +++ D:/Project/Freemail-latest/src/freemail/support/io/TooLongException.java (revision 0) @@ -0,0 +1,8 @@ +package freemail.support.io; + +import java.io.IOException; + +/** Exception thrown by a LineReadingInputStream when a line is too long. */ +public class TooLongException extends IOException { + static final long serialVersionUID = -1; +} \ No newline at end of file Index: D:/Project/Freemail-latest/src/freemail/support/io/LineReader.java =================================================================== --- D:/Project/Freemail-latest/src/freemail/support/io/LineReader.java (revision 0) +++ D:/Project/Freemail-latest/src/freemail/support/io/LineReader.java (revision 0) @@ -0,0 +1,9 @@ +package freemail.support.io; + +import java.io.IOException; + +public interface LineReader { + + public String readLine(int maxLength, int bufferSize) throws IOException; + +} Index: D:/Project/Freemail-latest/src/freemail/support/io/LineReadingInputStream.java =================================================================== --- D:/Project/Freemail-latest/src/freemail/support/io/LineReadingInputStream.java (revision 0) +++ D:/Project/Freemail-latest/src/freemail/support/io/LineReadingInputStream.java (revision 0) @@ -0,0 +1,47 @@ +package freemail.support.io; + +import java.io.FilterInputStream; +import java.io.IOException; +import java.io.InputStream; + +/** + * A FilterInputStream which provides readLine(). + */ +public class LineReadingInputStream extends FilterInputStream implements LineReader { + private int lastBytesRead; + + public LineReadingInputStream(InputStream in) { + super(in); + } + + /** + * Read a line of US-ASCII. Used for e.g. HTTP. @return Null if end of file. + */ + public String readLine(int maxLength, int bufferSize) throws IOException { + StringBuffer sb = new StringBuffer(bufferSize); + this.lastBytesRead = 0; + while(true) { + int x = read(); + this.lastBytesRead++; + if(x == -1) { + if(sb.length() == 0) return null; + return sb.toString(); + } + char c = (char) x; + if(c == '\n') { + if(sb.length() > 0) { + if(sb.charAt(sb.length()-1) == '\r') + sb.setLength(sb.length()-1); + } + return sb.toString(); + } + sb.append(c); + if(sb.length() >= maxLength) + throw new TooLongException(); + } + } + + public int getLastBytesRead() { + return this.lastBytesRead; + } +} Index: D:/Project/Freemail-latest/build.xml =================================================================== --- D:/Project/Freemail-latest/build.xml (revision 15425) +++ D:/Project/Freemail-latest/build.xml (working copy) @@ -37,7 +37,11 @@ - + + + + + @@ -52,6 +56,7 @@ +
-------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://emu.freenetproject.org/pipermail/freemail/attachments/20071023/3138edb7/attachment.pgp From lists at privaterra.info Tue Oct 23 16:28:57 2007 From: lists at privaterra.info (Robert Guerra) Date: Tue, 23 Oct 2007 12:28:57 -0400 Subject: [Freemail] From Frost: ET's patch to make Freemail a plugin In-Reply-To: <200710231724.09601.toad@amphibian.dyndns.org> References: <200710231724.09601.toad@amphibian.dyndns.org> Message-ID: <080542C2-CDCF-43B9-ADED-F00D9C9B4A09@privaterra.info> Can someone let me know where I can download this - nice - plugin? On 23-Oct-07, at 12:24 PM, Matthew Toseland wrote: > ----- ET at mj+bSV4hxRMtCj9fcwy4Ww9_3mc ----- 2007.10.02 - 21:16:23GMT > ----- > > Hello, i send you patch for use freemail with freenet plugin. It's > not finish > but work with FCP acces. > I've send too on your freemail address. > > > _______________________________________________ > Freemail mailing list > Freemail at freenetproject.org > http://emu.freenetproject.org/cgi-bin/mailman/listinfo/freemail From nextgens at freenetproject.org Tue Oct 23 16:32:14 2007 From: nextgens at freenetproject.org (Florent =?iso-8859-1?Q?Daigni=E8re?=) Date: Tue, 23 Oct 2007 18:32:14 +0200 Subject: [Freemail] From Frost: ET's patch to make Freemail a plugin In-Reply-To: <080542C2-CDCF-43B9-ADED-F00D9C9B4A09@privaterra.info> References: <200710231724.09601.toad@amphibian.dyndns.org> <080542C2-CDCF-43B9-ADED-F00D9C9B4A09@privaterra.info> Message-ID: <20071023163213.GM4248@freenetproject.org> * Robert Guerra [2007-10-23 12:28:57]: > Can someone let me know where I can download this - nice - plugin? > The question is more who is going to review/commit it so that it can be built and deployed ;) > > On 23-Oct-07, at 12:24 PM, Matthew Toseland wrote: > > > ----- ET at mj+bSV4hxRMtCj9fcwy4Ww9_3mc ----- 2007.10.02 - 21:16:23GMT > > ----- > > > > Hello, i send you patch for use freemail with freenet plugin. It's > > not finish > > but work with FCP acces. > > I've send too on your freemail address. > > > > > > _______________________________________________ > > Freemail mailing list > > Freemail at freenetproject.org > > http://emu.freenetproject.org/cgi-bin/mailman/listinfo/freemail > > _______________________________________________ > Freemail mailing list > Freemail at freenetproject.org > http://emu.freenetproject.org/cgi-bin/mailman/listinfo/freemail -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://emu.freenetproject.org/pipermail/freemail/attachments/20071023/6e5e8226/attachment.pgp From toad at amphibian.dyndns.org Tue Oct 23 16:54:25 2007 From: toad at amphibian.dyndns.org (Matthew Toseland) Date: Tue, 23 Oct 2007 17:54:25 +0100 Subject: [Freemail] From Frost: ET's patch to make Freemail a plugin In-Reply-To: <080542C2-CDCF-43B9-ADED-F00D9C9B4A09@privaterra.info> References: <200710231724.09601.toad@amphibian.dyndns.org> <080542C2-CDCF-43B9-ADED-F00D9C9B4A09@privaterra.info> Message-ID: <200710231754.26097.toad@amphibian.dyndns.org> On Tuesday 23 October 2007 17:28, you wrote: > Can someone let me know where I can download this - nice - plugin? Does Freemail actually work for you then? > > On 23-Oct-07, at 12:24 PM, Matthew Toseland wrote: > > > ----- ET at mj+bSV4hxRMtCj9fcwy4Ww9_3mc ----- 2007.10.02 - 21:16:23GMT > > ----- > > > > Hello, i send you patch for use freemail with freenet plugin. It's > > not finish > > but work with FCP acces. > > I've send too on your freemail address. > > > > > > _______________________________________________ > > Freemail mailing list > > Freemail at freenetproject.org > > http://emu.freenetproject.org/cgi-bin/mailman/listinfo/freemail > > _______________________________________________ > Freemail mailing list > Freemail at freenetproject.org > http://emu.freenetproject.org/cgi-bin/mailman/listinfo/freemail > > -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://emu.freenetproject.org/pipermail/freemail/attachments/20071023/3d26bc7e/attachment.pgp From lists at privaterra.info Tue Oct 23 16:56:55 2007 From: lists at privaterra.info (Robert Guerra) Date: Tue, 23 Oct 2007 12:56:55 -0400 Subject: [Freemail] From Frost: ET's patch to make Freemail a plugin In-Reply-To: <200710231754.26097.toad@amphibian.dyndns.org> References: <200710231724.09601.toad@amphibian.dyndns.org> <080542C2-CDCF-43B9-ADED-F00D9C9B4A09@privaterra.info> <200710231754.26097.toad@amphibian.dyndns.org> Message-ID: The latest freemail works just fine :) regards, Robert --- Robert Guerra Managing Director, Privaterra Tel +1 416 893 0377 On 23-Oct-07, at 12:54 PM, Matthew Toseland wrote: > * PGP Signed: 10/23/07 at 12:54:25 > > On Tuesday 23 October 2007 17:28, you wrote: >> Can someone let me know where I can download this - nice - plugin? > > Does Freemail actually work for you then? >> >> On 23-Oct-07, at 12:24 PM, Matthew Toseland wrote: >> >>> ----- ET at mj+bSV4hxRMtCj9fcwy4Ww9_3mc ----- 2007.10.02 - 21:16:23GMT >>> ----- >>> >>> Hello, i send you patch for use freemail with freenet plugin. It's >>> not finish >>> but work with FCP acces. >>> I've send too on your freemail address. >>> >>> >>> _______________________________________________ >>> Freemail mailing list >>> Freemail at freenetproject.org >>> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/freemail >> >> _______________________________________________ >> Freemail mailing list >> Freemail at freenetproject.org >> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/freemail >> >> > > * Matthew John Toseland > * 0xE43DA450 From toad at amphibian.dyndns.org Tue Oct 23 17:46:13 2007 From: toad at amphibian.dyndns.org (Matthew Toseland) Date: Tue, 23 Oct 2007 18:46:13 +0100 Subject: [Freemail] From Frost: ET's patch to make Freemail a plugin In-Reply-To: References: <200710231724.09601.toad@amphibian.dyndns.org> <200710231754.26097.toad@amphibian.dyndns.org> Message-ID: <200710231846.18171.toad@amphibian.dyndns.org> On Tuesday 23 October 2007 17:56, you wrote: > The latest freemail works just fine :) Send me a freemail: anything at amphibian.freemail > > regards, > > Robert > --- > Robert Guerra > Managing Director, Privaterra > Tel +1 416 893 0377 > > > > On 23-Oct-07, at 12:54 PM, Matthew Toseland wrote: > > > * PGP Signed: 10/23/07 at 12:54:25 > > > > On Tuesday 23 October 2007 17:28, you wrote: > >> Can someone let me know where I can download this - nice - plugin? > > > > Does Freemail actually work for you then? > >> > >> On 23-Oct-07, at 12:24 PM, Matthew Toseland wrote: > >> > >>> ----- ET at mj+bSV4hxRMtCj9fcwy4Ww9_3mc ----- 2007.10.02 - 21:16:23GMT > >>> ----- > >>> > >>> Hello, i send you patch for use freemail with freenet plugin. It's > >>> not finish > >>> but work with FCP acces. > >>> I've send too on your freemail address. > >>> > >>> > >>> _______________________________________________ > >>> Freemail mailing list > >>> Freemail at freenetproject.org > >>> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/freemail > >> > >> _______________________________________________ > >> Freemail mailing list > >> Freemail at freenetproject.org > >> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/freemail > >> > >> > > > > * Matthew John Toseland > > * 0xE43DA450 > > _______________________________________________ > Freemail mailing list > Freemail at freenetproject.org > http://emu.freenetproject.org/cgi-bin/mailman/listinfo/freemail > > -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://emu.freenetproject.org/pipermail/freemail/attachments/20071023/7cdeb6da/attachment.pgp From toad at freenetproject.org Tue Oct 23 23:20:49 2007 From: toad at freenetproject.org (toad at freenetproject.org) Date: Tue, 23 Oct 2007 23:20:49 +0000 (UTC) Subject: [Freemail] r15516 - trunk/apps/Freemail/src/freemail Message-ID: <20071023232049.9E57447AEA3@freenetproject.org> Author: toad Date: 2007-10-23 23:20:49 +0000 (Tue, 23 Oct 2007) New Revision: 15516 Modified: trunk/apps/Freemail/src/freemail/Freemail.java Log: ET: I've seen a little error in freemail.Freemail.java Modified: trunk/apps/Freemail/src/freemail/Freemail.java =================================================================== --- trunk/apps/Freemail/src/freemail/Freemail.java 2007-10-23 23:11:20 UTC (rev 15515) +++ trunk/apps/Freemail/src/freemail/Freemail.java 2007-10-23 23:20:49 UTC (rev 15516) @@ -351,7 +351,7 @@ addedBox.addChild("div", "class", "infobox-content", "Account for " + request.getParam("name") + " is created"); } catch (IOException ioe) { - HTMLNode errorBox = contentNode.addChild("div", "class", "infobox-error"); + HTMLNode errorBox = contentNode.addChild("div", "class", "infobox infobox-error"); errorBox.addChild("div", "class", "infobox-header", "IO Error"); errorBox.addChild("div", "class", "infobox-content", "Couldn't create account. Please check write access to Freemail's working directory. If you want to overwrite your account, delete the appropriate directory manually in 'data' first. Freemail will intentionally not overwrite it. Error: "+ioe.getMessage()); } catch (Exception e) { @@ -360,7 +360,7 @@ errorBox.addChild("div", "class", "infobox-content", "Couldn't change password for "+request.getParam("name")+". "+e.getMessage()); } } else { - HTMLNode errorBox = contentNode.addChild("div", "class", "infobox-error"); + HTMLNode errorBox = contentNode.addChild("div", "class", "infobox infobox-error"); errorBox.addChild("div", "class", "infobox-header", "Error"); errorBox.addChild("div", "class", "infobox-content", "Couldn't create account, name or password is missing"); } From dbkr at freenetproject.org Thu Oct 25 20:37:52 2007 From: dbkr at freenetproject.org (Dave Baker) Date: Thu, 25 Oct 2007 21:37:52 +0100 Subject: [Freemail] From Frost: ET's patch to make Freemail a plugin In-Reply-To: <200710231724.09601.toad@amphibian.dyndns.org> References: <200710231724.09601.toad@amphibian.dyndns.org> Message-ID: <200710252137.52194.dbkr@freenetproject.org> On Tuesday 23 October 2007 17:24:08 Matthew Toseland wrote: > ----- ET at mj+bSV4hxRMtCj9fcwy4Ww9_3mc ----- 2007.10.02 - 21:16:23GMT ----- > > Hello, i send you patch for use freemail with freenet plugin. It's not finish > but work with FCP acces. > I've send too on your freemail address. > Fantastic. Thanks for committing that. Unfortunately I can't try it out right now as I appear to have missed a Freenet mandatory update, and I can't update because emu seems to be down (some things never change! ;) ) However, hopefully I'll get a chance to have a play at the weekend, and hopefully get on Frost too. Dave From alexlehm at freenetproject.org Sat Oct 27 17:54:26 2007 From: alexlehm at freenetproject.org (alexlehm at freenetproject.org) Date: Sat, 27 Oct 2007 17:54:26 +0000 (UTC) Subject: [Freemail] r15613 - trunk/apps/Freemail/src/freemail Message-ID: <20071027175426.5EB393A0694@freenetproject.org> Author: alexlehm Date: 2007-10-27 17:54:26 +0000 (Sat, 27 Oct 2007) New Revision: 15613 Modified: trunk/apps/Freemail/src/freemail/InboundContact.java Log: check for invalid slot names (too short), this should be the fix for issue 1811 which is basically residue of the error #844 Modified: trunk/apps/Freemail/src/freemail/InboundContact.java =================================================================== --- trunk/apps/Freemail/src/freemail/InboundContact.java 2007-10-27 17:17:04 UTC (rev 15612) +++ trunk/apps/Freemail/src/freemail/InboundContact.java 2007-10-27 17:54:26 UTC (rev 15613) @@ -87,6 +87,11 @@ } String slot; while ( (slot = sm.getNextSlot()) != null) { + if(slot.length()!=52) { + System.out.println("ignoring malformed slot "+slot+" (probably due to previous bug)"); + System.out.println("please the fix the entry in "+this.ibct_dir); + break; + } String key = basekey+slot; System.out.println("Attempting to fetch mail on key "+key); From dbkr at freenetproject.org Sun Oct 28 22:12:19 2007 From: dbkr at freenetproject.org (dbkr at freenetproject.org) Date: Sun, 28 Oct 2007 22:12:19 +0000 (UTC) Subject: [Freemail] r15629 - trunk/apps/Freemail/src/freemail Message-ID: <20071028221219.AA2A9479879@freenetproject.org> Author: dbkr Date: 2007-10-28 22:12:19 +0000 (Sun, 28 Oct 2007) New Revision: 15629 Modified: trunk/apps/Freemail/src/freemail/InboundContact.java Log: Please add comments to hacks like this. Modified: trunk/apps/Freemail/src/freemail/InboundContact.java =================================================================== --- trunk/apps/Freemail/src/freemail/InboundContact.java 2007-10-28 19:43:08 UTC (rev 15628) +++ trunk/apps/Freemail/src/freemail/InboundContact.java 2007-10-28 22:12:19 UTC (rev 15629) @@ -87,6 +87,9 @@ } String slot; while ( (slot = sm.getNextSlot()) != null) { + // the slot should be 52 characters long, since this is how long a 256 bit string ends up when base32 encoded. + // (the slots being base32 encoded SHA-256 checksums) + // TODO: remove this once the bug is ancient history, or if actually want to check the slots, do so in the SlotManagers. if(slot.length()!=52) { System.out.println("ignoring malformed slot "+slot+" (probably due to previous bug)"); System.out.println("please the fix the entry in "+this.ibct_dir); From alexlehm at freenetproject.org Mon Oct 29 19:37:28 2007 From: alexlehm at freenetproject.org (alexlehm at freenetproject.org) Date: Mon, 29 Oct 2007 19:37:28 +0000 (UTC) Subject: [Freemail] r15648 - trunk/apps/Freemail/src/freemail Message-ID: <20071029193728.6C4FF3C0441@freenetproject.org> Author: alexlehm Date: 2007-10-29 19:37:28 +0000 (Mon, 29 Oct 2007) New Revision: 15648 Modified: trunk/apps/Freemail/src/freemail/InboundContact.java Log: added a comment about who is affected by the problem sorry Modified: trunk/apps/Freemail/src/freemail/InboundContact.java =================================================================== --- trunk/apps/Freemail/src/freemail/InboundContact.java 2007-10-29 18:45:34 UTC (rev 15647) +++ trunk/apps/Freemail/src/freemail/InboundContact.java 2007-10-29 19:37:28 UTC (rev 15648) @@ -90,6 +90,8 @@ // the slot should be 52 characters long, since this is how long a 256 bit string ends up when base32 encoded. // (the slots being base32 encoded SHA-256 checksums) // TODO: remove this once the bug is ancient history, or if actually want to check the slots, do so in the SlotManagers. + // a fix for the bug causing this (https://bugs.freenetproject.org/view.php?id=1087) was commited on Feb 4 2007, + // anybody who has started using Freemail after that date is not affected. if(slot.length()!=52) { System.out.println("ignoring malformed slot "+slot+" (probably due to previous bug)"); System.out.println("please the fix the entry in "+this.ibct_dir);