Allow IM Encryption Engine to return a custom code upon reception of a composing message

This commit is contained in:
Sylvain Berfini 2016-12-06 10:30:09 +01:00
parent 0b16049394
commit a1d5ed8ca9
4 changed files with 10 additions and 6 deletions

View file

@ -98,8 +98,6 @@ void sal_process_incoming_message(SalOp *op,const belle_sip_request_event_t *eve
saliscomposing.from=from;
saliscomposing.text=belle_sip_message_get_body(BELLE_SIP_MESSAGE(req));
op->base.root->callbacks.is_composing_received(op,&saliscomposing);
resp = belle_sip_response_create_from_request(req,200);
belle_sip_server_transaction_send_response(server_transaction,resp);
belle_sip_object_unref(address);
belle_sip_free(from);
} else {

View file

@ -1163,13 +1163,14 @@ static void text_received(SalOp *op, const SalMessage *msg){
if (reason == LinphoneReasonNone && is_duplicate_msg(lc, msg->message_id) == FALSE) {
reason = linphone_core_message_received(lc, op, msg);
}
sal_message_reply(op,linphone_reason_to_sal(reason));
sal_message_reply(op, linphone_reason_to_sal(reason));
if (!call) sal_op_release(op);
}
static void is_composing_received(SalOp *op, const SalIsComposing *is_composing) {
LinphoneCore *lc = (LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
linphone_core_is_composing_received(lc, op, is_composing);
LinphoneReason reason = linphone_core_is_composing_received(lc, op, is_composing);
sal_message_reply(op, linphone_reason_to_sal(reason));
sal_op_release(op);
}

View file

@ -702,10 +702,11 @@ static void linphone_chat_room_notify_is_composing(LinphoneChatRoom *cr, const c
linphone_xmlparsing_context_destroy(xml_ctx);
}
void linphone_core_is_composing_received(LinphoneCore *lc, SalOp *op, const SalIsComposing *is_composing) {
LinphoneReason linphone_core_is_composing_received(LinphoneCore *lc, SalOp *op, const SalIsComposing *is_composing) {
LinphoneAddress *addr = linphone_address_new(is_composing->from);
LinphoneChatRoom *cr = _linphone_core_get_chat_room(lc, addr);
LinphoneImEncryptionEngine *imee = linphone_core_get_im_encryption_engine(lc);
LinphoneReason reason = LinphoneReasonNone;
if (cr != NULL) {
int retval = -1;
@ -720,10 +721,14 @@ void linphone_core_is_composing_received(LinphoneCore *lc, SalOp *op, const SalI
}
if (retval <= 0) {
linphone_chat_room_notify_is_composing(cr, msg->message);
} else {
reason = linphone_error_code_to_reason(retval);
}
linphone_chat_message_unref(msg);
}
linphone_address_destroy(addr);
return reason;
}
bool_t linphone_chat_room_is_remote_composing(const LinphoneChatRoom *cr) {

View file

@ -551,7 +551,7 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore *lc
void linphone_proxy_config_write_to_config_file(struct _LpConfig* config,LinphoneProxyConfig *obj, int index);
LinphoneReason linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessage *msg);
void linphone_core_is_composing_received(LinphoneCore *lc, SalOp *op, const SalIsComposing *is_composing);
LinphoneReason linphone_core_is_composing_received(LinphoneCore *lc, SalOp *op, const SalIsComposing *is_composing);
void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *cr, uint32_t character, LinphoneCall *call);
void linphone_call_init_stats(LinphoneCallStats *stats, int type);