Merge "Make quick search focusing shortcut configurable"
[trojita.git] / src / MSA / SMTP.h
blob453407d3829a0ed1f62949bb47a14daa58087e0e
1 /* Copyright (C) 2006 - 2014 Jan Kundrát <jkt@flaska.net>
3 This file is part of the Trojita Qt IMAP e-mail client,
4 http://trojita.flaska.net/
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2 of
9 the License or (at your option) version 3 or any later version
10 accepted by the membership of KDE e.V. (or its successor approved
11 by the membership of KDE e.V.), which shall act as a proxy
12 defined in Section 14 of version 3 of the license.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef SMTP_H
23 #define SMTP_H
25 #include "AbstractMSA.h"
26 #include "qwwsmtpclient/qwwsmtpclient.h"
28 namespace MSA
31 class SMTP : public AbstractMSA
33 Q_OBJECT
34 public:
35 SMTP(QObject *parent, const QString &host, quint16 port, bool encryptedConnect, bool startTls, bool auth,
36 const QString &user);
37 virtual void sendMail(const QByteArray &from, const QList<QByteArray> &to, const QByteArray &data);
39 virtual bool supportsBurl() const;
40 virtual void sendBurl(const QByteArray &from, const QList<QByteArray> &to, const QByteArray &imapUrl);
41 public slots:
42 virtual void cancel();
43 virtual void setPassword(const QString &password);
44 void handleDone(bool ok);
45 void handleError(QAbstractSocket::SocketError err, const QString &msg);
46 private:
47 QwwSmtpClient *qwwSmtp;
48 QString host;
49 quint16 port;
50 bool encryptedConnect;
51 bool startTls;
52 bool auth;
53 QString user;
54 QString pass;
55 bool failed;
56 QByteArray from;
57 QList<QByteArray> to;
58 QByteArray data;
59 bool isWaitingForPassword;
60 enum { MODE_SMTP_INVALID, MODE_SMTP_DATA, MODE_SMTP_BURL } sendingMode;
62 void sendContinueGotPassword();
64 SMTP(const SMTP &); // don't implement
65 SMTP &operator=(const SMTP &); // don't implement
68 class SMTPFactory: public MSAFactory
70 public:
71 SMTPFactory(const QString &host, quint16 port, bool encryptedConnect, bool startTls, bool auth,
72 const QString &user);
73 virtual ~SMTPFactory();
74 virtual AbstractMSA *create(QObject *parent) const;
75 private:
76 QString m_host;
77 quint16 m_port;
78 bool m_encryptedConnect;
79 bool m_startTls;
80 bool m_auth;
81 QString m_user;
86 #endif // SMTP_H