summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-05-24 16:30:34 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-05-24 16:30:34 (GMT)
commitc6da39affbcc0057524b40155e16da34c81190e6 (patch)
tree72a9c44cd82169cce9630815ab93556649e99e60 /Swift/Controllers
parent3a0803936a07163013082f77200f6fde1152bc5d (diff)
downloadswift-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/Controllers')
-rw-r--r--Swift/Controllers/MainController.cpp19
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_;
}
}