diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-23 16:44:12 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-06-23 16:44:12 +0200 |
commit | 2ce8dcf40f22dd4e9cf4a6b1c8f5386993ebba6e (patch) | |
tree | a18576f6b4b01abcc1e632f17304a0f360db8b48 /examples/imapresource/imapresource.cpp | |
parent | 751f2c82c4121d28d0740bffb29a4fb273ec55c5 (diff) | |
download | sink-2ce8dcf40f22dd4e9cf4a6b1c8f5386993ebba6e.tar.gz sink-2ce8dcf40f22dd4e9cf4a6b1c8f5386993ebba6e.zip |
Use username instead of just user
Diffstat (limited to 'examples/imapresource/imapresource.cpp')
-rw-r--r-- | examples/imapresource/imapresource.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index a97f860..18747bf 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp | |||
@@ -294,6 +294,8 @@ public: | |||
294 | { | 294 | { |
295 | Log() << " Synchronizing"; | 295 | Log() << " Synchronizing"; |
296 | return KAsync::start<void>([this](KAsync::Future<void> future) { | 296 | return KAsync::start<void>([this](KAsync::Future<void> future) { |
297 | Trace() << "Connecting to:" << mServer << mPort; | ||
298 | Trace() << "as:" << mUser; | ||
297 | ImapServerProxy imap(mServer, mPort); | 299 | ImapServerProxy imap(mServer, mPort); |
298 | auto loginFuture = imap.login(mUser, mPassword).exec(); | 300 | auto loginFuture = imap.login(mUser, mPassword).exec(); |
299 | loginFuture.waitForFinished(); | 301 | loginFuture.waitForFinished(); |
@@ -542,8 +544,17 @@ ImapResource::ImapResource(const QByteArray &instanceIdentifier, const QSharedPo | |||
542 | auto config = ResourceConfig::getConfiguration(instanceIdentifier); | 544 | auto config = ResourceConfig::getConfiguration(instanceIdentifier); |
543 | mServer = config.value("server").toString(); | 545 | mServer = config.value("server").toString(); |
544 | mPort = config.value("port").toInt(); | 546 | mPort = config.value("port").toInt(); |
545 | mUser = config.value("user").toString(); | 547 | mUser = config.value("username").toString(); |
546 | mPassword = config.value("password").toString(); | 548 | mPassword = config.value("password").toString(); |
549 | if (mServer.startsWith("imap")) { | ||
550 | mServer.remove("imap://"); | ||
551 | mServer.remove("imaps://"); | ||
552 | } | ||
553 | if (mServer.contains(':')) { | ||
554 | auto list = mServer.split(':'); | ||
555 | mServer = list.at(0); | ||
556 | mPort = list.at(1).toInt(); | ||
557 | } | ||
547 | 558 | ||
548 | auto synchronizer = QSharedPointer<ImapSynchronizer>::create(PLUGIN_NAME, instanceIdentifier); | 559 | auto synchronizer = QSharedPointer<ImapSynchronizer>::create(PLUGIN_NAME, instanceIdentifier); |
549 | synchronizer->mServer = mServer; | 560 | synchronizer->mServer = mServer; |
@@ -603,6 +614,8 @@ KAsync::Job<void> ImapResource::inspect(int inspectionType, const QByteArray &in | |||
603 | scope.mode = KIMAP::FetchJob::FetchScope::Full; | 614 | scope.mode = KIMAP::FetchJob::FetchScope::Full; |
604 | auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort); | 615 | auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort); |
605 | auto messageByUid = QSharedPointer<QHash<qint64, Imap::Message>>::create(); | 616 | auto messageByUid = QSharedPointer<QHash<qint64, Imap::Message>>::create(); |
617 | Trace() << "Connecting to:" << mServer << mPort; | ||
618 | Trace() << "as:" << mUser; | ||
606 | auto inspectionJob = imap->login(mUser, mPassword) | 619 | auto inspectionJob = imap->login(mUser, mPassword) |
607 | .then<void>(imap->select(folderRemoteId)) | 620 | .then<void>(imap->select(folderRemoteId)) |
608 | .then<void>(imap->fetch(set, scope, [imap, messageByUid](const QVector<Imap::Message> &messages) { | 621 | .then<void>(imap->fetch(set, scope, [imap, messageByUid](const QVector<Imap::Message> &messages) { |