Commit 3bcf6e35 authored by Benjamin REIS's avatar Benjamin REIS

add parseResouceLists method to local conference

parent 8d075bbd
......@@ -18,8 +18,10 @@
#include "local-conference.h"
#include "participant-p.h"
#include "xml/resource-lists.h"
using namespace std;
using namespace LinphonePrivate::Xsd::ResourceLists;
LINPHONE_BEGIN_NAMESPACE
......@@ -57,4 +59,22 @@ void LocalConference::removeParticipant (const shared_ptr<const Participant> &pa
}
}
list<shared_ptr<Address>> LocalConference::parseResourceLists(string xmlBody) {
istringstream data(xmlBody);
unique_ptr<ResourceLists> rl = LinphonePrivate::Xsd::ResourceLists::parseResourceLists(data, Xsd::XmlSchema::Flags::dont_validate);
list<shared_ptr<Address>> addresses = list<shared_ptr<Address>>();
for(const auto &l : rl->getList()) {
for(const auto &entry : l.getEntry()) {
shared_ptr<Address> addr = make_shared<Address>(Address(entry.getUri()));
// TODO : set display name when possible
/*if(!entry.getDisplayName()->present()) {
addr->setDisplayName(entry.getDisplayName()->get());
}*/
addresses.push_back(addr);
}
}
return addresses;
}
LINPHONE_END_NAMESPACE
......@@ -38,6 +38,8 @@ public:
std::shared_ptr<Participant> addParticipant (const Address &addr, const CallSessionParams *params, bool hasMedia) override;
void removeParticipant (const std::shared_ptr<const Participant> &participant) override;
std::list<std::shared_ptr<Address>> parseResourceLists(std::string xmlBody);
private:
L_DISABLE_COPY(LocalConference);
......
......@@ -65,7 +65,7 @@ string RemoteConference::getResourceLists(const list<shared_ptr<const Address>>
ListType l = ListType();
for(const auto &addr : addresses) {
EntryType entry = EntryType(addr->asStringUriOnly());
if(addr->getDisplayName() != "") {
if(!addr->getDisplayName().empty()) {
entry.setDisplayName(DisplayName(addr->getDisplayName()));
}
l.getEntry().push_back(entry);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment