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
parentbfdf408bed69a279eb710de915e932764ceaed76 (diff)
downloadswift-22b51f8f82f6bd3186339b05943c1e19aa71050f.zip
swift-22b51f8f82f6bd3186339b05943c1e19aa71050f.tar.bz2
Autoaway.
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/MainController.cpp14
-rw-r--r--Swift/Controllers/MainController.h1
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_;