Commit 42cb9e22 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Added 2 new Core callbacks for Android app

parent ff8ca06f
......@@ -280,6 +280,22 @@ void linphone_core_cbs_set_call_log_updated(LinphoneCoreCbs *cbs, LinphoneCoreCb
cbs->vtable->call_log_updated = cb;
}
LinphoneCoreCbsChatRoomReadCb linphone_core_cbs_get_chat_room_read(LinphoneCoreCbs *cbs) {
return cbs->vtable->chat_room_read;
}
void linphone_core_cbs_set_chat_room_read(LinphoneCoreCbs *cbs, LinphoneCoreCbsChatRoomReadCb cb) {
cbs->vtable->chat_room_read = cb;
}
LinphoneCoreCbsMessageReceivedCb linphone_core_cbs_get_message_sent(LinphoneCoreCbs *cbs) {
return cbs->vtable->message_sent;
}
void linphone_core_cbs_set_message_sent(LinphoneCoreCbs *cbs, LinphoneCoreCbsMessageReceivedCb cb) {
cbs->vtable->message_sent = cb;
}
LinphoneCoreCbsMessageReceivedCb linphone_core_cbs_get_message_received(LinphoneCoreCbs *cbs) {
return cbs->vtable->message_received;
}
......
......@@ -531,7 +531,9 @@ void linphone_core_notify_authentication_requested(LinphoneCore *lc, LinphoneAut
void linphone_core_notify_call_log_updated(LinphoneCore *lc, LinphoneCallLog *newcl);
void linphone_core_notify_text_message_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message);
void linphone_core_notify_message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message);
void linphone_core_notify_message_sent(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message);
void linphone_core_notify_message_received_unable_decrypt(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message);
void linphone_core_notify_chat_room_read(LinphoneCore *lc, LinphoneChatRoom *room);
void linphone_core_notify_file_transfer_recv(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, const char* buff, size_t size);
void linphone_core_notify_file_transfer_send(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, char* buff, size_t* size);
void linphone_core_notify_file_transfer_progress_indication(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total);
......
......@@ -162,7 +162,17 @@ void linphone_core_notify_text_message_received(LinphoneCore *lc, LinphoneChatRo
#endif
void linphone_core_notify_message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message){
NOTIFY_IF_EXIST(message_received, lc,room,message);
NOTIFY_IF_EXIST(message_received, lc, room, message);
cleanup_dead_vtable_refs(lc);
}
void linphone_core_notify_message_sent(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message){
NOTIFY_IF_EXIST(message_sent, lc, room, message);
cleanup_dead_vtable_refs(lc);
}
void linphone_core_notify_chat_room_read(LinphoneCore *lc, LinphoneChatRoom *room){
NOTIFY_IF_EXIST(chat_room_read, lc, room);
cleanup_dead_vtable_refs(lc);
}
......
......@@ -194,11 +194,26 @@ typedef void (*LinphoneCoreTextMessageReceivedCb)(LinphoneCore *lc, LinphoneChat
*/
typedef void (*LinphoneCoreCbsMessageReceivedCb)(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message);
/**
* Chat message callback prototype
* @param lc #LinphoneCore object
* @param room #LinphoneChatRoom involved in this conversation. Can be be created by the framework in case \link #LinphoneAddress the from \endlink is not present in any chat room.
* @param #LinphoneChatMessage outgoing message
*/
typedef void (*LinphoneCoreCbsMessageSentCb)(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message);
/**
* Old name of #LinphoneCoreCbsMessageReceivedCb.
*/
typedef LinphoneCoreCbsMessageReceivedCb LinphoneCoreMessageReceivedCb;
/**
* Chat room marked as read callback
* @param lc #LinphoneCore object
* @param room #LinphoneChatRoom that has been marked as read.
*/
typedef void (*LinphoneCoreCbsChatRoomReadCb)(LinphoneCore *lc, LinphoneChatRoom *room);
/**
* Chat message not decrypted callback prototype
* @param lc #LinphoneCore object
......
......@@ -229,6 +229,8 @@ typedef struct _LinphoneCoreVTable{
LinphoneCoreCbsEcCalibrationResultCb ec_calibration_result;
LinphoneCoreCbsEcCalibrationAudioInitCb ec_calibration_audio_init;
LinphoneCoreCbsEcCalibrationAudioUninitCb ec_calibration_audio_uninit;
LinphoneCoreCbsMessageReceivedCb message_sent;
LinphoneCoreCbsChatRoomReadCb chat_room_read;
void *user_data; /**<User data associated with the above callbacks */
} LinphoneCoreVTable;
......@@ -425,6 +427,34 @@ LINPHONE_PUBLIC void linphone_core_cbs_set_message_received(LinphoneCoreCbs *cbs
*/
LINPHONE_PUBLIC LinphoneCoreCbsMessageReceivedCb linphone_core_cbs_get_message_received(LinphoneCoreCbs *cbs);
/**
* Set the #LinphoneCoreCbsMessageSentCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_message_sent(LinphoneCoreCbs *cbs, LinphoneCoreCbsMessageSentCb cb);
/**
* Get the #LinphoneCoreCbsMessageSentCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @return The callback.
*/
LINPHONE_PUBLIC LinphoneCoreCbsMessageSentCb linphone_core_cbs_get_message_sent(LinphoneCoreCbs *cbs);
/**
* Set the #LinphoneCoreCbsChatRoomReadCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_chat_room_read(LinphoneCoreCbs *cbs, LinphoneCoreCbsChatRoomReadCb cb);
/**
* Get the #LinphoneCoreCbsChatRoomReadCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @return The callback.
*/
LINPHONE_PUBLIC LinphoneCoreCbsChatRoomReadCb linphone_core_cbs_get_chat_room_read(LinphoneCoreCbs *cbs);
/**
* Set the #LinphoneCoreCbsMessageReceivedUnableDecryptCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
......
......@@ -65,6 +65,7 @@ void ChatRoomPrivate::sendChatMessage (const shared_ptr<ChatMessage> &chatMessag
event = make_shared<ConferenceChatMessageEvent>(time(nullptr), chatMessage);
_linphone_chat_room_notify_chat_message_sent(cr, L_GET_C_BACK_PTR(event));
linphone_core_notify_message_sent(q->getCore()->getCCore(), cr, L_GET_C_BACK_PTR(chatMessage));
}
if (isComposing)
......@@ -551,6 +552,7 @@ void ChatRoom::markAsRead () {
}
dCore->mainDb->markChatMessagesAsRead(d->conferenceId);
linphone_core_notify_chat_room_read(getCore()->getCCore(), d->getCChatRoom());
}
const std::shared_ptr<ChatRoomParams> &ChatRoom::getCurrentParams() const {
......
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