aboutsummaryrefslogtreecommitdiff
path: root/src/mm-sms-list.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-09-13 12:00:37 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-09-14 07:05:26 +0200
commite212f6b6edcd2b5678372bd0b05c70209c516f05 (patch)
treef28a596d95ed494ca667a351b78f42c50b60ab3a /src/mm-sms-list.c
parent2da9474d0c0e22044d7ab636e3336cab1a75bc22 (diff)
sms: create SMS parts only when storing or sending
When a user creates an SMS object, we will expose all its properties in DBus properly, but we will not create the internal list of SMS parts. The list of SMS parts will be created when the SMS is stored or sent, whatever comes first. When the message is sent and it was previously stored, the list of parts is not re-created. If the message requires multiple parts, the multipart reference is computed as follows: * If the SMS was not stored and is being sent, we just use a random number. * If the SMS is being stored, we will use a multipart reference which is not being used already in another SMS to the same destination.
Diffstat (limited to 'src/mm-sms-list.c')
-rw-r--r--src/mm-sms-list.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mm-sms-list.c b/src/mm-sms-list.c
index 393101ba..a34bd679 100644
--- a/src/mm-sms-list.c
+++ b/src/mm-sms-list.c
@@ -54,6 +54,35 @@ struct _MMSmsListPrivate {
/*****************************************************************************/
+gboolean
+mm_sms_list_has_local_multipart_reference (MMSmsList *self,
+ const gchar *number,
+ guint8 reference)
+{
+ GList *l;
+
+ /* No one should look for multipart reference 0, which isn't valid */
+ g_assert (reference != 0);
+
+ for (l = self->priv->list; l; l = g_list_next (l)) {
+ MMSms *sms = MM_SMS (l->data);
+
+ if (mm_sms_is_multipart (sms) &&
+ mm_gdbus_sms_get_pdu_type (MM_GDBUS_SMS (sms)) == MM_SMS_PDU_TYPE_SUBMIT &&
+ mm_sms_get_storage (sms) != MM_SMS_STORAGE_UNKNOWN &&
+ mm_sms_get_multipart_reference (sms) == reference &&
+ g_str_equal (mm_gdbus_sms_get_number (MM_GDBUS_SMS (sms)), number)) {
+ /* Yes, the SMS list has an SMS with the same destination number
+ * and multipart reference */
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+/*****************************************************************************/
+
guint
mm_sms_list_get_count (MMSmsList *self)
{