From 97a7a6178926fc4315ccb0b7a3e39fbd41f13e92 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 26 Apr 2011 14:40:35 -0500 Subject: [PATCH] voicecall: Refactor the previous commit slightly --- src/voicecall.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/voicecall.c b/src/voicecall.c index 51b8511..d3bc394 100644 --- a/src/voicecall.c +++ b/src/voicecall.c @@ -2688,8 +2688,6 @@ static void emulator_clcc_cb(struct ofono_emulator *em, struct ofono_voicecall *vc = userdata; struct ofono_error result; GSList *l; - struct voicecall *v; - gboolean mpty; /* * '+CLCC: 123,1,1,0,1,"+",' + phone number + phone type on 3 digits * + terminating null @@ -2701,7 +2699,10 @@ static void emulator_clcc_cb(struct ofono_emulator *em, switch (ofono_emulator_request_get_type(req)) { case OFONO_EMULATOR_REQUEST_TYPE_COMMAND_ONLY: for (l = vc->call_list; l; l = l->next) { - v = l->data; + struct voicecall *v = l->data; + const char *number = ""; + int type = 128; + gboolean mpty; if (g_slist_find_custom(vc->multiparty_list, GINT_TO_POINTER(v->call->id), @@ -2710,17 +2711,14 @@ static void emulator_clcc_cb(struct ofono_emulator *em, else mpty = FALSE; - if (v->call->clip_validity == CLIP_VALIDITY_VALID) - sprintf(buf, "+CLCC: %d,%d,%d,0,%d,\"%s\",%d", - v->call->id, v->call->direction, - v->call->status, mpty, - v->call->phone_number.number, - v->call->phone_number.type); - else - sprintf(buf, "+CLCC: %d,%d,%d,0,%d,\"\",128", - v->call->id, v->call->direction, - v->call->status, mpty); + if (v->call->clip_validity == CLIP_VALIDITY_VALID) { + number = v->call->phone_number.number; + type = v->call->phone_number.type; + } + sprintf(buf, "+CLCC: %d,%d,%d,0,%d,\"%s\",%d", + v->call->id, v->call->direction, + v->call->status, mpty, number, type); ofono_emulator_send_info(em, buf, l->next == NULL ? TRUE : FALSE); } -- 2.7.4