Commit 84d94988 authored by Benjamin REIS's avatar Benjamin REIS

uniformize conference event

parent 24b2861e
......@@ -96,7 +96,7 @@ typedef void (*LinphoneCallCbsAckProcessingCb)(LinphoneCall *call, LinphoneHeade
* @addtogroup chatroom
* @{
*/
/**
* Call back used to notify message delivery status
* @param msg #LinphoneChatMessage object
......@@ -161,14 +161,14 @@ typedef void (*LinphoneChatRoomCbsMessageReceivedCb) (LinphoneChatRoom *cr, Linp
* @param[in] cr #LinphoneChatRoom object
* @param[in] participant The #LinphoneParticipant that has been added to the chat room
*/
typedef void (*LinphoneChatRoomCbsParticipantAddedCb) (LinphoneChatRoom *cr, LinphoneParticipant *participant);
typedef void (*LinphoneChatRoomCbsParticipantAddedCb) (LinphoneChatRoom *cr, const LinphoneConferenceParticipantEvent *event);
/**
* Callback used to notify a chat room that a participant has been removed.
* @param[in] cr #LinphoneChatRoom object
* @param[in] participant The #LinphoneParticipant that has been removed from the chat room
*/
typedef void (*LinphoneChatRoomCbsParticipantRemovedCb) (LinphoneChatRoom *cr, LinphoneParticipant *participant);
typedef void (*LinphoneChatRoomCbsParticipantRemovedCb) (LinphoneChatRoom *cr, const LinphoneConferenceParticipantEvent *event);
/**
* Callback used to notify a chat room that the admin status of a participant has been changed.
......@@ -176,7 +176,7 @@ typedef void (*LinphoneChatRoomCbsParticipantRemovedCb) (LinphoneChatRoom *cr, L
* @param[in] participant The #LinphoneParticipant for which the admin status has been changed
* @param[in] isAdmin The new admin status of the participant
*/
typedef void (*LinphoneChatRoomCbsParticipantAdminStatusChangedCb) (LinphoneChatRoom *cr, LinphoneParticipant *participant, bool_t isAdmin);
typedef void (*LinphoneChatRoomCbsParticipantAdminStatusChangedCb) (LinphoneChatRoom *cr, const LinphoneConferenceParticipantEvent *event);
/**
* Callback used to notify a chat room state has changed.
......@@ -190,7 +190,7 @@ typedef void (*LinphoneChatRoomCbsStateChangedCb) (LinphoneChatRoom *cr, Linphon
* @param[in] cr #LinphoneChatRoom object
* @param[in] subject The new subject of the chat room
*/
typedef void (*LinphoneChatRoomCbsSubjectChangedCb) (LinphoneChatRoom *cr, const char *subject);
typedef void (*LinphoneChatRoomCbsSubjectChangedCb) (LinphoneChatRoom *cr, const LinphoneConferenceSubjectEvent *event);
/**
* Callback used to notify a chat room that a message has been received but we were unable to decrypt it
......@@ -199,6 +199,19 @@ typedef void (*LinphoneChatRoomCbsSubjectChangedCb) (LinphoneChatRoom *cr, const
*/
typedef void (*LinphoneChatRoomCbsUndecryptableMessageReceivedCb) (LinphoneChatRoom *cr, LinphoneChatMessage *msg);
/**
* Callback used to notify a chat room that a participant has been added.
* @param[in] cr #LinphoneChatRoom object
* @param[in] participant The #LinphoneParticipant that has been added to the chat room
*/
typedef void (*LinphoneChatRoomCbsParticipantDeviceAddedCb) (LinphoneChatRoom *cr, const LinphoneConferenceParticipantDeviceEvent *event);
/**
* Callback used to notify a chat room that a participant has been removed.
* @param[in] cr #LinphoneChatRoom object
* @param[in] participant The #LinphoneParticipant that has been removed from the chat room
*/
typedef void (*LinphoneChatRoomCbsParticipantDeviceRemovedCb) (LinphoneChatRoom *cr, const LinphoneConferenceParticipantDeviceEvent *event);
/**
* @}
**/
......
......@@ -173,6 +173,33 @@ LINPHONE_PUBLIC LinphoneChatRoomCbsUndecryptableMessageReceivedCb linphone_chat_
*/
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_undecryptable_message_received (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsUndecryptableMessageReceivedCb cb);
/**
* Get the participant device added callback.
* @param[in] cbs LinphoneChatRoomCbs object.
* @return The current participant device added callback.
*/
LINPHONE_PUBLIC LinphoneChatRoomCbsParticipantDeviceAddedCb linphone_chat_room_cbs_get_participant_device_added (const LinphoneChatRoomCbs *cbs);
/**
* Set the participant device added callback.
* @param[in] cbs LinphoneChatRoomCbs object.
* @param[in] cb The participant device added callback to be used.
*/
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_participant_device_added (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsParticipantDeviceAddedCb cb);
/**
* Get the participant device removed callback.
* @param[in] cbs LinphoneChatRoomCbs object.
* @return The current participant device removed callback.
*/
LINPHONE_PUBLIC LinphoneChatRoomCbsParticipantDeviceRemovedCb linphone_chat_room_cbs_get_participant_device_removed (const LinphoneChatRoomCbs *cbs);
/**
* Set the participant device removed callback.
* @param[in] cbs LinphoneChatRoomCbs object.
* @param[in] cb The participant device removed callback to be used.
*/
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_participant_device_removed (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsParticipantDeviceRemovedCb cb);
/**
* @}
*/
......
......@@ -130,6 +130,8 @@ typedef struct _LinphoneDialPlan LinphoneDialPlan;
typedef struct _LinphoneCallEvent LinphoneCallEvent;
typedef struct _LinphoneConferenceEvent LinphoneConferenceEvent;
typedef struct _LinphoneConferenceParticipantEvent LinphoneConferenceParticipantEvent;
typedef struct _LinphoneConferenceParticipantDeviceEvent LinphoneConferenceParticipantDeviceEvent;
typedef struct _LinphoneConferenceSubjectEvent LinphoneConferenceSubjectEvent;
typedef struct _LinphoneEventLog LinphoneEventLog;
typedef struct _LinphoneChatMessageEvent LinphoneChatMessageEvent;
......
......@@ -30,6 +30,8 @@ struct _LinphoneChatRoomCbs {
LinphoneChatRoomCbsMessageReceivedCb messageReceivedCb;
LinphoneChatRoomCbsParticipantAddedCb participantAddedCb;
LinphoneChatRoomCbsParticipantRemovedCb participantRemovedCb;
LinphoneChatRoomCbsParticipantDeviceAddedCb participantDeviceAddedCb;
LinphoneChatRoomCbsParticipantDeviceRemovedCb participantDeviceRemovedCb;
LinphoneChatRoomCbsParticipantAdminStatusChangedCb participantAdminStatusChangedCb;
LinphoneChatRoomCbsStateChangedCb stateChangedCb;
LinphoneChatRoomCbsSubjectChangedCb subjectChangedCb;
......@@ -133,3 +135,19 @@ LinphoneChatRoomCbsUndecryptableMessageReceivedCb linphone_chat_room_cbs_get_und
void linphone_chat_room_cbs_set_undecryptable_message_received (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsUndecryptableMessageReceivedCb cb) {
cbs->undecryptableMessageReceivedCb = cb;
}
LinphoneChatRoomCbsParticipantDeviceAddedCb linphone_chat_room_cbs_get_participant_device_added (const LinphoneChatRoomCbs *cbs) {
return cbs->participantDeviceAddedCb;
}
void linphone_chat_room_cbs_set_participant_device_added (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsParticipantDeviceAddedCb cb) {
cbs->participantDeviceAddedCb = cb;
}
LinphoneChatRoomCbsParticipantDeviceRemovedCb linphone_chat_room_cbs_get_participant_device_removed (const LinphoneChatRoomCbs *cbs) {
return cbs->participantDeviceRemovedCb;
}
void linphone_chat_room_cbs_set_participant_device_removed (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsParticipantDeviceRemovedCb cb) {
cbs->participantDeviceRemovedCb = cb;
}
......@@ -31,6 +31,8 @@ L_DECLARE_C_CLONABLE_STRUCT_IMPL(EventLog);
L_DECLARE_C_CLONABLE_STRUCT_IMPL(CallEvent);
L_DECLARE_C_CLONABLE_STRUCT_IMPL(ConferenceEvent);
L_DECLARE_C_CLONABLE_STRUCT_IMPL(ConferenceParticipantEvent);
L_DECLARE_C_CLONABLE_STRUCT_IMPL(ConferenceParticipantDeviceEvent);
L_DECLARE_C_CLONABLE_STRUCT_IMPL(ConferenceSubjectEvent);
L_DECLARE_C_CLONABLE_STRUCT_IMPL(ChatMessageEvent);
using namespace std;
......
......@@ -37,6 +37,8 @@
F(ChatRoom, ChatRoom) \
F(ConferenceEvent, ConferenceEvent) \
F(ConferenceParticipantEvent, ConferenceParticipantEvent) \
F(ConferenceParticipantDeviceEvent, ConferenceParticipantDeviceEvent) \
F(ConferenceSubjectEvent, ConferenceSubjectEvent) \
F(DialPlan, DialPlan) \
F(EventLog, EventLog) \
F(MediaSessionParams, CallParams) \
......
......@@ -275,7 +275,7 @@ 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(
const ConferenceParticipantEvent event(
EventLog::Type::ConferenceParticipantAdded,
tm,
dConference->conferenceAddress,
......@@ -284,7 +284,7 @@ void ClientGroupChatRoom::onParticipantAdded (time_t tm, const Address &addr) {
);
if (cb)
cb(cr, L_GET_C_BACK_PTR(participant));
cb(cr, L_GET_C_BACK_PTR(&event));
}
void ClientGroupChatRoom::onParticipantRemoved (time_t tm, const Address &addr) {
......@@ -299,7 +299,7 @@ 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(
const ConferenceParticipantEvent event(
EventLog::Type::ConferenceParticipantRemoved,
tm,
dConference->conferenceAddress,
......@@ -308,7 +308,7 @@ void ClientGroupChatRoom::onParticipantRemoved (time_t tm, const Address &addr)
);
if (cb)
cb(cr, L_GET_C_BACK_PTR(participant));
cb(cr, L_GET_C_BACK_PTR(&event));
dConference->participants.remove(participant);
}
......@@ -329,7 +329,7 @@ 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(
const ConferenceParticipantEvent event(
isAdmin ? EventLog::Type::ConferenceParticipantSetAdmin : EventLog::Type::ConferenceParticipantUnsetAdmin,
tm,
dConference->conferenceAddress,
......@@ -338,7 +338,7 @@ void ClientGroupChatRoom::onParticipantSetAdmin (time_t tm, const Address &addr,
);
if (cb)
cb(cr, L_GET_C_BACK_PTR(participant), isAdmin);
cb(cr, L_GET_C_BACK_PTR(&event));
}
void ClientGroupChatRoom::onSubjectChanged (time_t tm, const std::string &subject) {
......@@ -347,7 +347,7 @@ void ClientGroupChatRoom::onSubjectChanged (time_t tm, const std::string &subjec
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(
const ConferenceSubjectEvent event(
tm,
dConference->conferenceAddress,
dConference->eventHandler->getLastNotify(),
......@@ -355,7 +355,7 @@ void ClientGroupChatRoom::onSubjectChanged (time_t tm, const std::string &subjec
);
if (cb)
cb(cr, subject.c_str());
cb(cr, L_GET_C_BACK_PTR(&event));
}
void ClientGroupChatRoom::onParticipantDeviceAdded (time_t tm, const Address &addr, const Address &gruu) {
......@@ -370,7 +370,10 @@ void ClientGroupChatRoom::onParticipantDeviceAdded (time_t tm, const Address &ad
return;
}
participant->getPrivate()->addDevice(gruu);
ConferenceParticipantDeviceEvent event(
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);
const ConferenceParticipantDeviceEvent event(
EventLog::Type::ConferenceParticipantDeviceAdded,
tm,
dConference->conferenceAddress,
......@@ -378,6 +381,9 @@ void ClientGroupChatRoom::onParticipantDeviceAdded (time_t tm, const Address &ad
addr,
gruu
);
if (cb)
cb(cr, L_GET_C_BACK_PTR(&event));
}
void ClientGroupChatRoom::onParticipantDeviceRemoved (time_t tm, const Address &addr, const Address &gruu) {
......@@ -392,7 +398,10 @@ void ClientGroupChatRoom::onParticipantDeviceRemoved (time_t tm, const Address &
return;
}
participant->getPrivate()->removeDevice(gruu);
ConferenceParticipantDeviceEvent event(
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);
const ConferenceParticipantDeviceEvent event(
EventLog::Type::ConferenceParticipantDeviceRemoved,
tm,
dConference->conferenceAddress,
......@@ -400,6 +409,9 @@ void ClientGroupChatRoom::onParticipantDeviceRemoved (time_t tm, const Address &
addr,
gruu
);
if (cb)
cb(cr, L_GET_C_BACK_PTR(&event));
}
// -----------------------------------------------------------------------------
......
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