Commit b969749c authored by Ronan's avatar Ronan

feat(c-event-log): add impl

parent 7e083459
......@@ -204,7 +204,6 @@ LINPHONE_PUBLIC const LinphoneAddress *linphone_conference_participant_device_ev
* Constructs a #LinphoneConferenceSubjectEvent object.
**/
LINPHONE_PUBLIC LinphoneConferenceSubjectEvent *linphone_conference_subject_event_new (
LinphoneEventLogType type,
time_t time,
const LinphoneAddress *conference_address,
unsigned int notify_id,
......
......@@ -17,7 +17,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "linphone/api/c-chat-message.h"
#include "linphone/api/c-event-log.h"
#include "c-wrapper/c-wrapper.h"
......@@ -30,6 +29,7 @@
L_DECLARE_C_OBJECT_IMPL(ConferenceCallEvent);
L_DECLARE_C_OBJECT_IMPL(ConferenceChatMessageEvent);
L_DECLARE_C_OBJECT_IMPL(ConferenceEvent);
L_DECLARE_C_OBJECT_IMPL(ConferenceNotifiedEvent);
L_DECLARE_C_OBJECT_IMPL(ConferenceParticipantDeviceEvent);
L_DECLARE_C_OBJECT_IMPL(ConferenceParticipantEvent);
L_DECLARE_C_OBJECT_IMPL(ConferenceSubjectEvent);
......@@ -38,11 +38,11 @@ L_DECLARE_C_OBJECT_IMPL(EventLog);
using namespace std;
// -----------------------------------------------------------------------------
// Event log.
// EventLog.
// -----------------------------------------------------------------------------
LinphoneEventLog *linphone_event_log_new () {
LinphoneEventLog *event_log = _linphone_EventLog_init();
LinphoneEventLog *event_log = L_INIT(EventLog);
L_SET_CPP_PTR_FROM_C_OBJECT(event_log, make_shared<LinphonePrivate::EventLog>());
return event_log;
}
......@@ -52,18 +52,88 @@ LinphoneEventLog *linphone_event_log_ref (LinphoneEventLog *event_log) {
return event_log;
}
void linphone_event_log_unref (LinphoneEventLog *event_log) {
belle_sip_object_unref(event_log);
}
LinphoneEventLogType linphone_event_log_get_type (const LinphoneEventLog *event_log) {
return static_cast<LinphoneEventLogType>(
L_GET_CPP_PTR_FROM_C_OBJECT(event_log)->getType()
);
}
time_t linphone_event_log_get_time (const LinphoneEventLog *event_log) {
return L_GET_CPP_PTR_FROM_C_OBJECT(event_log)->getTime();
}
// -----------------------------------------------------------------------------
// ConferenceEvent.
// -----------------------------------------------------------------------------
LinphoneConferenceEvent *linphone_conference_event_new (
LinphoneEventLogType type,
time_t time,
const LinphoneAddress *conference_address
) {
LinphoneConferenceEvent *conference_event = L_INIT(ConferenceEvent);
L_SET_CPP_PTR_FROM_C_OBJECT(
conference_event,
make_shared<LinphonePrivate::ConferenceEvent>(
static_cast<LinphonePrivate::EventLog::Type>(type),
time,
*L_GET_CPP_PTR_FROM_C_OBJECT(conference_address)
)
);
return conference_event;
}
const LinphoneAddress *linphone_conference_event_get_conference_address (
const LinphoneConferenceEvent *conference_event
) {
return L_GET_C_BACK_PTR(
&L_GET_CPP_PTR_FROM_C_OBJECT(conference_event)->getConferenceAddress()
);
}
// -----------------------------------------------------------------------------
// Call event.
// ConferenceNotifiedEvent.
// -----------------------------------------------------------------------------
LinphoneConferenceCallEvent *linphone_conference_call_event_new (LinphoneEventLogType type, time_t time, LinphoneCall *call) {
LinphoneConferenceCallEvent *conference_call_event = _linphone_ConferenceCallEvent_init();
LinphoneConferenceNotifiedEvent *linphone_conference_notified_event_new (
LinphoneEventLogType type,
time_t time,
const LinphoneAddress *conference_address,
unsigned int notify_id
) {
LinphoneConferenceNotifiedEvent *conference_notified_event = L_INIT(ConferenceNotifiedEvent);
L_SET_CPP_PTR_FROM_C_OBJECT(
conference_notified_event,
make_shared<LinphonePrivate::ConferenceNotifiedEvent>(
static_cast<LinphonePrivate::EventLog::Type>(type),
time,
*L_GET_CPP_PTR_FROM_C_OBJECT(conference_address),
notify_id
)
);
return conference_notified_event;
}
unsigned int linphone_conference_notified_event_get_notify_id (
const LinphoneConferenceNotifiedEvent *conference_notified_event
) {
return L_GET_CPP_PTR_FROM_C_OBJECT(conference_notified_event)->getNotifyId();
}
// -----------------------------------------------------------------------------
// ConferenceCallEvent.
// -----------------------------------------------------------------------------
LinphoneConferenceCallEvent *linphone_conference_call_event_new (
LinphoneEventLogType type,
time_t time,
LinphoneCall *call
) {
LinphoneConferenceCallEvent *conference_call_event = L_INIT(ConferenceCallEvent);
L_SET_CPP_PTR_FROM_C_OBJECT(
conference_call_event,
make_shared<LinphonePrivate::ConferenceCallEvent>(
......@@ -82,64 +152,130 @@ LinphoneCall *linphone_conference_call_event_get_call (const LinphoneConferenceC
}
// -----------------------------------------------------------------------------
// Conference event.
// ConferenceChatMessageEvent.
// -----------------------------------------------------------------------------
LinphoneConferenceEvent *linphone_conference_event_new (
LinphoneEventLogType type,
LinphoneConferenceChatMessageEvent *linphone_conference_chat_message_event_new (
time_t time,
const LinphoneAddress *address
LinphoneChatMessage *chat_message
) {
// TODO.
return nullptr;
LinphoneConferenceChatMessageEvent *conference_chat_message_event = L_INIT(ConferenceChatMessageEvent);
L_SET_CPP_PTR_FROM_C_OBJECT(
conference_chat_message_event,
make_shared<LinphonePrivate::ConferenceChatMessageEvent>(
time,
L_GET_CPP_PTR_FROM_C_OBJECT(chat_message)
)
);
return conference_chat_message_event;
}
const LinphoneAddress *linphone_conference_event_get_address (const LinphoneConferenceEvent *conference_event) {
// TODO.
return nullptr;
LinphoneChatMessage *linphone_conference_chat_message_event_get_chat_message (
const LinphoneConferenceChatMessageEvent *conference_chat_message_event
) {
return L_GET_C_BACK_PTR(
L_GET_CPP_PTR_FROM_C_OBJECT(conference_chat_message_event)->getChatMessage()
);
}
// -----------------------------------------------------------------------------
// Conference participant event.
// ConferenceParticipantEvent.
// -----------------------------------------------------------------------------
LinphoneConferenceParticipantEvent *linphone_conference_participant_event_new (
LinphoneEventLogType type,
time_t time,
const LinphoneAddress *conferenceAddress,
const LinphoneAddress *participantAddress
const LinphoneAddress *conference_address,
unsigned int notify_id,
const LinphoneAddress *participant_address
) {
// TODO.
return nullptr;
LinphoneConferenceParticipantEvent *conference_participant_event = L_INIT(ConferenceParticipantEvent);
L_SET_CPP_PTR_FROM_C_OBJECT(
conference_participant_event,
make_shared<LinphonePrivate::ConferenceParticipantEvent>(
static_cast<LinphonePrivate::EventLog::Type>(type),
time,
*L_GET_CPP_PTR_FROM_C_OBJECT(conference_address),
notify_id,
*L_GET_CPP_PTR_FROM_C_OBJECT(participant_address)
)
);
return conference_participant_event;
}
const LinphoneAddress *linphone_conference_participant_event_get_participant_address (
const LinphoneConferenceParticipantEvent *conference_participant_event
) {
// TODO.
return nullptr;
return L_GET_C_BACK_PTR(
&L_GET_CPP_PTR_FROM_C_OBJECT(conference_participant_event)->getParticipantAddress()
);
}
// -----------------------------------------------------------------------------
// Message event.
// ConferenceParticipantDeviceEvent.
// -----------------------------------------------------------------------------
LinphoneConferenceChatMessageEvent *linphone_chat_message_event_new (LinphoneChatMessage *chat_message, time_t time) {
LinphoneConferenceChatMessageEvent *chat_message_event = _linphone_ConferenceChatMessageEvent_init();
LinphoneConferenceParticipantDeviceEvent *linphone_conference_participant_device_event_new (
LinphoneEventLogType type,
time_t time,
const LinphoneAddress *conference_address,
unsigned int notify_id,
const LinphoneAddress *participant_address,
const LinphoneAddress *gruu_address
) {
LinphoneConferenceParticipantDeviceEvent *conference_participant_device_event = L_INIT(
ConferenceParticipantDeviceEvent
);
L_SET_CPP_PTR_FROM_C_OBJECT(
chat_message_event,
make_shared<LinphonePrivate::ConferenceChatMessageEvent>(
conference_participant_device_event,
make_shared<LinphonePrivate::ConferenceParticipantDeviceEvent>(
static_cast<LinphonePrivate::EventLog::Type>(type),
time,
L_GET_CPP_PTR_FROM_C_OBJECT(chat_message)
*L_GET_CPP_PTR_FROM_C_OBJECT(conference_address),
notify_id,
*L_GET_CPP_PTR_FROM_C_OBJECT(participant_address),
*L_GET_CPP_PTR_FROM_C_OBJECT(gruu_address)
)
);
return chat_message_event;
return conference_participant_device_event;
}
LinphoneChatMessage *linphone_chat_message_event_get_chat_message (
const LinphoneConferenceChatMessageEvent *chat_message_event
const LinphoneAddress *linphone_conference_participant_device_event_get_gruu_address (
const LinphoneConferenceParticipantDeviceEvent *conference_participant_device_event
) {
return L_GET_C_BACK_PTR(
L_GET_CPP_PTR_FROM_C_OBJECT(chat_message_event)->getChatMessage()
&L_GET_CPP_PTR_FROM_C_OBJECT(conference_participant_device_event)->getGruuAddress()
);
}
// -----------------------------------------------------------------------------
// ConferenceSubjectEvent.
// -----------------------------------------------------------------------------
LinphoneConferenceSubjectEvent *linphone_conference_subject_event_new (
LinphoneEventLogType type,
time_t time,
const LinphoneAddress *conference_address,
unsigned int notify_id,
const char *subject
) {
LinphoneConferenceSubjectEvent *conference_subject_event = L_INIT(ConferenceSubjectEvent);
L_SET_CPP_PTR_FROM_C_OBJECT(
conference_subject_event,
make_shared<LinphonePrivate::ConferenceSubjectEvent>(
time,
*L_GET_CPP_PTR_FROM_C_OBJECT(conference_address),
notify_id,
L_C_TO_STRING(subject)
)
);
return conference_subject_event;
}
LINPHONE_PUBLIC const char *linphone_conference_subject_event_get_subject (
const LinphoneConferenceSubjectEvent *conference_subject_event
) {
return L_STRING_TO_C(
L_GET_CPP_PTR_FROM_C_OBJECT(conference_subject_event)->getSubject()
);
}
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