diff options
-rw-r--r-- | Swiften/Client/NickResolver.cpp | 6 | ||||
-rw-r--r-- | Swiften/Client/NickResolver.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/Swiften/Client/NickResolver.cpp b/Swiften/Client/NickResolver.cpp index 9bfe269..3e1ae8e 100644 --- a/Swiften/Client/NickResolver.cpp +++ b/Swiften/Client/NickResolver.cpp @@ -28,12 +28,18 @@ NickResolver::NickResolver(const JID& ownJID, XMPPRoster* xmppRoster, VCardManag } mucRegistry_ = mucRegistry; xmppRoster_->onJIDUpdated.connect(boost::bind(&NickResolver::handleJIDUpdated, this, _1, _2, _3)); + xmppRoster_->onJIDAdded.connect(boost::bind(&NickResolver::handleJIDAdded, this, _1)); } void NickResolver::handleJIDUpdated(const JID& jid, const String& previousNick, const std::vector<String>& /*groups*/) { onNickChanged(jid, previousNick); } +void NickResolver::handleJIDAdded(const JID& jid) { + String oldNick(jidToNick(jid)); + onNickChanged(jid, oldNick); +} + String NickResolver::jidToNick(const JID& jid) { if (jid.toBare() == ownJID_) { if (!ownNick_.isEmpty()) { diff --git a/Swiften/Client/NickResolver.h b/Swiften/Client/NickResolver.h index de7d64a..697409f 100644 --- a/Swiften/Client/NickResolver.h +++ b/Swiften/Client/NickResolver.h @@ -27,6 +27,7 @@ namespace Swift { private: void handleVCardReceived(const JID& jid, VCard::ref vCard); void handleJIDUpdated(const JID& jid, const String& previousNick, const std::vector<String>& groups); + void handleJIDAdded(const JID& jid); private: JID ownJID_; |