summaryrefslogtreecommitdiff
path: root/lib/MailClient.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MailClient.cc')
-rw-r--r--lib/MailClient.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/MailClient.cc b/lib/MailClient.cc
index 380c878..8691f4f 100644
--- a/lib/MailClient.cc
+++ b/lib/MailClient.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: MailClient.cc,v 1.1 2007-10-12 13:07:42 pixel Exp $ */
+/* $Id: MailClient.cc,v 1.2 2007-10-15 13:47:12 pixel Exp $ */
#include <TaskMan.h>
#include <MailClient.h>
@@ -145,7 +145,7 @@ String MailClient::getNext() {
}
}
- return *(ptr++);
+ return getEmail(*(ptr++));
}
int MailClient::Do() throw (GeneralException) {
@@ -157,6 +157,7 @@ int MailClient::Do() throw (GeneralException) {
switch (current) {
case 0:
WaitFor(c = new ReadJob(&s, &b, final_line));
+ WaitTimeout();
current = 1;
Suspend(TASK_ON_HOLD);
@@ -168,11 +169,13 @@ int MailClient::Do() throw (GeneralException) {
b << "EHLO foobar\r\n";
WaitFor(c = new CopyJob(&b, &s));
+ WaitTimeout();
current = 2;
Suspend(TASK_ON_HOLD);
case 2:
WaitFor(c = new ReadJob(&s, &b, final_line));
+ WaitTimeout();
current = 3;
Suspend(TASK_ON_HOLD);
@@ -184,11 +187,13 @@ int MailClient::Do() throw (GeneralException) {
b << "MAIL FROM: " << getEmail(from) << "\r\n";
WaitFor(c = new CopyJob(&b, &s));
+ WaitTimeout();
current = 4;
Suspend(TASK_ON_HOLD);
case 4:
WaitFor(c = new ReadJob(&s, &b, final_line));
+ WaitTimeout();
current = 5;
Suspend(TASK_ON_HOLD);
@@ -197,7 +202,7 @@ int MailClient::Do() throw (GeneralException) {
if (cur_rcpt == RCPT_BEGIN) {
status = "SMTP server rejected our MAIL FROM: " + msg;
return TASK_DONE;
- // } else { // SMTP server rejecter one RCPT TO, nevermind it.
+ // } else { // SMTP server rejected one RCPT TO, nevermind it.
}
}
@@ -206,17 +211,20 @@ int MailClient::Do() throw (GeneralException) {
if (cur_rcpt != RCPT_END) {
b << "RCPT TO: " << n << "\r\n";
WaitFor(c = new CopyJob(&b, &s));
+ WaitTimeout();
current = 4;
Suspend(TASK_ON_HOLD);
}
b << "DATA\r\n";
WaitFor(c = new CopyJob(&b, &s));
+ WaitTimeout();
current = 6;
Suspend(TASK_ON_HOLD);
case 6:
WaitFor(c = new ReadJob(&s, &b, final_line));
+ WaitTimeout();
current = 7;
Suspend(TASK_ON_HOLD);
@@ -228,11 +236,13 @@ int MailClient::Do() throw (GeneralException) {
writeEmail(&b);
WaitFor(c = new CopyJob(&b, &s));
+ WaitTimeout();
current = 8;
Suspend(TASK_ON_HOLD);
case 8:
WaitFor(c = new ReadJob(&s, &b, final_line));
+ WaitTimeout();
current = 9;
Suspend(TASK_ON_HOLD);
@@ -242,13 +252,15 @@ int MailClient::Do() throw (GeneralException) {
return TASK_DONE;
}
- b << "QUIT\n\r";
+ b << "QUIT\r\n";
WaitFor(c = new CopyJob(&b, &s));
+ WaitTimeout();
current = 10;
Suspend(TASK_ON_HOLD);
case 10:
WaitFor(c = new ReadJob(&s, &b, final_line));
+ WaitTimeout();
current = 11;
Suspend(TASK_ON_HOLD);