mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
Revert message callbacks moved to LinphoneChatRoom instead of LinphoneChatMessage.
This commit is contained in:
parent
9867c2fee7
commit
410f5b9e1c
9 changed files with 125 additions and 389 deletions
|
|
@ -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);
|
||||
|
||||
static void _linphone_chat_room_destroy(LinphoneChatRoom *cr) {
|
||||
|
|
@ -197,9 +134,6 @@ static void _linphone_chat_room_destroy(LinphoneChatRoom *cr) {
|
|||
if (cr->pending_message)
|
||||
linphone_chat_message_destroy(cr->pending_message);
|
||||
ms_free(cr->peer);
|
||||
if (cr->callbacks) {
|
||||
linphone_chat_room_cbs_unref(cr->callbacks);
|
||||
}
|
||||
}
|
||||
|
||||
void linphone_chat_message_set_state(LinphoneChatMessage *msg, LinphoneChatMessageState state) {
|
||||
|
|
@ -218,9 +152,6 @@ void linphone_chat_message_set_state(LinphoneChatMessage *msg, LinphoneChatMessa
|
|||
if (linphone_chat_message_cbs_get_msg_state_changed(msg->callbacks)) {
|
||||
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,
|
|||
static LinphoneChatRoom *_linphone_core_create_chat_room_base(LinphoneCore *lc, LinphoneAddress *addr){
|
||||
LinphoneChatRoom *cr = belle_sip_object_new(LinphoneChatRoom);
|
||||
cr->lc = lc;
|
||||
cr->callbacks = linphone_chat_room_cbs_new();
|
||||
cr->peer = linphone_address_as_string(addr);
|
||||
cr->peer_url = addr;
|
||||
cr->unread_count = -1;
|
||||
|
|
@ -1605,10 +1535,6 @@ LinphoneChatMessageCbs *linphone_chat_message_get_callbacks(const LinphoneChatMe
|
|||
return msg->callbacks;
|
||||
}
|
||||
|
||||
LinphoneChatRoomCbs *linphone_chat_room_get_callbacks(const LinphoneChatRoom *room) {
|
||||
return room->callbacks;
|
||||
}
|
||||
|
||||
LinphoneCall *linphone_chat_room_get_call(const LinphoneChatRoom *room) {
|
||||
return room->call;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,17 +81,13 @@ static void linphone_chat_message_file_transfer_on_progress(belle_sip_body_handl
|
|||
_release_http_request(msg);
|
||||
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);
|
||||
if (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);
|
||||
} else {
|
||||
if (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);
|
||||
} else {
|
||||
/* Legacy: call back given by application level */
|
||||
linphone_core_notify_file_transfer_progress_indication(msg->chat_room->lc, msg, msg->file_transfer_information,
|
||||
offset, total);
|
||||
}
|
||||
/* Legacy: call back given by application level */
|
||||
linphone_core_notify_file_transfer_progress_indication(msg->chat_room->lc, msg, msg->file_transfer_information,
|
||||
offset, total);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -115,9 +111,9 @@ 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 */
|
||||
if (offset < linphone_content_get_size(msg->file_transfer_information)) {
|
||||
/* 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);
|
||||
LinphoneChatMessageCbsFileTransferSendCb file_transfer_send_cb = linphone_chat_message_cbs_get_file_transfer_send(msg->callbacks);
|
||||
if (file_transfer_send_cb) {
|
||||
LinphoneBuffer *lb = file_transfer_send_cb(msg, msg->file_transfer_information, offset, *size);
|
||||
if (lb == NULL) {
|
||||
*size = 0;
|
||||
} else {
|
||||
|
|
@ -126,20 +122,8 @@ static int on_send_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t *
|
|||
linphone_buffer_unref(lb);
|
||||
}
|
||||
} else {
|
||||
LinphoneChatMessageCbsFileTransferSendCb file_transfer_send_cb = linphone_chat_message_cbs_get_file_transfer_send(msg->callbacks);
|
||||
if (file_transfer_send_cb) {
|
||||
LinphoneBuffer *lb = file_transfer_send_cb(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 {
|
||||
/* Legacy */
|
||||
linphone_core_notify_file_transfer_send(lc, msg, msg->file_transfer_information, (char *)buffer, size);
|
||||
}
|
||||
/* Legacy */
|
||||
linphone_core_notify_file_transfer_send(lc, msg, msg->file_transfer_information, (char *)buffer, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -413,19 +397,13 @@ static void on_recv_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t
|
|||
ms_free(decrypted_buffer);
|
||||
|
||||
if (retval <= 0) {
|
||||
if (linphone_chat_room_cbs_get_file_transfer_recv(msg->chat_room->callbacks)) {
|
||||
if (linphone_chat_message_cbs_get_file_transfer_recv(msg->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_chat_message_cbs_get_file_transfer_recv(msg->callbacks)(msg, msg->file_transfer_information, lb);
|
||||
linphone_buffer_unref(lb);
|
||||
} else {
|
||||
if (linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)) {
|
||||
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_buffer_unref(lb);
|
||||
} else {
|
||||
/* Legacy: call back given by application level */
|
||||
linphone_core_notify_file_transfer_recv(lc, msg, msg->file_transfer_information, (const char *)buffer, size);
|
||||
}
|
||||
/* Legacy: call back given by application level */
|
||||
linphone_core_notify_file_transfer_recv(lc, msg, msg->file_transfer_information, (const char *)buffer, size);
|
||||
}
|
||||
} else {
|
||||
ms_warning("File transfer decrypt failed with code %d", (int)retval);
|
||||
|
|
@ -450,19 +428,13 @@ static void on_recv_end(belle_sip_user_body_handler_t *bh, void *data) {
|
|||
}
|
||||
|
||||
if (retval <= 0) {
|
||||
if (linphone_chat_room_cbs_get_file_transfer_recv(msg->chat_room->callbacks)) {
|
||||
if (linphone_chat_message_cbs_get_file_transfer_recv(msg->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_chat_message_cbs_get_file_transfer_recv(msg->callbacks)(msg, msg->file_transfer_information, lb);
|
||||
linphone_buffer_unref(lb);
|
||||
} else {
|
||||
if (linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)) {
|
||||
LinphoneBuffer *lb = linphone_buffer_new();
|
||||
linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)(msg, msg->file_transfer_information, lb);
|
||||
linphone_buffer_unref(lb);
|
||||
} else {
|
||||
/* Legacy: call back given by application level */
|
||||
linphone_core_notify_file_transfer_recv(lc, msg, msg->file_transfer_information, NULL, 0);
|
||||
}
|
||||
/* Legacy: call back given by application level */
|
||||
linphone_core_notify_file_transfer_recv(lc, msg, msg->file_transfer_information, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ static void stop(int signum){
|
|||
/**
|
||||
* 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* 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);
|
||||
|
|
@ -59,7 +59,7 @@ static void file_transfer_progress_indication(LinphoneChatRoom *room,LinphoneCha
|
|||
/**
|
||||
* 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;
|
||||
if (!linphone_chat_message_get_user_data(message)) {
|
||||
/*first chunk, creating file*/
|
||||
|
|
@ -85,7 +85,7 @@ char big_file [128000];
|
|||
/*
|
||||
* 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);
|
||||
if (size == 0) return linphone_buffer_new(); /*end of file*/
|
||||
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
|
|||
/*
|
||||
* 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);
|
||||
char *to = linphone_address_as_string(to_address);
|
||||
printf("File transfer sent to [%s] delivery status is [%s] \n" , to
|
||||
|
|
@ -123,7 +123,7 @@ int main(int argc, char *argv[]){
|
|||
LinphoneChatRoom* chat_room;
|
||||
LinphoneContent* content;
|
||||
LinphoneChatMessage* chat_message;
|
||||
LinphoneChatRoomCbs *cbs;
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
|
||||
/*seting dummy file content to something*/
|
||||
for (i=0;i<sizeof(big_file);i+=strlen(big_file_content))
|
||||
|
|
@ -157,17 +157,6 @@ int main(int argc, char *argv[]){
|
|||
/*Next step is to create a chat room*/
|
||||
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);
|
||||
linphone_content_set_type(content,"text");
|
||||
linphone_content_set_subtype(content,"plain");
|
||||
|
|
@ -180,6 +169,17 @@ int main(int argc, char *argv[]){
|
|||
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*/
|
||||
linphone_chat_room_send_chat_message(chat_room, chat_message);
|
||||
|
||||
|
|
|
|||
|
|
@ -610,7 +610,6 @@ void _linphone_proxy_config_release_ops(LinphoneProxyConfig *obj);
|
|||
|
||||
/*chat*/
|
||||
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_update_state(LinphoneChatMessage *msg, LinphoneChatMessageState new_state);
|
||||
void linphone_chat_message_set_state(LinphoneChatMessage *msg, LinphoneChatMessageState state);
|
||||
|
|
@ -618,7 +617,7 @@ void linphone_chat_message_send_delivery_notification(LinphoneChatMessage *cm);
|
|||
void linphone_chat_message_send_display_notification(LinphoneChatMessage *cm);
|
||||
int linphone_chat_room_upload_file(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);
|
||||
/**/
|
||||
|
||||
|
|
@ -694,22 +693,10 @@ typedef enum _LinphoneIsComposingState {
|
|||
LinphoneIsComposingActive
|
||||
} 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{
|
||||
belle_sip_object_t base;
|
||||
void *user_data;
|
||||
struct _LinphoneCore *lc;
|
||||
LinphoneChatRoomCbs *callbacks;
|
||||
char *peer;
|
||||
LinphoneAddress *peer_url;
|
||||
MSList *messages_hist;
|
||||
|
|
@ -1550,7 +1537,6 @@ BELLE_SIP_TYPE_ID(LinphoneCallParams),
|
|||
BELLE_SIP_TYPE_ID(LinphoneChatMessage),
|
||||
BELLE_SIP_TYPE_ID(LinphoneChatMessageCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneChatRoom),
|
||||
BELLE_SIP_TYPE_ID(LinphoneChatRoomCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneContent),
|
||||
BELLE_SIP_TYPE_ID(LinphoneImEncryptionEngine),
|
||||
BELLE_SIP_TYPE_ID(LinphoneImEncryptionEngineCbs),
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ extern "C" {
|
|||
|
||||
/**
|
||||
* An object to handle the callbacks for the handling a LinphoneChatMessage objects.
|
||||
* @deprecated Use LinphoneChatRoomCbs instead.
|
||||
*/
|
||||
typedef struct _LinphoneChatMessageCbs LinphoneChatMessageCbs;
|
||||
|
||||
|
|
@ -42,11 +41,6 @@ typedef struct _LinphoneChatMessageCbs LinphoneChatMessageCbs;
|
|||
*/
|
||||
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.
|
||||
* <br> Can be created by linphone_core_create_chat_room().
|
||||
|
|
@ -78,7 +72,7 @@ typedef enum _LinphoneLimeState {
|
|||
* @param msg #LinphoneChatMessage object
|
||||
* @param status LinphoneChatMessageState
|
||||
* @param ud application user data
|
||||
* @deprecated Use LinphoneChatRoomCbsMsgStateChangedCb instead.
|
||||
* @deprecated Use LinphoneChatMessageCbsMsgStateChangedCb instead.
|
||||
*/
|
||||
typedef void (*LinphoneChatMessageStateChangedCb)(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud);
|
||||
|
||||
|
|
@ -86,7 +80,6 @@ typedef void (*LinphoneChatMessageStateChangedCb)(LinphoneChatMessage* msg,Linph
|
|||
* Call back used to notify message delivery status
|
||||
* @param msg #LinphoneChatMessage object
|
||||
* @param status LinphoneChatMessageState
|
||||
* @deprecated Use LinphoneChatRoomCbsMsgStateChangedCb instead.
|
||||
*/
|
||||
typedef void (*LinphoneChatMessageCbsMsgStateChangedCb)(LinphoneChatMessage* msg, LinphoneChatMessageState state);
|
||||
|
||||
|
|
@ -95,7 +88,6 @@ typedef void (*LinphoneChatMessageCbsMsgStateChangedCb)(LinphoneChatMessage* msg
|
|||
* @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.
|
||||
* @deprecated Use LinphoneChatRoomCbsFileTransferRecvCb instead.
|
||||
*/
|
||||
typedef void (*LinphoneChatMessageCbsFileTransferRecvCb)(LinphoneChatMessage *message, const LinphoneContent* content, const LinphoneBuffer *buffer);
|
||||
|
||||
|
|
@ -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 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.
|
||||
* @deprecated Use LinphoneChatRoomCbsFileTransferSendCb instead.
|
||||
*/
|
||||
typedef LinphoneBuffer * (*LinphoneChatMessageCbsFileTransferSendCb)(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t size);
|
||||
|
||||
|
|
@ -116,50 +107,10 @@ typedef LinphoneBuffer * (*LinphoneChatMessageCbsFileTransferSendCb)(LinphoneCha
|
|||
* @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.
|
||||
* @deprecated Use LinphoneChatRoomCbsFileTransferProgressIndicationCb instead.
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
|
|
@ -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);
|
||||
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneChatRoomCbsMsgStateChangedCb linphone_chat_room_cbs_get_msg_state_changed(const LinphoneChatRoomCbs *cbs);
|
||||
|
||||
/**
|
||||
* Set the message state changed callback.
|
||||
* @param[in] cbs LinphoneChatRoomCbs object.
|
||||
* @param[in] cb The message state changed callback to be used.
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_msg_state_changed(LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsMsgStateChangedCb cb);
|
||||
|
||||
/**
|
||||
* Get the file transfer receive callback.
|
||||
* @param[in] cbs LinphoneChatRoomCbs object.
|
||||
* @return The current file transfer receive callback.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneChatRoomCbsFileTransferRecvCb linphone_chat_room_cbs_get_file_transfer_recv(const LinphoneChatRoomCbs *cbs);
|
||||
|
||||
/**
|
||||
* Set the file transfer receive callback.
|
||||
* @param[in] cbs LinphoneChatRoomCbs object.
|
||||
* @param[in] cb The file transfer receive callback to be used.
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_file_transfer_recv(LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsFileTransferRecvCb cb);
|
||||
|
||||
/**
|
||||
* Get the file transfer send callback.
|
||||
* @param[in] cbs LinphoneChatRoomCbs object.
|
||||
* @return The current file transfer send callback.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneChatRoomCbsFileTransferSendCb linphone_chat_room_cbs_get_file_transfer_send(const LinphoneChatRoomCbs *cbs);
|
||||
|
||||
/**
|
||||
* Set the file transfer send callback.
|
||||
* @param[in] cbs LinphoneChatRoomCbs object.
|
||||
* @param[in] cb The file transfer send callback to be used.
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_file_transfer_send(LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsFileTransferSendCb cb);
|
||||
|
||||
/**
|
||||
* Get the file transfer progress indication callback.
|
||||
* @param[in] cbs LinphoneChatRoomCbs object.
|
||||
* @return The current file transfer progress indication callback.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneChatRoomCbsFileTransferProgressIndicationCb linphone_chat_room_cbs_get_file_transfer_progress_indication(const LinphoneChatRoomCbs *cbs);
|
||||
|
||||
/**
|
||||
* Set the file transfer progress indication callback.
|
||||
* @param[in] cbs LinphoneChatRoomCbs object.
|
||||
* @param[in] cb The file transfer progress indication callback to be used.
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_file_transfer_progress_indication(LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsFileTransferProgressIndicationCb cb);
|
||||
|
||||
|
||||
LINPHONE_PUBLIC unsigned int linphone_chat_message_store(LinphoneChatMessage *msg);
|
||||
|
||||
/**
|
||||
|
|
@ -734,14 +594,12 @@ LINPHONE_PUBLIC LinphoneChatMessageCbs * linphone_chat_message_get_callbacks(con
|
|||
* Acquire a reference to the LinphoneChatMessageCbs object.
|
||||
* @param[in] cbs LinphoneChatMessageCbs object.
|
||||
* @return The same LinphoneChatMessageCbs object.
|
||||
* @deprecated Use linphone_chat_room_cbs_ref() instead.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneChatMessageCbs * linphone_chat_message_cbs_ref(LinphoneChatMessageCbs *cbs);
|
||||
|
||||
/**
|
||||
* Release reference to the LinphoneChatMessageCbs object.
|
||||
* @param[in] cbs LinphoneChatMessageCbs object.
|
||||
* @deprecated Use linphone_chat_room_cbs_unref() instead.
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_chat_message_cbs_unref(LinphoneChatMessageCbs *cbs);
|
||||
|
||||
|
|
@ -749,7 +607,6 @@ LINPHONE_PUBLIC void linphone_chat_message_cbs_unref(LinphoneChatMessageCbs *cbs
|
|||
* Retrieve the user pointer associated with the LinphoneChatMessageCbs object.
|
||||
* @param[in] cbs LinphoneChatMessageCbs object.
|
||||
* @return The user pointer associated with the LinphoneChatMessageCbs object.
|
||||
* @deprecated Use linphone_chat_room_cbs_get_user_data() instead.
|
||||
*/
|
||||
LINPHONE_PUBLIC void *linphone_chat_message_cbs_get_user_data(const LinphoneChatMessageCbs *cbs);
|
||||
|
||||
|
|
@ -757,7 +614,6 @@ LINPHONE_PUBLIC void *linphone_chat_message_cbs_get_user_data(const LinphoneChat
|
|||
* Assign a user pointer to the LinphoneChatMessageCbs object.
|
||||
* @param[in] cbs LinphoneChatMessageCbs object.
|
||||
* @param[in] ud The user pointer to associate with the LinphoneChatMessageCbs object.
|
||||
* @deprecated Use linphone_chat_room_cbs_set_user_data() instead.
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_chat_message_cbs_set_user_data(LinphoneChatMessageCbs *cbs, void *ud);
|
||||
|
||||
|
|
@ -765,7 +621,6 @@ LINPHONE_PUBLIC void linphone_chat_message_cbs_set_user_data(LinphoneChatMessage
|
|||
* Get the message state changed callback.
|
||||
* @param[in] cbs LinphoneChatMessageCbs object.
|
||||
* @return The current message state changed callback.
|
||||
* @deprecated Use linphone_chat_room_cbs_get_msg_state_changed() instead.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneChatMessageCbsMsgStateChangedCb linphone_chat_message_cbs_get_msg_state_changed(const LinphoneChatMessageCbs *cbs);
|
||||
|
||||
|
|
@ -773,7 +628,6 @@ LINPHONE_PUBLIC LinphoneChatMessageCbsMsgStateChangedCb linphone_chat_message_cb
|
|||
* Set the message state changed callback.
|
||||
* @param[in] cbs LinphoneChatMessageCbs object.
|
||||
* @param[in] cb The message state changed callback to be used.
|
||||
* @deprecated Use linphone_chat_room_cbs_set_msg_state_changed() instead.
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_chat_message_cbs_set_msg_state_changed(LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsMsgStateChangedCb cb);
|
||||
|
||||
|
|
@ -781,7 +635,6 @@ LINPHONE_PUBLIC void linphone_chat_message_cbs_set_msg_state_changed(LinphoneCha
|
|||
* Get the file transfer receive callback.
|
||||
* @param[in] cbs LinphoneChatMessageCbs object.
|
||||
* @return The current file transfer receive callback.
|
||||
* @deprecated Use linphone_chat_room_cbs_get_file_transfer_recv() instead.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneChatMessageCbsFileTransferRecvCb linphone_chat_message_cbs_get_file_transfer_recv(const LinphoneChatMessageCbs *cbs);
|
||||
|
||||
|
|
@ -789,7 +642,6 @@ LINPHONE_PUBLIC LinphoneChatMessageCbsFileTransferRecvCb linphone_chat_message_c
|
|||
* Set the file transfer receive callback.
|
||||
* @param[in] cbs LinphoneChatMessageCbs object.
|
||||
* @param[in] cb The file transfer receive callback to be used.
|
||||
* @deprecated Use linphone_chat_room_cbs_set_file_transfer_recv() instead.
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_chat_message_cbs_set_file_transfer_recv(LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsFileTransferRecvCb cb);
|
||||
|
||||
|
|
@ -797,7 +649,6 @@ LINPHONE_PUBLIC void linphone_chat_message_cbs_set_file_transfer_recv(LinphoneCh
|
|||
* Get the file transfer send callback.
|
||||
* @param[in] cbs LinphoneChatMessageCbs object.
|
||||
* @return The current file transfer send callback.
|
||||
* @deprecated Use linphone_chat_room_cbs_get_file_transfer_send() instead.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneChatMessageCbsFileTransferSendCb linphone_chat_message_cbs_get_file_transfer_send(const LinphoneChatMessageCbs *cbs);
|
||||
|
||||
|
|
@ -805,7 +656,6 @@ LINPHONE_PUBLIC LinphoneChatMessageCbsFileTransferSendCb linphone_chat_message_c
|
|||
* Set the file transfer send callback.
|
||||
* @param[in] cbs LinphoneChatMessageCbs object.
|
||||
* @param[in] cb The file transfer send callback to be used.
|
||||
* @deprecated Use linphone_chat_room_cbs_set_file_transfer_send() instead.
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_chat_message_cbs_set_file_transfer_send(LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsFileTransferSendCb cb);
|
||||
|
||||
|
|
@ -813,7 +663,6 @@ LINPHONE_PUBLIC void linphone_chat_message_cbs_set_file_transfer_send(LinphoneCh
|
|||
* Get the file transfer progress indication callback.
|
||||
* @param[in] cbs LinphoneChatMessageCbs object.
|
||||
* @return The current file transfer progress indication callback.
|
||||
* @deprecated Use linphone_chat_room_cbs_get_file_transfer_progress_indication() instead.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneChatMessageCbsFileTransferProgressIndicationCb linphone_chat_message_cbs_get_file_transfer_progress_indication(const LinphoneChatMessageCbs *cbs);
|
||||
|
||||
|
|
@ -821,7 +670,6 @@ LINPHONE_PUBLIC LinphoneChatMessageCbsFileTransferProgressIndicationCb linphone_
|
|||
* Set the file transfer progress indication callback.
|
||||
* @param[in] cbs LinphoneChatMessageCbs object.
|
||||
* @param[in] cb The file transfer progress indication callback to be used.
|
||||
* @deprecated Use linphone_chat_room_cbs_set_file_transfer_progress_indication() instead.
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_chat_message_cbs_set_file_transfer_progress_indication(LinphoneChatMessageCbs *cbs, LinphoneChatMessageCbsFileTransferProgressIndicationCb cb);
|
||||
|
||||
|
|
|
|||
|
|
@ -64,13 +64,13 @@ static void message_forking(void) {
|
|||
LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc");
|
||||
bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
|
||||
LinphoneChatRoom* chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
|
||||
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(chat_room);
|
||||
LinphoneChatMessage* message = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu");
|
||||
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(message);
|
||||
|
||||
lcs=bctbx_list_append(lcs,pauline->lc);
|
||||
lcs=bctbx_list_append(lcs,marie2->lc);
|
||||
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_room_send_chat_message(chat_room, message);
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,1000));
|
||||
|
|
@ -94,8 +94,8 @@ static void message_forking_with_unreachable_recipients(void) {
|
|||
LinphoneCoreManager* marie3 = linphone_core_manager_new( "marie_rc");
|
||||
bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
|
||||
LinphoneChatRoom* chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
|
||||
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(chat_room);
|
||||
LinphoneChatMessage* message = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu");
|
||||
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(message);
|
||||
|
||||
lcs=bctbx_list_append(lcs,pauline->lc);
|
||||
lcs=bctbx_list_append(lcs,marie2->lc);
|
||||
|
|
@ -112,7 +112,7 @@ static void message_forking_with_unreachable_recipients(void) {
|
|||
linphone_core_set_network_reachable(marie2->lc,FALSE);
|
||||
linphone_core_set_network_reachable(marie3->lc,FALSE);
|
||||
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_room_send_chat_message(chat_room, message);
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,3000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,1000));
|
||||
|
|
@ -144,8 +144,8 @@ static void message_forking_with_all_recipients_unreachable(void) {
|
|||
LinphoneCoreManager* marie3 = linphone_core_manager_new( "marie_rc");
|
||||
bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc);
|
||||
LinphoneChatRoom* chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
|
||||
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(chat_room);
|
||||
LinphoneChatMessage* message = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu");
|
||||
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(message);
|
||||
|
||||
lcs=bctbx_list_append(lcs,pauline->lc);
|
||||
lcs=bctbx_list_append(lcs,marie2->lc);
|
||||
|
|
@ -164,7 +164,7 @@ static void message_forking_with_all_recipients_unreachable(void) {
|
|||
linphone_core_set_network_reachable(marie2->lc,FALSE);
|
||||
linphone_core_set_network_reachable(marie3->lc,FALSE);
|
||||
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_room_send_chat_message(chat_room, message);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageInProgress,1,5000));
|
||||
|
|
@ -772,8 +772,8 @@ static void call_ipv6_to_ipv4(void){
|
|||
static void file_transfer_message_rcs_to_external_body_client(void) {
|
||||
if (transport_supported(LinphoneTransportTls)) {
|
||||
LinphoneChatRoom* chat_room;
|
||||
LinphoneChatRoomCbs *cbs;
|
||||
LinphoneChatMessage* message;
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
LinphoneContent* content;
|
||||
FILE *file_to_send = NULL;
|
||||
size_t file_size;
|
||||
|
|
@ -807,9 +807,6 @@ static void file_transfer_message_rcs_to_external_body_client(void) {
|
|||
|
||||
/* create a chatroom on pauline's side */
|
||||
chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
|
||||
cbs = linphone_chat_room_get_callbacks(chat_room);
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_room_cbs_set_file_transfer_send(cbs, tester_file_transfer_send);
|
||||
|
||||
/* create a file transfer message */
|
||||
content = linphone_core_create_content(pauline->lc);
|
||||
|
|
@ -819,19 +816,22 @@ static void file_transfer_message_rcs_to_external_body_client(void) {
|
|||
linphone_content_set_name(content,"nowebcamCIF.jpg");
|
||||
message = linphone_chat_room_create_file_transfer_message(chat_room, content);
|
||||
linphone_chat_message_set_user_data(message, file_to_send);
|
||||
cbs = linphone_chat_message_get_callbacks(message);
|
||||
{
|
||||
int dummy=0;
|
||||
wait_for_until(marie->lc,pauline->lc,&dummy,1,100); /*just to have time to purge message stored in the server*/
|
||||
reset_counters(&marie->stat);
|
||||
reset_counters(&pauline->stat);
|
||||
}
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_message_cbs_set_file_transfer_send(cbs, tester_file_transfer_send);
|
||||
linphone_chat_room_send_chat_message(chat_room,message);
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageExtBodyReceived,1));
|
||||
|
||||
if (marie->stat.last_received_chat_message ) {
|
||||
cbs = linphone_chat_room_get_callbacks(marie->stat.last_received_chat_message->chat_room);
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_room_cbs_set_file_transfer_recv(cbs, file_transfer_received);
|
||||
cbs = linphone_chat_message_get_callbacks(marie->stat.last_received_chat_message);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received);
|
||||
linphone_chat_message_download_file(marie->stat.last_received_chat_message);
|
||||
}
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageFileTransferDone,1));
|
||||
|
|
@ -850,17 +850,18 @@ static void file_transfer_message_rcs_to_external_body_client(void) {
|
|||
}
|
||||
|
||||
void send_file_transfer_message_using_external_body_url(LinphoneCoreManager *marie, LinphoneCoreManager *pauline) {
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
LinphoneChatRoom *chat_room;
|
||||
LinphoneChatRoomCbs *cbs;
|
||||
LinphoneChatMessage *message;
|
||||
|
||||
/* create a chatroom on pauline's side */
|
||||
chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
|
||||
cbs = linphone_chat_room_get_callbacks(chat_room);
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
|
||||
message = linphone_chat_room_create_message(chat_room, NULL);
|
||||
|
||||
cbs = linphone_chat_message_get_callbacks(message);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
|
||||
linphone_chat_message_set_external_body_url(message, "https://www.linphone.org:444//tmp/54ec58280ace9_c30709218df8eaba61d1.jpg");
|
||||
linphone_chat_room_send_chat_message(chat_room, message);
|
||||
|
||||
|
|
|
|||
|
|
@ -307,10 +307,10 @@ void notify_presence_received(LinphoneCore *lc, LinphoneFriend * lf);
|
|||
void notify_presence_received_for_uri_or_tel(LinphoneCore *lc, LinphoneFriend *lf, const char *uri_or_tel, const LinphonePresenceModel *presence);
|
||||
void text_message_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from_address, const char *message);
|
||||
void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage* message);
|
||||
void file_transfer_received(LinphoneChatRoom *room, LinphoneChatMessage *message, const LinphoneContent* content, const LinphoneBuffer *buffer);
|
||||
LinphoneBuffer * tester_file_transfer_send(LinphoneChatRoom *room, LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t size);
|
||||
void file_transfer_received(LinphoneChatMessage *message, const LinphoneContent* content, const LinphoneBuffer *buffer);
|
||||
LinphoneBuffer * tester_file_transfer_send(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t size);
|
||||
LinphoneBuffer * tester_memory_file_transfer_send(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t size);
|
||||
void file_transfer_progress_indication(LinphoneChatRoom *room, LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total);
|
||||
void file_transfer_progress_indication(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total);
|
||||
void is_composing_received(LinphoneCore *lc, LinphoneChatRoom *room);
|
||||
void info_message_received(LinphoneCore *lc, LinphoneCall *call, const LinphoneInfoMessage *msg);
|
||||
void new_subscription_requested(LinphoneCore *lc, LinphoneFriend *lf, const char *url);
|
||||
|
|
@ -353,7 +353,7 @@ LinphoneCoreManager *get_manager(LinphoneCore *lc);
|
|||
const char *liblinphone_tester_get_subscribe_content(void);
|
||||
const char *liblinphone_tester_get_notify_content(void);
|
||||
void liblinphone_tester_chat_message_state_change(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud);
|
||||
void liblinphone_tester_chat_message_msg_state_changed(LinphoneChatRoom *room, LinphoneChatMessage *msg, LinphoneChatMessageState state);
|
||||
void liblinphone_tester_chat_message_msg_state_changed(LinphoneChatMessage *msg, LinphoneChatMessageState state);
|
||||
void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreManager* callee);
|
||||
void liblinphone_tester_clock_start(MSTimeSpec *start);
|
||||
bool_t liblinphone_tester_clock_elapsed(const MSTimeSpec *start, int value_ms);
|
||||
|
|
|
|||
|
|
@ -69,10 +69,11 @@ void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMess
|
|||
/**
|
||||
* function invoked when a file transfer is received.
|
||||
* */
|
||||
void file_transfer_received(LinphoneChatRoom *room, LinphoneChatMessage *msg, const LinphoneContent* content, const LinphoneBuffer *buffer){
|
||||
void file_transfer_received(LinphoneChatMessage *msg, const LinphoneContent* content, const LinphoneBuffer *buffer){
|
||||
FILE* file=NULL;
|
||||
char *receive_file = NULL;
|
||||
LinphoneCore *lc = linphone_chat_room_get_core(room);
|
||||
LinphoneChatRoom *cr = linphone_chat_message_get_chat_room(msg);
|
||||
LinphoneCore *lc = linphone_chat_room_get_core(cr);
|
||||
|
||||
if (linphone_chat_message_get_file_transfer_filepath(msg) != NULL) {
|
||||
if (linphone_buffer_is_empty(buffer)) {
|
||||
|
|
@ -106,7 +107,7 @@ void file_transfer_received(LinphoneChatRoom *room, LinphoneChatMessage *msg, co
|
|||
/*
|
||||
* function called when the file transfer is initiated. file content should be feed into object LinphoneContent
|
||||
* */
|
||||
LinphoneBuffer * tester_file_transfer_send(LinphoneChatRoom *room, LinphoneChatMessage *msg, const LinphoneContent* content, size_t offset, size_t size){
|
||||
LinphoneBuffer * tester_file_transfer_send(LinphoneChatMessage *msg, const LinphoneContent* content, size_t offset, size_t size){
|
||||
LinphoneBuffer *lb;
|
||||
size_t file_size;
|
||||
size_t size_to_send;
|
||||
|
|
@ -135,8 +136,9 @@ LinphoneBuffer * tester_file_transfer_send(LinphoneChatRoom *room, LinphoneChatM
|
|||
/**
|
||||
* function invoked to report file transfer progress.
|
||||
* */
|
||||
void file_transfer_progress_indication(LinphoneChatRoom *room, LinphoneChatMessage *msg, const LinphoneContent* content, size_t offset, size_t total) {
|
||||
LinphoneCore *lc = linphone_chat_room_get_core(room);
|
||||
void file_transfer_progress_indication(LinphoneChatMessage *msg, const LinphoneContent* content, size_t offset, size_t total) {
|
||||
LinphoneChatRoom *cr = linphone_chat_message_get_chat_room(msg);
|
||||
LinphoneCore *lc = linphone_chat_room_get_core(cr);
|
||||
const LinphoneAddress* from_address = linphone_chat_message_get_from(msg);
|
||||
const LinphoneAddress* to_address = linphone_chat_message_get_to(msg);
|
||||
char *address = linphone_chat_message_is_outgoing(msg)?linphone_address_as_string(to_address):linphone_address_as_string(from_address);
|
||||
|
|
@ -162,10 +164,10 @@ void is_composing_received(LinphoneCore *lc, LinphoneChatRoom *room) {
|
|||
}
|
||||
|
||||
void liblinphone_tester_chat_message_state_change(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud) {
|
||||
liblinphone_tester_chat_message_msg_state_changed(msg->chat_room, msg, state);
|
||||
liblinphone_tester_chat_message_msg_state_changed(msg, state);
|
||||
}
|
||||
|
||||
void liblinphone_tester_chat_message_msg_state_changed(LinphoneChatRoom *room, LinphoneChatMessage *msg, LinphoneChatMessageState state) {
|
||||
void liblinphone_tester_chat_message_msg_state_changed(LinphoneChatMessage *msg, LinphoneChatMessageState state) {
|
||||
LinphoneChatRoom *cr = linphone_chat_message_get_chat_room(msg);
|
||||
LinphoneCore *lc = linphone_chat_room_get_core(cr);
|
||||
stats* counters = get_stats(lc);
|
||||
|
|
@ -215,7 +217,7 @@ void compare_files(const char *path1, const char *path2) {
|
|||
|
||||
LinphoneChatMessage* create_message_from_nowebcam(LinphoneChatRoom *chat_room) {
|
||||
FILE *file_to_send = NULL;
|
||||
LinphoneChatRoomCbs *cbs;
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
LinphoneContent* content;
|
||||
LinphoneChatMessage* msg;
|
||||
size_t file_size;
|
||||
|
|
@ -232,12 +234,11 @@ LinphoneChatMessage* create_message_from_nowebcam(LinphoneChatRoom *chat_room) {
|
|||
linphone_content_set_size(content,file_size); /*total size to be transfered*/
|
||||
linphone_content_set_name(content,"nowebcamCIF.jpg");
|
||||
|
||||
cbs = linphone_chat_room_get_callbacks(chat_room);
|
||||
linphone_chat_room_cbs_set_file_transfer_send(cbs, tester_file_transfer_send);
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_room_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
|
||||
|
||||
msg = linphone_chat_room_create_file_transfer_message(chat_room, content);
|
||||
cbs = linphone_chat_message_get_callbacks(msg);
|
||||
linphone_chat_message_cbs_set_file_transfer_send(cbs, tester_file_transfer_send);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_message_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
|
||||
linphone_chat_message_set_user_data(msg, file_to_send);
|
||||
|
||||
linphone_content_unref(content);
|
||||
|
|
@ -246,7 +247,7 @@ LinphoneChatMessage* create_message_from_nowebcam(LinphoneChatRoom *chat_room) {
|
|||
}
|
||||
|
||||
LinphoneChatMessage* create_file_transfer_message_from_nowebcam(LinphoneChatRoom *chat_room) {
|
||||
LinphoneChatRoomCbs *cbs;
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
LinphoneContent* content;
|
||||
LinphoneChatMessage* msg;
|
||||
char *send_filepath = bc_tester_res("images/nowebcamCIF.jpg");
|
||||
|
|
@ -257,12 +258,11 @@ LinphoneChatMessage* create_file_transfer_message_from_nowebcam(LinphoneChatRoom
|
|||
linphone_content_set_subtype(content,"jpeg");
|
||||
linphone_content_set_name(content,"nowebcamCIF.jpg");
|
||||
|
||||
cbs = linphone_chat_room_get_callbacks(chat_room);
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_room_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
|
||||
|
||||
msg = linphone_chat_room_create_file_transfer_message(chat_room, content);
|
||||
linphone_chat_message_set_file_transfer_filepath(msg, send_filepath);
|
||||
cbs = linphone_chat_message_get_callbacks(msg);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_message_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
|
||||
|
||||
linphone_content_unref(content);
|
||||
ms_free(send_filepath);
|
||||
|
|
@ -270,10 +270,9 @@ LinphoneChatMessage* create_file_transfer_message_from_nowebcam(LinphoneChatRoom
|
|||
}
|
||||
|
||||
void text_message_base(LinphoneCoreManager* marie, LinphoneCoreManager* pauline) {
|
||||
LinphoneChatRoom *room = linphone_core_get_chat_room(pauline->lc, marie->identity);
|
||||
LinphoneChatMessage* msg = linphone_chat_room_create_message(room, "Bli bli bli \n blu");
|
||||
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(room);
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
LinphoneChatMessage* msg = linphone_chat_room_create_message(linphone_core_get_chat_room(pauline->lc,marie->identity),"Bli bli bli \n blu");
|
||||
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(msg);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_room_send_chat_message(msg->chat_room,msg);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1));
|
||||
|
|
@ -388,12 +387,12 @@ static void text_message_with_send_error(void) {
|
|||
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
|
||||
LinphoneChatRoom* chat_room = linphone_core_get_chat_room(marie->lc, pauline->identity);
|
||||
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(chat_room);
|
||||
LinphoneChatMessage* msg = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu");
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(msg);
|
||||
|
||||
/*simulate a network error*/
|
||||
sal_set_send_error(marie->lc->sal, -1);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_room_send_chat_message(chat_room,msg);
|
||||
|
||||
/* check transient msg list: the msg should be in it, and should be the only one */
|
||||
|
|
@ -421,12 +420,12 @@ static void text_message_with_external_body(void) {
|
|||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
|
||||
LinphoneChatRoom* chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
|
||||
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(chat_room);
|
||||
LinphoneChatMessage* msg = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu");
|
||||
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(msg);
|
||||
|
||||
message_external_body_url="http://www.linphone.org";
|
||||
linphone_chat_message_set_external_body_url(msg,message_external_body_url);
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_room_send_chat_message(chat_room,msg);
|
||||
|
||||
/* check transient msg list: the msg should be in it, and should be the only one */
|
||||
|
|
@ -450,8 +449,8 @@ void transfer_message_base2(LinphoneCoreManager* marie, LinphoneCoreManager* pau
|
|||
char *send_filepath = bc_tester_res("images/nowebcamCIF.jpg");
|
||||
char *receive_filepath = bc_tester_file("receive_file.dump");
|
||||
LinphoneChatRoom* chat_room;
|
||||
LinphoneChatRoomCbs *cbs;
|
||||
LinphoneChatMessage* msg;
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
|
||||
/* Remove any previously downloaded file */
|
||||
remove(receive_filepath);
|
||||
|
|
@ -461,10 +460,6 @@ void transfer_message_base2(LinphoneCoreManager* marie, LinphoneCoreManager* pau
|
|||
|
||||
/* create a chatroom on pauline's side */
|
||||
chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
|
||||
cbs = linphone_chat_room_get_callbacks(chat_room);
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_room_cbs_set_file_transfer_recv(cbs, file_transfer_received);
|
||||
linphone_chat_room_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
|
||||
|
||||
/* create a file transfer msg */
|
||||
if (use_file_body_handler_in_upload) {
|
||||
|
|
@ -492,6 +487,10 @@ void transfer_message_base2(LinphoneCoreManager* marie, LinphoneCoreManager* pau
|
|||
} else {
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1));
|
||||
if (marie->stat.last_received_chat_message ) {
|
||||
cbs = linphone_chat_message_get_callbacks(marie->stat.last_received_chat_message);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received);
|
||||
linphone_chat_message_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
|
||||
if (use_file_body_handler_in_download) {
|
||||
linphone_chat_message_set_file_transfer_filepath(recv_msg, receive_filepath);
|
||||
}
|
||||
|
|
@ -591,7 +590,6 @@ static void transfer_message_upload_cancelled(void) {
|
|||
|
||||
static void transfer_message_download_cancelled(void) {
|
||||
LinphoneChatRoom* chat_room;
|
||||
LinphoneChatRoomCbs *cbs;
|
||||
LinphoneChatMessage* msg;
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
|
||||
|
|
@ -601,8 +599,6 @@ static void transfer_message_download_cancelled(void) {
|
|||
|
||||
/* create a chatroom on pauline's side */
|
||||
chat_room = linphone_core_get_chat_room(pauline->lc,marie->identity);
|
||||
cbs = linphone_chat_room_get_callbacks(chat_room);
|
||||
linphone_chat_room_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
|
||||
msg = create_message_from_nowebcam(chat_room);
|
||||
linphone_chat_room_send_chat_message(chat_room,msg);
|
||||
|
||||
|
|
@ -610,6 +606,8 @@ static void transfer_message_download_cancelled(void) {
|
|||
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1));
|
||||
|
||||
if (marie->stat.last_received_chat_message ) { /* get last msg and use it to download file */
|
||||
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(marie->stat.last_received_chat_message);
|
||||
linphone_chat_message_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
|
||||
linphone_chat_message_start_file_download(marie->stat.last_received_chat_message, liblinphone_tester_chat_message_state_change, marie->lc);
|
||||
/* wait for file to be 50% downloaded */
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.progress_of_LinphoneFileTransfer, 50));
|
||||
|
|
@ -630,8 +628,8 @@ static void file_transfer_using_external_body_url(void) {
|
|||
if (transport_supported(LinphoneTransportTls)) {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneChatRoom *chat_room;
|
||||
LinphoneChatRoomCbs *cbs;
|
||||
LinphoneChatMessage *msg;
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_rc");
|
||||
|
||||
/* make sure lime is disabled */
|
||||
|
|
@ -640,11 +638,12 @@ static void file_transfer_using_external_body_url(void) {
|
|||
|
||||
/* create a chatroom on pauline's side */
|
||||
chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
|
||||
cbs = linphone_chat_room_get_callbacks(chat_room);
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
|
||||
msg = linphone_chat_room_create_message(chat_room, NULL);
|
||||
|
||||
cbs = linphone_chat_message_get_callbacks(msg);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
|
||||
linphone_chat_message_set_external_body_url(msg, "https://www.linphone.org:444//tmp/54ec58280ace9_c30709218df8eaba61d1.jpg");
|
||||
linphone_chat_room_send_chat_message(chat_room, msg);
|
||||
|
||||
|
|
@ -663,10 +662,9 @@ static void file_transfer_2_messages_simultaneously(void) {
|
|||
if (transport_supported(LinphoneTransportTls)) {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneChatRoom* pauline_room;
|
||||
LinphoneChatRoom *marie_room;
|
||||
LinphoneChatRoomCbs *cbs;
|
||||
LinphoneChatMessage* msg;
|
||||
LinphoneChatMessage* msg2;
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
char *send_filepath = bc_tester_res("images/nowebcamCIF.jpg");
|
||||
char *receive_filepath = bc_tester_file("receive_file.dump");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
|
||||
|
|
@ -679,21 +677,18 @@ static void file_transfer_2_messages_simultaneously(void) {
|
|||
|
||||
/* create a chatroom on pauline's side */
|
||||
pauline_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
|
||||
cbs = linphone_chat_room_get_callbacks(pauline_room);
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
msg = create_message_from_nowebcam(pauline_room);
|
||||
msg2 = create_message_from_nowebcam(pauline_room);
|
||||
|
||||
cbs = linphone_chat_message_get_callbacks(msg2);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed);
|
||||
|
||||
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(linphone_core_get_chat_rooms(marie->lc)), 0, unsigned int, "%u");
|
||||
if (bctbx_list_size(linphone_core_get_chat_rooms(marie->lc)) == 0) {
|
||||
linphone_chat_room_send_chat_message(pauline_room,msg);
|
||||
linphone_chat_room_send_chat_message(pauline_room,msg2);
|
||||
if (BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1))) {
|
||||
msg = linphone_chat_message_clone(marie->stat.last_received_chat_message);
|
||||
marie_room = linphone_chat_message_get_chat_room(msg);
|
||||
cbs = linphone_chat_room_get_callbacks(marie_room);
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_room_cbs_set_file_transfer_recv(cbs, file_transfer_received);
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,2));
|
||||
msg2 = marie->stat.last_received_chat_message;
|
||||
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(linphone_core_get_chat_rooms(marie->lc)), 1, unsigned int, "%u");
|
||||
|
|
@ -708,8 +703,16 @@ static void file_transfer_2_messages_simultaneously(void) {
|
|||
ms_error("%s", buf);
|
||||
}
|
||||
|
||||
cbs = linphone_chat_message_get_callbacks(msg);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received);
|
||||
linphone_chat_message_download_file(msg);
|
||||
|
||||
cbs = linphone_chat_message_get_callbacks(msg2);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received);
|
||||
linphone_chat_message_download_file(msg2);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,2));
|
||||
|
||||
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,4, int, "%d");
|
||||
|
|
@ -731,12 +734,12 @@ static void text_message_denied(void) {
|
|||
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
|
||||
LinphoneChatRoom* chat_room = linphone_core_get_chat_room(marie->lc, pauline->identity);
|
||||
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(chat_room);
|
||||
LinphoneChatMessage* msg = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu");
|
||||
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(msg);
|
||||
|
||||
/*pauline doesn't want to be disturbed*/
|
||||
linphone_core_disable_chat(pauline->lc,LinphoneReasonDoNotDisturb);
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_room_send_chat_message(chat_room,msg);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageNotDelivered,1));
|
||||
|
|
@ -885,13 +888,13 @@ static void imdn_notifications(void) {
|
|||
LinphoneCoreManager *pauline = linphone_core_manager_new( "pauline_tcp_rc");
|
||||
LinphoneChatRoom *pauline_chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
|
||||
LinphoneChatRoom *marie_chat_room;
|
||||
LinphoneChatRoomCbs *cbs;
|
||||
LinphoneChatMessage *cm;
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
bctbx_list_t *history;
|
||||
|
||||
cbs = linphone_chat_room_get_callbacks(pauline_chat_room);
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
cm = linphone_chat_room_create_message(pauline_chat_room, "Tell me if you get my message");
|
||||
cbs = linphone_chat_message_get_callbacks(cm);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_room_send_chat_message(pauline_chat_room, cm);
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1));
|
||||
marie_chat_room = linphone_core_get_chat_room(marie->lc, pauline->identity);
|
||||
|
|
@ -1002,7 +1005,7 @@ void lime_transfer_message_base(bool_t encrypt_file,bool_t download_file_from_st
|
|||
FILE *ZIDCacheMarieFD, *ZIDCachePaulineFD;
|
||||
LinphoneCoreManager *marie, *pauline;
|
||||
LinphoneChatMessage *msg;
|
||||
LinphoneChatRoomCbs *cbs;
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
char *pauline_id, *marie_id;
|
||||
char *filepath;
|
||||
char *send_filepath = bc_tester_res("images/nowebcamCIF.jpg");
|
||||
|
|
@ -1071,9 +1074,9 @@ void lime_transfer_message_base(bool_t encrypt_file,bool_t download_file_from_st
|
|||
} else {
|
||||
recv_msg = marie->stat.last_received_chat_message;
|
||||
}
|
||||
cbs = linphone_chat_room_get_callbacks(linphone_chat_message_get_chat_room(recv_msg));
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_room_cbs_set_file_transfer_recv(cbs, file_transfer_received);
|
||||
cbs = linphone_chat_message_get_callbacks(recv_msg);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received);
|
||||
content = linphone_chat_message_get_file_transfer_information(recv_msg);
|
||||
if (!content) goto end;
|
||||
if (encrypt_file)
|
||||
|
|
@ -1542,9 +1545,9 @@ static void text_status_after_destroying_chat_room(void) {
|
|||
static void file_transfer_not_sent_if_invalid_url(void) {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneChatRoom *chatroom = linphone_core_get_chat_room_from_uri(marie->lc, "<sip:Jehan@sip.linphone.org>");
|
||||
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(chatroom);
|
||||
LinphoneChatMessage *msg = create_message_from_nowebcam(chatroom);
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(msg);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_core_set_file_transfer_server(marie->lc, "INVALID URL");
|
||||
linphone_chat_room_send_chat_message(chatroom, msg);
|
||||
BC_ASSERT_TRUE(wait_for_until(marie->lc, NULL, &marie->stat.number_of_LinphoneMessageNotDelivered, 1, 1000));
|
||||
|
|
@ -1554,9 +1557,9 @@ static void file_transfer_not_sent_if_invalid_url(void) {
|
|||
void file_transfer_io_error_base(char *server_url, bool_t destroy_room) {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneChatRoom *chatroom = linphone_core_get_chat_room_from_uri(marie->lc, "<sip:Jehan@sip.linphone.org>");
|
||||
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(chatroom);
|
||||
LinphoneChatMessage *msg = create_message_from_nowebcam(chatroom);
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(msg);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_core_set_file_transfer_server(marie->lc, server_url);
|
||||
linphone_chat_room_send_chat_message(chatroom, msg);
|
||||
BC_ASSERT_TRUE(wait_for_until(marie->lc, NULL, &marie->stat.number_of_LinphoneMessageInProgress, 1, 1000));
|
||||
|
|
@ -2021,14 +2024,14 @@ void chat_message_custom_headers(void) {
|
|||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
|
||||
LinphoneChatRoom* chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
|
||||
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(chat_room);
|
||||
LinphoneChatMessage* msg = linphone_chat_room_create_message(chat_room, "Lorem Ipsum");
|
||||
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(msg);
|
||||
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_message_add_custom_header(msg, "Test1", "Value1");
|
||||
linphone_chat_message_add_custom_header(msg, "Test2", "Value2");
|
||||
linphone_chat_message_remove_custom_header(msg, "Test1");
|
||||
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_room_send_chat_message(chat_room,msg);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ static void helper(const char *progname) {
|
|||
exit(0);
|
||||
}
|
||||
|
||||
static void on_msg_state_changed(LinphoneChatRoom *room, LinphoneChatMessage *msg, LinphoneChatMessageState state){
|
||||
static void on_msg_state_changed(LinphoneChatMessage *msg, LinphoneChatMessageState state){
|
||||
switch(state){
|
||||
case LinphoneChatMessageStateInProgress:
|
||||
printf("Sending message...\n");
|
||||
|
|
@ -85,7 +85,7 @@ int main(int argc, char *argv[]){
|
|||
LinphoneProxyConfig *cfg;
|
||||
LinphoneChatMessage *msg;
|
||||
LinphoneChatRoom *room;
|
||||
LinphoneChatRoomCbs *cbs;
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
char * text = NULL;
|
||||
char *tmp;
|
||||
|
||||
|
|
@ -177,9 +177,9 @@ int main(int argc, char *argv[]){
|
|||
linphone_proxy_config_unref(cfg);
|
||||
|
||||
room = linphone_core_get_chat_room(lc, to);
|
||||
cbs = linphone_chat_room_get_callbacks(room);
|
||||
linphone_chat_room_cbs_set_msg_state_changed(cbs, on_msg_state_changed);
|
||||
msg = linphone_chat_room_create_message(room, text);
|
||||
cbs = linphone_chat_message_get_callbacks(msg);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, on_msg_state_changed);
|
||||
linphone_chat_room_send_chat_message(room, msg);
|
||||
/* main loop for receiving notifications and doing background linphonecore work: */
|
||||
while(running){
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue