Commit 5c8fa71e authored by Benjamin REIS's avatar Benjamin REIS

create event object on notifed conference event

parent 3a1a899c
......@@ -26,6 +26,7 @@
#include "conference/remote-conference-event-handler.h"
#include "conference/remote-conference-p.h"
#include "conference/session/call-session-p.h"
#include "event-log/events.h"
#include "logger/logger.h"
#include "sal/refer-op.h"
......@@ -274,6 +275,14 @@ void ClientGroupChatRoom::onParticipantAdded (time_t tm, const Address &addr) {
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);
ConferenceParticipantEvent event(
EventLog::Type::ConferenceParticipantAdded,
tm,
dConference->conferenceAddress,
dConference->eventHandler->getLastNotify(),
addr
);
if (cb)
cb(cr, L_GET_C_BACK_PTR(participant));
}
......@@ -290,6 +299,13 @@ void ClientGroupChatRoom::onParticipantRemoved (time_t tm, const Address &addr)
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);
ConferenceParticipantEvent event(
EventLog::Type::ConferenceParticipantRemoved,
tm,
dConference->conferenceAddress,
dConference->eventHandler->getLastNotify(),
addr
);
if (cb)
cb(cr, L_GET_C_BACK_PTR(participant));
......@@ -298,6 +314,7 @@ void ClientGroupChatRoom::onParticipantRemoved (time_t tm, const Address &addr)
}
void ClientGroupChatRoom::onParticipantSetAdmin (time_t tm, const Address &addr, bool isAdmin) {
L_D_T(RemoteConference, dConference);
shared_ptr<Participant> participant;
if (isMe(addr))
participant = getMe();
......@@ -312,22 +329,37 @@ void ClientGroupChatRoom::onParticipantSetAdmin (time_t tm, const Address &addr,
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);
ConferenceParticipantEvent event(
isAdmin ? EventLog::Type::ConferenceParticipantSetAdmin : EventLog::Type::ConferenceParticipantUnsetAdmin,
tm,
dConference->conferenceAddress,
dConference->eventHandler->getLastNotify(),
addr
);
if (cb)
cb(cr, L_GET_C_BACK_PTR(participant), isAdmin);
}
void ClientGroupChatRoom::onSubjectChanged (time_t tm, const std::string &subject) {
L_D_T(RemoteConference, dConference);
RemoteConference::setSubject(subject);
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);
ConferenceSubjectEvent event(
tm,
dConference->conferenceAddress,
dConference->eventHandler->getLastNotify(),
subject
);
if (cb)
cb(cr, subject.c_str());
}
void ClientGroupChatRoom::onParticipantDeviceAdded (time_t tm, const Address &addr, const Address &gruu) {
L_D_T(RemoteConference, dConference);
shared_ptr<Participant> participant;
if (isMe(addr))
participant = getMe();
......@@ -338,9 +370,18 @@ void ClientGroupChatRoom::onParticipantDeviceAdded (time_t tm, const Address &ad
return;
}
participant->getPrivate()->addDevice(gruu);
ConferenceParticipantDeviceEvent event(
EventLog::Type::ConferenceParticipantDeviceAdded,
tm,
dConference->conferenceAddress,
dConference->eventHandler->getLastNotify(),
addr,
gruu
);
}
void ClientGroupChatRoom::onParticipantDeviceRemoved (time_t tm, const Address &addr, const Address &gruu) {
L_D_T(RemoteConference, dConference);
shared_ptr<Participant> participant;
if (isMe(addr))
participant = getMe();
......@@ -351,6 +392,14 @@ void ClientGroupChatRoom::onParticipantDeviceRemoved (time_t tm, const Address &
return;
}
participant->getPrivate()->removeDevice(gruu);
ConferenceParticipantDeviceEvent event(
EventLog::Type::ConferenceParticipantDeviceRemoved,
tm,
dConference->conferenceAddress,
dConference->eventHandler->getLastNotify(),
addr,
gruu
);
}
// -----------------------------------------------------------------------------
......
......@@ -29,11 +29,6 @@
LINPHONE_BEGIN_NAMESPACE
class RemoteConferenceEventHandlerPrivate : public ObjectPrivate {
public:
inline unsigned int getLastNotify () const {
return lastNotify;
};
private:
LinphoneCore *core = nullptr;
ConferenceListener *listener = nullptr;
......
......@@ -68,7 +68,7 @@ void RemoteConferenceEventHandler::unsubscribe () {
}
}
void RemoteConferenceEventHandler::notifyReceived (string xmlBody) {
void RemoteConferenceEventHandler::notifyReceived (const string &xmlBody) {
L_D();
lInfo() << "NOTIFY received for conference " << d->confAddress.asString();
istringstream data(xmlBody);
......@@ -133,4 +133,9 @@ const Address &RemoteConferenceEventHandler::getConfAddress () const {
return d->confAddress;
}
unsigned int RemoteConferenceEventHandler::getLastNotify () const {
L_D();
return d->lastNotify;
};
LINPHONE_END_NAMESPACE
......@@ -22,8 +22,6 @@
#include <string>
#include "linphone/types.h"
#include "object/object.h"
#include "conference-listener.h"
......@@ -37,10 +35,11 @@ class RemoteConferenceEventHandler : public Object {
~RemoteConferenceEventHandler ();
void subscribe (const Address &confAddress);
void notifyReceived (std::string xmlBody);
void notifyReceived (const std::string &xmlBody);
void unsubscribe ();
const Address &getConfAddress () const;
unsigned int getLastNotify () const;
private:
L_DECLARE_PRIVATE(RemoteConferenceEventHandler);
......
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