Commit d97c796d authored by Benjamin REIS's avatar Benjamin REIS

add isFullState info to conference-event-packages-callbacks

parent 975cfd80
......@@ -263,7 +263,7 @@ void ClientGroupChatRoom::onConferenceTerminated (const Address &addr) {
d->setState(ChatRoom::State::Terminated);
}
void ClientGroupChatRoom::onParticipantAdded (time_t tm, const Address &addr) {
void ClientGroupChatRoom::onParticipantAdded (time_t tm, bool isFullState, const Address &addr) {
L_D_T(RemoteConference, dConference);
if (isMe(addr))
......@@ -293,7 +293,7 @@ void ClientGroupChatRoom::onParticipantAdded (time_t tm, const Address &addr) {
cb(cr, L_GET_C_BACK_PTR(event));
}
void ClientGroupChatRoom::onParticipantRemoved (time_t tm, const Address &addr) {
void ClientGroupChatRoom::onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) {
L_D_T(RemoteConference, dConference);
shared_ptr<Participant> participant = findParticipant(addr);
......@@ -320,7 +320,7 @@ void ClientGroupChatRoom::onParticipantRemoved (time_t tm, const Address &addr)
dConference->participants.remove(participant);
}
void ClientGroupChatRoom::onParticipantSetAdmin (time_t tm, const Address &addr, bool isAdmin) {
void ClientGroupChatRoom::onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) {
L_D_T(RemoteConference, dConference);
shared_ptr<Participant> participant;
if (isMe(addr))
......@@ -349,7 +349,7 @@ void ClientGroupChatRoom::onParticipantSetAdmin (time_t tm, const Address &addr,
cb(cr, L_GET_C_BACK_PTR(event));
}
void ClientGroupChatRoom::onSubjectChanged (time_t tm, const std::string &subject) {
void ClientGroupChatRoom::onSubjectChanged (time_t tm, bool isFullState, const std::string &subject) {
L_D_T(RemoteConference, dConference);
RemoteConference::setSubject(subject);
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(this);
......@@ -367,7 +367,7 @@ void ClientGroupChatRoom::onSubjectChanged (time_t tm, const std::string &subjec
cb(cr, L_GET_C_BACK_PTR(event));
}
void ClientGroupChatRoom::onParticipantDeviceAdded (time_t tm, const Address &addr, const Address &gruu) {
void ClientGroupChatRoom::onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) {
L_D_T(RemoteConference, dConference);
shared_ptr<Participant> participant;
if (isMe(addr))
......@@ -396,7 +396,7 @@ void ClientGroupChatRoom::onParticipantDeviceAdded (time_t tm, const Address &ad
cb(cr, L_GET_C_BACK_PTR(event));
}
void ClientGroupChatRoom::onParticipantDeviceRemoved (time_t tm, const Address &addr, const Address &gruu) {
void ClientGroupChatRoom::onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) {
L_D_T(RemoteConference, dConference);
shared_ptr<Participant> participant;
if (isMe(addr))
......
......@@ -64,12 +64,12 @@ private:
/* ConferenceListener */
void onConferenceCreated (const Address &addr) override;
void onConferenceTerminated (const Address &addr) override;
void onParticipantAdded (time_t tm, const Address &addr) override;
void onParticipantRemoved (time_t tm, const Address &addr) override;
void onParticipantSetAdmin (time_t tm, const Address &addr, bool isAdmin) override;
void onSubjectChanged (time_t tm, const std::string &subject) override;
void onParticipantDeviceAdded (time_t tm, const Address &addr, const Address &gruu) override;
void onParticipantDeviceRemoved (time_t tm, const Address &addr, const Address &gruu) override;
void onParticipantAdded (time_t tm, bool isFullState, const Address &addr) override;
void onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) override;
void onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) override;
void onSubjectChanged (time_t tm, bool isFullState, const std::string &subject) override;
void onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) override;
void onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) override;
private:
/* CallSessionListener */
......
......@@ -35,12 +35,12 @@ class ConferenceListener {
public:
virtual void onConferenceCreated (const Address &addr) = 0;
virtual void onConferenceTerminated (const Address &addr) = 0;
virtual void onParticipantAdded (time_t tm, const Address &addr) = 0;
virtual void onParticipantRemoved (time_t tm, const Address &addr) = 0;
virtual void onParticipantSetAdmin (time_t tm, const Address &addr, bool isAdmin) = 0;
virtual void onSubjectChanged (time_t tm, const std::string &subject) = 0;
virtual void onParticipantDeviceAdded (time_t tm, const Address &addr, const Address &gruu) = 0;
virtual void onParticipantDeviceRemoved (time_t tm, const Address &addr, const Address &gruu) = 0;
virtual void onParticipantAdded (time_t tm, bool isFullState, const Address &addr) = 0;
virtual void onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) = 0;
virtual void onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) = 0;
virtual void onSubjectChanged (time_t tm, bool isFullState, const std::string &subject) = 0;
virtual void onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) = 0;
virtual void onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) = 0;
};
LINPHONE_END_NAMESPACE
......
......@@ -49,7 +49,7 @@ private:
LocalConference *conf = nullptr;
unsigned int lastNotify = 0;
std::string createNotify (Xsd::ConferenceInfo::ConferenceType confInfo, int notifyId = -1);
std::string createNotify (Xsd::ConferenceInfo::ConferenceType confInfo, int notifyId = -1, bool isFullState = FALSE);
void sendNotify (const std::string &notify, const Address &addr);
L_DECLARE_PUBLIC(LocalConferenceEventHandler);
......
......@@ -76,14 +76,14 @@ void LocalConferenceEventHandlerPrivate::notifyParticipant (const string &notify
sendNotify(notify, participant->getAddress());
}
string LocalConferenceEventHandlerPrivate::createNotify (ConferenceType confInfo, int notifyId) {
string LocalConferenceEventHandlerPrivate::createNotify (ConferenceType confInfo, int notifyId, bool isFullState) {
if (notifyId == -1) {
lastNotify = lastNotify + 1;
confInfo.setVersion(lastNotify);
} else {
confInfo.setVersion(static_cast<unsigned int>(notifyId));
}
confInfo.setState(isFullState ? "full" : "optional");
if (!confInfo.getConferenceDescription()) {
ConferenceDescriptionType description = ConferenceDescriptionType();
confInfo.setConferenceDescription(description);
......@@ -130,7 +130,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyFullState (int notifyId)
confInfo.getUsers()->getUser().push_back(user);
}
return createNotify(confInfo, notifyId);
return createNotify(confInfo, notifyId, TRUE);
}
string LocalConferenceEventHandlerPrivate::createNotifyParticipantAdded (const Address &addr, int notifyId) {
......
......@@ -77,6 +77,7 @@ void RemoteConferenceEventHandler::notifyReceived (const string &xmlBody) {
if (confInfo->getConferenceDescription()->getFreeText().present())
tm = static_cast<time_t>(Utils::stoll(confInfo->getConferenceDescription()->getFreeText().get()));
bool isFullState = (confInfo->getState() == "full");
Address cleanedConfAddress = d->confAddress;
cleanedConfAddress.clean();
cleanedConfAddress.setPort(0);
......@@ -92,7 +93,7 @@ void RemoteConferenceEventHandler::notifyReceived (const string &xmlBody) {
confInfo->getConferenceDescription().present() &&
confInfo->getConferenceDescription().get().getSubject().present()
)
d->listener->onSubjectChanged(tm, confInfo->getConferenceDescription().get().getSubject().get());
d->listener->onSubjectChanged(tm, isFullState, confInfo->getConferenceDescription().get().getSubject().get());
if (confInfo->getVersion().present())
d->lastNotify = confInfo->getVersion().get();
......@@ -106,7 +107,7 @@ void RemoteConferenceEventHandler::notifyReceived (const string &xmlBody) {
Address addr(cAddrStr);
bctbx_free(cAddrStr);
if (user.getState() == "deleted")
d->listener->onParticipantRemoved(tm, addr);
d->listener->onParticipantRemoved(tm, isFullState, addr);
else {
bool isAdmin = false;
if (user.getRoles()) {
......@@ -118,17 +119,17 @@ void RemoteConferenceEventHandler::notifyReceived (const string &xmlBody) {
}
}
if (user.getState() == "full")
d->listener->onParticipantAdded(tm, addr);
d->listener->onParticipantSetAdmin(tm, addr, isAdmin);
d->listener->onParticipantAdded(tm, isFullState, addr);
d->listener->onParticipantSetAdmin(tm, isFullState, addr, isAdmin);
for (const auto &endpoint : user.getEndpoint()) {
if (!endpoint.getEntity().present())
break;
Address gruu(endpoint.getEntity().get());
if (endpoint.getState() == "deleted")
d->listener->onParticipantDeviceRemoved(tm, addr, gruu);
d->listener->onParticipantDeviceRemoved(tm, isFullState, addr, gruu);
else if (endpoint.getState() == "full")
d->listener->onParticipantDeviceAdded(tm, addr, gruu);
d->listener->onParticipantDeviceAdded(tm, isFullState, addr, gruu);
}
}
......
......@@ -89,16 +89,16 @@ void RemoteConference::onConferenceTerminated (const Address &addr) {
d->eventHandler->unsubscribe();
}
void RemoteConference::onParticipantAdded (time_t tm, const Address &addr) {}
void RemoteConference::onParticipantAdded (time_t tm, bool isFullState, const Address &addr) {}
void RemoteConference::onParticipantRemoved (time_t tm, const Address &addr) {}
void RemoteConference::onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) {}
void RemoteConference::onParticipantSetAdmin (time_t tm, const Address &addr, bool isAdmin) {}
void RemoteConference::onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) {}
void RemoteConference::onSubjectChanged (time_t tm, const std::string &subject) {}
void RemoteConference::onSubjectChanged (time_t tm, bool isFullState, const std::string &subject) {}
void RemoteConference::onParticipantDeviceAdded (time_t tm, const Address &addr, const Address &gruu) {}
void RemoteConference::onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) {}
void RemoteConference::onParticipantDeviceRemoved (time_t tm, const Address &addr, const Address &gruu) {}
void RemoteConference::onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) {}
LINPHONE_END_NAMESPACE
......@@ -46,12 +46,12 @@ protected:
/* ConferenceListener */
void onConferenceCreated (const Address &addr) override;
void onConferenceTerminated (const Address &addr) override;
void onParticipantAdded (time_t tm, const Address &addr) override;
void onParticipantRemoved (time_t tm, const Address &addr) override;
void onParticipantSetAdmin (time_t tm, const Address &addr, bool isAdmin) override;
void onSubjectChanged (time_t tm, const std::string &subject) override;
void onParticipantDeviceAdded (time_t tm, const Address &addr, const Address &gruu) override;
void onParticipantDeviceRemoved (time_t tm, const Address &addr, const Address &gruu) override;
void onParticipantAdded (time_t tm, bool isFullState, const Address &addr) override;
void onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) override;
void onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) override;
void onSubjectChanged (time_t tm, bool isFullState, const std::string &subject) override;
void onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) override;
void onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) override;
private:
L_DECLARE_PRIVATE(RemoteConference);
......
......@@ -447,12 +447,12 @@ public:
private:
void onConferenceCreated (const Address &addr) override;
void onConferenceTerminated (const Address &addr) override;
void onParticipantAdded (time_t tm, const Address &addr) override;
void onParticipantRemoved (time_t tm, const Address &addr) override;
void onParticipantSetAdmin (time_t tm, const Address &addr, bool isAdmin) override;
void onSubjectChanged (time_t tm, const string &subject) override;
void onParticipantDeviceAdded (time_t tm, const Address &addr, const Address &gruu) override;
void onParticipantDeviceRemoved (time_t tm, const Address &addr, const Address &gruu) override;
void onParticipantAdded (time_t tm, bool isFullState, const Address &addr) override;
void onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) override;
void onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) override;
void onSubjectChanged (time_t tm, bool isFullState, const string &subject) override;
void onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) override;
void onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) override;
public:
RemoteConferenceEventHandler *handler;
......@@ -473,33 +473,33 @@ void ConferenceEventTester::onConferenceCreated (const Address &addr) {}
void ConferenceEventTester::onConferenceTerminated (const Address &addr) {}
void ConferenceEventTester::onParticipantAdded (time_t tm, const Address &addr) {
void ConferenceEventTester::onParticipantAdded (time_t tm, bool isFullState, const Address &addr) {
participants.insert(pair<string, bool>(addr.asString(), FALSE));
participantDevices.insert(pair<string, int>(addr.asString(), 0));
}
void ConferenceEventTester::onParticipantRemoved (time_t tm, const Address &addr) {
void ConferenceEventTester::onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) {
participants.erase(addr.asString());
participantDevices.erase(addr.asString());
}
void ConferenceEventTester::onParticipantSetAdmin (time_t tm, const Address &addr, bool isAdmin) {
void ConferenceEventTester::onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) {
auto it = participants.find(addr.asString());
if (it != participants.end())
it->second = isAdmin;
}
void ConferenceEventTester::onSubjectChanged(time_t tm, const string &subject) {
void ConferenceEventTester::onSubjectChanged(time_t tm, bool isFullState, const string &subject) {
confSubject = subject;
}
void ConferenceEventTester::onParticipantDeviceAdded (time_t tm, const Address &addr, const Address &gruu) {
void ConferenceEventTester::onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) {
auto it = participantDevices.find(addr.asString());
if (it != participantDevices.end())
it->second++;
}
void ConferenceEventTester::onParticipantDeviceRemoved (time_t tm, const Address &addr, const Address &gruu) {
void ConferenceEventTester::onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) {
auto it = participantDevices.find(addr.asString());
if (it != participantDevices.end() && it->second > 0)
it->second--;
......
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