aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-09-10 16:23:05 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-09-14 07:05:23 +0200
commit67081f02c88bc907561f6d9a9bd0e74cf9797189 (patch)
treec832d275c7414ecf8512b4a4d80648cdd5b0a9ab /src
parentb7e1c6d36dd10c6772582196117dc5d0ccefcb08 (diff)
api: new `SupportedStorages' property in the Messaging interface
We will list which are the storages allowed to use when receiving/storing SMS messages.
Diffstat (limited to 'src')
-rw-r--r--src/mm-iface-modem-messaging.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mm-iface-modem-messaging.c b/src/mm-iface-modem-messaging.c
index 31f6ec99..fe287a88 100644
--- a/src/mm-iface-modem-messaging.c
+++ b/src/mm-iface-modem-messaging.c
@@ -1026,6 +1026,8 @@ load_supported_storages_ready (MMIfaceModemMessaging *self,
gchar *mem1;
gchar *mem2;
gchar *mem3;
+ GArray *supported_storages;
+ guint i;
mem1 = mm_common_build_sms_storages_string ((MMSmsStorage *)storage_ctx->supported_mem1->data,
storage_ctx->supported_mem1->len);
@@ -1041,6 +1043,32 @@ load_supported_storages_ready (MMIfaceModemMessaging *self,
g_free (mem1);
g_free (mem2);
g_free (mem3);
+
+ /* We set in the interface the list of storages which are allowed for
+ * both write/send and receive */
+ supported_storages = g_array_sized_new (FALSE, FALSE, sizeof (guint32), storage_ctx->supported_mem2->len);
+ for (i = 0; i < storage_ctx->supported_mem2->len; i++) {
+ gboolean found = FALSE;
+ guint j;
+
+ for (j = 0; j < storage_ctx->supported_mem3->len && !found; j++) {
+ if (g_array_index (storage_ctx->supported_mem3, MMSmsStorage, j) ==
+ g_array_index (storage_ctx->supported_mem2, MMSmsStorage, i))
+ found = TRUE;
+ }
+
+ if (found) {
+ guint32 val;
+
+ val = g_array_index (storage_ctx->supported_mem2, MMSmsStorage, i);
+ g_array_append_val (supported_storages, val);
+ }
+ }
+
+ mm_gdbus_modem_messaging_set_supported_storages (
+ ctx->skeleton,
+ mm_common_sms_storages_garray_to_variant (supported_storages));
+ g_array_unref (supported_storages);
}
/* Go on to next step */