Since the re-querying is done, cache the call forwardings.
---
 src/call-forwarding.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 575d96d..7109c21 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -38,6 +38,7 @@
 
 #define CALL_FORWARDING_FLAG_CACHED    0x1
 #define CALL_FORWARDING_FLAG_CPHS_CFF  0x2
+#define CALL_FORWARDING_FLAG_CACHE     0x4
 
 /* According to 27.007 Spec */
 #define DEFAULT_NO_REPLY_TIMEOUT 20
@@ -635,7 +636,8 @@ static void set_query_cf_callback(const struct ofono_error 
*error, int total,
 
        if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
                ofono_error("Setting succeeded, but query failed");
-               cf->flags &= ~CALL_FORWARDING_FLAG_CACHED;
+               cf->flags &= ~(CALL_FORWARDING_FLAG_CACHED |
+                               CALL_FORWARDING_FLAG_CACHE);
                __ofono_dbus_pending_reply(&cf->pending,
                                        __ofono_error_failed(cf->pending));
                return;
@@ -655,6 +657,11 @@ static void set_query_cf_callback(const struct ofono_error 
*error, int total,
                cf->flags ^= CALL_FORWARDING_FLAG_CACHED;
 
        if (cf->query_next == cf->query_end) {
+               if (cf->flags & CALL_FORWARDING_FLAG_CACHE) {
+                       cf->flags &= ~CALL_FORWARDING_FLAG_CACHE;
+                       cf->flags |= CALL_FORWARDING_FLAG_CACHED;
+               }
+
                __ofono_dbus_pending_reply(&cf->pending,
                                dbus_message_new_method_return(cf->pending));
                return;
@@ -701,12 +708,13 @@ static DBusMessage *set_property_request(struct 
ofono_call_forwarding *cf,
        cf->query_next = type;
 
        if (type == CALL_FORWARDING_TYPE_UNCONDITIONAL &&
-               ph->number[0] == '\0' && is_cfu_enabled(cf))
+               ph->number[0] == '\0' && is_cfu_enabled(cf)) {
                /*
                 * CFU is removed, conditionals need to be updated
                 */
                cf->query_end = CALL_FORWARDING_TYPE_NOT_REACHABLE;
-       else
+               cf->flags |= CALL_FORWARDING_FLAG_CACHE;
+       } else
                cf->query_end = type;
 
        DBG("Farming off request, will be erasure: %d", ph->number[0] == '\0');
-- 
1.7.5.4

_______________________________________________
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono

Reply via email to