chore: Some minor changes
This commit is contained in:
@ -15,12 +15,13 @@ import java.util.Properties;
|
|||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
private static MailContextPool getMailContextPool() {
|
private static MailContextPool getMailContextPool() {
|
||||||
|
// Initial capacity of Properties is by default 8, so we don't have to pass it in
|
||||||
Properties loginProps = new Properties();
|
Properties loginProps = new Properties();
|
||||||
|
|
||||||
loginProps.put("mail.smtp.auth", "true");
|
loginProps.put("mail.smtp.auth", "true");
|
||||||
loginProps.put("mail.smtp.starttls.enable", "true");
|
|
||||||
loginProps.put("mail.smtp.host", "smtppro.zoho.eu");
|
loginProps.put("mail.smtp.host", "smtppro.zoho.eu");
|
||||||
loginProps.put("mail.smtp.port", "587");
|
loginProps.put("mail.smtp.port", "587");
|
||||||
|
loginProps.put("mail.smtp.starttls.enable", "true");
|
||||||
|
|
||||||
loginProps.put("mail.store.protocol", "imaps");
|
loginProps.put("mail.store.protocol", "imaps");
|
||||||
loginProps.put("mail.imaps.host", "imappro.zoho.eu");
|
loginProps.put("mail.imaps.host", "imappro.zoho.eu");
|
||||||
@ -44,9 +45,9 @@ public class Main {
|
|||||||
Thread thread = new Thread(mailReader);
|
Thread thread = new Thread(mailReader);
|
||||||
thread.start();
|
thread.start();
|
||||||
|
|
||||||
SortingAlgorithm sortingAlgorithm = new BubbleSort(globalContext, "klindkubak@zohomail.eu", "sefljulie@zohomail.eu");
|
SortingAlgorithm sortingAlgorithm = new BubbleSort(globalContext, "email@jzitnik.dev", "email@jzitnik.dev");
|
||||||
|
|
||||||
int[] arr = {3, 2, 1};
|
int[] arr = {5,3,7,5,2};
|
||||||
int[] newArr = sortingAlgorithm.sort(arr);
|
int[] newArr = sortingAlgorithm.sort(arr);
|
||||||
|
|
||||||
System.out.println(Arrays.toString(newArr));
|
System.out.println(Arrays.toString(newArr));
|
||||||
|
|||||||
@ -45,17 +45,17 @@ public abstract class SortingAlgorithm {
|
|||||||
Message answer = globalContext.getBlockingQueue().take();
|
Message answer = globalContext.getBlockingQueue().take();
|
||||||
globalContext.setWaitingForMessage(false);
|
globalContext.setWaitingForMessage(false);
|
||||||
|
|
||||||
String answ = getTextFromMessage(answer).trim();
|
String answ = getTextFromMessage(answer).trim().toLowerCase();
|
||||||
|
|
||||||
if (answ.startsWith("FIRST")) {
|
if (answ.startsWith("first")) {
|
||||||
return ResponseAnswer.FIRST;
|
return ResponseAnswer.FIRST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (answ.startsWith("SECOND")) {
|
if (answ.startsWith("second")) {
|
||||||
return ResponseAnswer.SECOND;
|
return ResponseAnswer.SECOND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (answ.startsWith("EQUAL")) {
|
if (answ.startsWith("third")) {
|
||||||
return ResponseAnswer.SAME;
|
return ResponseAnswer.SAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,12 +3,7 @@ package cz.jzitnik.utils.mail.read;
|
|||||||
import cz.jzitnik.GlobalContext;
|
import cz.jzitnik.GlobalContext;
|
||||||
import jakarta.mail.Message;
|
import jakarta.mail.Message;
|
||||||
|
|
||||||
public class MailReadHandler implements MailReader.OnNewEmailListener {
|
public record MailReadHandler(GlobalContext globalContext) implements MailReader.OnNewEmailListener {
|
||||||
private final GlobalContext globalContext;
|
|
||||||
|
|
||||||
public MailReadHandler(GlobalContext globalContext) {
|
|
||||||
this.globalContext = globalContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNewEmail(Message message) {
|
public void onNewEmail(Message message) {
|
||||||
|
|||||||
Reference in New Issue
Block a user