diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-sms.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/mm-sms.c b/src/mm-sms.c index 2dc661d2..19b1f567 100644 --- a/src/mm-sms.c +++ b/src/mm-sms.c @@ -172,8 +172,21 @@ static gboolean handle_send (MMSms *self, GDBusMethodInvocation *invocation) { + MMSmsState state = MM_SMS_STATE_UNKNOWN; + + g_object_get (self, + "state", &state, + NULL); + + /* We can only send SMS created by the user */ + if (state == MM_SMS_STATE_RECEIVED || + state == MM_SMS_STATE_RECEIVING) + g_dbus_method_invocation_return_error (invocation, + MM_CORE_ERROR, + MM_CORE_ERROR_FAILED, + "This SMS was received, cannot send it"); /* Check if we do support doing it */ - if (MM_SMS_GET_CLASS (self)->send && + else if (MM_SMS_GET_CLASS (self)->send && MM_SMS_GET_CLASS (self)->send_finish) MM_SMS_GET_CLASS (self)->send (self, (GAsyncReadyCallback)handle_send_ready, |