int _messages_save_textfile(const char *text, char **filepath);
int _messages_load_textfile(const char *filepath, char **text);
void _messages_sent_mediator_cb(msg_handle_t handle, msg_struct_t pStatus, void *user_param);
+void _messages_incoming_mediator_cb(msg_handle_t handle, msg_struct_t msg, void *user_param);
+void _messages_incoming_cb_mediator_cb(msg_handle_t handle, msg_struct_t msg, void *user_param);
int _messages_check_feature(char *feature_name);
int messages_open_service(messages_service_h * svc)
return ERROR_CONVERT(ret);
}
+ ret = msg_reg_sms_message_callback(_svc->service_h, &_messages_incoming_mediator_cb, 0, (void *)_svc);
+ if (MSG_SUCCESS != ret) {
+ free(_svc);
+ return ERROR_CONVERT(ret);
+ }
+
+ ret = msg_reg_cb_message_callback(_svc->service_h, &_messages_incoming_cb_mediator_cb, true, (void *)_svc);
+ if (MSG_SUCCESS != ret) {
+ free(_svc);
+ return ERROR_CONVERT(ret);
+ }
+
+ if (MESSAGES_ERROR_NONE == _messages_check_feature(MESSAGES_TELEPHONY_MMS_FEATURE)) {
+ ret = msg_reg_mms_conf_message_callback(_svc->service_h, &_messages_incoming_mediator_cb, NULL, (void *)_svc);
+ if (MSG_SUCCESS != ret) {
+ free(_svc);
+ return ERROR_CONVERT(ret);
+ }
+ }
+
*svc = (messages_service_h) _svc;
return MESSAGES_ERROR_NONE;
{
CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_SMS_FEATURE);
- int ret;
-
messages_service_s *_svc = (messages_service_s *) svc;
CHECK_NULL(_svc);
CHECK_NULL(callback);
- if (NULL == _svc->incoming_cb) {
- ret = ERROR_CONVERT(msg_reg_sms_message_callback(_svc->service_h, &_messages_incoming_mediator_cb, 0, (void *)_svc)
- );
- 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)
- );
- if (MESSAGES_ERROR_NONE != ret)
- return ret;
- }
- }
-
_svc->incoming_cb = (void *)callback;
_svc->incoming_cb_user_data = (void *)user_data;
_svc->incoming_cb_enabled = true;