aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem-messaging.c
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2014-02-05 08:40:16 +0100
committerGuido Günther <agx@sigxcpu.org>2014-02-05 08:40:16 +0100
commitfa2b467e288cb137ffd792becbf0c1e757d85be4 (patch)
treece308eb0886e93805e7d88bccce48c93797fd6dd /src/mm-iface-modem-messaging.c
parentafc4b839a31c530d73b91aa2483795f185eb7e52 (diff)
New upstream version 1.2.0upstream/1.2.0upstream
Diffstat (limited to 'src/mm-iface-modem-messaging.c')
-rw-r--r--src/mm-iface-modem-messaging.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/mm-iface-modem-messaging.c b/src/mm-iface-modem-messaging.c
index 143d7ef..1101862 100644
--- a/src/mm-iface-modem-messaging.c
+++ b/src/mm-iface-modem-messaging.c
@@ -490,6 +490,17 @@ mm_iface_modem_messaging_is_storage_supported_for_receiving (MMIfaceModemMessagi
/*****************************************************************************/
static void
+update_message_list (MmGdbusModemMessaging *skeleton,
+ MMSmsList *list)
+{
+ gchar **paths;
+
+ paths = mm_sms_list_get_paths (list);
+ mm_gdbus_modem_messaging_set_messages (skeleton, (const gchar *const *)paths);
+ g_strfreev (paths);
+}
+
+static void
sms_added (MMSmsList *list,
const gchar *sms_path,
gboolean received,
@@ -498,6 +509,7 @@ sms_added (MMSmsList *list,
mm_dbg ("Added %s SMS at '%s'",
received ? "received" : "local",
sms_path);
+ update_message_list (skeleton, list);
mm_gdbus_modem_messaging_emit_added (skeleton, sms_path, received);
}
@@ -507,6 +519,7 @@ sms_deleted (MMSmsList *list,
MmGdbusModemMessaging *skeleton)
{
mm_dbg ("Deleted SMS at '%s'", sms_path);
+ update_message_list (skeleton, list);
mm_gdbus_modem_messaging_emit_deleted (skeleton, sms_path);
}
@@ -1079,6 +1092,21 @@ initialization_context_complete_and_free_if_cancelled (InitializationContext *ct
}
static void
+skip_unknown_storages (GArray *mem)
+{
+ guint i = mem->len;
+
+ if (!mem)
+ return;
+
+ /* Remove UNKNOWN from the list of supported storages */
+ while (i-- > 0) {
+ if (g_array_index (mem, MMSmsStorage, i) == MM_SMS_STORAGE_UNKNOWN)
+ g_array_remove_index (mem, i);
+ }
+}
+
+static void
load_supported_storages_ready (MMIfaceModemMessaging *self,
GAsyncResult *res,
InitializationContext *ctx)
@@ -1103,6 +1131,11 @@ load_supported_storages_ready (MMIfaceModemMessaging *self,
GArray *supported_storages;
guint i;
+ /* Never add unknown storages */
+ skip_unknown_storages (storage_ctx->supported_mem1);
+ skip_unknown_storages (storage_ctx->supported_mem2);
+ skip_unknown_storages (storage_ctx->supported_mem3);
+
mem1 = mm_common_build_sms_storages_string ((MMSmsStorage *)storage_ctx->supported_mem1->data,
storage_ctx->supported_mem1->len);
mem2 = mm_common_build_sms_storages_string ((MMSmsStorage *)storage_ctx->supported_mem2->data,