Commit 5b4c2cc8 authored by DanmeiChen's avatar DanmeiChen Committed by Sylvain Berfini
Browse files

add feature ephmeral message

fix wrapper swift

fix build windows

correct spelling and add useful logs

add events

fix indentation error

rename functions

Renamed expiredLifetime to expireLifetime + fixed long type in java wrapper

optimization of ephemeral message

Fixed issues in event logs filters

Added missing history size override

set expired time maximum by default

Added missing callback for ephemeral related event generated + moved ephemeral code to client-group-chat-room instead of chat-room

Added tag to epehemeral tests

fix expired time

remove useless item

fix spelling

Delete chat message from db before notifying the callbacks

Added ephemeral messages capability

Set ephemeral spec when creating Core

Started API to check if all participants in a chat room support ephemeral messages

Added callback on Core when an ephemeral message has expired

Use internal app directory as download path

Do not generate an ephemeral lifetime changed event when ephemeral feature is disabled

Changes regarding ephemeral time header used in CPIM

Fixed wrong callback called
parent 6603e354
......@@ -492,6 +492,14 @@ void linphone_core_cbs_set_chat_room_subject_changed (LinphoneCoreCbs *cbs, Linp
cbs->vtable->chat_room_subject_changed = cb;
}
LinphoneCoreCbsChatRoomEphemeralMessageDeleteCb linphone_core_cbs_get_chat_room_ephemeral_message_deleted (LinphoneCoreCbs *cbs) {
return cbs->vtable->chat_room_ephemeral_message_deleted;
}
void linphone_core_cbs_set_chat_room_ephemeral_message_deleted (LinphoneCoreCbs *cbs, LinphoneCoreCbsChatRoomEphemeralMessageDeleteCb cb) {
cbs->vtable->chat_room_ephemeral_message_deleted = cb;
}
LinphoneCoreCbsQrcodeFoundCb linphone_core_cbs_get_qrcode_found(LinphoneCoreCbs *cbs) {
return cbs->vtable->qrcode_found;
}
......@@ -2549,6 +2557,7 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
linphone_presence_model_set_basic_status(lc->presence_model, LinphonePresenceBasicStatusOpen);
_linphone_core_read_config(lc);
linphone_core_add_linphone_spec(lc, "ephemeral");
linphone_core_set_state(lc, LinphoneGlobalReady, "Ready");
if (automatically_start) {
......@@ -2607,7 +2616,7 @@ LinphoneStatus linphone_core_start (LinphoneCore *lc) {
} else {
linphone_configuring_terminated(lc, LinphoneConfiguringSkipped, NULL);
}
L_GET_PRIVATE_FROM_C_OBJECT(lc)->initEphemeralMessages();
return 0;
} catch (const CorePrivate::DatabaseConnectionFailure &e) {
bctbx_error("%s", e.what());
......
......@@ -838,7 +838,8 @@ LinphoneStatus linphone_presence_service_set_service_descriptions(LinphonePresen
namespace {
const std::unordered_map<int, std::string> CapabilityToString {
{ LinphoneFriendCapabilityGroupChat, "groupchat" },
{ LinphoneFriendCapabilityLimeX3dh, "lime" }
{ LinphoneFriendCapabilityLimeX3dh, "lime" },
{ LinphoneFriendCapabilityEphemeralMessages, "ephemeral" }
};
}
static std::string capability_to_string (const LinphoneFriendCapability capability) {
......@@ -1228,7 +1229,8 @@ void * linphone_presence_model_get_user_data(const LinphonePresenceModel *model)
namespace {
const std::unordered_map<std::string, LinphoneFriendCapability> StringToCapability {
{ "groupchat", LinphoneFriendCapabilityGroupChat },
{ "lime", LinphoneFriendCapabilityLimeX3dh }
{ "lime", LinphoneFriendCapabilityLimeX3dh },
{ "ephemeral", LinphoneFriendCapabilityEphemeralMessages }
};
}
static LinphoneFriendCapability get_capability_from_string (const std::string &capabilityName) {
......
......@@ -321,6 +321,9 @@ void _linphone_chat_room_notify_security_event(LinphoneChatRoom *cr, const Linph
void _linphone_chat_room_notify_subject_changed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
void _linphone_chat_room_notify_conference_joined(LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
void _linphone_chat_room_notify_conference_left(LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
void _linphone_chat_room_notify_ephemeral_event(LinphoneChatRoom *cr, const LinphoneEventLog *eventLog);
void _linphone_chat_room_notify_ephemeral_message_timer_started(LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
void _linphone_chat_room_notify_ephemeral_message_deleted(LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
void _linphone_chat_room_notify_undecryptable_message_received(LinphoneChatRoom *cr, LinphoneChatMessage *msg);
void _linphone_chat_room_notify_chat_message_received(LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
void _linphone_chat_room_notify_chat_message_sent(LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
......@@ -337,6 +340,8 @@ void _linphone_chat_message_notify_participant_imdn_state_changed(LinphoneChatMe
void _linphone_chat_message_notify_file_transfer_recv(LinphoneChatMessage *msg, const LinphoneContent* content, const LinphoneBuffer *buffer);
void _linphone_chat_message_notify_file_transfer_send(LinphoneChatMessage *msg, const LinphoneContent* content, size_t offset, size_t size);
void _linphone_chat_message_notify_file_transfer_progress_indication(LinphoneChatMessage *msg, const LinphoneContent* content, size_t offset, size_t total);
void _linphone_chat_message_notify_ephemeral_message_timer_started(LinphoneChatMessage* msg);
void _linphone_chat_message_notify_ephemeral_message_deleted(LinphoneChatMessage* msg);
void _linphone_chat_message_clear_callbacks (LinphoneChatMessage *msg);
......@@ -559,6 +564,7 @@ void linphone_core_notify_call_created(LinphoneCore *lc, LinphoneCall *call);
void linphone_core_notify_version_update_check_result_received(LinphoneCore *lc, LinphoneVersionUpdateCheckResult result, const char *version, const char *url);
void linphone_core_notify_chat_room_state_changed (LinphoneCore *lc, LinphoneChatRoom *cr, LinphoneChatRoomState state);
void linphone_core_notify_chat_room_subject_changed (LinphoneCore *lc, LinphoneChatRoom *cr);
void linphone_core_notify_chat_room_ephemeral_message_deleted (LinphoneCore *lc, LinphoneChatRoom *cr);
void linphone_core_notify_qrcode_found(LinphoneCore *lc, const char *result);
void linphone_core_notify_ec_calibration_result(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms);
void linphone_core_notify_ec_calibration_audio_init(LinphoneCore *lc);
......
......@@ -324,6 +324,11 @@ void linphone_core_notify_chat_room_subject_changed (LinphoneCore *lc, LinphoneC
cleanup_dead_vtable_refs(lc);
}
void linphone_core_notify_chat_room_ephemeral_message_deleted (LinphoneCore *lc, LinphoneChatRoom *cr) {
NOTIFY_IF_EXIST(chat_room_ephemeral_message_deleted, lc, cr);
cleanup_dead_vtable_refs(lc);
}
void linphone_core_notify_qrcode_found(LinphoneCore *lc, const char *result) {
NOTIFY_IF_EXIST(qrcode_found, lc, result);
cleanup_dead_vtable_refs(lc);
......
......@@ -169,6 +169,19 @@ typedef LinphoneBuffer * (*LinphoneChatMessageCbsFileTransferSendCb)(LinphoneCha
*/
typedef void (*LinphoneChatMessageCbsFileTransferProgressIndicationCb)(LinphoneChatMessage *msg, const LinphoneContent* content, size_t offset, size_t total);
/**
* Callback used to notify an ephemeral message that its lifespan before disappearing has started to decrease.
* This callback is called when the ephemeral message is read by the receiver.
* @param msg #LinphoneChatMessage object
*/
typedef void (*LinphoneChatMessageCbsEphemeralMessageTimerStartedCb)(LinphoneChatMessage* msg);
/**
* Call back used to notify ephemeral message is deleted.
* @param msg #LinphoneChatMessage object
*/
typedef void (*LinphoneChatMessageCbsEphemeralMessageDeletedCb)(LinphoneChatMessage* msg);
/**
* Is composing notification callback prototype.
* @param[in] cr #LinphoneChatRoom involved in the conversation
......@@ -275,6 +288,28 @@ typedef void (*LinphoneChatRoomCbsConferenceJoinedCb) (LinphoneChatRoom *cr, con
*/
typedef void (*LinphoneChatRoomCbsConferenceLeftCb) (LinphoneChatRoom *cr, const LinphoneEventLog *eventLog);
/**
* Callback used to notify a chat room that an ephemeral related event has been generated.
* @param[in] cr #LinphoneChatRoom object
* @param[in] event_log #LinphoneEventLog The event to be notified
*/
typedef void (*LinphoneChatRoomCbsEphemeralEventCb) (LinphoneChatRoom *cr, const LinphoneEventLog *eventLog);
/**
* Callback used to notify a chat room that the lifespan of an ephemeral message before disappearing has started to decrease.
* This callback is called when the ephemeral message is read by the receiver.
* @param[in] cr #LinphoneChatRoom object
* @param[in] event_log #LinphoneEventLog The event to be notified
*/
typedef void (*LinphoneChatRoomCbsEphemeralMessageTimerStartedCb) (LinphoneChatRoom *cr, const LinphoneEventLog *eventLog);
/**
* Callback used to notify a chat room that an ephemeral message has been deleted.
* @param[in] cr #LinphoneChatRoom object
* @param[in] event_log #LinphoneEventLog The event to be notified
*/
typedef void (*LinphoneChatRoomCbsEphemeralMessageDeletedCb) (LinphoneChatRoom *cr, const LinphoneEventLog *eventLog);
/**
* Callback used when a group chat room is created server-side to generate the address of the chat room.
* The function linphone_chat_room_set_conference_address() needs to be called by this callback.
......
......@@ -133,6 +133,34 @@ LINPHONE_PUBLIC LinphoneChatMessageCbsParticipantImdnStateChangedCb linphone_cha
*/
LINPHONE_PUBLIC void linphone_chat_message_cbs_set_participant_imdn_state_changed (LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsParticipantImdnStateChangedCb cb);
/**
* Get the current "ephemeral message timer started" callback. This callback is called when the message deletion timer starts (the message has been viewed).
* @param[in] cbs #LinphoneChatMessageCbs object.
* @return The current ephemeral message timer started callback.
*/
LINPHONE_PUBLIC LinphoneChatMessageCbsEphemeralMessageTimerStartedCb linphone_chat_message_cbs_get_ephemeral_message_timer_started (const LinphoneChatMessageCbs *cbs);
/**
* Set the ephemeral message timer started callback. This callback will be used when new message deletion timer starts (the message has been viewed).
* @param[in] cbs LinphoneChatMessageCbs object.
* @param[in] cb The ephemeral message timer started callback to be used.
*/
LINPHONE_PUBLIC void linphone_chat_message_cbs_set_ephemeral_message_timer_started (LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsEphemeralMessageTimerStartedCb cb);
/**
* Get the ephemeral message deleted callback. This callback is used when a message deletion timer runs out (message is deleted).
* @param[in] cbs #LinphoneChatMessageCbs object.
* @return The current ephemeral message deleted callback.
*/
LINPHONE_PUBLIC LinphoneChatMessageCbsEphemeralMessageDeletedCb linphone_chat_message_cbs_get_ephemeral_message_deleted (const LinphoneChatMessageCbs *cbs);
/**
* Set the ephemeral message deleted callback. This callback is used when new message deletion timer runs out (message is deleted).
* @param[in] cbs LinphoneChatMessageCbs object.
* @param[in] cb The ephemeral message deleted callback to be used.
*/
LINPHONE_PUBLIC void linphone_chat_message_cbs_set_ephemeral_message_deleted (LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsEphemeralMessageDeletedCb cb);
/**
* @}
*/
......
......@@ -361,6 +361,29 @@ LINPHONE_PUBLIC bool_t linphone_chat_message_is_forward (LinphoneChatMessage *ms
*/
LINPHONE_PUBLIC const char *linphone_chat_message_get_forward_info (const LinphoneChatMessage *msg);
/**
* Returns true if the chat message is an ephemeral message.
* An ephemeral message will automatically disappear from the recipient's screen after the message has been viewed.
* @param[in] msg #LinphoneChatMessage object.
* @return true if it is an ephemeral message, false otherwise
*/
LINPHONE_PUBLIC bool_t linphone_chat_message_is_ephemeral(const LinphoneChatMessage *msg);
/**
* Returns lifetime of an ephemeral message.
* The lifetime is the duration after which the ephemeral message will disappear once viewed.
* @param[in] msg #LinphoneChatMessage object.
* @return the lifetime of an ephemeral message, by default 86400s.
*/
LINPHONE_PUBLIC long linphone_chat_message_get_ephemeral_lifetime (const LinphoneChatMessage *msg);
/**
* Returns the real time at which an ephemeral message expires and will be deleted.
* @param[in] msg #LinphoneChatMessage object.
* @return the time at which an ephemeral message expires. 0 means the message has not been read.
*/
LINPHONE_PUBLIC time_t linphone_chat_message_get_ephemeral_expire_time (const LinphoneChatMessage *msg);
/**
* Fulfill a chat message char by char. Message linked to a Real Time Text Call send char in realtime following RFC 4103/T.140
* To commit a message, use #linphone_chat_room_send_message
......
......@@ -271,6 +271,48 @@ LINPHONE_PUBLIC LinphoneChatRoomCbsConferenceLeftCb linphone_chat_room_cbs_get_c
*/
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_conference_left (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsConferenceLeftCb cb);
/**
* Get the ephemeral event callback.
* @param[in] cbs #LinphoneChatRoomCbs object.
* @return The ephemeral event callback to be used.
*/
LINPHONE_PUBLIC LinphoneChatRoomCbsEphemeralEventCb linphone_chat_room_cbs_get_ephemeral_event (const LinphoneChatRoomCbs *cbs);
/**
* Set the ephemeral event callback.
* @param[in] cbs #LinphoneChatRoomCbs object.
* @param[in] cb The ephemeral event callback to be used.
*/
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_ephemeral_event (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsEphemeralEventCb cb);
/**
* Get the current "ephemeral message timer started" callback. This callback is called when a message deletion timer starts (the message has been viewed).
* @param[in] cbs LinphoneChatRoomCbs object.
* @return The current ephemeral message "timer started" callback.
*/
LINPHONE_PUBLIC LinphoneChatRoomCbsEphemeralMessageTimerStartedCb linphone_chat_room_cbs_get_ephemeral_message_timer_started (const LinphoneChatRoomCbs *cbs);
/**
* Set the ephemeral message timer started callback. This callback will be used when new message deletion timer starts (the message has been viewed).
* @param[in] cbs LinphoneChatRoomCbs object.
* @param[in] cb The ephemeral message timer started callback to be used.
*/
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_ephemeral_message_timer_started (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsEphemeralMessageTimerStartedCb cb);
/**
* Get the ephemeral message deleted callback. This callback is used when a message deletion timer runs out (message is deleted).
* @param[in] cbs LinphoneChatRoomCbs object.
* @return The current ephemeral message deleted callback.
*/
LINPHONE_PUBLIC LinphoneChatRoomCbsEphemeralMessageDeletedCb linphone_chat_room_cbs_get_ephemeral_message_deleted (const LinphoneChatRoomCbs *cbs);
/**
* Set the ephemeral message deleted callback. This callback is used when new message deletion timer runs out (message is deleted).
* @param[in] cbs LinphoneChatRoomCbs object.
* @param[in] cb The ephemeral message deleted callback to be used.
*/
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_ephemeral_message_deleted (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsEphemeralMessageDeletedCb cb);
/**
* Get the conference address generation callback.
* @param[in] cbs #LinphoneChatRoomCbs object
......
......@@ -156,6 +156,46 @@ LINPHONE_PUBLIC void linphone_chat_room_receive_chat_message (LinphoneChatRoom *
*/
LINPHONE_PUBLIC void linphone_chat_room_mark_as_read(LinphoneChatRoom *cr);
/**
* Enable or disable the ephemeral message feature in the chat room. Works only for conference based chat room.
* An ephemeral message will automatically disappear from the recipient's screen after the message has been viewed.
* @param[in] cr #LinphoneChatRoom object
* @param[in] ephem TRUE if the ephemeral message feature is enabled, FALSE otherwise.
*/
LINPHONE_PUBLIC void linphone_chat_room_enable_ephemeral (LinphoneChatRoom *cr, bool_t ephem);
/**
* Returns whether or not the ephemeral message feature is enabled in the chat room.
* @param[in] cr The #LinphoneChatRoom object corresponding to the conversation
* @return true if ephemeral is enabled, false otherwise.
*/
LINPHONE_PUBLIC bool_t linphone_chat_room_ephemeral_enabled (const LinphoneChatRoom *cr);
/**
* Set lifetime (in seconds) for all new ephemral messages in the chat room.
* After the message is read, it will be deleted after "time" seconds.
* @param[in] cr #LinphoneChatRoom object
* @param[in] time The ephemral lifetime, default 24h, 86400s
*/
LINPHONE_PUBLIC void linphone_chat_room_set_ephemeral_lifetime (LinphoneChatRoom *cr, long time);
/**
* Get lifetime (in seconds) for all new ephemeral messages in the chat room.
* After the message is read, it will be deleted after "time" seconds.
* @param[in] cr #LinphoneChatRoom object
* @return the ephemeral lifetime (in secoonds)
*/
LINPHONE_PUBLIC long linphone_chat_room_get_ephemeral_lifetime (const LinphoneChatRoom *cr);
/**
* Uses linphone spec to check if all participants support ephemeral messages.
* It doesn't prevent to send ephemeral messages in the room but those who don't support it
* won't delete messages after lifetime has expired.
* @param[in] cr #LinphoneChatRoom object
* @return true if all participants in the chat room support ephemeral messages, false otherwise
*/
LINPHONE_PUBLIC bool_t linphone_chat_room_ephemeral_supported_by_all_participants (const LinphoneChatRoom *cr);
/**
* Delete a message from the chat room history.
* @param[in] cr The #LinphoneChatRoom object corresponding to the conversation.
......
......@@ -169,6 +169,17 @@ LINPHONE_PUBLIC LinphoneAddress *linphone_event_log_get_security_event_faulty_de
*/
LINPHONE_PUBLIC const char *linphone_event_log_get_subject (const LinphoneEventLog *event_log);
// -----------------------------------------------------------------------------
// ConferenceEphemeralMessageEvent.
// -----------------------------------------------------------------------------
/**
* Returns the ephemeral message lifetime of a conference ephemeral message event.
* Ephemeral lifetime means the time before an ephemeral message which has been viewed gets deleted.
* @param[in] event_log A #LinphoneEventLog object.
* @return The ephemeral message lifetime.
*/
LINPHONE_PUBLIC long linphone_event_log_get_ephemeral_message_lifetime (const LinphoneEventLog *event_log);
/**
* @}
*/
......
......@@ -429,6 +429,13 @@ typedef void (*LinphoneCoreCbsChatRoomStateChangedCb) (LinphoneCore *lc, Linphon
*/
typedef void (*LinphoneCoreCbsChatRoomSubjectChangedCb) (LinphoneCore *lc, LinphoneChatRoom *cr);
/**
* Callback prototype telling that a #LinphoneChatRoom ephemeral message has expired.
* @param[in] lc #LinphoneCore object
* @param[in] cr The #LinphoneChatRoom object for which a message has expired.
*/
typedef void (*LinphoneCoreCbsChatRoomEphemeralMessageDeleteCb) (LinphoneCore *lc, LinphoneChatRoom *cr);
/**
* Callback prototype telling the result of decoded qrcode
* @param[in] lc LinphoneCore object
......
......@@ -232,6 +232,7 @@ typedef struct _LinphoneCoreVTable{
LinphoneCoreCbsMessageReceivedCb message_sent;
LinphoneCoreCbsChatRoomReadCb chat_room_read;
LinphoneCoreCbsChatRoomSubjectChangedCb chat_room_subject_changed;
LinphoneCoreCbsChatRoomEphemeralMessageDeleteCb chat_room_ephemeral_message_deleted;
void *user_data; /**<User data associated with the above callbacks */
} LinphoneCoreVTable;
......@@ -778,6 +779,20 @@ LINPHONE_PUBLIC LinphoneCoreCbsChatRoomSubjectChangedCb linphone_core_cbs_get_ch
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_chat_room_subject_changed (LinphoneCoreCbs *cbs, LinphoneCoreCbsChatRoomSubjectChangedCb cb);
/**
* Get the chat room ephemeral message deleted callback.
* @param[in] cbs #LinphoneCoreCbs object
* @return The current callback
*/
LINPHONE_PUBLIC LinphoneCoreCbsChatRoomEphemeralMessageDeleteCb linphone_core_cbs_get_chat_room_ephemeral_message_deleted (LinphoneCoreCbs *cbs);
/**
* Set the chat room ephemeral message deleted callback.
* @param[in] cbs #LinphoneCoreCbs object
* @param[in] cb The callback to use
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_chat_room_ephemeral_message_deleted (LinphoneCoreCbs *cbs, LinphoneCoreCbsChatRoomEphemeralMessageDeleteCb cb);
/**
* Get the qrcode found callback.
* @param[in] cbs LinphoneCoreCbs object
......
......@@ -37,5 +37,8 @@
F(ConferenceParticipantDeviceRemoved /**< Conference participant device (removed) event */) \
F(ConferenceSubjectChanged /**< Conference subject event */) \
F(ConferenceSecurityEvent /**< Conference encryption security event*/) \
F(ConferenceEphemeralMessageLifetimeChanged /**< Conference ephemeral message (ephemeral message lifetime changed) event */) \
F(ConferenceEphemeralMessageEnabled /**< Conference ephemeral message (ephemeral message enabled) event */) \
F(ConferenceEphemeralMessageDisabled /**< Conference ephemeral message (ephemeral message disabled) event */) \
#endif // ifndef _L_EVENT_LOG_ENUMS_H_
......@@ -470,7 +470,8 @@ typedef struct _LinphoneFriend LinphoneFriend;
typedef enum _LinphoneFriendCapability {
LinphoneFriendCapabilityNone = 0,
LinphoneFriendCapabilityGroupChat = 1 << 0,
LinphoneFriendCapabilityLimeX3dh = 1 << 1
LinphoneFriendCapabilityLimeX3dh = 1 << 1,
LinphoneFriendCapabilityEphemeralMessages = 1 << 2
} LinphoneFriendCapability;
/**
......
......@@ -242,6 +242,11 @@ namespace Private {
CLASS \
>::type * \
>(getPublic());
// -----------------------------------------------------------------------------
// Macro.
// -----------------------------------------------------------------------------
#define EPHEMERAL_MESSAGE_TASKS_MAX_NB 10
// -----------------------------------------------------------------------------
// Overload.
......
......@@ -199,6 +199,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
event-log/conference/conference-event.h
event-log/conference/conference-notified-event-p.h
event-log/conference/conference-notified-event.h
event-log/conference/conference-ephemeral-message-event.h
event-log/conference/conference-participant-device-event.h
event-log/conference/conference-participant-event-p.h
event-log/conference/conference-participant-event.h
......@@ -361,6 +362,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
event-log/conference/conference-participant-event.cpp
event-log/conference/conference-security-event.cpp
event-log/conference/conference-subject-event.cpp
event-log/conference/conference-ephemeral-message-event.cpp
event-log/event-log.cpp
hacks/hacks.cpp
logger/logger.cpp
......
......@@ -31,6 +31,8 @@ struct _LinphoneChatMessageCbs {
LinphoneChatMessageCbsFileTransferSendCb file_transfer_send;
LinphoneChatMessageCbsFileTransferProgressIndicationCb file_transfer_progress_indication;
LinphoneChatMessageCbsParticipantImdnStateChangedCb participant_imdn_state_changed;
LinphoneChatMessageCbsEphemeralMessageTimerStartedCb ephemeral_message_timer_started;
LinphoneChatMessageCbsEphemeralMessageDeletedCb ephemeral_message_deleted;
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneChatMessageCbs);
......@@ -131,3 +133,29 @@ void linphone_chat_message_cbs_set_participant_imdn_state_changed (
) {
cbs->participant_imdn_state_changed = cb;
}
LinphoneChatMessageCbsEphemeralMessageTimerStartedCb linphone_chat_message_cbs_get_ephemeral_message_timer_started (
const LinphoneChatMessageCbs *cbs
) {
return cbs->ephemeral_message_timer_started;
}
void linphone_chat_message_cbs_set_ephemeral_message_timer_started (
LinphoneChatMessageCbs *cbs,
LinphoneChatMessageCbsEphemeralMessageTimerStartedCb cb
) {
cbs->ephemeral_message_timer_started = cb;
}
LinphoneChatMessageCbsEphemeralMessageDeletedCb linphone_chat_message_cbs_get_ephemeral_message_deleted (
const LinphoneChatMessageCbs *cbs
) {
return cbs->ephemeral_message_deleted;
}
void linphone_chat_message_cbs_set_ephemeral_message_deleted (
LinphoneChatMessageCbs *cbs,
LinphoneChatMessageCbsEphemeralMessageDeletedCb cb
) {
cbs->ephemeral_message_deleted = cb;
}
......@@ -168,6 +168,14 @@ void _linphone_chat_message_notify_file_transfer_progress_indication(LinphoneCha
NOTIFY_IF_EXIST(FileTransferProgressIndication, file_transfer_progress_indication, msg, content, offset, total)
}
void _linphone_chat_message_notify_ephemeral_message_timer_started(LinphoneChatMessage* msg) {
NOTIFY_IF_EXIST(EphemeralMessageTimerStarted, ephemeral_message_timer_started, msg)
}
void _linphone_chat_message_notify_ephemeral_message_deleted(LinphoneChatMessage* msg) {
NOTIFY_IF_EXIST(EphemeralMessageDeleted, ephemeral_message_deleted, msg)
}
// =============================================================================
// Getter and setters
// =============================================================================
......@@ -250,6 +258,18 @@ const char *linphone_chat_message_get_forward_info (const LinphoneChatMessage *m
return L_STRING_TO_C(L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getForwardInfo());
}
bool_t linphone_chat_message_is_ephemeral (const LinphoneChatMessage *msg) {
return L_GET_CPP_PTR_FROM_C_OBJECT(msg)->isEphemeral();
}
long linphone_chat_message_get_ephemeral_lifetime (const LinphoneChatMessage *msg) {
return L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getEphemeralLifetime();
}
time_t linphone_chat_message_get_ephemeral_expire_time (const LinphoneChatMessage *msg) {
return L_GET_CPP_PTR_FROM_C_OBJECT(msg)->getEphemeralExpireTime();
}
void linphone_chat_message_add_custom_header(
LinphoneChatMessage *msg,
const char *header_name,
......
......@@ -45,6 +45,9 @@ struct _LinphoneChatRoomCbs {
LinphoneChatRoomCbsParticipantRegistrationSubscriptionRequestedCb participantRegistrationSubscriptionRequestedCb;
LinphoneChatRoomCbsParticipantRegistrationUnsubscriptionRequestedCb participantRegistrationUnsubscriptionRequestedCb;
LinphoneChatRoomCbsShouldChatMessageBeStoredCb shouldMessageBeStoredCb;
LinphoneChatRoomCbsEphemeralEventCb ephemeralEventCb;
LinphoneChatRoomCbsEphemeralMessageTimerStartedCb EphemeralMessageTimerStartedCb;
LinphoneChatRoomCbsEphemeralMessageDeletedCb ephemeralMessageDeletedCb;
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneChatRoomCbs);
......@@ -201,6 +204,30 @@ void linphone_chat_room_cbs_set_conference_left (LinphoneChatRoomCbs *cbs, Linph
cbs->conferenceLeftCb = cb;
}
LinphoneChatRoomCbsEphemeralEventCb linphone_chat_room_cbs_get_ephemeral_event (const LinphoneChatRoomCbs *cbs) {
return cbs->ephemeralEventCb;
}
void linphone_chat_room_cbs_set_ephemeral_event (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsEphemeralEventCb cb) {
cbs->ephemeralEventCb = cb;
}
LinphoneChatRoomCbsEphemeralMessageTimerStartedCb linphone_chat_room_cbs_get_ephemeral_message_timer_started (const LinphoneChatRoomCbs *cbs) {
return cbs->EphemeralMessageTimerStartedCb;
}
void linphone_chat_room_cbs_set_ephemeral_message_timer_started (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsEphemeralMessageTimerStartedCb cb) {
cbs->EphemeralMessageTimerStartedCb = cb;
}
LinphoneChatRoomCbsEphemeralMessageDeletedCb linphone_chat_room_cbs_get_ephemeral_message_deleted (const LinphoneChatRoomCbs *cbs) {
return cbs->ephemeralMessageDeletedCb;
}
void linphone_chat_room_cbs_set_ephemeral_message_deleted (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsEphemeralMessageDeletedCb cb) {
cbs->ephemeralMessageDeletedCb = cb;
}
LinphoneChatRoomCbsConferenceAddressGenerationCb linphone_chat_room_cbs_get_conference_address_generation (const LinphoneChatRoomCbs *cbs) {
return cbs->conferenceAddressGenerationCb;
}
......
......@@ -209,6 +209,26 @@ void linphone_chat_room_mark_as_read (LinphoneChatRoom *cr) {
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->markAsRead();
}
void linphone_chat_room_enable_ephemeral (LinphoneChatRoom *cr, bool_t ephem) {
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->enableEphemeral(!!ephem, true);
}
bool_t linphone_chat_room_ephemeral_enabled (const LinphoneChatRoom *cr) {
return (bool_t)L_GET_CPP_PTR_FROM_C_OBJECT(cr)->ephemeralEnabled();
}
void linphone_chat_room_set_ephemeral_lifetime (LinphoneChatRoom *cr, long time) {
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->setEphemeralLifetime(time, true);
}
long linphone_chat_room_get_ephemeral_lifetime (const LinphoneChatRoom *cr) {
return L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getEphemeralLifetime();
}
bool_t linphone_chat_room_ephemeral_supported_by_all_participants (const LinphoneChatRoom *cr) {
return (bool_t)L_GET_CPP_PTR_FROM_C_OBJECT(cr)->ephemeralSupportedByAllParticipants();
}
int linphone_chat_room_get_unread_messages_count (LinphoneChatRoom *cr) {
return L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getUnreadChatMessageCount();
}
......@@ -517,6 +537,18 @@ void _linphone_chat_room_notify_conference_left(LinphoneChatRoom *cr, const Linp
NOTIFY_IF_EXIST(ConferenceLeft, conference_left, cr, eventLog)
}
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_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_deleted(LinphoneChatRoom *cr, const LinphoneEventLog *eventLog) {
NOTIFY_IF_EXIST(EphemeralMessageDeleted, ephemeral_message_deleted, cr, eventLog)
}
void _linphone_chat_room_notify_undecryptable_message_received(LinphoneChatRoom *cr, LinphoneChatMessage *msg) {
NOTIFY_IF_EXIST(UndecryptableMessageReceived, undecryptable_message_received, cr, msg)
}
......
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