free(_msg);
}
}
+
+void _messages_incoming_cb_mediator_cb(msg_handle_t handle, msg_struct_t msg, void *user_param)
+{
+ messages_message_h _msg = NULL;
+ messages_service_s *_svc = (messages_service_s *) user_param;
+
+ if (NULL == _svc)
+ return;
+
+ int msg_id = 0;
+ msg_get_int_value(msg, MSG_CB_MSG_INTERNAL_MSG_ID_INT, &msg_id);
+
+ if (msg_id > 0 && _svc->incoming_cb_enabled && _svc->incoming_cb != NULL) {
+ messages_search_message_by_id((messages_service_h)_svc, msg_id, &_msg);
+ if (NULL == _msg) {
+ LOGE("[%s] OUT_OF_MEMORY(0x%08x) fail to create '_msg'.", __FUNCTION__, MESSAGES_ERROR_OUT_OF_MEMORY);
+ return;
+ }
+
+ ((messages_incoming_cb) _svc->incoming_cb) (_msg, _svc->incoming_cb_user_data);
+
+ messages_destroy_message(_msg);
+ }
+}
//LCOV_EXCL_STOP
int messages_set_message_incoming_cb(messages_service_h svc, messages_incoming_cb callback, void *user_data)
if (MESSAGES_ERROR_NONE != ret)
return ret;
+ ret = ERROR_CONVERT(msg_reg_cb_message_callback(_svc->service_h, &_messages_incoming_cb_mediator_cb, true, (void *)_svc)
+ );
+ if (MESSAGES_ERROR_NONE != ret)
+ return ret;
+
if (MESSAGES_ERROR_NONE == _messages_check_feature(MESSAGES_TELEPHONY_MMS_FEATURE)) {
ret = ERROR_CONVERT(msg_reg_mms_conf_message_callback(_svc->service_h, &_messages_incoming_mediator_cb, NULL, (void *)_svc)
);