diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-12-12 16:49:18 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-12-12 16:49:18 (GMT) |
commit | e90e08301a03a4ad562a35e60927815d43daebec (patch) | |
tree | 3bfeec305b49c7366586d75cb17c77beac01db14 /Swiften/Client | |
parent | 4315ccbd51f63e408d69d944f162d0ead4f9addd (diff) | |
download | swift-contrib-e90e08301a03a4ad562a35e60927815d43daebec.zip swift-contrib-e90e08301a03a4ad562a35e60927815d43daebec.tar.bz2 |
Removing nickname change functionality from roster header.
Diffstat (limited to 'Swiften/Client')
-rw-r--r-- | Swiften/Client/NickManagerImpl.cpp | 9 | ||||
-rw-r--r-- | Swiften/Client/NickManagerImpl.h | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/Swiften/Client/NickManagerImpl.cpp b/Swiften/Client/NickManagerImpl.cpp index 09f8de5..fd37222 100644 --- a/Swiften/Client/NickManagerImpl.cpp +++ b/Swiften/Client/NickManagerImpl.cpp @@ -14,6 +14,8 @@ namespace Swift { NickManagerImpl::NickManagerImpl(const JID& ownJID, VCardManager* vcardManager) : ownJID(ownJID), vcardManager(vcardManager) { vcardManager->onVCardChanged.connect(boost::bind(&NickManagerImpl::handleVCardReceived, this, _1, _2)); + + updateOwnNickFromVCard(vcardManager->getVCard(ownJID.toBare())); } NickManagerImpl::~NickManagerImpl() { @@ -21,7 +23,7 @@ NickManagerImpl::~NickManagerImpl() { } String NickManagerImpl::getOwnNick() const { - return ownJID; + return ownNick; } void NickManagerImpl::setOwnNick(const String&) { @@ -31,9 +33,12 @@ void NickManagerImpl::handleVCardReceived(const JID& jid, VCard::ref vcard) { if (!jid.equals(ownJID, JID::WithoutResource)) { return; } + updateOwnNickFromVCard(vcard); +} +void NickManagerImpl::updateOwnNickFromVCard(VCard::ref vcard) { String nick; - if (!vcard->getNickname().isEmpty()) { + if (vcard && !vcard->getNickname().isEmpty()) { nick = vcard->getNickname(); } if (ownNick != nick) { diff --git a/Swiften/Client/NickManagerImpl.h b/Swiften/Client/NickManagerImpl.h index 87c9711..8796dbe 100644 --- a/Swiften/Client/NickManagerImpl.h +++ b/Swiften/Client/NickManagerImpl.h @@ -24,6 +24,7 @@ namespace Swift { private: void handleVCardReceived(const JID& jid, VCard::ref vCard); + void updateOwnNickFromVCard(VCard::ref vcard); private: JID ownJID; |