From 617c03ede05ef1c6145bfaa36b3751d11fb5ba5e Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Thu, 30 Sep 2010 19:13:47 +0100
Subject: Show status in chat window when contact sends presence.


diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index dc15242..bb4bacd 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -118,20 +118,23 @@ String ChatController::senderDisplayNameFromMessage(const JID& from) {
 
 String ChatController::getStatusChangeString(boost::shared_ptr<Presence> presence) {
 	String nick = senderDisplayNameFromMessage(presence->getFrom());
+	String response = nick;
 	if (presence->getType() == Presence::Unavailable) {
-		return nick + " has gone offline.";
+		response += " has gone offline";
 	} else if (presence->getType() == Presence::Available) {
 		StatusShow::Type show = presence->getShow();
 		if (show == StatusShow::Online || show == StatusShow::FFC) {
-			return nick + " has become available.";
+			response += " has become available";
 		} else if (show == StatusShow::Away || show == StatusShow::XA) {
-			return nick + " has gone away.";
+			response += " has gone away";
 		} else if (show == StatusShow::DND) {
-			return nick + " is now busy.";
+			response += " is now busy";
 		} 
 	}
-
-	return "";
+	if (!presence->getStatus().isEmpty()) {
+		response += "(" + presence->getStatus() + ")";
+	}
+	return response + ".";
 }
 
 void ChatController::handlePresenceChange(boost::shared_ptr<Presence> newPresence) {
-- 
cgit v0.10.2-6-g49f6