summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Roster/Roster.cpp')
-rw-r--r--Swiften/Roster/Roster.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/Swiften/Roster/Roster.cpp b/Swiften/Roster/Roster.cpp
index f9f0dbb..68bac53 100644
--- a/Swiften/Roster/Roster.cpp
+++ b/Swiften/Roster/Roster.cpp
@@ -73,9 +73,18 @@ void Roster::addContact(const JID& jid, const JID& displayJID, const String& nam
ContactRosterItem *item = new ContactRosterItem(jid, displayJID, name, group);
item->setAvatarPath(avatarPath);
group->addChild(item);
+ if (itemMap_[fullJIDMapping_ ? jid : jid.toBare()].size() > 0) {
+ foreach (String existingGroup, itemMap_[fullJIDMapping_ ? jid : jid.toBare()][0]->getGroups()) {
+ item->addGroup(existingGroup);
+ }
+ }
itemMap_[fullJIDMapping_ ? jid : jid.toBare()].push_back(item);
item->onDataChanged.connect(boost::bind(&Roster::handleDataChanged, this, item));
filterContact(item, group);
+
+ foreach (ContactRosterItem* item, itemMap_[fullJIDMapping_ ? jid : jid.toBare()]) {
+ item->addGroup(groupName);
+ }
}
struct JIDEqualsTo {
@@ -113,6 +122,9 @@ void Roster::removeContactFromGroup(const JID& jid, const String& groupName) {
}
it++;
}
+ foreach (ContactRosterItem* item, itemMap_[fullJIDMapping_ ? jid : jid.toBare()]) {
+ item->removeGroup(groupName);
+ }
}