diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MailServer.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/MailServer.cc b/lib/MailServer.cc index b34678e..d0bb165 100644 --- a/lib/MailServer.cc +++ b/lib/MailServer.cc @@ -31,7 +31,7 @@ const timeval timeout_sending = { 80, 0 }; class ProcessSMTPRequest : public Task { public: - ProcessSMTPRequest(const Socket & out) : s(out) { + ProcessSMTPRequest(const Socket & out, MailHandler * _handler) : s(out), handler(_handler) { SetBurst(); } virtual ~ProcessSMTPRequest() { @@ -47,6 +47,7 @@ class ProcessSMTPRequest : public Task { Task * c; String from; std::vector<String> tos; + MailHandler * handler; }; static Regex single_dot("^\\.$"), dotted_line("^\\..+$"); @@ -158,7 +159,8 @@ int ProcessSMTPRequest::Do() { } } - // do something with out + if (handler) + handler->ProcessMail(out, from, tos); delete out; @@ -174,7 +176,7 @@ int ProcessSMTPRequest::Do() { } } -MailServer::MailServer(int _port, const String & _name) throw (GeneralException) : name(_name), localport(_port) { +MailServer::MailServer(MailHandler * _handler, int _port, const String & _name) throw (GeneralException) : name(_name), localport(_port), handler(_handler) { bool r; r = Listener.SetLocal("", localport); @@ -200,7 +202,7 @@ int MailServer::Do() throw (GeneralException) { try { Socket s = Listener.Accept(); s.SetNonBlock(); - new ProcessSMTPRequest(s); + new ProcessSMTPRequest(s, handler); } catch (GeneralException) { } |