diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-09-30 18:13:47 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-09-30 18:13:47 (GMT) |
commit | 617c03ede05ef1c6145bfaa36b3751d11fb5ba5e (patch) | |
tree | afc32cab49395977a4700add8c523f5bcd39aced /Swift/Controllers/Chat | |
parent | 245185ca3133fd496b90c5c9973713e8aa02f0ef (diff) | |
download | swift-617c03ede05ef1c6145bfaa36b3751d11fb5ba5e.zip swift-617c03ede05ef1c6145bfaa36b3751d11fb5ba5e.tar.bz2 |
Show status in chat window when contact sends presence.
Diffstat (limited to 'Swift/Controllers/Chat')
-rw-r--r-- | Swift/Controllers/Chat/ChatController.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
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) { |