summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-12-15 19:39:17 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-12-15 19:40:08 (GMT)
commita04c157e156061a08bb6dec573eb05f1b6e15b9e (patch)
treeba38dea14c63e411d638bfc550a19fe2a9bed371 /Swiften/Client
parent4db2d2d64a44de948c183d8379689fa7b74f59c9 (diff)
downloadswift-contrib-a04c157e156061a08bb6dec573eb05f1b6e15b9e.zip
swift-contrib-a04c157e156061a08bb6dec573eb05f1b6e15b9e.tar.bz2
Emit nickname change signal when adding to the roster.
So open chat windows should change their title if you're talking to a contact not in your roster, and then add them. Resolves: #704
Diffstat (limited to 'Swiften/Client')
-rw-r--r--Swiften/Client/NickResolver.cpp6
-rw-r--r--Swiften/Client/NickResolver.h1
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_;