diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-05-24 16:30:34 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-05-24 16:30:34 (GMT) |
commit | c6da39affbcc0057524b40155e16da34c81190e6 (patch) | |
tree | 72a9c44cd82169cce9630815ab93556649e99e60 /Swift | |
parent | 3a0803936a07163013082f77200f6fde1152bc5d (diff) | |
download | swift-contrib-c6da39affbcc0057524b40155e16da34c81190e6.zip swift-contrib-c6da39affbcc0057524b40155e16da34c81190e6.tar.bz2 |
Only send autoaway when you're online, and don't change the message.
Resolves: #360
Resolves: #366
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/MainController.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index 591ccda..b0a8fda 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -281,21 +281,24 @@ void MainController::sendPresence(boost::shared_ptr<Presence> presence) { } void MainController::handleInputIdleChanged(bool idle) { - if (!client_ || !client_->isAvailable()) { - return; - } if (idle) { + if (lastSentPresence_->getShow() != StatusShow::Online) { + return; + } preIdlePresence_ = lastSentPresence_; boost::shared_ptr<Presence> presence(new Presence()); presence->setShow(StatusShow::Away); - presence->setStatus("Auto-away"); - sendPresence(presence); + presence->setStatus(lastSentPresence_->getStatus()); + if (client_ && client_->isAvailable()) { + sendPresence(presence); + } else { + queuedPresence_ = presence; + } } else { - if (client_) { + if (client_ && client_->isAvailable()) { sendPresence(preIdlePresence_); - } - else { + } else { queuedPresence_ = preIdlePresence_; } } |