/* * Copyright (c) 2013 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include #include #include #include #include #include namespace Swift { ContactsFromXMPPRoster::ContactsFromXMPPRoster(XMPPRoster* roster, AvatarManager* avatarManager, PresenceOracle* presenceOracle) : roster_(roster), avatarManager_(avatarManager), presenceOracle_(presenceOracle) { } ContactsFromXMPPRoster::~ContactsFromXMPPRoster() { } std::vector ContactsFromXMPPRoster::getContacts(bool /*withMUCNicks*/) { std::vector results; std::vector rosterItems = roster_->getItems(); foreach(const XMPPRosterItem& rosterItem, rosterItems) { Contact::ref contact = std::make_shared(rosterItem.getName().empty() ? rosterItem.getJID().toString() : rosterItem.getName(), rosterItem.getJID(), StatusShow::None,""); contact->statusType = presenceOracle_->getAccountPresence(contact->jid) ? presenceOracle_->getAccountPresence(contact->jid)->getShow() : StatusShow::None; contact->avatarPath = avatarManager_->getAvatarPath(contact->jid); results.push_back(contact); } return results; } }