-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPMaildServer.cpp
More file actions
43 lines (37 loc) · 945 Bytes
/
PMaildServer.cpp
File metadata and controls
43 lines (37 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "PMaildServer.hpp"
#include "PMaildServerSmtp.hpp"
#include "PMaildServerImap4.hpp"
#include "PMaildServerPop3.hpp"
#include "PMaildCore.hpp"
#include <QSslSocket>
PMaildServer::PMaildServer(PMaildCore *_core, PMaildServerType _type, bool _auto_ssl) {
core = _core;
type = _type;
auto_ssl = _auto_ssl;
connect(core, SIGNAL(destroyed(QObject*)), this, SLOT(deleteLater()));
}
void PMaildServer::incomingConnection(int socketDescriptor) {
QSslSocket *sock = new QSslSocket(this);
sock->setSocketDescriptor(socketDescriptor);
PMaildServerBase *i;
switch(type) {
case SERVER_SMTP:
i = new PMaildServerSmtp(sock, core, this);
break;
case SERVER_IMAP4:
i = new PMaildServerImap4(sock, core, this);
break;
case SERVER_POP3:
i = new PMaildServerPop3(sock, core, this);
break;
default:
sock->disconnect();
sock->deleteLater();
return;
}
if (auto_ssl) {
i->ssl();
} else {
i->noSsl();
}
}