first milestone:
We are sucessfully receiving push mails and sending notifications upon receiving emails. Next step: Enable Online configuration
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user