summaryrefslogtreecommitdiffstats
path: root/src/call-forwarding.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-12-17 16:40:04 -0600
committerDenis Kenzior <denkenz@gmail.com>2010-12-17 16:40:32 -0600
commit212b291e15021c6ea3d8d23a1f17537a1f426ff6 (patch)
tree0acb54cc680214f48ec4d7d2a59306edea576458 /src/call-forwarding.c
parent424b2f8eb9ec3742b42a50954dbdc4f4f51c13b4 (diff)
downloadofono-212b291e15021c6ea3d8d23a1f17537a1f426ff6.tar.bz2
call-forwarding: Simplify sim_set_cf_indicator
Diffstat (limited to 'src/call-forwarding.c')
-rw-r--r--src/call-forwarding.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 809d9d9f..ad140bcb 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -219,29 +219,37 @@ static void sim_cphs_cff_update_cb(int ok, void *data)
ofono_info("Failed to update EFcphs-cff");
}
-static void sim_set_cf_indicator(struct ofono_call_forwarding *cf)
+static gboolean is_cfu_enabled(struct ofono_call_forwarding *cf,
+ struct ofono_call_forwarding_condition **out)
{
- gboolean cfu_voice = FALSE;
- struct ofono_call_forwarding_condition *cond = NULL;
- GSList *l;
- const char *number = NULL;
+ GSList *l = cf->cf_conditions[CALL_FORWARDING_TYPE_UNCONDITIONAL];
+ struct ofono_call_forwarding_condition *cond;
/*
* For now we only support Voice, although Fax & all Data
* basic services are applicable as well.
*/
- for (l = cf->cf_conditions[0]; l; l = l->next) {
+ for (; l; l = l->next) {
cond = l->data;
- if ((cond->cls & BEARER_CLASS_VOICE) &&
- strlen(cond->phone_number.number) > 0) {
- number = phone_number_to_string(&cond->phone_number);
- cfu_voice = TRUE;
- break;
- }
+ if (cond->cls > BEARER_CLASS_VOICE)
+ continue;
+
+ if (out)
+ *out = cond;
+
+ return TRUE;
}
- cf->status_on_sim = cfu_voice;
+ return FALSE;
+}
+
+static void sim_set_cf_indicator(struct ofono_call_forwarding *cf)
+{
+ gboolean cfu_voice;
+ struct ofono_call_forwarding_condition *cond;
+
+ cfu_voice = is_cfu_enabled(cf, &cond);
if (cf->cfis_record_id) {
unsigned char data[16];