summaryrefslogtreecommitdiff
path: root/fbdaemon
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsys.com>2013-02-22 11:14:53 (GMT)
committerChristian Mollekopf <mollekopf@kolabsys.com>2013-02-22 11:14:53 (GMT)
commit7582e0c8ceb3014bad95ad6ae9cbab69caecb27f (patch)
treee12983e410507d9d147f62828b8d0679d6a10bad /fbdaemon
parent628b52adcf64a9c785c6c84599b38c6af8dab3eb (diff)
downloadkolab-utils-7582e0c8ceb3014bad95ad6ae9cbab69caecb27f.tar.gz
Abort if authentication fails.
Diffstat (limited to 'fbdaemon')
-rw-r--r--fbdaemon/authenticationjob.cpp6
-rw-r--r--fbdaemon/fbcoordinator.cpp13
-rw-r--r--fbdaemon/fbcoordinator.h1
3 files changed, 15 insertions, 5 deletions
diff --git a/fbdaemon/authenticationjob.cpp b/fbdaemon/authenticationjob.cpp
index 1bffc61..39368d4 100644
--- a/fbdaemon/authenticationjob.cpp
+++ b/fbdaemon/authenticationjob.cpp
@@ -55,14 +55,16 @@ void AuthenticationJob::start()
void AuthenticationJob::onLoginDone(KJob* job)
{
if ( job->error() ) {
- Warning() << "Failed to login: " << job->errorString();
setError(KJob::UserDefinedError);
+ setErrorText("Failed to login: " + job->errorString());
+ Warning() << errorString();
emitResult();
return;
}
if ((static_cast<KIMAP::LoginJob*>(job))->encryptionMode() != mRequestedMode) {
- Warning() << "Failed to get requested encryption mode";
setError(KJob::UserDefinedError);
+ setErrorText("Failed to get requested encryption mode");
+ Warning() << errorString();
emitResult();
return;
}
diff --git a/fbdaemon/fbcoordinator.cpp b/fbdaemon/fbcoordinator.cpp
index b236a02..2da2bfa 100644
--- a/fbdaemon/fbcoordinator.cpp
+++ b/fbdaemon/fbcoordinator.cpp
@@ -57,7 +57,6 @@ void FBCoordinator::generateForAllUsers(const QString &filter)
settings.userName = Settings::instance().getAuthorizationUser(); //Login as admin
settings.host = Settings::instance().getServerUri(settings.port);
SequentialCompositeJob *sequentialJob = new SequentialCompositeJob(true, this);
- //TODO test if that still works
KIMAP::Session *mSession = new KIMAP::Session( settings.host, settings.port, this );
mSession->setUiProxy( KIMAP::SessionUiProxy::Ptr(new UiProxy()) );
// QObject::connect( mSession, SIGNAL(stateChanged(KIMAP::Session::State,KIMAP::Session::State)),
@@ -70,15 +69,23 @@ void FBCoordinator::generateForAllUsers(const QString &filter)
GetUserListJob *getUsersJob = new GetUserListJob(mSession, this);
getUsersJob->setFilterDomain(filter);
sequentialJob->addSubjob(getUsersJob);
- //FIXME use sequentialJob result (abort in case of failure)
connect(getUsersJob, SIGNAL(result(KJob*)), this, SLOT(onGotUserList(KJob*)));
KIMAP::LogoutJob *logoutjob = new KIMAP::LogoutJob(mSession);
sequentialJob->addSubjob(logoutjob);
-
+
+ connect(sequentialJob, SIGNAL(result(KJob*)), this, SLOT(onGenerateAllResult(KJob*)));
sequentialJob->start();
}
+void FBCoordinator::onGenerateAllResult(KJob *job)
+{
+ if (job->error()) {
+ Warning() << "Error while generating for all users: " << job->errorString();
+ continueProcessing();
+ }
+}
+
void FBCoordinator::onGotUserList(KJob *job)
{
GetUserListJob *getUsersJob = static_cast<GetUserListJob*>(job);
diff --git a/fbdaemon/fbcoordinator.h b/fbdaemon/fbcoordinator.h
index a2bc611..14e45a6 100644
--- a/fbdaemon/fbcoordinator.h
+++ b/fbdaemon/fbcoordinator.h
@@ -56,6 +56,7 @@ signals:
void quit();
private slots:
void onGeneratorDone(KJob*);
+ void onGenerateAllResult(KJob*);
public slots:
void onGotUserList(KJob*);
private: