uses event directly in internal conference callbacks

This commit is contained in:
Benjamin Reis 2017-11-06 13:36:18 +01:00
parent c1ceea6c2d
commit bea9b7f3d9
21 changed files with 182 additions and 131 deletions

View file

@ -263,9 +263,10 @@ void ClientGroupChatRoom::onConferenceTerminated (const Address &addr) {
d->setState(ChatRoom::State::Terminated);
}
void ClientGroupChatRoom::onParticipantAdded (time_t tm, bool isFullState, const Address &addr) {
void ClientGroupChatRoom::onParticipantAdded (shared_ptr<ConferenceParticipantEvent> event) {
L_D_T(RemoteConference, dConference);
const Address &addr = event->getParticipantAddress();
if (isMe(addr))
return;
@ -280,22 +281,16 @@ void ClientGroupChatRoom::onParticipantAdded (time_t tm, bool isFullState, const
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(this);
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(cr);
LinphoneChatRoomCbsParticipantAddedCb cb = linphone_chat_room_cbs_get_participant_added(cbs);
shared_ptr<ConferenceParticipantEvent> event = make_shared<ConferenceParticipantEvent>(
EventLog::Type::ConferenceParticipantAdded,
tm,
dConference->conferenceAddress,
dConference->eventHandler->getLastNotify(),
addr
);
Conference::getCore()->cppCore->getPrivate()->mainDb->addEvent(event);
if (cb)
cb(cr, L_GET_C_BACK_PTR(event));
}
void ClientGroupChatRoom::onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) {
void ClientGroupChatRoom::onParticipantRemoved (shared_ptr<ConferenceParticipantEvent> event) {
L_D_T(RemoteConference, dConference);
const Address &addr = event->getParticipantAddress();
shared_ptr<Participant> participant = findParticipant(addr);
if (!participant) {
lWarning() << "Participant " << addr.asString() << " removed but not in the list of participants!";
@ -305,13 +300,6 @@ void ClientGroupChatRoom::onParticipantRemoved (time_t tm, bool isFullState, con
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(this);
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(cr);
LinphoneChatRoomCbsParticipantRemovedCb cb = linphone_chat_room_cbs_get_participant_removed(cbs);
shared_ptr<ConferenceParticipantEvent> event = make_shared<ConferenceParticipantEvent>(
EventLog::Type::ConferenceParticipantRemoved,
tm,
dConference->conferenceAddress,
dConference->eventHandler->getLastNotify(),
addr
);
Conference::getCore()->cppCore->getPrivate()->mainDb->addEvent(event);
if (cb)
@ -320,8 +308,8 @@ void ClientGroupChatRoom::onParticipantRemoved (time_t tm, bool isFullState, con
dConference->participants.remove(participant);
}
void ClientGroupChatRoom::onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) {
L_D_T(RemoteConference, dConference);
void ClientGroupChatRoom::onParticipantSetAdmin (shared_ptr<ConferenceParticipantEvent> event) {
const Address &addr = event->getParticipantAddress();
shared_ptr<Participant> participant;
if (isMe(addr))
participant = getMe();
@ -332,43 +320,29 @@ void ClientGroupChatRoom::onParticipantSetAdmin (time_t tm, bool isFullState, co
return;
}
participant->getPrivate()->setAdmin(isAdmin);
participant->getPrivate()->setAdmin(event->getType() == EventLog::Type::ConferenceParticipantSetAdmin);
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(this);
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(cr);
LinphoneChatRoomCbsParticipantAdminStatusChangedCb cb = linphone_chat_room_cbs_get_participant_admin_status_changed(cbs);
shared_ptr<ConferenceParticipantEvent> event = make_shared<ConferenceParticipantEvent>(
isAdmin ? EventLog::Type::ConferenceParticipantSetAdmin : EventLog::Type::ConferenceParticipantUnsetAdmin,
tm,
dConference->conferenceAddress,
dConference->eventHandler->getLastNotify(),
addr
);
Conference::getCore()->cppCore->getPrivate()->mainDb->addEvent(event);
if (cb)
cb(cr, L_GET_C_BACK_PTR(event));
}
void ClientGroupChatRoom::onSubjectChanged (time_t tm, bool isFullState, const std::string &subject) {
L_D_T(RemoteConference, dConference);
RemoteConference::setSubject(subject);
void ClientGroupChatRoom::onSubjectChanged (shared_ptr<ConferenceSubjectEvent> event) {
RemoteConference::setSubject(event->getSubject());
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(this);
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(cr);
LinphoneChatRoomCbsSubjectChangedCb cb = linphone_chat_room_cbs_get_subject_changed(cbs);
shared_ptr<ConferenceSubjectEvent> event = make_shared<ConferenceSubjectEvent>(
tm,
dConference->conferenceAddress,
dConference->eventHandler->getLastNotify(),
subject
);
Conference::getCore()->cppCore->getPrivate()->mainDb->addEvent(event);
if (cb)
cb(cr, L_GET_C_BACK_PTR(event));
}
void ClientGroupChatRoom::onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) {
L_D_T(RemoteConference, dConference);
void ClientGroupChatRoom::onParticipantDeviceAdded (shared_ptr<ConferenceParticipantDeviceEvent> event) {
const Address &addr = event->getParticipantAddress();
shared_ptr<Participant> participant;
if (isMe(addr))
participant = getMe();
@ -378,26 +352,18 @@ void ClientGroupChatRoom::onParticipantDeviceAdded (time_t tm, bool isFullState,
lWarning() << "Participant " << participant << " added a device but is not in the list of participants!";
return;
}
participant->getPrivate()->addDevice(gruu);
participant->getPrivate()->addDevice(event->getGruuAddress());
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(this);
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(cr);
LinphoneChatRoomCbsParticipantDeviceAddedCb cb = linphone_chat_room_cbs_get_participant_device_added(cbs);
shared_ptr<ConferenceParticipantDeviceEvent> event = make_shared<ConferenceParticipantDeviceEvent>(
EventLog::Type::ConferenceParticipantDeviceAdded,
tm,
dConference->conferenceAddress,
dConference->eventHandler->getLastNotify(),
addr,
gruu
);
Conference::getCore()->cppCore->getPrivate()->mainDb->addEvent(event);
if (cb)
cb(cr, L_GET_C_BACK_PTR(event));
}
void ClientGroupChatRoom::onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) {
L_D_T(RemoteConference, dConference);
void ClientGroupChatRoom::onParticipantDeviceRemoved (shared_ptr<ConferenceParticipantDeviceEvent> event) {
const Address &addr = event->getParticipantAddress();
shared_ptr<Participant> participant;
if (isMe(addr))
participant = getMe();
@ -407,18 +373,10 @@ void ClientGroupChatRoom::onParticipantDeviceRemoved (time_t tm, bool isFullStat
lWarning() << "Participant " << participant << " removed a device but is not in the list of participants!";
return;
}
participant->getPrivate()->removeDevice(gruu);
participant->getPrivate()->removeDevice(event->getGruuAddress());
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(this);
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(cr);
LinphoneChatRoomCbsParticipantDeviceRemovedCb cb = linphone_chat_room_cbs_get_participant_device_removed(cbs);
shared_ptr<ConferenceParticipantDeviceEvent> event = make_shared<ConferenceParticipantDeviceEvent>(
EventLog::Type::ConferenceParticipantDeviceRemoved,
tm,
dConference->conferenceAddress,
dConference->eventHandler->getLastNotify(),
addr,
gruu
);
Conference::getCore()->cppCore->getPrivate()->mainDb->addEvent(event);
if (cb)

View file

@ -64,12 +64,12 @@ private:
/* ConferenceListener */
void onConferenceCreated (const Address &addr) override;
void onConferenceTerminated (const Address &addr) 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;
void onParticipantAdded (std::shared_ptr<ConferenceParticipantEvent> event) override;
void onParticipantRemoved (std::shared_ptr<ConferenceParticipantEvent> event) override;
void onParticipantSetAdmin (std::shared_ptr<ConferenceParticipantEvent> event) override;
void onSubjectChanged (std::shared_ptr<ConferenceSubjectEvent> event) override;
void onParticipantDeviceAdded (std::shared_ptr<ConferenceParticipantDeviceEvent> event) override;
void onParticipantDeviceRemoved (std::shared_ptr<ConferenceParticipantDeviceEvent> event) override;
private:
/* CallSessionListener */

View file

@ -23,6 +23,7 @@
#include <ctime>
#include <string>
#include "event-log/events.h"
#include "linphone/utils/general.h"
// =============================================================================
@ -35,12 +36,12 @@ class ConferenceListener {
public:
virtual void onConferenceCreated (const Address &addr) = 0;
virtual void onConferenceTerminated (const Address &addr) = 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;
virtual void onParticipantAdded (std::shared_ptr<ConferenceParticipantEvent> event) = 0;
virtual void onParticipantRemoved (std::shared_ptr<ConferenceParticipantEvent> event) = 0;
virtual void onParticipantSetAdmin (std::shared_ptr<ConferenceParticipantEvent> event) = 0;
virtual void onSubjectChanged (std::shared_ptr<ConferenceSubjectEvent> event) = 0;
virtual void onParticipantDeviceAdded (std::shared_ptr<ConferenceParticipantDeviceEvent> event) = 0;
virtual void onParticipantDeviceRemoved (std::shared_ptr<ConferenceParticipantDeviceEvent> event) = 0;
};
LINPHONE_END_NAMESPACE

View file

@ -83,7 +83,7 @@ string LocalConferenceEventHandlerPrivate::createNotify (ConferenceType confInfo
} else {
confInfo.setVersion(static_cast<unsigned int>(notifyId));
}
confInfo.setState(isFullState ? "full" : "optional");
confInfo.setState(isFullState ? StateType::full : StateType::partial);
if (!confInfo.getConferenceDescription()) {
ConferenceDescriptionType description = ConferenceDescriptionType();
confInfo.setConferenceDescription(description);
@ -117,13 +117,13 @@ string LocalConferenceEventHandlerPrivate::createNotifyFullState (int notifyId)
user.setEndpoint(endpoints);
user.setEntity(participant->getAddress().asStringUriOnly());
user.getRoles()->getEntry().push_back(participant->isAdmin() ? "admin" : "participant");
user.setState("full");
user.setState(StateType::full);
for (const auto &device : participant->getPrivate()->getDevices()) {
const string &gruu = device.getGruu().asStringUriOnly();
EndpointType endpoint = EndpointType();
endpoint.setEntity(gruu);
endpoint.setState("full");
endpoint.setState(StateType::full);
user.getEndpoint().push_back(endpoint);
}
@ -148,7 +148,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantAdded (const A
const string &gruu = device.getGruu().asStringUriOnly();
EndpointType endpoint = EndpointType();
endpoint.setEntity(gruu);
endpoint.setState("full");
endpoint.setState(StateType::full);
user.getEndpoint().push_back(endpoint);
}
}
@ -156,7 +156,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantAdded (const A
user.setRoles(roles);
user.setEntity(addr.asStringUriOnly());
user.getRoles()->getEntry().push_back("participant");
user.setState("full");
user.setState(StateType::full);
confInfo.getUsers()->getUser().push_back(user);
@ -171,7 +171,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantRemoved (const
UserType user = UserType();
user.setEntity(addr.asStringUriOnly());
user.setState("deleted");
user.setState(StateType::deleted);
confInfo.getUsers()->getUser().push_back(user);
return createNotify(confInfo, notifyId);
@ -188,7 +188,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantAdmined (const
user.setRoles(roles);
user.setEntity(addr.asStringUriOnly());
user.getRoles()->getEntry().push_back(isAdmin ? "admin" : "participant");
user.setState("partial");
user.setState(StateType::partial);
confInfo.getUsers()->getUser().push_back(user);
return createNotify(confInfo, notifyId);
@ -217,11 +217,11 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantDeviceAdded (c
user.setRoles(roles);
user.setEntity(addr.asStringUriOnly());
user.getRoles()->getEntry().push_back("participant");
user.setState("partial");
user.setState(StateType::partial);
EndpointType endpoint = EndpointType();
endpoint.setEntity(gruu.asStringUriOnly());
endpoint.setState("full");
endpoint.setState(StateType::full);
user.getEndpoint().push_back(endpoint);
confInfo.getUsers()->getUser().push_back(user);
@ -241,11 +241,11 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantDeviceRemoved
user.setRoles(roles);
user.setEntity(addr.asStringUriOnly());
user.getRoles()->getEntry().push_back("participant");
user.setState("partial");
user.setState(StateType::partial);
EndpointType endpoint = EndpointType();
endpoint.setEntity(gruu.asStringUriOnly());
endpoint.setState("deleted");
endpoint.setState(StateType::deleted);
user.getEndpoint().push_back(endpoint);
confInfo.getUsers()->getUser().push_back(user);

View file

@ -77,7 +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");
bool isFullState = (confInfo->getState() == StateType::full);
Address cleanedConfAddress = d->confAddress;
cleanedConfAddress.clean();
cleanedConfAddress.setPort(0);
@ -93,8 +93,13 @@ void RemoteConferenceEventHandler::notifyReceived (const string &xmlBody) {
confInfo->getConferenceDescription().present() &&
confInfo->getConferenceDescription().get().getSubject().present()
)
d->listener->onSubjectChanged(tm, isFullState, confInfo->getConferenceDescription().get().getSubject().get());
d->listener->onSubjectChanged(make_shared<ConferenceSubjectEvent>(
tm,
isFullState,
d->confAddress,
d->lastNotify,
confInfo->getConferenceDescription().get().getSubject().get()
));
if (confInfo->getVersion().present())
d->lastNotify = confInfo->getVersion().get();
@ -106,9 +111,16 @@ void RemoteConferenceEventHandler::notifyReceived (const string &xmlBody) {
char *cAddrStr = linphone_address_as_string(cAddr);
Address addr(cAddrStr);
bctbx_free(cAddrStr);
if (user.getState() == "deleted")
d->listener->onParticipantRemoved(tm, isFullState, addr);
else {
if (user.getState() == StateType::deleted) {
d->listener->onParticipantRemoved(make_shared<ConferenceParticipantEvent>(
EventLog::Type::ConferenceParticipantRemoved,
tm,
isFullState,
d->confAddress,
d->lastNotify,
addr
));
} else {
bool isAdmin = false;
if (user.getRoles()) {
for (const auto &entry : user.getRoles()->getEntry()) {
@ -118,19 +130,50 @@ void RemoteConferenceEventHandler::notifyReceived (const string &xmlBody) {
}
}
}
if (user.getState() == "full")
d->listener->onParticipantAdded(tm, isFullState, addr);
d->listener->onParticipantSetAdmin(tm, isFullState, addr, isAdmin);
if (user.getState() == StateType::full) {
d->listener->onParticipantAdded(make_shared<ConferenceParticipantEvent>(
EventLog::Type::ConferenceParticipantAdded,
tm,
isFullState,
d->confAddress,
d->lastNotify,
addr
));
}
d->listener->onParticipantSetAdmin(make_shared<ConferenceParticipantEvent>(
isAdmin ? EventLog::Type::ConferenceParticipantSetAdmin : EventLog::Type::ConferenceParticipantUnsetAdmin,
tm,
isFullState,
d->confAddress,
d->lastNotify,
addr
));
for (const auto &endpoint : user.getEndpoint()) {
if (!endpoint.getEntity().present())
break;
Address gruu(endpoint.getEntity().get());
if (endpoint.getState() == "deleted")
d->listener->onParticipantDeviceRemoved(tm, isFullState, addr, gruu);
else if (endpoint.getState() == "full")
d->listener->onParticipantDeviceAdded(tm, isFullState, addr, gruu);
if (endpoint.getState() == StateType::deleted) {
d->listener->onParticipantDeviceRemoved(make_shared<ConferenceParticipantDeviceEvent>(
EventLog::Type::ConferenceParticipantDeviceRemoved,
tm,
isFullState,
d->confAddress,
d->lastNotify,
addr,
gruu
));
} else if (endpoint.getState() == StateType::full) {
d->listener->onParticipantDeviceAdded(make_shared<ConferenceParticipantDeviceEvent>(
EventLog::Type::ConferenceParticipantDeviceAdded,
tm,
isFullState,
d->confAddress,
d->lastNotify,
addr,
gruu
));
}
}
}
linphone_address_unref(cAddr);

View file

@ -22,8 +22,8 @@
#include <string>
#include "object/object.h"
#include "conference-listener.h"
#include "object/object.h"
LINPHONE_BEGIN_NAMESPACE

View file

@ -89,16 +89,16 @@ void RemoteConference::onConferenceTerminated (const Address &addr) {
d->eventHandler->unsubscribe();
}
void RemoteConference::onParticipantAdded (time_t tm, bool isFullState, const Address &addr) {}
void RemoteConference::onParticipantAdded (std::shared_ptr<ConferenceParticipantEvent> event) {}
void RemoteConference::onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) {}
void RemoteConference::onParticipantRemoved (std::shared_ptr<ConferenceParticipantEvent> event) {}
void RemoteConference::onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) {}
void RemoteConference::onParticipantSetAdmin (std::shared_ptr<ConferenceParticipantEvent> event) {}
void RemoteConference::onSubjectChanged (time_t tm, bool isFullState, const std::string &subject) {}
void RemoteConference::onSubjectChanged (std::shared_ptr<ConferenceSubjectEvent> event) {}
void RemoteConference::onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) {}
void RemoteConference::onParticipantDeviceAdded (std::shared_ptr<ConferenceParticipantDeviceEvent> event) {}
void RemoteConference::onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) {}
void RemoteConference::onParticipantDeviceRemoved (std::shared_ptr<ConferenceParticipantDeviceEvent> event) {}
LINPHONE_END_NAMESPACE

View file

@ -46,12 +46,12 @@ protected:
/* ConferenceListener */
void onConferenceCreated (const Address &addr) override;
void onConferenceTerminated (const Address &addr) 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;
void onParticipantAdded (std::shared_ptr<ConferenceParticipantEvent> event) override;
void onParticipantRemoved (std::shared_ptr<ConferenceParticipantEvent> event) override;
void onParticipantSetAdmin (std::shared_ptr<ConferenceParticipantEvent> event) override;
void onSubjectChanged (std::shared_ptr<ConferenceSubjectEvent> event) override;
void onParticipantDeviceAdded (std::shared_ptr<ConferenceParticipantDeviceEvent> event) override;
void onParticipantDeviceRemoved (std::shared_ptr<ConferenceParticipantDeviceEvent> event) override;
private:
L_DECLARE_PRIVATE(RemoteConference);

View file

@ -355,6 +355,7 @@ MainDb::MainDb (const shared_ptr<Core> &core) : CoreAccessor(core), AbstractDb(*
return make_shared<ConferenceParticipantEvent>(
type,
date,
false,
Address(peerAddress),
notifyId,
Address(participantAddress)
@ -386,6 +387,7 @@ MainDb::MainDb (const shared_ptr<Core> &core) : CoreAccessor(core), AbstractDb(*
return make_shared<ConferenceParticipantDeviceEvent>(
type,
date,
false,
Address(peerAddress),
notifyId,
Address(participantAddress),
@ -412,6 +414,7 @@ MainDb::MainDb (const shared_ptr<Core> &core) : CoreAccessor(core), AbstractDb(*
// TODO: Use cache.
return make_shared<ConferenceSubjectEvent>(
date,
false,
Address(peerAddress),
notifyId,
subject

View file

@ -30,6 +30,7 @@ LINPHONE_BEGIN_NAMESPACE
class ConferenceNotifiedEventPrivate : public ConferenceEventPrivate {
private:
unsigned int notifyId = 0;
bool isFullState = false;
L_DECLARE_PUBLIC(ConferenceNotifiedEvent);
};

View file

@ -30,22 +30,26 @@ LINPHONE_BEGIN_NAMESPACE
ConferenceNotifiedEvent::ConferenceNotifiedEvent (
Type type,
time_t time,
bool isFullState,
const Address &conferenceAddress,
unsigned int notifyId
) : ConferenceEvent(*new ConferenceNotifiedEventPrivate, type, time, conferenceAddress) {
L_D();
d->notifyId = notifyId;
d->isFullState = isFullState;
}
ConferenceNotifiedEvent::ConferenceNotifiedEvent (
ConferenceNotifiedEventPrivate &p,
Type type,
time_t time,
bool isFullState,
const Address &conferenceAddress,
unsigned int notifyId
) : ConferenceEvent(p, type, time, conferenceAddress) {
L_D();
d->notifyId = notifyId;
d->isFullState = isFullState;
}
unsigned int ConferenceNotifiedEvent::getNotifyId () const {
@ -53,4 +57,9 @@ unsigned int ConferenceNotifiedEvent::getNotifyId () const {
return d->notifyId;
}
bool ConferenceNotifiedEvent::isFullState () const {
L_D();
return d->isFullState;
}
LINPHONE_END_NAMESPACE

View file

@ -30,15 +30,22 @@ class ConferenceNotifiedEventPrivate;
class LINPHONE_PUBLIC ConferenceNotifiedEvent : public ConferenceEvent {
public:
ConferenceNotifiedEvent (Type type, std::time_t time, const Address &conferenceAddress, unsigned int notifiyId);
ConferenceNotifiedEvent (
Type type, std::time_t time,
bool isFullState,
const Address &conferenceAddress,
unsigned int notifiyId
);
unsigned int getNotifyId () const;
bool isFullState() const;
protected:
ConferenceNotifiedEvent (
ConferenceNotifiedEventPrivate &p,
Type type,
std::time_t time,
bool isFullState,
const Address &conferenceAddress,
unsigned int notifyId
);

View file

@ -36,6 +36,7 @@ public:
ConferenceParticipantDeviceEvent::ConferenceParticipantDeviceEvent (
Type type,
time_t time,
bool isFullState,
const Address &conferenceAddress,
unsigned int notifyId,
const Address &participantAddress,
@ -44,6 +45,7 @@ ConferenceParticipantDeviceEvent::ConferenceParticipantDeviceEvent (
*new ConferenceParticipantDeviceEventPrivate,
type,
time,
isFullState,
conferenceAddress,
notifyId,
participantAddress

View file

@ -33,6 +33,7 @@ public:
ConferenceParticipantDeviceEvent (
Type type,
std::time_t time,
bool isFullState,
const Address &conferenceAddress,
unsigned int notifyId,
const Address &participantAddress,

View file

@ -30,10 +30,18 @@ LINPHONE_BEGIN_NAMESPACE
ConferenceParticipantEvent::ConferenceParticipantEvent (
Type type,
time_t time,
bool isFullState,
const Address &conferenceAddress,
unsigned int notifyId,
const Address &participantAddress
) : ConferenceNotifiedEvent(*new ConferenceParticipantEventPrivate, type, time, conferenceAddress, notifyId) {
) : ConferenceNotifiedEvent(
*new ConferenceParticipantEventPrivate,
type,
time,
isFullState,
conferenceAddress,
notifyId
) {
L_D();
L_ASSERT(
type == Type::ConferenceParticipantAdded ||
@ -48,10 +56,18 @@ ConferenceParticipantEvent::ConferenceParticipantEvent (
ConferenceParticipantEventPrivate &p,
Type type,
time_t time,
bool isFullState,
const Address &conferenceAddress,
unsigned int notifyId,
const Address &participantAddress
) : ConferenceNotifiedEvent(p, type, time, conferenceAddress, notifyId) {
) : ConferenceNotifiedEvent(
p,
type,
time,
isFullState,
conferenceAddress,
notifyId
) {
L_D();
d->participantAddress = participantAddress;
}

View file

@ -33,6 +33,7 @@ public:
ConferenceParticipantEvent (
Type type,
std::time_t time,
bool isFullState,
const Address &conferenceAddress,
unsigned int notifyId,
const Address &participantAddress
@ -45,6 +46,7 @@ protected:
ConferenceParticipantEventPrivate &p,
Type type,
std::time_t time,
bool isFullState,
const Address &conferenceAddress,
unsigned int notifyId,
const Address &participantAddress

View file

@ -35,6 +35,7 @@ public:
ConferenceSubjectEvent::ConferenceSubjectEvent (
time_t time,
bool isFullState,
const Address &conferenceAddress,
unsigned int notifyId,
const string &subject
@ -42,6 +43,7 @@ ConferenceSubjectEvent::ConferenceSubjectEvent (
*new ConferenceSubjectEventPrivate,
Type::ConferenceSubjectChanged,
time,
isFullState,
conferenceAddress,
notifyId
) {

View file

@ -34,6 +34,7 @@ class LINPHONE_PUBLIC ConferenceSubjectEvent : public ConferenceNotifiedEvent {
public:
ConferenceSubjectEvent (
std::time_t time,
bool isFullState,
const Address &conferenceAddress,
unsigned int notifyId,
const std::string &subject

View file

@ -196,7 +196,7 @@ set(SOURCE_FILES_C
set(SOURCE_FILES_CXX
clonable-object-tester.cpp
#conference-event-tester.cpp
conference-event-tester.cpp
conference-tester.cpp
content-manager-tester.cpp
cpim-tester.cpp

View file

@ -145,7 +145,7 @@ static const char *participant_added_notify = \
" <conference-info"\
" xmlns=\"urn:ietf:params:xml:ns:conference-info\""\
" entity=\"%s\""\
" state=\"full\" version=\"1\">"\
" state=\"partial\" version=\"1\">"\
" <!--"\
" CONFERENCE INFO"\
" -->"\
@ -202,7 +202,7 @@ static const char *participant_not_added_notify = \
" <conference-info"\
" xmlns=\"urn:ietf:params:xml:ns:conference-info\""\
" entity=\"%s\""\
" state=\"full\" version=\"1\">"\
" state=\"partial\" version=\"1\">"\
" <!--"\
" CONFERENCE INFO"\
" -->"\
@ -259,7 +259,7 @@ static const char *participant_deleted_notify = \
" <conference-info"\
" xmlns=\"urn:ietf:params:xml:ns:conference-info\""\
" entity=\"%s\""\
" state=\"full\" version=\"1\">"\
" state=\"partial\" version=\"1\">"\
" <!--"\
" CONFERENCE INFO"\
" -->"\
@ -316,7 +316,7 @@ static const char *participant_admined_notify = \
" <conference-info"\
" xmlns=\"urn:ietf:params:xml:ns:conference-info\""\
" entity=\"%s\""\
" state=\"full\" version=\"1\">"\
" state=\"partial\" version=\"1\">"\
" <!--"\
" CONFERENCE INFO"\
" -->"\
@ -377,7 +377,7 @@ static const char *participant_unadmined_notify = \
" <conference-info"\
" xmlns=\"urn:ietf:params:xml:ns:conference-info\""\
" entity=\"%s\""\
" state=\"full\" version=\"1\">"\
" state=\"partial\" version=\"1\">"\
" <!--"\
" CONFERENCE INFO"\
" -->"\
@ -447,12 +447,12 @@ public:
private:
void onConferenceCreated (const Address &addr) override;
void onConferenceTerminated (const Address &addr) 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;
void onParticipantAdded (shared_ptr<ConferenceParticipantEvent> event) override;
void onParticipantRemoved (shared_ptr<ConferenceParticipantEvent> event) override;
void onParticipantSetAdmin (shared_ptr<ConferenceParticipantEvent> event) override;
void onSubjectChanged (shared_ptr<ConferenceSubjectEvent> event) override;
void onParticipantDeviceAdded (shared_ptr<ConferenceParticipantDeviceEvent> event) override;
void onParticipantDeviceRemoved (shared_ptr<ConferenceParticipantDeviceEvent> event) override;
public:
RemoteConferenceEventHandler *handler;
@ -473,33 +473,38 @@ void ConferenceEventTester::onConferenceCreated (const Address &addr) {}
void ConferenceEventTester::onConferenceTerminated (const Address &addr) {}
void ConferenceEventTester::onParticipantAdded (time_t tm, bool isFullState, const Address &addr) {
void ConferenceEventTester::onParticipantAdded (shared_ptr<ConferenceParticipantEvent> event) {
const Address addr = event->getParticipantAddress();
participants.insert(pair<string, bool>(addr.asString(), FALSE));
participantDevices.insert(pair<string, int>(addr.asString(), 0));
}
void ConferenceEventTester::onParticipantRemoved (time_t tm, bool isFullState, const Address &addr) {
void ConferenceEventTester::onParticipantRemoved (shared_ptr<ConferenceParticipantEvent> event) {
const Address addr = event->getParticipantAddress();
participants.erase(addr.asString());
participantDevices.erase(addr.asString());
}
void ConferenceEventTester::onParticipantSetAdmin (time_t tm, bool isFullState, const Address &addr, bool isAdmin) {
void ConferenceEventTester::onParticipantSetAdmin (shared_ptr<ConferenceParticipantEvent> event) {
const Address addr = event->getParticipantAddress();
auto it = participants.find(addr.asString());
if (it != participants.end())
it->second = isAdmin;
it->second = (event->getType() == EventLog::Type::ConferenceParticipantSetAdmin);
}
void ConferenceEventTester::onSubjectChanged(time_t tm, bool isFullState, const string &subject) {
confSubject = subject;
void ConferenceEventTester::onSubjectChanged(shared_ptr<ConferenceSubjectEvent> event) {
confSubject = event->getSubject();
}
void ConferenceEventTester::onParticipantDeviceAdded (time_t tm, bool isFullState, const Address &addr, const Address &gruu) {
void ConferenceEventTester::onParticipantDeviceAdded (shared_ptr<ConferenceParticipantDeviceEvent> event) {
const Address addr = event->getParticipantAddress();
auto it = participantDevices.find(addr.asString());
if (it != participantDevices.end())
it->second++;
}
void ConferenceEventTester::onParticipantDeviceRemoved (time_t tm, bool isFullState, const Address &addr, const Address &gruu) {
void ConferenceEventTester::onParticipantDeviceRemoved (shared_ptr<ConferenceParticipantDeviceEvent> event) {
const Address addr = event->getParticipantAddress();
auto it = participantDevices.find(addr.asString());
if (it != participantDevices.end() && it->second > 0)
it->second--;

View file

@ -563,7 +563,7 @@ void liblinphone_tester_add_suites() {
bc_tester_add_suite(&account_creator_test_suite);
bc_tester_add_suite(&stun_test_suite);
bc_tester_add_suite(&event_test_suite);
//bc_tester_add_suite(&conference_event_test_suite);
bc_tester_add_suite(&conference_event_test_suite);
bc_tester_add_suite(&conference_test_suite);
bc_tester_add_suite(&content_manager_test_suite);
bc_tester_add_suite(&flexisip_test_suite);