diff options
Diffstat (limited to 'examples/imapresource/imapresource.cpp')
-rw-r--r-- | examples/imapresource/imapresource.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index 3ae7fd7..2aba6b0 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp | |||
@@ -470,7 +470,7 @@ public: | |||
470 | { | 470 | { |
471 | SinkTrace() << "Connecting to:" << mServer << mPort; | 471 | SinkTrace() << "Connecting to:" << mServer << mPort; |
472 | SinkTrace() << "as:" << mUser; | 472 | SinkTrace() << "as:" << mUser; |
473 | return imap->login(mUser, mPassword) | 473 | return imap->login(mUser, secret()) |
474 | .addToContext(imap); | 474 | .addToContext(imap); |
475 | } | 475 | } |
476 | 476 | ||
@@ -513,6 +513,8 @@ public: | |||
513 | return {ApplicationDomain::NoServerError, error.errorMessage}; | 513 | return {ApplicationDomain::NoServerError, error.errorMessage}; |
514 | case Imap::ConnectionLost: | 514 | case Imap::ConnectionLost: |
515 | return {ApplicationDomain::ConnectionLostError, error.errorMessage}; | 515 | return {ApplicationDomain::ConnectionLostError, error.errorMessage}; |
516 | case Imap::MissingCredentialsError: | ||
517 | return {ApplicationDomain::MissingCredentialsError, error.errorMessage}; | ||
516 | default: | 518 | default: |
517 | return {ApplicationDomain::UnknownError, error.errorMessage}; | 519 | return {ApplicationDomain::UnknownError, error.errorMessage}; |
518 | } | 520 | } |
@@ -631,7 +633,7 @@ public: | |||
631 | } | 633 | } |
632 | } | 634 | } |
633 | auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort, &mSessionCache); | 635 | auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort, &mSessionCache); |
634 | auto login = imap->login(mUser, mPassword); | 636 | auto login = imap->login(mUser, secret()); |
635 | KAsync::Job<QByteArray> job = KAsync::null<QByteArray>(); | 637 | KAsync::Job<QByteArray> job = KAsync::null<QByteArray>(); |
636 | if (operation == Sink::Operation_Creation) { | 638 | if (operation == Sink::Operation_Creation) { |
637 | const QString mailbox = syncStore().resolveLocalId(ENTITY_TYPE_FOLDER, mail.getFolder()); | 639 | const QString mailbox = syncStore().resolveLocalId(ENTITY_TYPE_FOLDER, mail.getFolder()); |
@@ -716,7 +718,7 @@ public: | |||
716 | } | 718 | } |
717 | } | 719 | } |
718 | auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort, &mSessionCache); | 720 | auto imap = QSharedPointer<ImapServerProxy>::create(mServer, mPort, &mSessionCache); |
719 | auto login = imap->login(mUser, mPassword); | 721 | auto login = imap->login(mUser, secret()); |
720 | if (operation == Sink::Operation_Creation) { | 722 | if (operation == Sink::Operation_Creation) { |
721 | QString parentFolder; | 723 | QString parentFolder; |
722 | if (!folder.getParent().isEmpty()) { | 724 | if (!folder.getParent().isEmpty()) { |
@@ -736,7 +738,7 @@ public: | |||
736 | }); | 738 | }); |
737 | } else { //We try to merge special purpose folders first | 739 | } else { //We try to merge special purpose folders first |
738 | auto specialPurposeFolders = QSharedPointer<QHash<QByteArray, QString>>::create(); | 740 | auto specialPurposeFolders = QSharedPointer<QHash<QByteArray, QString>>::create(); |
739 | auto mergeJob = imap->login(mUser, mPassword) | 741 | auto mergeJob = imap->login(mUser, secret()) |
740 | .then(imap->fetchFolders([=](const Imap::Folder &folder) { | 742 | .then(imap->fetchFolders([=](const Imap::Folder &folder) { |
741 | if (SpecialPurpose::isSpecialPurposeFolderName(folder.name())) { | 743 | if (SpecialPurpose::isSpecialPurposeFolderName(folder.name())) { |
742 | specialPurposeFolders->insert(SpecialPurpose::getSpecialPurposeType(folder.name()), folder.path()); | 744 | specialPurposeFolders->insert(SpecialPurpose::getSpecialPurposeType(folder.name()), folder.path()); |
@@ -790,7 +792,6 @@ public: | |||
790 | QString mServer; | 792 | QString mServer; |
791 | int mPort; | 793 | int mPort; |
792 | QString mUser; | 794 | QString mUser; |
793 | QString mPassword; | ||
794 | int mDaysToSync = 0; | 795 | int mDaysToSync = 0; |
795 | QByteArray mResourceInstanceIdentifier; | 796 | QByteArray mResourceInstanceIdentifier; |
796 | Imap::SessionCache mSessionCache; | 797 | Imap::SessionCache mSessionCache; |
@@ -959,7 +960,6 @@ ImapResource::ImapResource(const ResourceContext &resourceContext) | |||
959 | auto server = config.value("server").toString(); | 960 | auto server = config.value("server").toString(); |
960 | auto port = config.value("port").toInt(); | 961 | auto port = config.value("port").toInt(); |
961 | auto user = config.value("username").toString(); | 962 | auto user = config.value("username").toString(); |
962 | auto password = config.value("password").toString(); | ||
963 | if (server.startsWith("imap")) { | 963 | if (server.startsWith("imap")) { |
964 | server.remove("imap://"); | 964 | server.remove("imap://"); |
965 | server.remove("imaps://"); | 965 | server.remove("imaps://"); |
@@ -974,7 +974,6 @@ ImapResource::ImapResource(const ResourceContext &resourceContext) | |||
974 | synchronizer->mServer = server; | 974 | synchronizer->mServer = server; |
975 | synchronizer->mPort = port; | 975 | synchronizer->mPort = port; |
976 | synchronizer->mUser = user; | 976 | synchronizer->mUser = user; |
977 | synchronizer->mPassword = password; | ||
978 | synchronizer->mDaysToSync = 14; | 977 | synchronizer->mDaysToSync = 14; |
979 | setupSynchronizer(synchronizer); | 978 | setupSynchronizer(synchronizer); |
980 | 979 | ||
@@ -982,7 +981,8 @@ ImapResource::ImapResource(const ResourceContext &resourceContext) | |||
982 | inspector->mServer = server; | 981 | inspector->mServer = server; |
983 | inspector->mPort = port; | 982 | inspector->mPort = port; |
984 | inspector->mUser = user; | 983 | inspector->mUser = user; |
985 | inspector->mPassword = password; | 984 | //TODO |
985 | // inspector->mPassword = password; | ||
986 | setupInspector(inspector); | 986 | setupInspector(inspector); |
987 | 987 | ||
988 | setupPreprocessors(ENTITY_TYPE_MAIL, QVector<Sink::Preprocessor*>() << new SpecialPurposeProcessor << new MailPropertyExtractor); | 988 | setupPreprocessors(ENTITY_TYPE_MAIL, QVector<Sink::Preprocessor*>() << new SpecialPurposeProcessor << new MailPropertyExtractor); |