Tried to finish this damn project, but didnt work

This commit is contained in:
Maxim Derksen 2022-01-27 10:37:23 +01:00
parent a1befcdfd5
commit 0f3da85728
2 changed files with 28 additions and 10 deletions

View File

@ -154,7 +154,7 @@ public class MyMail {
lastError = "Fehler beim Abfragen der Mails!";
return -1;
}
return Integer.parseInt(mes.substring(4,6));
return Integer.parseInt(mes.substring(4,5));
}
/**
@ -225,6 +225,11 @@ public class MyMail {
public Mail getMail( int pNumber ) {
con.send("RETR " + pNumber);
String mes = con.receive(); // Speicher für Antworten des Servers
String date = "";
String sender = "";
String subject = "";
String text = "";
boolean header = false;
if(mes == null || mes.startsWith("-ERR")){
lastError = "Fehler beim abfragen der Mail!";
return null;
@ -245,9 +250,22 @@ public class MyMail {
//
// Hinweis: Denke daran die Maskierung des Enzeichens "." rückgängig zu machen.
// Tipp: Merk dir in einem boolean, ob du im Textkörper oder im Header bist.
if( mes.trim().startsWith("Date: ") ) {
date = mes.substring(6);
}
else if( mes.startsWith("From: ") ) {
sender = mes.substring(6);
}
else if( mes.startsWith("Subject: ") ) {
subject = mes.substring(9);
}
else if( mes.startsWith("") || header) {
text += mes + "/n";
}
mes = con.receive();
} // end of while
return null;
return new Mail(pNumber, date, sender, subject, text);
}
/**

View File

@ -19,17 +19,17 @@ dependency6.to=Mail
dependency6.type=UsesDependency
editor.fx.0.height=1017
editor.fx.0.width=914
editor.fx.0.x=771
editor.fx.0.y=0
objectbench.height=93
editor.fx.0.x=363
editor.fx.0.y=14
objectbench.height=134
objectbench.width=1656
package.divider.horizontal=0.6
package.divider.vertical=0.8920086393088553
package.editor.height=819
package.divider.vertical=0.8297101449275363
package.editor.height=680
package.editor.width=1545
package.editor.x=0
package.editor.y=0
package.frame.height=1026
package.editor.y=98
package.frame.height=928
package.frame.width=1696
package.numDependencies=6
package.numTargets=5