diff options
Diffstat (limited to 'Swiften/Roster/XMPPRoster.cpp')
m--------- | Swiften | 0 | ||||
-rw-r--r-- | Swiften/Roster/XMPPRoster.cpp | 48 |
2 files changed, 0 insertions, 48 deletions
diff --git a/Swiften b/Swiften new file mode 160000 +Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c diff --git a/Swiften/Roster/XMPPRoster.cpp b/Swiften/Roster/XMPPRoster.cpp deleted file mode 100644 index 62edc45..0000000 --- a/Swiften/Roster/XMPPRoster.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "Swiften/Roster/XMPPRoster.h" - -namespace Swift { - -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); -} - -bool XMPPRoster::containsJID(const JID& jid) { - return entries_.find(JID(jid.toBare())) != entries_.end(); -} - -const String& XMPPRoster::getNameForJID(const JID& jid) { - return entries_[JID(jid.toBare())].name; -} - -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; -} - -} - |