Changeset View
Changeset View
Standalone View
Standalone View
src/session.cpp
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | 74 | { | |||
---|---|---|---|---|---|
75 | for (const QByteArray &method : authMethods) { | 75 | for (const QByteArray &method : authMethods) { | ||
76 | QString m = QString::fromLatin1(method); | 76 | QString m = QString::fromLatin1(method); | ||
77 | if (!m_authModes.contains(m)) { | 77 | if (!m_authModes.contains(m)) { | ||
78 | m_authModes.append(m); | 78 | m_authModes.append(m); | ||
79 | } | 79 | } | ||
80 | } | 80 | } | ||
81 | } | 81 | } | ||
82 | 82 | | |||
83 | void SessionPrivate::startHandshake() | ||||
84 | { | ||||
85 | QByteArray cmd; | ||||
86 | if (!m_ehloRejected) { | ||||
87 | cmd = "EHLO "; | ||||
88 | } else { | ||||
89 | cmd = "HELO "; | ||||
90 | } | ||||
91 | setState(Session::Handshake); | ||||
92 | const auto hostname = m_customHostname.isEmpty() ? m_thread->hostName() : m_customHostname; | ||||
93 | sendData(cmd + QUrl::toAce(hostname)); | ||||
94 | } | ||||
95 | | ||||
83 | 96 | | |||
84 | 97 | | |||
85 | Session::Session(const QString &hostName, quint16 port, QObject *parent) | 98 | Session::Session(const QString &hostName, quint16 port, QObject *parent) | ||
86 | : QObject(parent), | 99 | : QObject(parent), | ||
87 | d(new SessionPrivate(this)) | 100 | d(new SessionPrivate(this)) | ||
88 | 101 | | |||
89 | { | 102 | { | ||
90 | qRegisterMetaType<ServerResponse>("ServerResponse"); | 103 | qRegisterMetaType<ServerResponse>("ServerResponse"); | ||
▲ Show 20 Lines • Show All 181 Lines • ▼ Show 20 Line(s) | 284 | if (!r.isMultiline()) { | |||
272 | setState(Session::NotAuthenticated); | 285 | setState(Session::NotAuthenticated); | ||
273 | startNext(); | 286 | startNext(); | ||
274 | } | 287 | } | ||
275 | } | 288 | } | ||
276 | } | 289 | } | ||
277 | 290 | | |||
278 | if (m_state == Session::Ready) { | 291 | if (m_state == Session::Ready) { | ||
279 | if (r.isCode(22) || m_ehloRejected) { | 292 | if (r.isCode(22) || m_ehloRejected) { | ||
280 | QByteArray cmd; | 293 | startHandshake(); | ||
281 | if (!m_ehloRejected) { | | |||
282 | cmd = "EHLO "; | | |||
283 | } else { | | |||
284 | cmd = "HELO "; | | |||
285 | } | | |||
286 | setState(Session::Handshake); | | |||
287 | const auto hostname = m_customHostname.isEmpty() ? m_thread->hostName() : m_customHostname; | | |||
288 | sendData(cmd + QUrl::toAce(hostname)); | | |||
289 | return; | 294 | return; | ||
290 | } | 295 | } | ||
291 | } | 296 | } | ||
292 | 297 | | |||
293 | if (m_currentJob) { | 298 | if (m_currentJob) { | ||
294 | m_currentJob->handleResponse(r); | 299 | m_currentJob->handleResponse(r); | ||
295 | } | 300 | } | ||
296 | } | 301 | } | ||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | |||||
341 | 346 | | |||
342 | KTcpSocket::SslVersion SessionPrivate::negotiatedEncryption() const | 347 | KTcpSocket::SslVersion SessionPrivate::negotiatedEncryption() const | ||
343 | { | 348 | { | ||
344 | return m_sslVersion; | 349 | return m_sslVersion; | ||
345 | } | 350 | } | ||
346 | 351 | | |||
347 | void SessionPrivate::encryptionNegotiationResult(bool encrypted, KTcpSocket::SslVersion version) | 352 | void SessionPrivate::encryptionNegotiationResult(bool encrypted, KTcpSocket::SslVersion version) | ||
348 | { | 353 | { | ||
349 | Q_UNUSED(encrypted); | 354 | if (encrypted) { | ||
355 | // Get the updated auth methods | ||||
356 | startHandshake(); | ||||
357 | } | ||||
358 | | ||||
350 | m_sslVersion = version; | 359 | m_sslVersion = version; | ||
351 | } | 360 | } | ||
352 | 361 | | |||
353 | void SessionPrivate::addJob(Job *job) | 362 | void SessionPrivate::addJob(Job *job) | ||
354 | { | 363 | { | ||
355 | m_queue.append(job); | 364 | m_queue.append(job); | ||
356 | //Q_EMIT q->jobQueueSizeChanged( q->jobQueueSize() ); | 365 | //Q_EMIT q->jobQueueSizeChanged( q->jobQueueSize() ); | ||
357 | 366 | | |||
▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines |