diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2016-05-06 21:31:14 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2016-05-06 23:36:07 +0900 |
commit | 0b7bee1e2600ee80554aa85b18d30ca1964535a0 (patch) | |
tree | 775fc4bec459b4be217a7f448dae4a4b40edd8e6 /connectionprivate.cpp | |
parent | c1de050c143a79361e6b183bbfa84fc2fdaef959 (diff) | |
download | libquotient-0b7bee1e2600ee80554aa85b18d30ca1964535a0.tar.gz libquotient-0b7bee1e2600ee80554aa85b18d30ca1964535a0.zip |
Use lambda captures instead of throwing job pointers around
Diffstat (limited to 'connectionprivate.cpp')
-rw-r--r-- | connectionprivate.cpp | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/connectionprivate.cpp b/connectionprivate.cpp index 851e3d58..bcca8744 100644 --- a/connectionprivate.cpp +++ b/connectionprivate.cpp @@ -116,67 +116,67 @@ Room* ConnectionPrivate::provideRoom(QString id) return room; } -void ConnectionPrivate::connectDone(KJob* job) -{ - PasswordLogin* realJob = static_cast<PasswordLogin*>(job); - if( !realJob->error() ) - { - isConnected = true; - userId = realJob->id(); - qDebug() << "Our user ID: " << userId; - emit q->connected(); - } - else { - emit q->loginError( job->errorString() ); - } -} - -void ConnectionPrivate::reconnectDone(KJob* job) -{ - PasswordLogin* realJob = static_cast<PasswordLogin*>(job); - if( !realJob->error() ) - { - userId = realJob->id(); - emit q->reconnected(); - } - else { - emit q->loginError( job->errorString() ); - isConnected = false; - } -} - -void ConnectionPrivate::syncDone(KJob* job) -{ - SyncJob* syncJob = static_cast<SyncJob*>(job); - if( !syncJob->error() ) - { - data->setLastEvent(syncJob->nextBatch()); - processRooms(syncJob->roomData()); - emit q->syncDone(); - } - else { - if( syncJob->error() == BaseJob::NetworkError ) - emit q->connectionError( syncJob->errorString() ); - else - qDebug() << "syncJob failed, error:" << syncJob->error(); - } -} - -void ConnectionPrivate::gotJoinRoom(KJob* job) -{ - qDebug() << "gotJoinRoom"; - JoinRoomJob* joinJob = static_cast<JoinRoomJob*>(job); - if( !joinJob->error() ) - { - if ( Room* r = provideRoom(joinJob->roomId()) ) - emit q->joinedRoom(r); - } - else - { - if( joinJob->error() == BaseJob::NetworkError ) - emit q->connectionError( joinJob->errorString() ); - } -} +//void ConnectionPrivate::connectDone(KJob* job) +//{ +// PasswordLogin* realJob = static_cast<PasswordLogin*>(job); +// if( !realJob->error() ) +// { +// isConnected = true; +// userId = realJob->id(); +// qDebug() << "Our user ID: " << userId; +// emit q->connected(); +// } +// else { +// emit q->loginError( job->errorString() ); +// } +//} + +//void ConnectionPrivate::reconnectDone(KJob* job) +//{ +// PasswordLogin* realJob = static_cast<PasswordLogin*>(job); +// if( !realJob->error() ) +// { +// userId = realJob->id(); +// emit q->reconnected(); +// } +// else { +// emit q->loginError( job->errorString() ); +// isConnected = false; +// } +//} + +//void ConnectionPrivate::syncDone(KJob* job) +//{ +// SyncJob* syncJob = static_cast<SyncJob*>(job); +// if( !syncJob->error() ) +// { +// data->setLastEvent(syncJob->nextBatch()); +// processRooms(syncJob->roomData()); +// emit q->syncDone(); +// } +// else { +// if( syncJob->error() == BaseJob::NetworkError ) +// emit q->connectionError( syncJob->errorString() ); +// else +// qDebug() << "syncJob failed, error:" << syncJob->error(); +// } +//} + +//void ConnectionPrivate::gotJoinRoom(KJob* job) +//{ +// qDebug() << "gotJoinRoom"; +// JoinRoomJob* joinJob = static_cast<JoinRoomJob*>(job); +// if( !joinJob->error() ) +// { +// if ( Room* r = provideRoom(joinJob->roomId()) ) +// emit q->joinedRoom(r); +// } +// else +// { +// if( joinJob->error() == BaseJob::NetworkError ) +// emit q->connectionError( joinJob->errorString() ); +// } +//} void ConnectionPrivate::gotRoomMembers(KJob* job) { |