From ea8b4c80b7adcde5d9beb02f90c09efc3d1992ac Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Thu, 9 Feb 2012 18:16:57 +0100 Subject: sms: don't allow sending received messages --- src/mm-sms.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') 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, -- cgit v1.2.3-70-g09d2