Skip to content

Commit

Permalink
RSS Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
matteobaccan committed Apr 16, 2019
1 parent 8c06763 commit 30dd8e4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/main/java/it/baccan/html2pop3/POP3Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -672,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
18 changes: 11 additions & 7 deletions src/main/java/it/baccan/html2pop3/plugin/pop3/PluginRSS.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public static void setConfig(String cPath, String cConfig) {
* @param cPwd
* @return
*/
@Override
public boolean login(String cUser, String cPwd) {
boolean bRet = false;
try {
Expand All @@ -82,18 +83,18 @@ public boolean login(String cUser, String cPwd) {
this.cUser = cUser;
cPwd = config.getProperty(cPwd, cPwd);

Vector aRss = new Vector();
List<String> aRss = new ArrayList<>(10);
if (cPwd.equalsIgnoreCase("all")) {
Enumeration keysEnum = config.keys();
while (keysEnum.hasMoreElements()) {
aRss.addElement(config.getProperty((String) keysEnum.nextElement()));
aRss.add(config.getProperty((String) keysEnum.nextElement()));
}
} else {
aRss.addElement(cPwd);
aRss.add(cPwd);
}

for (int nRss = 0; nRss < aRss.size(); nRss++) {
String cUrl = (String) aRss.elementAt(nRss);
String cUrl = (String) aRss.get(nRss);

log.error("Rss: " + cUrl);

Expand Down Expand Up @@ -157,7 +158,7 @@ public boolean login(String cUser, String cPwd) {
cCRCList += "-" + cCrc + "-";

// Se non l'ho letto nella sessione precedente
if (cCache.indexOf("-" + cCrc + "-") == -1) {
if (!cCache.contains("-" + cCrc + "-")) {
p.put(cCrc, cEmail);
pXML.put(cCrc, cRss);
pXML.put(cCrc + "enc", cEnc);
Expand All @@ -178,7 +179,8 @@ public boolean login(String cUser, String cPwd) {

try {
cache.save(new FileOutputStream(cCacheFile), null);
} catch (Throwable e) {
} catch (FileNotFoundException e) {
log.error("FileNotFoundException" ,e);
}
} catch (Throwable ex) {
log.error("Error", ex);
Expand All @@ -193,6 +195,7 @@ public boolean login(String cUser, String cPwd) {
* @param bAll
* @return
*/
@Override
public String getMessage(int nPos, int nLine, boolean bAll) {
StringBuffer oMail = new StringBuffer();
try {
Expand All @@ -207,7 +210,7 @@ public String getMessage(int nPos, int nLine, boolean bAll) {
pop3.setCharset(cEnc);
pop3.setDa("HTML2POP3 RSS");
pop3.setA(cUser);
pop3.setOggetto("=?" + cEnc + "?B?" + new String(Base64.getEncoder().encodeToString(toHTML(getSubStr(pXML.getProperty(cMsgId), "title"), cEnc).getBytes())) + "?=");
pop3.setOggetto("=?" + cEnc + "?B?" + Base64.getEncoder().encodeToString(toHTML(getSubStr(pXML.getProperty(cMsgId), "title"), cEnc).getBytes()) + "?=");
String cData = getSubStr(pXML.getProperty(cMsgId), "pubDate");
pop3.setData(cData.length() == 0 ? getCurDate() : cData);
pop3.setBody(p.getProperty(cMsgId));
Expand All @@ -229,6 +232,7 @@ public String getMessage(int nPos, int nLine, boolean bAll) {
* @param nPos
* @return
*/
@Override
public boolean delMessage(int nPos) {
boolean bRet = true;
try {
Expand Down

0 comments on commit 30dd8e4

Please sign in to comment.