chore: Some minor changes

This commit is contained in:
2025-10-20 09:56:49 +02:00
parent 0b59ebb658
commit 23fafecccb
3 changed files with 9 additions and 13 deletions

View File

@ -15,12 +15,13 @@ import java.util.Properties;
public class Main {
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();
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.port", "587");
loginProps.put("mail.smtp.starttls.enable", "true");
loginProps.put("mail.store.protocol", "imaps");
loginProps.put("mail.imaps.host", "imappro.zoho.eu");
@ -44,9 +45,9 @@ public class Main {
Thread thread = new Thread(mailReader);
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);
System.out.println(Arrays.toString(newArr));

View File

@ -45,17 +45,17 @@ public abstract class SortingAlgorithm {
Message answer = globalContext.getBlockingQueue().take();
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;
}
if (answ.startsWith("SECOND")) {
if (answ.startsWith("second")) {
return ResponseAnswer.SECOND;
}
if (answ.startsWith("EQUAL")) {
if (answ.startsWith("third")) {
return ResponseAnswer.SAME;
}

View File

@ -3,12 +3,7 @@ package cz.jzitnik.utils.mail.read;
import cz.jzitnik.GlobalContext;
import jakarta.mail.Message;
public class MailReadHandler implements MailReader.OnNewEmailListener {
private final GlobalContext globalContext;
public MailReadHandler(GlobalContext globalContext) {
this.globalContext = globalContext;
}
public record MailReadHandler(GlobalContext globalContext) implements MailReader.OnNewEmailListener {
@Override
public void onNewEmail(Message message) {