From c6da39affbcc0057524b40155e16da34c81190e6 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Mon, 24 May 2010 17:30:34 +0100
Subject: Only send autoaway when you're online, and don't change the message.

Resolves: #360
Resolves: #366

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_;
 		}
 	}
-- 
cgit v0.10.2-6-g49f6