Skip to content

Commit

Permalink
Correzione dell'errata interpretazione dei caratteri sulle email rico…
Browse files Browse the repository at this point in the history
…struite
  • Loading branch information
matteobaccan committed Apr 16, 2019
1 parent a19a6e6 commit 8c06763
Show file tree
Hide file tree
Showing 22 changed files with 86 additions and 154 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>it.baccan</groupId>
<artifactId>HTML2POP3</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
<packaging>jar</packaging>
<name>HTML2POP3 ${project.version}</name>

Expand Down Expand Up @@ -143,7 +143,7 @@
</platforms>
<programs>
<program>
<mainClass>it.baccan.html2pop3.htmlgui32</mainClass>
<mainClass>it.baccan.html2pop3.HTMLGUI32</mainClass>
<id>${project.artifactId}-${project.version}</id>
</program>
</programs>
Expand All @@ -158,7 +158,7 @@
<version>1.4.0.RELEASE</version>
<configuration>
<mainClass>it.baccan.html2pop3.htmlgui32</mainClass>
<mainClass>it.baccan.html2pop3.HTMLGUI32</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/it/baccan/html2pop3/BaseServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected final void setKeepAlive(final Socket socket) throws Throwable {
}

/**
*
* Close server.
*/
public final void finish() {
try {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/it/baccan/html2pop3/HTML2POP3.java
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public boolean load() {
this.delete = p.getProperty("delete", "true").equalsIgnoreCase("true");
this.deleteOptimized = p.getProperty("deleteoptimized", "true").equalsIgnoreCase("true");
this.bLifo = p.getProperty("coda", "lifo").equalsIgnoreCase("lifo");
setOutlook2002Timeout( p.getProperty("outlook2002.timeout", "true").equalsIgnoreCase("true") );
setOutlook2002Timeout(p.getProperty("outlook2002.timeout", "true").equalsIgnoreCase("true"));
this.debug = p.getProperty("debug", "false").equalsIgnoreCase("true");

// Email per session
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/it/baccan/html2pop3/HTMLGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class HTMLGUI extends javax.swing.JFrame {
private HTML2POP3 h2p = null;

/**
*
* HTMLGUI constructor.
*/
public HTMLGUI() {
initComponents();
Expand Down
41 changes: 4 additions & 37 deletions src/main/java/it/baccan/html2pop3/NNTPServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.util.Vector;
import java.util.ArrayList;
import lombok.extern.slf4j.Slf4j;

/**
Expand All @@ -55,7 +55,7 @@ public void run() {
nntpThread thread;
try {
if (getParent().getPortNNTP() > 0) {
setServerSocket( new ServerSocket(getParent().getPortNNTP(), getParent().getClient(), InetAddress.getByName(getParent().getHost())));
setServerSocket(new ServerSocket(getParent().getPortNNTP(), getParent().getClient(), InetAddress.getByName(getParent().getHost())));
while (true) {
// Faccio partire il Thread
Socket socket = null;
Expand Down Expand Up @@ -159,9 +159,6 @@ private void manage(Socket socket) throws Throwable {
NNTPBase sp = null;
if (cServer.equalsIgnoreCase("nntp")) {
sp = new PluginNNTP();
//} else {
//log.error( "NNTP server: errore, server mancante." );
//sp = new pluginnntp();
}

boolean bExit = false;
Expand Down Expand Up @@ -198,11 +195,6 @@ private void manage(Socket socket) throws Throwable {
} else if (cLineUpper.startsWith("LIST")) {
html.putData(SO, "215 list of newsgroups follows\r\n");
sp.streamList(SO);

//Vector aGroup = sp.list();
//for( int nCur=0; nCur<aGroup.size(); nCur++ ){
//html.putData( SO, ((String)aGroup.elementAt( nCur )) +" 00001 00001 n\r\n" );
//}
html.putData(SO, ".\r\n");

} else if (cLineUpper.startsWith("GROUP")) {
Expand Down Expand Up @@ -235,11 +227,11 @@ private void manage(Socket socket) throws Throwable {
cTo = cFrom;
}

Vector aRet = sp.xover(Double.valueOf(cFrom).longValue(), Double.valueOf(cTo).longValue());
ArrayList aRet = sp.xover(Double.valueOf(cFrom).longValue(), Double.valueOf(cTo).longValue());

html.putData(SO, "224 Overview Information Follows\r\n");
for (int nCur = 0; nCur < aRet.size(); nCur++) {
html.putData(SO, ((String) aRet.elementAt(nCur)) + "\r\n");
html.putData(SO, ((String) aRet.get(nCur)) + "\r\n");
}
html.putData(SO, ".\r\n");
}
Expand All @@ -260,29 +252,6 @@ private void manage(Socket socket) throws Throwable {
}
}

//12345678
//} else if( cLineUpper.startsWith("STAT") ){
//if( cLine.length()<=4 ) {
//html.putData( SO, "501 Syntax error in parameters or arguments to STAT command\r\n" );
//} else {
//cArt = cLine.substring(4).trim();
//html.putData( SO, "223 " +cArt +" article retrieved - statistics\r\n" );
//}
//12345678
//} else if( cLineUpper.startsWith("HEAD") ){
//html.putData( SO, "221 " +cArt +" article retrieved - head\r\n" );
//html.putData( SO, "xxxxxxxxxxxxxxx\r\n" );
//html.putData( SO, ".\r\n" );
//12345678
//} else if( cLineUpper.startsWith("BODY") ){
//html.putData( SO, "221 " +cArt +" article retrieved - body\r\n" );
//html.putData( SO, "xxxxxxxxxxxxxxx\r\n" );
//html.putData( SO, ".\r\n" );
//12345678
//} else if( cLineUpper.startsWith("NEXT") ){
//html.putData( SO, "222 " +cArt +" article retrieved - statistics\r\n" );
//html.putData( SO, "xxxxxxxxxxxxxxx\r\n" );
//html.putData( SO, ".\r\n" );
} else if (cLineUpper.startsWith("QUIT")) {
html.putData(SO, "205 HTML2POP3 QUIT\r\n");
bExit = true;
Expand All @@ -291,8 +260,6 @@ private void manage(Socket socket) throws Throwable {
html.putData(SO, "500 Syntax Error or Unknown Command\r\n");
}
}
//*/
}

}
}
7 changes: 4 additions & 3 deletions src/main/java/it/baccan/html2pop3/POP3Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ private boolean isTunnel(String cEmail) {
return (getTunnelConversion(cEmail).length() > 0);
}

private String getTunnelConversion(String cEmail) {
private String getTunnelConversion(String fullEmail) {
String cRet = "";

String cEmail = fullEmail;
// Stacco la parte @qualcosa e la cerco nel config
int nPos = cEmail.indexOf("@");
if (nPos != -1) {
Expand Down Expand Up @@ -671,8 +672,8 @@ private void manage(Socket socket) throws Throwable {
html.putData(SO, "-ERR already deleted\r\n");
}
} else {
html.putData(SO, "-ERR delete disabled\r\n");
//html.putData(SO, "+OK message marked for deletion\r\n");
//html.putData(SO, "-ERR delete disabled\r\n");
html.putData(SO, "+OK message marked for deletion\r\n");
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/it/baccan/html2pop3/SMTPServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public class SMTPServer extends BaseServer {

private final String cLoginString = "220 HTML2POP3 ESMTP Service (" + Version.getVersion() + ") ready";


/**
*
* @param p
Expand All @@ -58,7 +57,7 @@ public void run() {
smtpThread thread;
try {
if (getParent().getPortSMTP() > 0) {
setServerSocket( new ServerSocket(getParent().getPortSMTP(), getParent().getClient(), InetAddress.getByName(getParent().getHost())));
setServerSocket(new ServerSocket(getParent().getPortSMTP(), getParent().getClient(), InetAddress.getByName(getParent().getHost())));
while (true) {
// Faccio partire il Thread
Socket socket = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
public class DeleteMessageException extends Exception {

/**
*
*/
public DeleteMessageException() {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
public class ParsingMailException extends Exception {

/**
*
* ParsingMailException constructor.
*/
public ParsingMailException() {
super();
Expand Down
1 change: 0 additions & 1 deletion src/main/java/it/baccan/html2pop3/plugin/PluginBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -1224,5 +1224,4 @@ public String getFullCook(String cCook, String cSubCook) {
return cRet;
}


}
27 changes: 6 additions & 21 deletions src/main/java/it/baccan/html2pop3/plugin/nntp/NNTPBase.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
/*
* nntpbase
* Copyright (c) 2019 Matteo Baccan
* http://www.baccan.it
*
* Copyright 2004 Matteo Baccan
* www - http://www.baccan.it
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
* Distributed under the GPL v3 software license, see the accompanying
* file LICENSE or http://www.gnu.org/licenses/gpl.html.
*
*/
/**
Expand All @@ -33,8 +19,7 @@

import it.baccan.html2pop3.plugin.PluginBase;
import java.io.OutputStream;
import java.util.Vector;

import java.util.ArrayList;

/**
*
Expand Down Expand Up @@ -62,7 +47,7 @@ public abstract class NNTPBase extends PluginBase {
* @param to
* @return
*/
public abstract Vector xover(long from, long to);
public abstract ArrayList<String> xover(long from, long to);

/**
*
Expand Down
27 changes: 6 additions & 21 deletions src/main/java/it/baccan/html2pop3/plugin/nntp/NNTPPlugin.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
/*
* nntpplugin interface
* Copyright (c) 2019 Matteo Baccan
* http://www.baccan.it
*
* Copyright 2004 Matteo Baccan
* www - http://www.baccan.it
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
* Distributed under the GPL v3 software license, see the accompanying
* file LICENSE or http://www.gnu.org/licenses/gpl.html.
*
*/
/**
Expand All @@ -32,8 +18,7 @@
package it.baccan.html2pop3.plugin.nntp;

import java.io.OutputStream;
import java.util.Vector;

import java.util.ArrayList;

/**
*
Expand Down Expand Up @@ -61,7 +46,7 @@ public interface NNTPPlugin {
* @param nTo
* @return
*/
Vector xover(long nFrom, long nTo);
ArrayList<String> xover(long nFrom, long nTo);

/**
*
Expand Down
30 changes: 9 additions & 21 deletions src/main/java/it/baccan/html2pop3/plugin/nntp/PluginNNTP.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
/*
* HTTP/NNTP generic plugin
* Copyright (c) 2019 Matteo Baccan
* http://www.baccan.it
*
* Copyright 2004 Matteo Baccan
* www - http://www.baccan.it
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
* Distributed under the GPL v3 software license, see the accompanying
* file LICENSE or http://www.gnu.org/licenses/gpl.html.
*
*/
/**
Expand All @@ -43,6 +29,7 @@
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Properties;
import java.util.Vector;
Expand Down Expand Up @@ -384,15 +371,16 @@ private String getRow(String cPage, String cId) {
* @param nTo
* @return
*/
public Vector xover(long nFrom, long nTo) {
Vector aRet = new Vector();
@Override
public ArrayList<String> xover(long nFrom, long nTo) {
ArrayList<String> aRet = new ArrayList<>(10);
log.error("nntp: xover init");
for (int nPos = 0; nPos < aOver.size(); nPos++) {
String cOver = (String) aOver.elementAt(nPos);
long nCurPos = Double.valueOf(cOver.substring(0, cOver.indexOf("\t"))).longValue();

if (nCurPos >= nFrom && (nTo == -1 || nTo >= nCurPos)) {
aRet.addElement(cOver);
aRet.add(cOver);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public static void setDefaultServer(String cS) {
}

/**
*Vettore email.
* Vettore email.
*
* @param cUser
* @param cPwd
* @return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ public boolean delMessage(int pos) {
String messageId = getMessageID(pos);
String deleteUrl = secondServer + BASE_DELETE + messageId + "=on";
String retPage = null;
int retry = 0;
int retry = 0;
boolean ret = true;

try {
Expand Down
Loading

0 comments on commit 8c06763

Please sign in to comment.