Commit 04e028c7 authored by Benjamin REIS's avatar Benjamin REIS
Browse files

create event when creating notify

parent 203e0674
......@@ -22,6 +22,7 @@
#include <string>
#include "chat/chat-room/chat-room-id.h"
#include "local-conference-event-handler.h"
#include "object/object-p.h"
#include "xml/conference-info.h"
......@@ -48,6 +49,8 @@ public:
inline unsigned int getLastNotify () const { return lastNotify; };
private:
ChatRoomId chatRoomId;
LocalConference *conf = nullptr;
unsigned int lastNotify = 0;
......
......@@ -21,7 +21,6 @@
#include "linphone/utils/utils.h"
#include "chat/chat-room/chat-room-id.h"
#include "conference/local-conference.h"
#include "conference/participant-p.h"
#include "content/content-manager.h"
......@@ -397,36 +396,85 @@ void LocalConferenceEventHandler::subscribeReceived (LinphoneEvent *lev) {
device->setConferenceSubscribeEvent(nullptr);
}
void LocalConferenceEventHandler::notifyParticipantAdded (const Address &addr) {
shared_ptr<ConferenceParticipantEvent> LocalConferenceEventHandler::notifyParticipantAdded (const Address &addr) {
L_D();
shared_ptr<Participant> participant = d->conf->findParticipant(addr);
d->notifyAllExcept(d->createNotifyParticipantAdded(addr), participant);
shared_ptr<ConferenceParticipantEvent> event = make_shared<ConferenceParticipantEvent>(
EventLog::Type::ConferenceParticipantAdded,
time(nullptr),
d->chatRoomId,
d->lastNotify,
addr
);
return event;
}
void LocalConferenceEventHandler::notifyParticipantRemoved (const Address &addr) {
shared_ptr<ConferenceParticipantEvent> LocalConferenceEventHandler::notifyParticipantRemoved (const Address &addr) {
L_D();
shared_ptr<Participant> participant = d->conf->findParticipant(addr);
d->notifyAllExcept(d->createNotifyParticipantRemoved(addr), participant);
shared_ptr<ConferenceParticipantEvent> event = make_shared<ConferenceParticipantEvent>(
EventLog::Type::ConferenceParticipantRemoved,
time(nullptr),
d->chatRoomId,
d->lastNotify,
addr
);
return event;
}
void LocalConferenceEventHandler::notifyParticipantSetAdmin (const Address &addr, bool isAdmin) {
shared_ptr<ConferenceParticipantEvent> LocalConferenceEventHandler::notifyParticipantSetAdmin (const Address &addr, bool isAdmin) {
L_D();
d->notifyAll(d->createNotifyParticipantAdmined(addr, isAdmin));
shared_ptr<ConferenceParticipantEvent> event = make_shared<ConferenceParticipantEvent>(
isAdmin ? EventLog::Type::ConferenceParticipantSetAdmin : EventLog::Type::ConferenceParticipantUnsetAdmin,
time(nullptr),
d->chatRoomId,
d->lastNotify,
addr
);
return event;
}
void LocalConferenceEventHandler::notifySubjectChanged () {
shared_ptr<ConferenceSubjectEvent> LocalConferenceEventHandler::notifySubjectChanged () {
L_D();
d->notifyAll(d->createNotifySubjectChanged());
shared_ptr<ConferenceSubjectEvent> event = make_shared<ConferenceSubjectEvent>(
time(nullptr),
d->chatRoomId,
d->lastNotify,
d->conf->getSubject()
);
return event;
}
void LocalConferenceEventHandler::notifyParticipantDeviceAdded (const Address &addr, const Address &gruu) {
shared_ptr<ConferenceParticipantDeviceEvent> LocalConferenceEventHandler::notifyParticipantDeviceAdded (const Address &addr, const Address &gruu) {
L_D();
d->notifyAll(d->createNotifyParticipantDeviceAdded(addr, gruu));
shared_ptr<ConferenceParticipantDeviceEvent> event = make_shared<ConferenceParticipantDeviceEvent>(
EventLog::Type::ConferenceParticipantDeviceAdded,
time(nullptr),
d->chatRoomId,
d->lastNotify,
addr,
gruu
);
return event;
}
void LocalConferenceEventHandler::notifyParticipantDeviceRemoved (const Address &addr, const Address &gruu) {
shared_ptr<ConferenceParticipantDeviceEvent> LocalConferenceEventHandler::notifyParticipantDeviceRemoved (const Address &addr, const Address &gruu) {
L_D();
d->notifyAll(d->createNotifyParticipantDeviceRemoved(addr, gruu));
shared_ptr<ConferenceParticipantDeviceEvent> event = make_shared<ConferenceParticipantDeviceEvent>(
EventLog::Type::ConferenceParticipantDeviceRemoved,
time(nullptr),
d->chatRoomId,
d->lastNotify,
addr,
gruu
);
return event;
}
void LocalConferenceEventHandler::setLastNotify (unsigned int lastNotify) {
......@@ -434,4 +482,9 @@ void LocalConferenceEventHandler::setLastNotify (unsigned int lastNotify) {
d->lastNotify = lastNotify;
}
void LocalConferenceEventHandler::setChatRoomId (const ChatRoomId &chatRoomId) {
L_D();
d->chatRoomId = chatRoomId;
}
LINPHONE_END_NAMESPACE
......@@ -20,6 +20,8 @@
#ifndef _LOCAL_CONFERENCE_EVENT_HANDLER_H_
#define _LOCAL_CONFERENCE_EVENT_HANDLER_H_
#include <memory>
#include "linphone/types.h"
#include "address/address.h"
......@@ -30,6 +32,10 @@
LINPHONE_BEGIN_NAMESPACE
class ChatRoomId;
class ConferenceParticipantDeviceEvent;
class ConferenceParticipantEvent;
class ConferenceSubjectEvent;
class LocalConference;
class LocalConferenceEventHandlerPrivate;
......@@ -39,14 +45,15 @@ public:
~LocalConferenceEventHandler ();
void subscribeReceived (LinphoneEvent *lev);
void notifyParticipantAdded (const Address &addr);
void notifyParticipantRemoved (const Address &addr);
void notifyParticipantSetAdmin (const Address &addr, bool isAdmin);
void notifySubjectChanged ();
void notifyParticipantDeviceAdded (const Address &addr, const Address &gruu);
void notifyParticipantDeviceRemoved (const Address &addr, const Address &gruu);
std::shared_ptr<ConferenceParticipantEvent> notifyParticipantAdded (const Address &addr);
std::shared_ptr<ConferenceParticipantEvent> notifyParticipantRemoved (const Address &addr);
std::shared_ptr<ConferenceParticipantEvent> notifyParticipantSetAdmin (const Address &addr, bool isAdmin);
std::shared_ptr<ConferenceSubjectEvent> notifySubjectChanged ();
std::shared_ptr<ConferenceParticipantDeviceEvent> notifyParticipantDeviceAdded (const Address &addr, const Address &gruu);
std::shared_ptr<ConferenceParticipantDeviceEvent> notifyParticipantDeviceRemoved (const Address &addr, const Address &gruu);
void setLastNotify (unsigned int lastNotify);
void setChatRoomId (const ChatRoomId &chatRoomId);
private:
L_DECLARE_PRIVATE(LocalConferenceEventHandler);
......
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