summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-05-27 07:59:51 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-05-27 07:59:51 (GMT)
commit0bdb45be4aa66dcc478d5f061096b1adbaa3ab2c (patch)
treebd9cbfea05d2edb45d59a0fe5ad43da95a705416 /Swift
parentaeaa3ef7a62f2aba11df6e20262fd17cff0bf9e0 (diff)
downloadswift-contrib-0bdb45be4aa66dcc478d5f061096b1adbaa3ab2c.zip
swift-contrib-0bdb45be4aa66dcc478d5f061096b1adbaa3ab2c.tar.bz2
Show JIDs for users without nicks in the roster.
Resolves: #344
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);