Commit 410f5b9e authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Revert message callbacks moved to LinphoneChatRoom instead of LinphoneChatMessage.

parent 9867c2fe
...@@ -110,69 +110,6 @@ void linphone_chat_message_cbs_set_file_transfer_progress_indication( ...@@ -110,69 +110,6 @@ void linphone_chat_message_cbs_set_file_transfer_progress_indication(
} }
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneChatRoomCbs);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneChatRoomCbs, belle_sip_object_t,
NULL, // destroy
NULL, // clone
NULL, // marshal
FALSE);
LinphoneChatRoomCbs *linphone_chat_room_cbs_new(void) {
return belle_sip_object_new(LinphoneChatRoomCbs);
}
LinphoneChatRoomCbs *linphone_chat_room_cbs_ref(LinphoneChatRoomCbs *cbs) {
belle_sip_object_ref(cbs);
return cbs;
}
void linphone_chat_room_cbs_unref(LinphoneChatRoomCbs *cbs) {
belle_sip_object_unref(cbs);
}
void *linphone_chat_room_cbs_get_user_data(const LinphoneChatRoomCbs *cbs) {
return cbs->user_data;
}
void linphone_chat_room_cbs_set_user_data(LinphoneChatRoomCbs *cbs, void *ud) {
cbs->user_data = ud;
}
LinphoneChatRoomCbsMsgStateChangedCb linphone_chat_room_cbs_get_msg_state_changed(const LinphoneChatRoomCbs *cbs) {
return cbs->msg_state_changed;
}
void linphone_chat_room_cbs_set_msg_state_changed(LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsMsgStateChangedCb cb) {
cbs->msg_state_changed = cb;
}
LinphoneChatRoomCbsFileTransferRecvCb linphone_chat_room_cbs_get_file_transfer_recv(const LinphoneChatRoomCbs *cbs) {
return cbs->file_transfer_recv;
}
void linphone_chat_room_cbs_set_file_transfer_recv(LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsFileTransferRecvCb cb) {
cbs->file_transfer_recv = cb;
}
LinphoneChatRoomCbsFileTransferSendCb linphone_chat_room_cbs_get_file_transfer_send(const LinphoneChatRoomCbs *cbs) {
return cbs->file_transfer_send;
}
void linphone_chat_room_cbs_set_file_transfer_send(LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsFileTransferSendCb cb) {
cbs->file_transfer_send = cb;
}
LinphoneChatRoomCbsFileTransferProgressIndicationCb linphone_chat_room_cbs_get_file_transfer_progress_indication(const LinphoneChatRoomCbs *cbs) {
return cbs->file_transfer_progress_indication;
}
void linphone_chat_room_cbs_set_file_transfer_progress_indication(LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsFileTransferProgressIndicationCb cb) {
cbs->file_transfer_progress_indication = cb;
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneChatMessage); BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneChatMessage);
static void _linphone_chat_room_destroy(LinphoneChatRoom *cr) { static void _linphone_chat_room_destroy(LinphoneChatRoom *cr) {
...@@ -197,9 +134,6 @@ static void _linphone_chat_room_destroy(LinphoneChatRoom *cr) { ...@@ -197,9 +134,6 @@ static void _linphone_chat_room_destroy(LinphoneChatRoom *cr) {
if (cr->pending_message) if (cr->pending_message)
linphone_chat_message_destroy(cr->pending_message); linphone_chat_message_destroy(cr->pending_message);
ms_free(cr->peer); ms_free(cr->peer);
if (cr->callbacks) {
linphone_chat_room_cbs_unref(cr->callbacks);
}
} }
void linphone_chat_message_set_state(LinphoneChatMessage *msg, LinphoneChatMessageState state) { void linphone_chat_message_set_state(LinphoneChatMessage *msg, LinphoneChatMessageState state) {
...@@ -218,9 +152,6 @@ void linphone_chat_message_set_state(LinphoneChatMessage *msg, LinphoneChatMessa ...@@ -218,9 +152,6 @@ void linphone_chat_message_set_state(LinphoneChatMessage *msg, LinphoneChatMessa
if (linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)) { if (linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)) {
linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)(msg, msg->state); linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)(msg, msg->state);
} }
if (linphone_chat_room_cbs_get_msg_state_changed(msg->chat_room->callbacks)) {
linphone_chat_room_cbs_get_msg_state_changed(msg->chat_room->callbacks)(msg->chat_room, msg, msg->state);
}
} }
} }
...@@ -261,7 +192,6 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneChatRoom, belle_sip_object_t, ...@@ -261,7 +192,6 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneChatRoom, belle_sip_object_t,
static LinphoneChatRoom *_linphone_core_create_chat_room_base(LinphoneCore *lc, LinphoneAddress *addr){ static LinphoneChatRoom *_linphone_core_create_chat_room_base(LinphoneCore *lc, LinphoneAddress *addr){
LinphoneChatRoom *cr = belle_sip_object_new(LinphoneChatRoom); LinphoneChatRoom *cr = belle_sip_object_new(LinphoneChatRoom);
cr->lc = lc; cr->lc = lc;
cr->callbacks = linphone_chat_room_cbs_new();
cr->peer = linphone_address_as_string(addr); cr->peer = linphone_address_as_string(addr);
cr->peer_url = addr; cr->peer_url = addr;
cr->unread_count = -1; cr->unread_count = -1;
...@@ -1605,10 +1535,6 @@ LinphoneChatMessageCbs *linphone_chat_message_get_callbacks(const LinphoneChatMe ...@@ -1605,10 +1535,6 @@ LinphoneChatMessageCbs *linphone_chat_message_get_callbacks(const LinphoneChatMe
return msg->callbacks; return msg->callbacks;
} }
LinphoneChatRoomCbs *linphone_chat_room_get_callbacks(const LinphoneChatRoom *room) {
return room->callbacks;
}
LinphoneCall *linphone_chat_room_get_call(const LinphoneChatRoom *room) { LinphoneCall *linphone_chat_room_get_call(const LinphoneChatRoom *room) {
return room->call; return room->call;
} }
...@@ -81,9 +81,6 @@ static void linphone_chat_message_file_transfer_on_progress(belle_sip_body_handl ...@@ -81,9 +81,6 @@ static void linphone_chat_message_file_transfer_on_progress(belle_sip_body_handl
_release_http_request(msg); _release_http_request(msg);
return; return;
} }
if (linphone_chat_room_cbs_get_file_transfer_progress_indication(msg->chat_room->callbacks)) {
linphone_chat_room_cbs_get_file_transfer_progress_indication(msg->chat_room->callbacks)(msg->chat_room, msg, msg->file_transfer_information, offset, total);
} else {
if (linphone_chat_message_cbs_get_file_transfer_progress_indication(msg->callbacks)) { if (linphone_chat_message_cbs_get_file_transfer_progress_indication(msg->callbacks)) {
linphone_chat_message_cbs_get_file_transfer_progress_indication(msg->callbacks)( linphone_chat_message_cbs_get_file_transfer_progress_indication(msg->callbacks)(
msg, msg->file_transfer_information, offset, total); msg, msg->file_transfer_information, offset, total);
...@@ -92,7 +89,6 @@ static void linphone_chat_message_file_transfer_on_progress(belle_sip_body_handl ...@@ -92,7 +89,6 @@ static void linphone_chat_message_file_transfer_on_progress(belle_sip_body_handl
linphone_core_notify_file_transfer_progress_indication(msg->chat_room->lc, msg, msg->file_transfer_information, linphone_core_notify_file_transfer_progress_indication(msg->chat_room->lc, msg, msg->file_transfer_information,
offset, total); offset, total);
} }
}
} }
static int on_send_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t *m, static int on_send_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t *m,
...@@ -115,17 +111,6 @@ static int on_send_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t * ...@@ -115,17 +111,6 @@ static int on_send_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t *
/* in case of file body handler, won't be called */ /* in case of file body handler, won't be called */
if (offset < linphone_content_get_size(msg->file_transfer_information)) { if (offset < linphone_content_get_size(msg->file_transfer_information)) {
/* get data from call back */ /* get data from call back */
LinphoneChatRoomCbsFileTransferSendCb cr_file_transfer_send_cb = linphone_chat_room_cbs_get_file_transfer_send(msg->chat_room->callbacks);
if (cr_file_transfer_send_cb) {
LinphoneBuffer *lb = cr_file_transfer_send_cb(msg->chat_room, msg, msg->file_transfer_information, offset, *size);
if (lb == NULL) {
*size = 0;
} else {
*size = linphone_buffer_get_size(lb);
memcpy(buffer, linphone_buffer_get_content(lb), *size);
linphone_buffer_unref(lb);
}
} else {
LinphoneChatMessageCbsFileTransferSendCb file_transfer_send_cb = linphone_chat_message_cbs_get_file_transfer_send(msg->callbacks); LinphoneChatMessageCbsFileTransferSendCb file_transfer_send_cb = linphone_chat_message_cbs_get_file_transfer_send(msg->callbacks);
if (file_transfer_send_cb) { if (file_transfer_send_cb) {
LinphoneBuffer *lb = file_transfer_send_cb(msg, msg->file_transfer_information, offset, *size); LinphoneBuffer *lb = file_transfer_send_cb(msg, msg->file_transfer_information, offset, *size);
...@@ -141,7 +126,6 @@ static int on_send_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t * ...@@ -141,7 +126,6 @@ static int on_send_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t *
linphone_core_notify_file_transfer_send(lc, msg, msg->file_transfer_information, (char *)buffer, size); linphone_core_notify_file_transfer_send(lc, msg, msg->file_transfer_information, (char *)buffer, size);
} }
} }
}
imee = linphone_core_get_im_encryption_engine(lc); imee = linphone_core_get_im_encryption_engine(lc);
if (imee) { if (imee) {
...@@ -413,11 +397,6 @@ static void on_recv_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t ...@@ -413,11 +397,6 @@ static void on_recv_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t
ms_free(decrypted_buffer); ms_free(decrypted_buffer);
if (retval <= 0) { if (retval <= 0) {
if (linphone_chat_room_cbs_get_file_transfer_recv(msg->chat_room->callbacks)) {
LinphoneBuffer *lb = linphone_buffer_new_from_data(buffer, size);
linphone_chat_room_cbs_get_file_transfer_recv(msg->chat_room->callbacks)(msg->chat_room, msg, msg->file_transfer_information, lb);
linphone_buffer_unref(lb);
} else {
if (linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)) { if (linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)) {
LinphoneBuffer *lb = linphone_buffer_new_from_data(buffer, size); LinphoneBuffer *lb = linphone_buffer_new_from_data(buffer, size);
linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)(msg, msg->file_transfer_information, lb); linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)(msg, msg->file_transfer_information, lb);
...@@ -426,7 +405,6 @@ static void on_recv_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t ...@@ -426,7 +405,6 @@ static void on_recv_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t
/* Legacy: call back given by application level */ /* Legacy: call back given by application level */
linphone_core_notify_file_transfer_recv(lc, msg, msg->file_transfer_information, (const char *)buffer, size); linphone_core_notify_file_transfer_recv(lc, msg, msg->file_transfer_information, (const char *)buffer, size);
} }
}
} else { } else {
ms_warning("File transfer decrypt failed with code %d", (int)retval); ms_warning("File transfer decrypt failed with code %d", (int)retval);
linphone_chat_message_set_state(msg, LinphoneChatMessageStateFileTransferError); linphone_chat_message_set_state(msg, LinphoneChatMessageStateFileTransferError);
...@@ -450,11 +428,6 @@ static void on_recv_end(belle_sip_user_body_handler_t *bh, void *data) { ...@@ -450,11 +428,6 @@ static void on_recv_end(belle_sip_user_body_handler_t *bh, void *data) {
} }
if (retval <= 0) { if (retval <= 0) {
if (linphone_chat_room_cbs_get_file_transfer_recv(msg->chat_room->callbacks)) {
LinphoneBuffer *lb = linphone_buffer_new();
linphone_chat_room_cbs_get_file_transfer_recv(msg->chat_room->callbacks)(msg->chat_room, msg, msg->file_transfer_information, lb);
linphone_buffer_unref(lb);
} else {
if (linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)) { if (linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)) {
LinphoneBuffer *lb = linphone_buffer_new(); LinphoneBuffer *lb = linphone_buffer_new();
linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)(msg, msg->file_transfer_information, lb); linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)(msg, msg->file_transfer_information, lb);
...@@ -464,7 +437,6 @@ static void on_recv_end(belle_sip_user_body_handler_t *bh, void *data) { ...@@ -464,7 +437,6 @@ static void on_recv_end(belle_sip_user_body_handler_t *bh, void *data) {
linphone_core_notify_file_transfer_recv(lc, msg, msg->file_transfer_information, NULL, 0); linphone_core_notify_file_transfer_recv(lc, msg, msg->file_transfer_information, NULL, 0);
} }
} }
}
if (retval <= 0 && linphone_chat_message_get_state(msg) != LinphoneChatMessageStateFileTransferError) { if (retval <= 0 && linphone_chat_message_get_state(msg) != LinphoneChatMessageStateFileTransferError) {
linphone_chat_message_set_state(msg, LinphoneChatMessageStateFileTransferDone); linphone_chat_message_set_state(msg, LinphoneChatMessageStateFileTransferDone);
......
...@@ -44,7 +44,7 @@ static void stop(int signum){ ...@@ -44,7 +44,7 @@ static void stop(int signum){
/** /**
* function invoked to report file transfer progress. * function invoked to report file transfer progress.
* */ * */
static void file_transfer_progress_indication(LinphoneChatRoom *room,LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total) { static void file_transfer_progress_indication(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total) {
const LinphoneAddress* from_address = linphone_chat_message_get_from(message); const LinphoneAddress* from_address = linphone_chat_message_get_from(message);
const LinphoneAddress* to_address = linphone_chat_message_get_to(message); const LinphoneAddress* to_address = linphone_chat_message_get_to(message);
char *address = linphone_chat_message_is_outgoing(message)?linphone_address_as_string(to_address):linphone_address_as_string(from_address); char *address = linphone_chat_message_is_outgoing(message)?linphone_address_as_string(to_address):linphone_address_as_string(from_address);
...@@ -59,7 +59,7 @@ static void file_transfer_progress_indication(LinphoneChatRoom *room,LinphoneCha ...@@ -59,7 +59,7 @@ static void file_transfer_progress_indication(LinphoneChatRoom *room,LinphoneCha
/** /**
* function invoked when a file transfer is received. * function invoked when a file transfer is received.
**/ **/
static void file_transfer_received(LinphoneChatRoom *room, LinphoneChatMessage *message, const LinphoneContent* content, const LinphoneBuffer *buffer){ static void file_transfer_received(LinphoneChatMessage *message, const LinphoneContent* content, const LinphoneBuffer *buffer){
FILE* file=NULL; FILE* file=NULL;
if (!linphone_chat_message_get_user_data(message)) { if (!linphone_chat_message_get_user_data(message)) {
/*first chunk, creating file*/ /*first chunk, creating file*/
...@@ -85,7 +85,7 @@ char big_file [128000]; ...@@ -85,7 +85,7 @@ char big_file [128000];
/* /*
* function called when the file transfer is initiated. file content should be feed into object LinphoneContent * function called when the file transfer is initiated. file content should be feed into object LinphoneContent
* */ * */
static LinphoneBuffer * file_transfer_send(LinphoneChatRoom *room, LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t size){ static LinphoneBuffer * file_transfer_send(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t size){
size_t size_to_send = MIN(size, sizeof(big_file) - offset); size_t size_to_send = MIN(size, sizeof(big_file) - offset);
if (size == 0) return linphone_buffer_new(); /*end of file*/ if (size == 0) return linphone_buffer_new(); /*end of file*/
return linphone_buffer_new_from_data((uint8_t *)big_file + offset, size_to_send); return linphone_buffer_new_from_data((uint8_t *)big_file + offset, size_to_send);
...@@ -94,7 +94,7 @@ static LinphoneBuffer * file_transfer_send(LinphoneChatRoom *room, LinphoneChatM ...@@ -94,7 +94,7 @@ static LinphoneBuffer * file_transfer_send(LinphoneChatRoom *room, LinphoneChatM
/* /*
* Call back to get delivery status of a message * Call back to get delivery status of a message
* */ * */
static void linphone_file_transfer_state_changed(LinphoneChatRoom *room,LinphoneChatMessage* msg,LinphoneChatMessageState state) { static void linphone_file_transfer_state_changed(LinphoneChatMessage* msg,LinphoneChatMessageState state) {
const LinphoneAddress* to_address = linphone_chat_message_get_to(msg); const LinphoneAddress* to_address = linphone_chat_message_get_to(msg);
char *to = linphone_address_as_string(to_address); char *to = linphone_address_as_string(to_address);
printf("File transfer sent to [%s] delivery status is [%s] \n" , to printf("File transfer sent to [%s] delivery status is [%s] \n" , to
...@@ -123,7 +123,7 @@ int main(int argc, char *argv[]){ ...@@ -123,7 +123,7 @@ int main(int argc, char *argv[]){
LinphoneChatRoom* chat_room; LinphoneChatRoom* chat_room;
LinphoneContent* content; LinphoneContent* content;
LinphoneChatMessage* chat_message; LinphoneChatMessage* chat_message;
LinphoneChatRoomCbs *cbs; LinphoneChatMessageCbs *cbs;
/*seting dummy file content to something*/ /*seting dummy file content to something*/
for (i=0;i<sizeof(big_file);i+=strlen(big_file_content)) for (i=0;i<sizeof(big_file);i+=strlen(big_file_content))
...@@ -157,17 +157,6 @@ int main(int argc, char *argv[]){ ...@@ -157,17 +157,6 @@ int main(int argc, char *argv[]){
/*Next step is to create a chat room*/ /*Next step is to create a chat room*/
chat_room = linphone_core_get_chat_room_from_uri(lc,dest_friend); chat_room = linphone_core_get_chat_room_from_uri(lc,dest_friend);
/**
* Fill the application callbacks. The file_transfer_received callback is used in order to get notifications
* about incoming file reception, file_transfer_send to feed file to be transfered and
* file_transfer_progress_indication to print progress.
*/
cbs = linphone_chat_room_get_callbacks(chat_room);
linphone_chat_room_cbs_set_file_transfer_recv(cbs, file_transfer_received);
linphone_chat_room_cbs_set_file_transfer_send(cbs, file_transfer_send);
linphone_chat_room_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
linphone_chat_room_cbs_set_msg_state_changed(cbs, linphone_file_transfer_state_changed);
content = linphone_core_create_content(lc); content = linphone_core_create_content(lc);
linphone_content_set_type(content,"text"); linphone_content_set_type(content,"text");
linphone_content_set_subtype(content,"plain"); linphone_content_set_subtype(content,"plain");
...@@ -180,6 +169,17 @@ int main(int argc, char *argv[]){ ...@@ -180,6 +169,17 @@ int main(int argc, char *argv[]){
printf("returned message is null\n"); printf("returned message is null\n");
} }
/**
* Fill the application callbacks. The file_transfer_received callback is used in order to get notifications
* about incoming file reception, file_transfer_send to feed file to be transfered and
* file_transfer_progress_indication to print progress.
*/
cbs = linphone_chat_message_get_callbacks(chat_message);
linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received);
linphone_chat_message_cbs_set_file_transfer_send(cbs, file_transfer_send);
linphone_chat_message_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
linphone_chat_message_cbs_set_msg_state_changed(cbs, linphone_file_transfer_state_changed);
/*initiating file transfer*/ /*initiating file transfer*/
linphone_chat_room_send_chat_message(chat_room, chat_message); linphone_chat_room_send_chat_message(chat_room, chat_message);
......
...@@ -610,7 +610,6 @@ void _linphone_proxy_config_release_ops(LinphoneProxyConfig *obj); ...@@ -610,7 +610,6 @@ void _linphone_proxy_config_release_ops(LinphoneProxyConfig *obj);
/*chat*/ /*chat*/
void linphone_chat_room_release(LinphoneChatRoom *cr); void linphone_chat_room_release(LinphoneChatRoom *cr);
LinphoneChatRoomCbs *linphone_chat_room_cbs_new(void);
void linphone_chat_message_destroy(LinphoneChatMessage* msg); void linphone_chat_message_destroy(LinphoneChatMessage* msg);
void linphone_chat_message_update_state(LinphoneChatMessage *msg, LinphoneChatMessageState new_state); void linphone_chat_message_update_state(LinphoneChatMessage *msg, LinphoneChatMessageState new_state);
void linphone_chat_message_set_state(LinphoneChatMessage *msg, LinphoneChatMessageState state); void linphone_chat_message_set_state(LinphoneChatMessage *msg, LinphoneChatMessageState state);
...@@ -618,7 +617,7 @@ void linphone_chat_message_send_delivery_notification(LinphoneChatMessage *cm); ...@@ -618,7 +617,7 @@ void linphone_chat_message_send_delivery_notification(LinphoneChatMessage *cm);
void linphone_chat_message_send_display_notification(LinphoneChatMessage *cm); void linphone_chat_message_send_display_notification(LinphoneChatMessage *cm);
int linphone_chat_room_upload_file(LinphoneChatMessage *msg); int linphone_chat_room_upload_file(LinphoneChatMessage *msg);
void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg); void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg);
LinphoneChatMessageCbs *linphone_chat_message_cbs_new(void); /* deprecated */ LinphoneChatMessageCbs *linphone_chat_message_cbs_new(void);
LinphoneChatRoom *_linphone_core_create_chat_room_from_call(LinphoneCall *call); LinphoneChatRoom *_linphone_core_create_chat_room_from_call(LinphoneCall *call);
/**/ /**/
...@@ -694,22 +693,10 @@ typedef enum _LinphoneIsComposingState { ...@@ -694,22 +693,10 @@ typedef enum _LinphoneIsComposingState {
LinphoneIsComposingActive LinphoneIsComposingActive
} LinphoneIsComposingState; } LinphoneIsComposingState;
struct _LinphoneChatRoomCbs {
belle_sip_object_t base;
void *user_data;
LinphoneChatRoomCbsMsgStateChangedCb msg_state_changed;
LinphoneChatRoomCbsFileTransferRecvCb file_transfer_recv; /**< Callback to store file received attached to a #LinphoneChatRoom */
LinphoneChatRoomCbsFileTransferSendCb file_transfer_send; /**< Callback to collect file chunk to be sent for a #LinphoneChatRoom */
LinphoneChatRoomCbsFileTransferProgressIndicationCb file_transfer_progress_indication; /**< Callback to indicate file transfer progress */
};
BELLE_SIP_DECLARE_VPTR(LinphoneChatRoomCbs);
struct _LinphoneChatRoom{ struct _LinphoneChatRoom{
belle_sip_object_t base; belle_sip_object_t base;
void *user_data; void *user_data;
struct _LinphoneCore *lc; struct _LinphoneCore *lc;
LinphoneChatRoomCbs *callbacks;
char *peer; char *peer;
LinphoneAddress *peer_url; LinphoneAddress *peer_url;
MSList *messages_hist; MSList *messages_hist;
...@@ -1550,7 +1537,6 @@ BELLE_SIP_TYPE_ID(LinphoneCallParams), ...@@ -1550,7 +1537,6 @@ BELLE_SIP_TYPE_ID(LinphoneCallParams),
BELLE_SIP_TYPE_ID(LinphoneChatMessage), BELLE_SIP_TYPE_ID(LinphoneChatMessage),
BELLE_SIP_TYPE_ID(LinphoneChatMessageCbs), BELLE_SIP_TYPE_ID(LinphoneChatMessageCbs),
BELLE_SIP_TYPE_ID(LinphoneChatRoom), BELLE_SIP_TYPE_ID(LinphoneChatRoom),
BELLE_SIP_TYPE_ID(LinphoneChatRoomCbs),
BELLE_SIP_TYPE_ID(LinphoneContent), BELLE_SIP_TYPE_ID(LinphoneContent),
BELLE_SIP_TYPE_ID(LinphoneImEncryptionEngine), BELLE_SIP_TYPE_ID(LinphoneImEncryptionEngine),
BELLE_SIP_TYPE_ID(LinphoneImEncryptionEngineCbs), BELLE_SIP_TYPE_ID(LinphoneImEncryptionEngineCbs),
......
...@@ -32,7 +32,6 @@ extern "C" { ...@@ -32,7 +32,6 @@ extern "C" {
/** /**
* An object to handle the callbacks for the handling a LinphoneChatMessage objects. * An object to handle the callbacks for the handling a LinphoneChatMessage objects.
* @deprecated Use LinphoneChatRoomCbs instead.
*/ */
typedef struct _LinphoneChatMessageCbs LinphoneChatMessageCbs; typedef struct _LinphoneChatMessageCbs LinphoneChatMessageCbs;
...@@ -42,11 +41,6 @@ typedef struct _LinphoneChatMessageCbs LinphoneChatMessageCbs; ...@@ -42,11 +41,6 @@ typedef struct _LinphoneChatMessageCbs LinphoneChatMessageCbs;
*/ */
typedef struct _LinphoneChatMessage LinphoneChatMessage; typedef struct _LinphoneChatMessage LinphoneChatMessage;
/**
* An object to handle the callbacks for the handling of LinphoneChatMessage objects related to a LinphoneChatRoom.
*/
typedef struct _LinphoneChatRoomCbs LinphoneChatRoomCbs;
/** /**
* A chat room is the place where text messages are exchanged. * A chat room is the place where text messages are exchanged.
* <br> Can be created by linphone_core_create_chat_room(). * <br> Can be created by linphone_core_create_chat_room().
...@@ -78,7 +72,7 @@ typedef enum _LinphoneLimeState { ...@@ -78,7 +72,7 @@ typedef enum _LinphoneLimeState {
* @param msg #LinphoneChatMessage object * @param msg #LinphoneChatMessage object
* @param status LinphoneChatMessageState * @param status LinphoneChatMessageState
* @param ud application user data * @param ud application user data
* @deprecated Use LinphoneChatRoomCbsMsgStateChangedCb instead. * @deprecated Use LinphoneChatMessageCbsMsgStateChangedCb instead.
*/ */
typedef void (*LinphoneChatMessageStateChangedCb)(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud); typedef void (*LinphoneChatMessageStateChangedCb)(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud);
...@@ -86,7 +80,6 @@ typedef void (*LinphoneChatMessageStateChangedCb)(LinphoneChatMessage* msg,Linph ...@@ -86,7 +80,6 @@ typedef void (*LinphoneChatMessageStateChangedCb)(LinphoneChatMessage* msg,Linph
* Call back used to notify message delivery status * Call back used to notify message delivery status
* @param msg #LinphoneChatMessage object * @param msg #LinphoneChatMessage object
* @param status LinphoneChatMessageState * @param status LinphoneChatMessageState
* @deprecated Use LinphoneChatRoomCbsMsgStateChangedCb instead.
*/ */
typedef void (*LinphoneChatMessageCbsMsgStateChangedCb)(LinphoneChatMessage* msg, LinphoneChatMessageState state); typedef void (*LinphoneChatMessageCbsMsgStateChangedCb)(LinphoneChatMessage* msg, LinphoneChatMessageState state);
...@@ -95,7 +88,6 @@ typedef void (*LinphoneChatMessageCbsMsgStateChangedCb)(LinphoneChatMessage* msg ...@@ -95,7 +88,6 @@ typedef void (*LinphoneChatMessageCbsMsgStateChangedCb)(LinphoneChatMessage* msg
* @param message #LinphoneChatMessage message from which the body is received. * @param message #LinphoneChatMessage message from which the body is received.
* @param content #LinphoneContent incoming content information * @param content #LinphoneContent incoming content information
* @param buffer #LinphoneBuffer holding the received data. Empty buffer means end of file. * @param buffer #LinphoneBuffer holding the received data. Empty buffer means end of file.
* @deprecated Use LinphoneChatRoomCbsFileTransferRecvCb instead.
*/ */
typedef void (*LinphoneChatMessageCbsFileTransferRecvCb)(LinphoneChatMessage *message, const LinphoneContent* content, const LinphoneBuffer *buffer); typedef void (*LinphoneChatMessageCbsFileTransferRecvCb)(LinphoneChatMessage *message, const LinphoneContent* content, const LinphoneBuffer *buffer);
...@@ -106,7 +98,6 @@ typedef void (*LinphoneChatMessageCbsFileTransferRecvCb)(LinphoneChatMessage *me ...@@ -106,7 +98,6 @@ typedef void (*LinphoneChatMessageCbsFileTransferRecvCb)(LinphoneChatMessage *me
* @param offset the offset in the file from where to get the data to be sent * @param offset the offset in the file from where to get the data to be sent
* @param size the number of bytes expected by the framework * @param size the number of bytes expected by the framework
* @return A LinphoneBuffer object holding the data written by the application. An empty buffer means end of file. * @return A LinphoneBuffer object holding the data written by the application. An empty buffer means end of file.
* @deprecated Use LinphoneChatRoomCbsFileTransferSendCb instead.
*/ */
typedef LinphoneBuffer * (*LinphoneChatMessageCbsFileTransferSendCb)(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t size); typedef LinphoneBuffer * (*LinphoneChatMessageCbsFileTransferSendCb)(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t size);
...@@ -116,50 +107,10 @@ typedef LinphoneBuffer * (*LinphoneChatMessageCbsFileTransferSendCb)(LinphoneCha ...@@ -116,50 +107,10 @@ typedef LinphoneBuffer * (*LinphoneChatMessageCbsFileTransferSendCb)(LinphoneCha
* @param content #LinphoneContent incoming content information * @param content #LinphoneContent incoming content information
* @param offset The number of bytes sent/received since the beginning of the transfer. * @param offset The number of bytes sent/received since the beginning of the transfer.
* @param total The total number of bytes to be sent/received. * @param total The total number of bytes to be sent/received.
* @deprecated Use LinphoneChatRoomCbsFileTransferProgressIndicationCb instead.
*/ */
typedef void (*LinphoneChatMessageCbsFileTransferProgressIndicationCb)(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total); typedef void (*LinphoneChatMessageCbsFileTransferProgressIndicationCb)(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total);
/**
* Call back used to notify message delivery status
* @param room #LinphoneChatRoom object
* @param msg #LinphoneChatMessage object
* @param status LinphoneChatMessageState
*/
typedef void (*LinphoneChatRoomCbsMsgStateChangedCb)(LinphoneChatRoom *room, LinphoneChatMessage* msg, LinphoneChatMessageState state);
/**
* File transfer receive callback prototype. This function is called by the core upon an incoming File transfer is started. This function may be call several time for the same file in case of large file.
* @param room #LinphoneChatRoom object
* @param message #LinphoneChatMessage message from which the body is received.
* @param content #LinphoneContent incoming content information
* @param buffer #LinphoneBuffer holding the received data. Empty buffer means end of file.
*/
typedef void (*LinphoneChatRoomCbsFileTransferRecvCb)(LinphoneChatRoom *room, LinphoneChatMessage *message, const LinphoneContent* content, const LinphoneBuffer *buffer);
/**
* File transfer send callback prototype. This function is called by the core when an outgoing file transfer is started. This function is called until size is set to 0.
* @param room #LinphoneChatRoom object
* @param message #LinphoneChatMessage message from which the body is received.
* @param content #LinphoneContent outgoing content
* @param offset the offset in the file from where to get the data to be sent
* @param size the number of bytes expected by the framework
* @return A LinphoneBuffer object holding the data written by the application. An empty buffer means end of file.
*/
typedef LinphoneBuffer * (*LinphoneChatRoomCbsFileTransferSendCb)(LinphoneChatRoom *room, LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t size);
/**
* File transfer progress indication callback prototype.
* @param room #LinphoneChatRoom object
* @param message #LinphoneChatMessage message from which the body is received.
* @param content #LinphoneContent incoming content information
* @param offset The number of bytes sent/received since the beginning of the transfer.
* @param total The total number of bytes to be sent/received.
*/
typedef void (*LinphoneChatRoomCbsFileTransferProgressIndicationCb)(LinphoneChatRoom *room, LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total);
LINPHONE_PUBLIC void linphone_core_set_chat_database_path(LinphoneCore *lc, const char *path); LINPHONE_PUBLIC void linphone_core_set_chat_database_path(LinphoneCore *lc, const char *path);
/** /**
...@@ -402,97 +353,6 @@ LINPHONE_PUBLIC bool_t linphone_chat_room_lime_available(LinphoneChatRoom *cr); ...@@ -402,97 +353,6 @@ LINPHONE_PUBLIC bool_t linphone_chat_room_lime_available(LinphoneChatRoom *cr);
LINPHONE_PUBLIC const bctbx_list_t* linphone_core_get_chat_rooms(LinphoneCore *lc); LINPHONE_PUBLIC const bctbx_list_t* linphone_core_get_chat_rooms(LinphoneCore *lc);
/**
* Get the LinphoneChatRoomCbs object associated with the LinphoneChatRoom.
* @param[in] room LinphoneChatRoom object
* @return The LinphoneChatRoomCbs object associated with the LinphoneChatRoom.
*/
LINPHONE_PUBLIC LinphoneChatRoomCbs * linphone_chat_room_get_callbacks(const LinphoneChatRoom *room);
/**
* Acquire a reference to the LinphoneChatRoomCbs object.
* @param[in] cbs LinphoneChatRoomCbs object.
* @return The same LinphoneChatRoomCbs object.
*/
LINPHONE_PUBLIC LinphoneChatRoomCbs * linphone_chat_room_cbs_ref(LinphoneChatRoomCbs *cbs);
/**
* Release reference to the LinphoneChatRoomCbs object.
* @param[in] cbs LinphoneChatRoomCbs object.
*/
LINPHONE_PUBLIC void linphone_chat_room_cbs_unref(LinphoneChatRoomCbs *cbs);
/**
* Retrieve the user pointer associated with the LinphoneChatRoomCbs object.
* @param[in] cbs LinphoneChatRoomCbs object.
* @return The user pointer associated with the LinphoneChatRoomCbs object.
*/
LINPHONE_PUBLIC void *linphone_chat_room_cbs_get_user_data(const LinphoneChatRoomCbs *cbs);
/**
* Assign a user pointer to the LinphoneChatRoomCbs object.
* @param[in] cbs LinphoneChatRoomCbs object.
* @param[in] ud The user pointer to associate with the LinphoneChatRoomCbs object.
*/
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_user_data(LinphoneChatRoomCbs *cbs, void *ud);
/**
* Get the message state changed callback.
* @param[in] cbs LinphoneChatRoomCbs object.
* @return The current message state changed callback.
*/