diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-02-09 18:16:57 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:15:02 +0100 |
commit | ea8b4c80b7adcde5d9beb02f90c09efc3d1992ac (patch) | |
tree | 8064b0ccdd497f44a7eca7abfda5a23562e8d5a8 /src | |
parent | 4e4078ef2eab0750baa38c2b23f3987fc70dfd2e (diff) |
sms: don't allow sending received messages
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, |