diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-02-09 12:48:00 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:15:02 +0100 |
commit | 714e4ca44b2dc4d877e28d01e9f402fa0d9066a7 (patch) | |
tree | 3d6396dd49ba8ecb363fb87fe4773e2389245e97 /src/mm-sms.c | |
parent | 186584f26f1aa6699ddc970fa6b85f60a27d1820 (diff) |
sms: export uncomplete multipart messages as well
Uncompleted multipart SMS will be exported to DBus, where only the "state"
property is valid, so that we allow completely removing those uncompleted
multipart SMS which will never get completed due to one reason or another.
Diffstat (limited to 'src/mm-sms.c')
-rw-r--r-- | src/mm-sms.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/mm-sms.c b/src/mm-sms.c index 54fa4dbd..88a9ad3d 100644 --- a/src/mm-sms.c +++ b/src/mm-sms.c @@ -562,9 +562,20 @@ mm_sms_multipart_take_part (MMSms *self, mm_warn ("Couldn't assemble SMS: '%s'", inner_error->message); g_error_free (inner_error); - } else - /* Only export once properly assembled */ - mm_sms_export (self); + } else { + /* Completed AND assembled */ + MMSmsState state = MM_SMS_STATE_UNKNOWN; + + /* Change state RECEIVING->RECEIVED, and signal completeness */ + g_object_get (self, + "state", &state, + NULL); + if (state == MM_SMS_STATE_RECEIVING) { + g_object_set (self, + "state", MM_SMS_STATE_RECEIVED, + NULL); + } + } } return TRUE; @@ -613,6 +624,11 @@ mm_sms_multipart_new (MMBaseModem *modem, { MMSms *self; + /* If this is the first part of a RECEIVED SMS, we overwrite the state + * as RECEIVING, to indicate that it is not completed yet. */ + if (state == MM_SMS_STATE_RECEIVED) + state = MM_SMS_STATE_RECEIVING; + self = mm_sms_new (modem); g_object_set (self, MM_SMS_IS_MULTIPART, TRUE, |