first milestone:

We are sucessfully receiving push mails and sending notifications upon receiving emails.
Next step:
Enable Online configuration
This commit is contained in:
2022-04-13 16:44:03 +02:00
parent c9019b63f3
commit b2d9a115b9
5 changed files with 28 additions and 14 deletions

View File

@@ -24,11 +24,6 @@ public class ImapClient {
private class ListeningThread extends Thread {
private static final Logger LOG = LoggerFactory.getLogger(ListeningThread.class);
private final JSONObject config;
ListeningThread(JSONObject config){
this.config = config;
}
@Override
public void run() {
@@ -50,13 +45,14 @@ public class ImapClient {
String host = (String) config.get(Constants.HOST);
String username = (String) config.get(Constants.USER);
String password = (String) config.get(Constants.PASSWORD);
String folderName = (String) config.get(Constants.INBOX);
LOG.debug("Connecting and logging in…");
Properties props = imapProps();
Session session = Session.getInstance(props);
Store store = session.getStore(Constants.IMAPS);
store.connect(host,username,password);
LOG.debug("Connected, opening inbox:");
inbox = (IMAPFolder)store.getFolder("INBOX");
LOG.debug("Connected, opening {}:",folderName);
inbox = (IMAPFolder)store.getFolder(folderName);
inbox.open(IMAPFolder.READ_WRITE);
while (!stopped){
@@ -116,7 +112,7 @@ public class ImapClient {
public void start() {
LOG.debug("Creating ListeningThread…");
new ListeningThread(config).start();
new ListeningThread().start();
LOG.debug("Creating Heartbeat…");
new Heartbeat().start();
}