Open Source Telephony
 help / color / mirror / Atom feed
* [PATCH] call-forward: Call forwarding state handling
@ 2011-06-16 14:31 Nicolas Bertrand
  2011-06-23 17:45 ` Denis Kenzior
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Bertrand @ 2011-06-16 14:31 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3242 bytes --]

When CFU is active be cautious with conditional
call-forward activation/deactivation
---
 src/call-forwarding.c |   46 ++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 73ce433..eff5e9d 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -504,6 +504,7 @@ static DBusMessage *cf_get_properties_reply(DBusMessage *msg,
 	DBusMessageIter dict;
 	int i;
 	dbus_bool_t status;
+	GSList *hidden = NULL;
 
 	reply = dbus_message_new_method_return(msg);
 	if (reply == NULL)
@@ -515,17 +516,33 @@ static DBusMessage *cf_get_properties_reply(DBusMessage *msg,
 					OFONO_PROPERTIES_ARRAY_SIGNATURE,
 						&dict);
 
-	for (i = 0; i < 4; i++)
-		property_append_cf_conditions(&dict, cf->cf_conditions[i],
-						BEARER_CLASS_VOICE,
-						cf_type_lut[i]);
-
 	if ((cf->flags & CALL_FORWARDING_FLAG_CPHS_CFF) ||
 			cf->cfis_record_id > 0)
 		status = is_cfu_enabled(cf, NULL);
 	else
 		status = FALSE;
 
+	/*
+	 * If unconditional call-forwarding is enabled,
+	 * hide conditionnal status
+	 */
+	if (status == TRUE) {
+		struct ofono_call_forwarding_condition cd = {0, 0, {"", 0}, 0};
+
+		for (i = 0; i < 4; i++)
+			hidden = g_slist_prepend(hidden, &cd);
+	}
+
+	for (i = 0; i < 4; i++)
+		property_append_cf_conditions(&dict, (status &&
+				i != CALL_FORWARDING_TYPE_UNCONDITIONAL) ?
+				hidden : cf->cf_conditions[i],
+				BEARER_CLASS_VOICE,
+				cf_type_lut[i]);
+
+	if (status == TRUE)
+		g_slist_free(hidden);
+
 	ofono_dbus_dict_append(&dict, "ForwardingFlagOnSim", DBUS_TYPE_BOOLEAN,
 					&status);
 
@@ -552,6 +569,13 @@ static void get_query_cf_callback(const struct ofono_error *error, int total,
 			cf->flags |= CALL_FORWARDING_FLAG_CACHED;
 	}
 
+	if (cf->query_next == CALL_FORWARDING_TYPE_UNCONDITIONAL &&
+			is_cfu_enabled(cf, NULL) == TRUE) {
+		DBusMessage *reply = cf_get_properties_reply(cf->pending, cf);
+		__ofono_dbus_pending_reply(&cf->pending, reply);
+		return;
+	}
+
 	if (cf->query_next == CALL_FORWARDING_TYPE_NOT_REACHABLE) {
 		DBusMessage *reply = cf_get_properties_reply(cf->pending, cf);
 		__ofono_dbus_pending_reply(&cf->pending, reply);
@@ -575,7 +599,8 @@ static DBusMessage *cf_get_properties(DBusConnection *conn, DBusMessage *msg,
 	struct ofono_modem *modem = __ofono_atom_get_modem(cf->atom);
 
 	if ((cf->flags & CALL_FORWARDING_FLAG_CACHED) ||
-			ofono_modem_get_online(modem) == FALSE)
+			ofono_modem_get_online(modem) == FALSE ||
+			is_cfu_enabled(cf, NULL) == TRUE)
 		return cf_get_properties_reply(msg, cf);
 
 	if (cf->driver->query == NULL)
@@ -698,6 +723,15 @@ static void set_property_callback(const struct ofono_error *error, void *data)
 		return;
 	}
 
+	if (cf->query_next != CALL_FORWARDING_TYPE_UNCONDITIONAL &&
+			is_cfu_enabled(cf, NULL) == TRUE) {
+		DBusMessage *reply;
+		cf->flags &= ~CALL_FORWARDING_FLAG_CACHED;
+		reply = dbus_message_new_method_return(cf->pending);
+		__ofono_dbus_pending_reply(&cf->pending, reply);
+		return;
+	}
+
 	/* Successfully set, query the entire set just in case */
 	set_query_next_cf_cond(cf);
 }
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH] call-forward: Call forwarding state handling
@ 2011-06-07 16:51 Nicolas Bertrand
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Bertrand @ 2011-06-07 16:51 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3227 bytes --]

When CFU is active be cautious with conditional
call-forward activation/deactivation
---
 src/call-forwarding.c |   44 ++++++++++++++++++++++++++++++++++++++------
 1 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 73ce433..42d681e 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -504,6 +504,7 @@ static DBusMessage *cf_get_properties_reply(DBusMessage *msg,
 	DBusMessageIter dict;
 	int i;
 	dbus_bool_t status;
+	GSList *hidden = NULL;
 
 	reply = dbus_message_new_method_return(msg);
 	if (reply == NULL)
@@ -515,17 +516,31 @@ static DBusMessage *cf_get_properties_reply(DBusMessage *msg,
 					OFONO_PROPERTIES_ARRAY_SIGNATURE,
 						&dict);
 
-	for (i = 0; i < 4; i++)
-		property_append_cf_conditions(&dict, cf->cf_conditions[i],
-						BEARER_CLASS_VOICE,
-						cf_type_lut[i]);
-
 	if ((cf->flags & CALL_FORWARDING_FLAG_CPHS_CFF) ||
 			cf->cfis_record_id > 0)
 		status = is_cfu_enabled(cf, NULL);
 	else
 		status = FALSE;
 
+	// If unconditional call-forwarding is enabled,
+	// hide conditionnal status
+	if (status == TRUE) {
+		struct ofono_call_forwarding_condition cd = {0, 0, {"", 0}, 0};
+
+		for (i = 0; i < 4; i++)
+			hidden = g_slist_prepend(hidden, &cd);
+	}
+
+	for (i = 0; i < 4; i++)
+		property_append_cf_conditions(&dict, (status &&
+				i != CALL_FORWARDING_TYPE_UNCONDITIONAL) ?
+				hidden : cf->cf_conditions[i],
+				BEARER_CLASS_VOICE,
+				cf_type_lut[i]);
+
+	if (status == TRUE)
+		g_slist_free(hidden);
+
 	ofono_dbus_dict_append(&dict, "ForwardingFlagOnSim", DBUS_TYPE_BOOLEAN,
 					&status);
 
@@ -552,6 +567,13 @@ static void get_query_cf_callback(const struct ofono_error *error, int total,
 			cf->flags |= CALL_FORWARDING_FLAG_CACHED;
 	}
 
+	if (cf->query_next == CALL_FORWARDING_TYPE_UNCONDITIONAL &&
+			is_cfu_enabled(cf, NULL) == TRUE) {
+		DBusMessage *reply = cf_get_properties_reply(cf->pending, cf);
+		__ofono_dbus_pending_reply(&cf->pending, reply);
+		return;
+	}
+
 	if (cf->query_next == CALL_FORWARDING_TYPE_NOT_REACHABLE) {
 		DBusMessage *reply = cf_get_properties_reply(cf->pending, cf);
 		__ofono_dbus_pending_reply(&cf->pending, reply);
@@ -575,7 +597,8 @@ static DBusMessage *cf_get_properties(DBusConnection *conn, DBusMessage *msg,
 	struct ofono_modem *modem = __ofono_atom_get_modem(cf->atom);
 
 	if ((cf->flags & CALL_FORWARDING_FLAG_CACHED) ||
-			ofono_modem_get_online(modem) == FALSE)
+			ofono_modem_get_online(modem) == FALSE ||
+			is_cfu_enabled(cf, NULL) == TRUE)
 		return cf_get_properties_reply(msg, cf);
 
 	if (cf->driver->query == NULL)
@@ -698,6 +721,15 @@ static void set_property_callback(const struct ofono_error *error, void *data)
 		return;
 	}
 
+	if (cf->query_next != CALL_FORWARDING_TYPE_UNCONDITIONAL &&
+			is_cfu_enabled(cf, NULL) == TRUE) {
+		DBusMessage *reply;
+		cf->flags &= ~CALL_FORWARDING_FLAG_CACHED;
+		reply = dbus_message_new_method_return(cf->pending);
+		__ofono_dbus_pending_reply(&cf->pending, reply);
+		return;
+	}
+
 	/* Successfully set, query the entire set just in case */
 	set_query_next_cf_cond(cf);
 }
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-23 17:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-16 14:31 [PATCH] call-forward: Call forwarding state handling Nicolas Bertrand
2011-06-23 17:45 ` Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2011-06-07 16:51 Nicolas Bertrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox