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

create event object on notifed conference event

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