diff options
Diffstat (limited to 'Swift/Controllers')
-rw-r--r-- | Swift/Controllers/MainController.cpp | 14 | ||||
-rw-r--r-- | Swift/Controllers/MainController.h | 1 |
2 files changed, 12 insertions, 3 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index 5495ec0..15947b6 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -185,7 +185,6 @@ void MainController::handleEventQueueLengthChange(int count) { void MainController::handleChangeStatusRequest(StatusShow::Type show, const String &statusText) { boost::shared_ptr<Presence> presence(new Presence()); - presence->addPayload(capsInfo_); if (show == StatusShow::None) { // FIXME: This is wrong. None doesn't mean unavailable presence->setType(Presence::Unavailable); @@ -206,6 +205,7 @@ void MainController::sendPresence(boost::shared_ptr<Presence> presence) { if (!vCardPhotoHash_.isEmpty()) { presence->addPayload(boost::shared_ptr<VCardUpdate>(new VCardUpdate(vCardPhotoHash_))); } + presence->addPayload(capsInfo_); lastSentPresence_ = presence; client_->sendPresence(presence); if (presence->getType() == Presence::Unavailable) { @@ -214,11 +214,19 @@ void MainController::sendPresence(boost::shared_ptr<Presence> presence) { } void MainController::handleInputIdle() { - + preIdlePresence_ = lastSentPresence_; + boost::shared_ptr<Presence> presence(new Presence()); + presence->setShow(StatusShow::Away); + presence->setStatus("Auto-away"); + sendPresence(presence); } void MainController::handleInputNotIdle() { - + if (client_) { + sendPresence(preIdlePresence_); + } else { + queuedPresence_ = preIdlePresence_; + } } void MainController::handleIncomingPresence(boost::shared_ptr<Presence> presence) { diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h index 5cdd9fa..3179df9 100644 --- a/Swift/Controllers/MainController.h +++ b/Swift/Controllers/MainController.h @@ -106,6 +106,7 @@ namespace Swift { SoundEventController* soundEventController_; AvatarManager* avatarManager_; boost::shared_ptr<Presence> lastSentPresence_; + boost::shared_ptr<Presence> preIdlePresence_; String vCardPhotoHash_; boost::shared_ptr<Presence> queuedPresence_; String password_; |