[folks] Bug 709674 — Ignore non-phonebook-enabled m odems in ofono backend
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Bug 709674 — Ignore non-phonebook-enabled m odems in ofono backend
- Date: Mon, 14 Oct 2013 17:15:14 +0000 (UTC)
commit 6f332795b9162fb7c8393a96848c8ff5ab35340b
Author: Philip Withnall <philip withnall collabora co uk>
Date: Tue Oct 8 19:51:30 2013 +0100
Bug 709674 — Ignore non-phonebook-enabled modems in ofono backend
Ignore ofono modems which don’t support the org.ofono.Phonebook interface,
which is needed for accessing contacts stored on the SIM.
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=709674
NEWS | 1 +
backends/ofono/ofono-backend.vala | 39 ++++++++++++++++++++++++++++++++----
2 files changed, 35 insertions(+), 5 deletions(-)
---
diff --git a/NEWS b/NEWS
index 08c4077..03365e3 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ Bugs fixed:
• Bug 697262 — uses deprecated e-d-s functions (Xavier)
• Bug 705403 — Use GLib.BytesIcon instead of Edsf.MemoryIcon
• Bug 679826 — Investigate using parallel-tests to speed up testing
+• Bug 709674 — Ignore non-phonebook-enabled modems in ofono backend
API changes:
diff --git a/backends/ofono/ofono-backend.vala b/backends/ofono/ofono-backend.vala
index a63d4b4..bd62c5f 100644
--- a/backends/ofono/ofono-backend.vala
+++ b/backends/ofono/ofono-backend.vala
@@ -269,22 +269,51 @@ public class Folks.Backends.Ofono.Backend : Folks.Backend
private void _modem_added (ObjectPath path, HashTable<string, Variant> properties)
{
+ bool has_sim = false;
+ bool has_phonebook = false;
+
Variant? features_variant = properties.get ("Features");
if (features_variant != null)
{
- string alias = this._modem_alias (properties);
var features = features_variant.get_strv ();
-
- foreach (string feature in features)
+ /* FIXME: can't use the ‘in’ operator because of
+ * https://bugzilla.gnome.org/show_bug.cgi?id=709672 */
+ foreach (var feature in features)
{
if (feature == "sim")
{
- /* This modem has a sim card, so add a persona store for it */
- this._add_modem (path, alias);
+ has_sim = true;
break;
}
}
}
+
+ /* If the modem doesn't have a SIM, don't go any further. */
+ if (has_sim == false)
+ return;
+
+ Variant? interfaces_variant = properties.get ("Interfaces");
+ if (interfaces_variant != null)
+ {
+ var interfaces = interfaces_variant.get_strv ();
+ /* FIXME: and here */
+ foreach (var interf in interfaces)
+ {
+ if (interf == "org.ofono.Phonebook")
+ {
+ has_phonebook = true;
+ break;
+ }
+ }
+ }
+
+ if (has_phonebook == false)
+ return;
+
+ /* The modem has both a SIM and a phonebook, so can be wrapped by a
+ * persona store. */
+ string alias = this._modem_alias (properties);
+ this._add_modem (path, alias);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]