diff options
Diffstat (limited to 'Swiften/Roster/XMPPRoster.cpp')
-rw-r--r-- | Swiften/Roster/XMPPRoster.cpp | 51 |
1 files changed, 1 insertions, 50 deletions
diff --git a/Swiften/Roster/XMPPRoster.cpp b/Swiften/Roster/XMPPRoster.cpp index 56616c2..61630b4 100644 --- a/Swiften/Roster/XMPPRoster.cpp +++ b/Swiften/Roster/XMPPRoster.cpp @@ -11,57 +11,8 @@ namespace Swift { XMPPRoster::XMPPRoster() { } -void XMPPRoster::addContact(const JID& jid, const String& name, const std::vector<String>& groups, RosterItemPayload::Subscription subscription) { - JID bareJID(jid.toBare()); - bool exists = containsJID(bareJID); - String oldName = getNameForJID(bareJID); - std::vector<String> oldGroups = entries_[bareJID].groups; - if (exists) { - entries_.erase(bareJID); - } - XMPPRosterItem item; - item.groups = groups; - item.name = name; - item.jid = jid; - item.subscription = subscription; - entries_[bareJID] = item; - if (exists) { - onJIDUpdated(bareJID, oldName, oldGroups); - } else { - onJIDAdded(bareJID); - } -} - -void XMPPRoster::removeContact(const JID& jid) { - entries_.erase(JID(jid.toBare())); - onJIDRemoved(jid); -} - -void XMPPRoster::clear() { - entries_.clear(); - onRosterCleared(); -} - -bool XMPPRoster::containsJID(const JID& jid) { - return entries_.find(JID(jid.toBare())) != entries_.end(); -} - -String XMPPRoster::getNameForJID(const JID& jid) const { - std::map<JID, XMPPRosterItem>::const_iterator i = entries_.find(jid.toBare()); - if (i != entries_.end()) { - return i->second.name; - } - else { - return ""; - } -} - -const std::vector<String>& XMPPRoster::getGroupsForJID(const JID& jid) { - return entries_[JID(jid.toBare())].groups; -} -RosterItemPayload::Subscription XMPPRoster::getSubscriptionStateForJID(const JID& jid) { - return entries_[JID(jid.toBare())].subscription; +XMPPRoster::~XMPPRoster() { } } |