MailTransport::ServerTest Class
class MailTransport::ServerTest| Header: | #include <MailTransport/ServerTest> |
| CMake: | find_package(KPim6MailTransport REQUIRED)target_link_libraries(mytarget PRIVATE KPim6::MailTransport) |
| Inherits: | QObject |
Public Types
| enum | Capability { Pipelining, Top, UIDL } |
Properties
- progressBar : QProgressBar*
- protocol : QString
- server : QString
Public Functions
| ServerTest(QObject *parent = nullptr) | |
| virtual | ~ServerTest() override |
| QList<MailTransport::ServerTest::Capability> | capabilities() const |
| QString | fakeHostname() const |
| bool | isNormalPossible() const |
| bool | isSecurePossible() const |
| QList<int> | normalProtocols() const |
| int | port(int encryptionMode) const |
| QProgressBar * | progressBar() const |
| QString | protocol() const |
| QList<int> | secureProtocols() const |
| QString | server() const |
| void | setFakeHostname(const QString &fakeHostname) |
| void | setPort(int encryptionMode, uint port) |
| void | setProgressBar(QProgressBar *pb) |
| void | setProtocol(const QString &protocol) |
| void | setServer(const QString &server) |
| void | start() |
| QList<int> | tlsProtocols() const |
Signals
| void | finished(const QList<int> &) |
Detailed Description
This class can be used to test certain server to see if they support stuff. Author: Tom Albers <tomalbers@kde.nl>
Member Type Documentation
enum ServerTest::Capability
This enumeration has the special capabilities a server might support. This covers only capabilities not related to authentication.
| Constant | Value | Description |
|---|---|---|
MailTransport::ServerTest::Pipelining | 0 | POP3 only. The server supports pipeplining of commands |
MailTransport::ServerTest::Top | 1 | POP3 only. The server supports fetching only the headers |
MailTransport::ServerTest::UIDL | 2 | POP3 only. The server has support for unique identifiers |
Property Documentation
progressBar : QProgressBar*
This property holds the progress bar used to show the test progress.
Access functions:
| QProgressBar * | progressBar() const |
| void | setProgressBar(QProgressBar *pb) |
protocol : QString
This property holds the protocol to test.
Access functions:
| QString | protocol() const |
| void | setProtocol(const QString &protocol) |
server : QString
This property holds the server to test.
Access functions:
Member Function Documentation
[explicit] ServerTest::ServerTest(QObject *parent = nullptr)
Creates a new server test.
parent The parent widget.
[override virtual noexcept] ServerTest::~ServerTest()
Destroys the server test.
QList<MailTransport::ServerTest::Capability> ServerTest::capabilities() const
Get the special capabilities of the server. Call this only after the finished() signals has been sent.
Returns the list of special capabilities of the server.
QString ServerTest::fakeHostname() const
Returns the fake hostname, as set before with setFakeHostname
See also setFakeHostname().
[signal] void ServerTest::finished(const QList<int> &)
This will be emitted when the test is done. It will contain the values from the enum EnumEncryption which are possible.
bool ServerTest::isNormalPossible() const
Returns true if the normal server is available.
bool ServerTest::isSecurePossible() const
Returns true if the ssl server is available.
QList<int> ServerTest::normalProtocols() const
Get the protocols for the normal connections.. Call this only after the finished() signals has been sent. Returns an enum of the type Transport::EnumAuthenticationType
int ServerTest::port(int encryptionMode) const
encryptionMode the port of this encryption mode is returned. Can only be 'None' and 'SSL'
Returns the port set by setPort or -1 if setPort() was never called for this encryption mode.
See also setPort().
QProgressBar *ServerTest::progressBar() const
Returns the used progress bar.
Note: Getter function for property progressBar.
See also setProgressBar().
QString ServerTest::protocol() const
Returns the protocol.
Note: Getter function for property protocol.
See also setProtocol().
QList<int> ServerTest::secureProtocols() const
Get the protocols for the SSL connections. Call this only after the finished() signals has been sent. Returns an enum of the type Transport::EnumAuthenticationType
QString ServerTest::server() const
Returns the server to test.
Note: Getter function for property server.
See also setServer().
void ServerTest::setFakeHostname(const QString &fakeHostname)
Sets a fake hostname for the test. This is currently only used when testing a SMTP server; there, the command for testing the capabilities (called EHLO) needs to have the hostname of the client included. The user can however choose to send a fake hostname instead of the local hostname to work around various problems. This fake hostname needs to be set here.
fakeHostname the fake hostname to send
See also fakeHostname().
void ServerTest::setPort(int encryptionMode, uint port)
Set a custom port to use.
Each encryption mode (no encryption or SSL) has a different port. TLS uses the same port as no encryption, because TLS is invoked during a normal session.
If this function is never called, the default port is used, which is: (normal first, then SSL) SMTP: 587 (falls back to 25), 465 POP: 110, 995 IMAP: 143, 993 NNTP: 119, 563
encryptionMode the port will only be used in this encryption mode. Valid values for this are only 'None' and 'SSL'. port the port to use
See also port().
void ServerTest::setProgressBar(QProgressBar *pb)
Makes pb the progressbar to use. This class will call show() and hide() and will count down. It does not take ownership of the progressbar.
Note: Setter function for property progressBar.
See also progressBar().
void ServerTest::setProtocol(const QString &protocol)
Sets protocol the protocol to test, currently supported are "smtp", "pop", "imap", and "nntp".
Note: Setter function for property protocol.
See also protocol().
void ServerTest::setServer(const QString &server)
Sets the server to test.
Note: Setter function for property server.
See also server().
void ServerTest::start()
Starts the test. Will emit finished() when done.
QList<int> ServerTest::tlsProtocols() const
Get the protocols for the TLS connections. Call this only after the finished() signals has been sent. Returns an enum of the type Transport::EnumAuthenticationType