summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/NickResolver.cpp3
-rw-r--r--Swift/Controllers/RosterController.cpp12
2 files changed, 5 insertions, 10 deletions
diff --git a/Swift/Controllers/NickResolver.cpp b/Swift/Controllers/NickResolver.cpp
index c271a31..ed2c8df 100644
--- a/Swift/Controllers/NickResolver.cpp
+++ b/Swift/Controllers/NickResolver.cpp
@@ -29,9 +29,10 @@ String NickResolver::jidToNick(const JID& jid) {
return jid.getResource();
}
- if (xmppRoster_->containsJID(jid) && xmppRoster_->getNameForJID(jid) != "") {
+ if (xmppRoster_->containsJID(jid) && !xmppRoster_->getNameForJID(jid).isEmpty()) {
return xmppRoster_->getNameForJID(jid);
}
+
std::map<JID, String>::const_iterator it = map_.find(jid);
return (it == map_.end()) ? jid.toBare() : it->second;
}
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp
index d8897e9..191d5fb 100644
--- a/Swift/Controllers/RosterController.cpp
+++ b/Swift/Controllers/RosterController.cpp
@@ -101,10 +101,7 @@ void RosterController::handleChangeStatusRequest(StatusShow::Type show, const St
void RosterController::handleOnJIDAdded(const JID& jid) {
std::vector<String> groups = xmppRoster_->getGroupsForJID(jid);
- String name = xmppRoster_->getNameForJID(jid);
- if (name.isEmpty()) {
- name = jid.toString();
- }
+ String name = nickResolver_->jidToNick(jid);
if (!groups.empty()) {
foreach(const String& group, groups) {
roster_->addContact(jid, name, group);
@@ -120,15 +117,12 @@ void RosterController::handleOnJIDRemoved(const JID& jid) {
void RosterController::handleOnJIDUpdated(const JID& jid, const String& oldName, const std::vector<String> passedOldGroups) {
if (oldName != xmppRoster_->getNameForJID(jid)) {
- roster_->applyOnItems(SetName(xmppRoster_->getNameForJID(jid), jid));
+ roster_->applyOnItems(SetName(nickResolver_->jidToNick(jid), jid));
return;
}
std::vector<String> groups = xmppRoster_->getGroupsForJID(jid);
std::vector<String> oldGroups = passedOldGroups;
- String name = xmppRoster_->getNameForJID(jid);
- if (name.isEmpty()) {
- name = jid.toString();
- }
+ String name = nickResolver_->jidToNick(jid);
String contactsGroup = "Contacts";
if (oldGroups.empty()) {
oldGroups.push_back(contactsGroup);