working on tests
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
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.SmtpClient;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -41,17 +39,18 @@ public class MailingList implements MessageHandler {
|
||||
private static final String SMTP_PASS = "smtp_pass";
|
||||
public static final String TABLE_NAME = "Lists";
|
||||
private static final int STATE_PENDING = 0;
|
||||
private static final int STATE_ENABLED = 1;
|
||||
private static final int STATE_PUBLIC = 2;
|
||||
public static final int STATE_FORWARD_FROM = 4;
|
||||
public static final int STATE_FORWARD_ATTACHED = 8;
|
||||
public static final int STATE_HIDE_RECEIVERS = 16;
|
||||
public static final int STATE_REPLY_TO_LIST = 32;
|
||||
public static final int STATE_OPEN = 64;
|
||||
public static final int STATE_PUBLIC_ARCHIVE = 128;
|
||||
private static final int STATE_ENABLED = 1; // do we process incoming messages?
|
||||
private static final int STATE_PUBLIC = 2; // can guests see this ML?
|
||||
public static final int STATE_FORWARD_FROM = 4; // set original sender as FROM when forwarding?
|
||||
public static final int STATE_FORWARD_ATTACHED = 8; // forward messages as attachment?
|
||||
public static final int STATE_HIDE_RECEIVERS = 16; // send using BCC receivers
|
||||
public static final int STATE_REPLY_TO_LIST = 32; // set REPLY TO field to list address?
|
||||
public static final int STATE_OPEN_FOR_GUESTS = 64; // allow anyone to send via this list?
|
||||
public static final int STATE_PUBLIC_ARCHIVE = 128; // save received messages in archive?
|
||||
public static final int STATE_OPEN_FOR_MODS = 256; // allow mods to send via this list?
|
||||
private static final int VISIBLE = 1;
|
||||
private static final int HIDDEN = 0;
|
||||
private static final int DEFAULT_STATE = STATE_PENDING|STATE_HIDE_RECEIVERS|STATE_PUBLIC_ARCHIVE;
|
||||
private static final int DEFAULT_STATE = STATE_PENDING|STATE_HIDE_RECEIVERS|STATE_PUBLIC_ARCHIVE|STATE_OPEN_FOR_MODS;
|
||||
private static final String RETAINED_FOLDER = "retained";
|
||||
private final String name;
|
||||
private final String email;
|
||||
@@ -335,7 +334,7 @@ public class MailingList implements MessageHandler {
|
||||
Address from = message.getFrom()[0];
|
||||
if (from instanceof InternetAddress internetAddress){
|
||||
var senderEmail = ((InternetAddress) from).getAddress();
|
||||
if (!hasState(STATE_OPEN) && !this.hashMember(senderEmail)){
|
||||
if (!hasState(STATE_OPEN_FOR_GUESTS) && !this.hashMember(senderEmail)){
|
||||
retainMessage(message);
|
||||
sentRetentionNotification(senderEmail);
|
||||
return;
|
||||
@@ -346,7 +345,7 @@ public class MailingList implements MessageHandler {
|
||||
}
|
||||
|
||||
public MailingList open(boolean open) throws SQLException {
|
||||
return setFlag(STATE_OPEN,open);
|
||||
return setFlag(STATE_OPEN_FOR_GUESTS,open);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -491,7 +490,7 @@ public class MailingList implements MessageHandler {
|
||||
if (hasState(STATE_FORWARD_ATTACHED)) map.put("forward_attached",HIDDEN);
|
||||
if (hasState(STATE_HIDE_RECEIVERS)) map.put("hide_receivers",HIDDEN);
|
||||
if (hasState(STATE_REPLY_TO_LIST)) map.put("reply_to_list",HIDDEN);
|
||||
if (hasState(STATE_OPEN)) map.put("open",VISIBLE);
|
||||
if (hasState(STATE_OPEN_FOR_GUESTS)) map.put("open",VISIBLE);
|
||||
if (hasState(STATE_PUBLIC_ARCHIVE)) map.put("archive",VISIBLE);
|
||||
return map;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user