summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Client/NickManagerImpl.cpp')
-rw-r--r--Swiften/Client/NickManagerImpl.cpp9
1 files changed, 7 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) {