Commit 2e210681 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Added generic event log callback

parent 66eccbbc
......@@ -329,6 +329,7 @@ void linphone_chat_room_set_call(LinphoneChatRoom *cr, LinphoneCall *call);
LinphoneChatRoomCbs * _linphone_chat_room_cbs_new (void);
void _linphone_chat_room_notify_is_composing_received(LinphoneChatRoom *cr, const LinphoneAddress *remoteAddr, bool_t isComposing);
void _linphone_chat_room_notify_message_received(LinphoneChatRoom *cr, LinphoneChatMessage *msg);
void _linphone_chat_room_notify_new_event(LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
void _linphone_chat_room_notify_participant_added(LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
void _linphone_chat_room_notify_participant_removed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
void _linphone_chat_room_notify_participant_device_added(LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
......
......@@ -219,6 +219,13 @@ typedef void (*LinphoneChatRoomCbsIsComposingReceivedCb) (LinphoneChatRoom *chat
*/
typedef void (*LinphoneChatRoomCbsMessageReceivedCb) (LinphoneChatRoom *chat_room, LinphoneChatMessage *message);
/**
* Callback used to notify a chat room that an event log has been created.
* @param chat_room #LinphoneChatRoom object @notnil
* @param event_log #LinphoneEventLog The event to be notified @notnil
*/
typedef void (*LinphoneChatRoomCbsNewEventCb) (LinphoneChatRoom *chat_room, const LinphoneEventLog *event_log);
/**
* Callback used to notify a chat room that a chat message has been received.
* @param chat_room #LinphoneChatRoom object @notnil
......
......@@ -89,6 +89,22 @@ LINPHONE_PUBLIC LinphoneChatRoomCbsMessageReceivedCb linphone_chat_room_cbs_get_
*/
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_message_received (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsMessageReceivedCb cb);
/**
* Get the new event log callback.
* This callback will be called before every other #LinphoneEventLog related callback.
* @param cbs #LinphoneChatRoomCbs object. @notnil
* @return The current event log created callback.
*/
LINPHONE_PUBLIC LinphoneChatRoomCbsNewEventCb linphone_chat_room_cbs_get_new_event (const LinphoneChatRoomCbs *cbs);
/**
* Set the new event log callback.
* This callback will be called before every other #LinphoneEventLog related callback.
* @param cbs #LinphoneChatRoomCbs object. @notnil
* @param cb The event log created callback to be used.
*/
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_new_event (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsNewEventCb cb);
/**
* Get the chat message received callback.
* @param cbs #LinphoneChatRoomCbs object. @notnil
......
......@@ -49,6 +49,7 @@ struct _LinphoneChatRoomCbs {
LinphoneChatRoomCbsEphemeralMessageTimerStartedCb EphemeralMessageTimerStartedCb;
LinphoneChatRoomCbsEphemeralMessageDeletedCb ephemeralMessageDeletedCb;
LinphoneChatRoomCbsChatMessageParticipantImdnStateChangedCb chatMessageParticipantImdnStateChangedCb;
LinphoneChatRoomCbsNewEventCb newEventCb;
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneChatRoomCbs);
......@@ -101,6 +102,14 @@ void linphone_chat_room_cbs_set_message_received (LinphoneChatRoomCbs *cbs, Linp
cbs->messageReceivedCb = cb;
}
LinphoneChatRoomCbsNewEventCb linphone_chat_room_cbs_get_new_event (const LinphoneChatRoomCbs *cbs) {
return cbs->newEventCb;
}
void linphone_chat_room_cbs_set_new_event (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsNewEventCb cb) {
cbs->newEventCb = cb;
}
LinphoneChatRoomCbsChatMessageReceivedCb linphone_chat_room_cbs_get_chat_message_received (const LinphoneChatRoomCbs *cbs) {
return cbs->chatMessageReceivedCb;
}
......
......@@ -522,23 +522,32 @@ void _linphone_chat_room_notify_message_received(LinphoneChatRoom *cr, LinphoneC
NOTIFY_IF_EXIST(MessageReceived, message_received, cr, msg)
}
void _linphone_chat_room_notify_new_event(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
NOTIFY_IF_EXIST(NewEvent, new_event, cr, event_log)
}
void _linphone_chat_room_notify_participant_added(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
_linphone_chat_room_notify_new_event(cr, event_log);
NOTIFY_IF_EXIST(ParticipantAdded, participant_added, cr, event_log)
}
void _linphone_chat_room_notify_participant_removed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
_linphone_chat_room_notify_new_event(cr, event_log);
NOTIFY_IF_EXIST(ParticipantRemoved, participant_removed, cr, event_log)
}
void _linphone_chat_room_notify_participant_device_added(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
_linphone_chat_room_notify_new_event(cr, event_log);
NOTIFY_IF_EXIST(ParticipantDeviceAdded, participant_device_added, cr, event_log)
}
void _linphone_chat_room_notify_participant_device_removed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
_linphone_chat_room_notify_new_event(cr, event_log);
NOTIFY_IF_EXIST(ParticipantDeviceRemoved, participant_device_removed, cr, event_log)
}
void _linphone_chat_room_notify_participant_admin_status_changed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
_linphone_chat_room_notify_new_event(cr, event_log);
NOTIFY_IF_EXIST(ParticipantAdminStatusChanged, participant_admin_status_changed, cr, event_log)
}
......@@ -547,31 +556,38 @@ void _linphone_chat_room_notify_state_changed(LinphoneChatRoom *cr, LinphoneChat
}
void _linphone_chat_room_notify_security_event(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
_linphone_chat_room_notify_new_event(cr, event_log);
NOTIFY_IF_EXIST(SecurityEvent, security_event, cr, event_log)
}
void _linphone_chat_room_notify_subject_changed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
_linphone_chat_room_notify_new_event(cr, event_log);
NOTIFY_IF_EXIST(SubjectChanged, subject_changed, cr, event_log)
}
void _linphone_chat_room_notify_conference_joined(LinphoneChatRoom *cr, const LinphoneEventLog *eventLog) {
NOTIFY_IF_EXIST(ConferenceJoined, conference_joined, cr, eventLog)
void _linphone_chat_room_notify_conference_joined(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
_linphone_chat_room_notify_new_event(cr, event_log);
NOTIFY_IF_EXIST(ConferenceJoined, conference_joined, cr, event_log)
}
void _linphone_chat_room_notify_conference_left(LinphoneChatRoom *cr, const LinphoneEventLog *eventLog) {
NOTIFY_IF_EXIST(ConferenceLeft, conference_left, cr, eventLog)
void _linphone_chat_room_notify_conference_left(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
_linphone_chat_room_notify_new_event(cr, event_log);
NOTIFY_IF_EXIST(ConferenceLeft, conference_left, cr, event_log)
}
void _linphone_chat_room_notify_ephemeral_event(LinphoneChatRoom *cr, const LinphoneEventLog *eventLog) {
NOTIFY_IF_EXIST(EphemeralEvent, ephemeral_event, cr, eventLog)
void _linphone_chat_room_notify_ephemeral_event(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
_linphone_chat_room_notify_new_event(cr, event_log);
NOTIFY_IF_EXIST(EphemeralEvent, ephemeral_event, cr, event_log)
}
void _linphone_chat_room_notify_ephemeral_message_timer_started(LinphoneChatRoom *cr, const LinphoneEventLog *eventLog) {
NOTIFY_IF_EXIST(EphemeralMessageTimerStarted, ephemeral_message_timer_started, cr, eventLog)
void _linphone_chat_room_notify_ephemeral_message_timer_started(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
_linphone_chat_room_notify_new_event(cr, event_log);
NOTIFY_IF_EXIST(EphemeralMessageTimerStarted, ephemeral_message_timer_started, cr, event_log)
}
void _linphone_chat_room_notify_ephemeral_message_deleted(LinphoneChatRoom *cr, const LinphoneEventLog *eventLog) {
NOTIFY_IF_EXIST(EphemeralMessageDeleted, ephemeral_message_deleted, cr, eventLog)
void _linphone_chat_room_notify_ephemeral_message_deleted(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
_linphone_chat_room_notify_new_event(cr, event_log);
NOTIFY_IF_EXIST(EphemeralMessageDeleted, ephemeral_message_deleted, cr, event_log)
}
void _linphone_chat_room_notify_undecryptable_message_received(LinphoneChatRoom *cr, LinphoneChatMessage *msg) {
......@@ -579,10 +595,12 @@ void _linphone_chat_room_notify_undecryptable_message_received(LinphoneChatRoom
}
void _linphone_chat_room_notify_chat_message_received(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
_linphone_chat_room_notify_new_event(cr, event_log);
NOTIFY_IF_EXIST(ChatMessageReceived, chat_message_received, cr, event_log)
}
void _linphone_chat_room_notify_chat_message_sent(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
_linphone_chat_room_notify_new_event(cr, event_log);
NOTIFY_IF_EXIST(ChatMessageSent, chat_message_sent, cr, event_log)
}
......
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