summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-10-01 09:27:01 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-10-01 09:27:01 (GMT)
commit1d7b76386202c7df168c088c6acde96718b05975 (patch)
tree0fb9e57d2ff1048181391a74110867091aefb72a /Swift/Controllers
parent7dadfb1d53a789e0b81adfd86aac3e38a9e658a9 (diff)
downloadswift-1d7b76386202c7df168c088c6acde96718b05975.zip
swift-1d7b76386202c7df168c088c6acde96718b05975.tar.bz2
Include contact's status when you start a chat with them.
Resolves: #580
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index bb4bacd..7fbf677 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -37,11 +37,19 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ
String nick = nickResolver_->jidToNick(toJID_);
chatWindow_->setName(nick);
String startMessage("Starting chat with " + nick);
+ Presence::ref theirPresence;
if (isInMUC) {
- startMessage += " in chatroom " + contact.toBare().toString() + ".";
+ startMessage += " in chatroom " + contact.toBare().toString();
+ theirPresence = presenceOracle->getLastPresence(contact);
} else {
- startMessage += " (" + contact.toBare().toString() + ").";
+ startMessage += " - " + contact.toBare().toString();
+ theirPresence = contact.isBare() ? presenceOracle->getHighestPriorityPresence(contact.toBare()) : presenceOracle->getLastPresence(contact);
}
+ startMessage += ": " + StatusShow::typeToFriendlyName(theirPresence ? theirPresence->getShow() : StatusShow::None);
+ if (theirPresence && !theirPresence->getStatus().isEmpty()) {
+ startMessage += " (" + theirPresence->getStatus() + ")";
+ }
+ startMessage += ".";
chatWindow_->addSystemMessage(startMessage);
chatWindow_->onUserTyping.connect(boost::bind(&ChatStateNotifier::setUserIsTyping, chatStateNotifier_));
chatWindow_->onUserCancelsTyping.connect(boost::bind(&ChatStateNotifier::userCancelledNewMessage, chatStateNotifier_));