summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2009-10-25 17:20:54 (GMT)
committerKevin Smith <git@kismith.co.uk>2009-10-25 17:20:54 (GMT)
commit22b51f8f82f6bd3186339b05943c1e19aa71050f (patch)
tree65f5444a7e6213ae4caa58b03b9ab974e9dc10d4 /Swift/Controllers/MainController.cpp
parentbfdf408bed69a279eb710de915e932764ceaed76 (diff)
downloadswift-22b51f8f82f6bd3186339b05943c1e19aa71050f.zip
swift-22b51f8f82f6bd3186339b05943c1e19aa71050f.tar.bz2
Autoaway.
Diffstat (limited to 'Swift/Controllers/MainController.cpp')
-rw-r--r--Swift/Controllers/MainController.cpp14
1 files changed, 11 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) {