diff --git a/coreapi/bellesip_sal/sal_op_message.c b/coreapi/bellesip_sal/sal_op_message.c index 4eec76c6e..25402aef2 100644 --- a/coreapi/bellesip_sal/sal_op_message.c +++ b/coreapi/bellesip_sal/sal_op_message.c @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static void process_error( SalOp* op) { if (op->dir == SalOpDirOutgoing) { - op->base.root->callbacks.text_delivery_update(op,403, "process error"); + op->base.root->callbacks.text_delivery_update(op,SalTextDeliveryFailed); } else { ms_warning("unexpected io error for incoming message on op [%p]",op); } @@ -54,8 +54,19 @@ static void process_response_event(void *op_base, const belle_sip_response_event SalOp* op = (SalOp*)op_base; /*belle_sip_client_transaction_t *client_transaction=belle_sip_response_event_get_client_transaction(event);*/ int code = belle_sip_response_get_status_code(belle_sip_response_event_get_response(event)); - const char *reason = belle_sip_response_get_reason_phrase(belle_sip_response_event_get_response(event)); - op->base.root->callbacks.text_delivery_update(op,code, reason); + SalTextDeliveryStatus status; + if (code>=100 && code <200) + status=SalTextDeliveryInProgress; + else if (code>=200 && code <300) + status=SalTextDeliveryDone; + else + status=SalTextDeliveryFailed; + if (status != SalTextDeliveryInProgress) { + /*reset op to make sure transaction terminated does not need op + belle_sip_transaction_set_application_data(BELLE_SIP_TRANSACTION(client_transaction),NULL);*/ + } + op->base.root->callbacks.text_delivery_update(op,status); + } static bool_t is_plain_text(belle_sip_header_content_type_t* content_type) { return strcmp("text",belle_sip_header_content_type_get_type(content_type))==0 diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index fe9b53aef..f22d35f20 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -1024,17 +1024,7 @@ static int op_equals(LinphoneCall *a, SalOp *b) { return a->op !=b; /*return 0 if equals*/ } -static SalTextDeliveryStatus code_to_text_delivery_status(int code) { - if (code>=100 && code <200) - return SalTextDeliveryInProgress; - else if (code>=200 && code <300) - return SalTextDeliveryDone; - else - return SalTextDeliveryFailed; -} - -static void text_delivery_update(SalOp *op, int code, const char *reason){ - SalTextDeliveryStatus status = code_to_text_delivery_status(code); +static void text_delivery_update(SalOp *op, SalTextDeliveryStatus status){ LinphoneChatMessage *chat_msg=(LinphoneChatMessage* )sal_op_get_user_pointer(op); const MSList* calls; @@ -1045,8 +1035,6 @@ static void text_delivery_update(SalOp *op, int code, const char *reason){ calls = linphone_core_get_calls(chat_msg->chat_room->lc); chat_msg->state=chatStatusSal2Linphone(status); - chat_msg->response_code=code; - chat_msg->response_reason=ms_strdup(reason); linphone_chat_message_store_state(chat_msg); if (chat_msg && chat_msg->cb) { ms_message("Notifying text delivery with status %i",chat_msg->state); diff --git a/coreapi/chat.c b/coreapi/chat.c index 2a756fef9..6dc8ae57a 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -786,17 +786,9 @@ void linphone_chat_message_destroy(LinphoneChatMessage* msg) { if (msg->from) linphone_address_destroy(msg->from); if (msg->to) linphone_address_destroy(msg->to); if (msg->custom_headers) sal_custom_header_free(msg->custom_headers); - if (msg->response_reason) ms_free(msg->response_reason); ms_free(msg); } -int linphone_chat_message_get_response_code(LinphoneChatMessage* msg) { - return msg->response_code; -} - -const char *linphone_chat_message_get_response_reason(LinphoneChatMessage* msg) { - return msg->response_reason; -} /** * @} diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 8fefaf7f6..0c6580bae 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1044,8 +1044,6 @@ LINPHONE_PUBLIC const char * linphone_chat_message_get_custom_header(LinphoneCha LINPHONE_PUBLIC bool_t linphone_chat_message_is_read(LinphoneChatMessage* message); LINPHONE_PUBLIC bool_t linphone_chat_message_is_outgoing(LinphoneChatMessage* message); LINPHONE_PUBLIC unsigned int linphone_chat_message_get_storage_id(LinphoneChatMessage* message); -LINPHONE_PUBLIC int linphone_chat_message_get_response_code(LinphoneChatMessage* msg); -LINPHONE_PUBLIC const char *linphone_chat_message_get_response_reason(LinphoneChatMessage* msg); /** * @} */ diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 7051c6abe..3ac117faa 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -2324,20 +2324,6 @@ extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getText(JNIEnv return jvalue; } -extern "C" jint Java_org_linphone_core_LinphoneChatMessageImpl_getResponseCode(JNIEnv* env - ,jobject thiz - ,jlong ptr) { - return linphone_chat_message_get_response_code((LinphoneChatMessage*)ptr); -} - -extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getResponseReason(JNIEnv* env - ,jobject thiz - ,jlong ptr) { - const char *reason = linphone_chat_message_get_response_reason((LinphoneChatMessage*)ptr); - return env->NewStringUTF(reason); - -} - extern "C" jstring Java_org_linphone_core_LinphoneChatMessageImpl_getCustomHeader(JNIEnv* env ,jobject thiz ,jlong ptr, jstring jheader_name) { diff --git a/coreapi/private.h b/coreapi/private.h index ca9054d8f..a4ec17857 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -25,7 +25,6 @@ #ifndef _PRIVATE_H #define _PRIVATE_H #ifdef __cplusplus - extern "C" { #endif #include "linphonecore.h" @@ -146,8 +145,6 @@ struct _LinphoneChatMessage { LinphoneChatMessageState state; bool_t is_read; unsigned int storage_id; - int response_code; - char *response_reason; }; typedef struct StunCandidate{ diff --git a/include/sal/sal.h b/include/sal/sal.h index db2625329..7a7134754 100644 --- a/include/sal/sal.h +++ b/include/sal/sal.h @@ -391,7 +391,7 @@ typedef void (*SalOnVfuRequest)(SalOp *op); typedef void (*SalOnDtmfReceived)(SalOp *op, char dtmf); typedef void (*SalOnRefer)(Sal *sal, SalOp *op, const char *referto); typedef void (*SalOnTextReceived)(SalOp *op, const SalMessage *msg); -typedef void (*SalOnTextDeliveryUpdate)(SalOp *op, int code, const char *reason); +typedef void (*SalOnTextDeliveryUpdate)(SalOp *op, SalTextDeliveryStatus status); typedef void (*SalOnIsComposingReceived)(SalOp *op, const SalIsComposing *is_composing); typedef void (*SalOnNotifyRefer)(SalOp *op, SalReferStatus state); typedef void (*SalOnSubscribeResponse)(SalOp *op, SalSubscribeStatus status, SalError error, SalReason reason); diff --git a/java/common/org/linphone/core/LinphoneChatMessage.java b/java/common/org/linphone/core/LinphoneChatMessage.java index c6985a33e..8345df382 100644 --- a/java/common/org/linphone/core/LinphoneChatMessage.java +++ b/java/common/org/linphone/core/LinphoneChatMessage.java @@ -141,14 +141,4 @@ public interface LinphoneChatMessage { * @return the id used to id this message in the database */ int getStorageId(); - - /** - * @return the response code or 0 if no response received - */ - int getResponseCode(); - - /** - * @return the response reason or null if no response received - */ - String getResponseReason(); } diff --git a/java/impl/org/linphone/core/LinphoneChatMessageImpl.java b/java/impl/org/linphone/core/LinphoneChatMessageImpl.java index a6f591bfa..8ce49c747 100644 --- a/java/impl/org/linphone/core/LinphoneChatMessageImpl.java +++ b/java/impl/org/linphone/core/LinphoneChatMessageImpl.java @@ -14,8 +14,6 @@ public class LinphoneChatMessageImpl implements LinphoneChatMessage { private native boolean isOutgoing(long ptr); private native void store(long ptr); private native int getStorageId(long ptr); - private native int getResponseCode(long ptr); - private native String getResponseReason(long ptr); protected LinphoneChatMessageImpl(long aNativePtr) { nativePtr = aNativePtr; @@ -96,12 +94,4 @@ public class LinphoneChatMessageImpl implements LinphoneChatMessage { public int getStorageId() { return getStorageId(nativePtr); } - - public int getResponseCode() { - return getResponseCode(nativePtr); - } - - public String getResponseReason() { - return getResponseReason(nativePtr); - } }