diff options
Diffstat (limited to 'Swift/Controllers')
-rw-r--r-- | Swift/Controllers/Chat/ChatController.cpp | 8 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatController.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index 4247109..ea21aa9 100644 --- a/Swift/Controllers/Chat/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp @@ -34,6 +34,7 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ presenceOracle_->onPresenceChange.connect(boost::bind(&ChatController::handlePresenceChange, this, _1)); chatStateTracker_->onChatStateChange.connect(boost::bind(&ChatWindow::setContactChatState, chatWindow_, _1)); stanzaChannel_->onStanzaAcked.connect(boost::bind(&ChatController::handleStanzaAcked, this, _1)); + nickResolver_->onNickChanged.connect(boost::bind(&ChatController::handleContactNickChanged, this, _1, _2)); String nick = nickResolver_->jidToNick(toJID_); chatWindow_->setName(nick); String startMessage("Starting chat with " + nick); @@ -57,7 +58,14 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ } +void ChatController::handleContactNickChanged(const JID& jid, const String& /*oldNick*/) { + if (jid.toBare() == toJID_.toBare()) { + chatWindow_->setName(nickResolver_->jidToNick(jid)); + } +} + ChatController::~ChatController() { + nickResolver_->onNickChanged.disconnect(boost::bind(&ChatController::handleContactNickChanged, this, _1, _2)); delete chatStateNotifier_; delete chatStateTracker_; } diff --git a/Swift/Controllers/Chat/ChatController.h b/Swift/Controllers/Chat/ChatController.h index d7a01c4..f9c686b 100644 --- a/Swift/Controllers/Chat/ChatController.h +++ b/Swift/Controllers/Chat/ChatController.h @@ -33,6 +33,7 @@ namespace Swift { virtual boost::optional<boost::posix_time::ptime> getMessageTimestamp(boost::shared_ptr<Message>) const; void handleStanzaAcked(boost::shared_ptr<Stanza> stanza); void dayTicked() {lastWasPresence_ = false;} + void handleContactNickChanged(const JID& jid, const String& /*oldNick*/); private: NickResolver* nickResolver_; |