|
|
|
@ -1,6 +1,7 @@
@@ -1,6 +1,7 @@
|
|
|
|
|
package de.srsoftware.widerhall.data; |
|
|
|
|
|
|
|
|
|
import de.srsoftware.widerhall.Configuration; |
|
|
|
|
import de.srsoftware.widerhall.Util; |
|
|
|
|
import de.srsoftware.widerhall.mail.ImapClient; |
|
|
|
|
import de.srsoftware.widerhall.mail.MessageHandler; |
|
|
|
|
import de.srsoftware.widerhall.mail.ProblemListener; |
|
|
|
@ -86,12 +87,13 @@ public class MailingList implements MessageHandler, ProblemListener {
@@ -86,12 +87,13 @@ public class MailingList implements MessageHandler, ProblemListener {
|
|
|
|
|
* @param smtpPass |
|
|
|
|
* @param state |
|
|
|
|
*/ |
|
|
|
|
public MailingList(String email, String name, String imapHost, int imapPort, String imapUser, String imapPass, String inbox, String smtpHost, int smtpPort, String smtpUser, String smtpPass, int state) { |
|
|
|
|
public MailingList(String email, String name, String imapHost, int imapPort, String imapUser, String imapPass, String inbox, String smtpHost, int smtpPort, String smtpUser, String smtpPass, int state, Integer holdTime) { |
|
|
|
|
this.email = email.toLowerCase(); |
|
|
|
|
this.name = name; |
|
|
|
|
this.state = state; |
|
|
|
|
this.smtp = new SmtpClient(smtpHost,smtpPort,smtpUser,smtpPass,email); |
|
|
|
|
this.imap = new ImapClient(imapHost,imapPort,imapUser,imapPass,inbox,this); |
|
|
|
|
this.holdTime = holdTime; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public MailingList archive(boolean enabled) throws SQLException { |
|
|
|
@ -122,8 +124,8 @@ public class MailingList implements MessageHandler, ProblemListener {
@@ -122,8 +124,8 @@ public class MailingList implements MessageHandler, ProblemListener {
|
|
|
|
|
* @return |
|
|
|
|
* @throws SQLException |
|
|
|
|
*/ |
|
|
|
|
public static MailingList create(String email, String name, String imapHost, int imapPort, String imapUser, String imapPass, String inbox, String smtpHost, int smtpPort, String smtpUser, String smtpPass) throws SQLException { |
|
|
|
|
return new MailingList(email, name, imapHost, imapPort, imapUser, imapPass, inbox, smtpHost, smtpPort, smtpUser, smtpPass, DEFAULT_STATE).save(); |
|
|
|
|
public static MailingList create(String email, String name, String imapHost, int imapPort, String imapUser, String imapPass, String inbox, String smtpHost, int smtpPort, String smtpUser, String smtpPass, Integer holdTime) throws SQLException { |
|
|
|
|
return new MailingList(email, name, imapHost, imapPort, imapUser, imapPass, inbox, smtpHost, smtpPort, smtpUser, smtpPass, DEFAULT_STATE, holdTime).save(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void createHoldTimeColumn() throws SQLException { |
|
|
|
@ -231,7 +233,8 @@ public class MailingList implements MessageHandler, ProblemListener {
@@ -231,7 +233,8 @@ public class MailingList implements MessageHandler, ProblemListener {
|
|
|
|
|
rs.getInt(SMTP_PORT), |
|
|
|
|
rs.getString(SMTP_USER), |
|
|
|
|
rs.getString(SMTP_PASS), |
|
|
|
|
rs.getInt(STATE))); |
|
|
|
|
rs.getInt(STATE), |
|
|
|
|
Util.getNullable(rs,HOLD_TIME))); |
|
|
|
|
return ml; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -562,6 +565,7 @@ public class MailingList implements MessageHandler, ProblemListener {
@@ -562,6 +565,7 @@ public class MailingList implements MessageHandler, ProblemListener {
|
|
|
|
|
.set(SMTP_USER, smtp.username()) |
|
|
|
|
.set(SMTP_PASS, smtp.password()) |
|
|
|
|
.set(STATE, state) |
|
|
|
|
.set(HOLD_TIME,holdTime) |
|
|
|
|
.compile() |
|
|
|
|
.run(); |
|
|
|
|
return this; |
|
|
|
|