From 41a55beef311182b58822061b14be5e478bcc932 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Wed, 15 Sep 2010 12:03:02 -0500 Subject: stk: Refactor Send USSD error handling --- src/stk.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/stk.c b/src/stk.c index 75da5d11..63b1fd3a 100644 --- a/src/stk.c +++ b/src/stk.c @@ -1637,33 +1637,26 @@ static void send_ussd_callback(int error, int dcs, const unsigned char *msg, rsp.result.type = STK_RESULT_TYPE_SUCCESS; rsp.send_ussd.text.text = msg; rsp.send_ussd.text.len = msg_len; - } else { + rsp.send_ussd.text.has_text = TRUE; + } else rsp.result.type = STK_RESULT_TYPE_USSD_RETURN_ERROR; - rsp.result.additional = (unsigned char *) &error; - rsp.result.additional_len = 1; - rsp.send_ussd.text.dcs = -1; - } if (stk_respond(stk, &rsp, stk_command_cb)) stk_command_cb(&failure, stk); break; + case -ECANCELED: send_simple_response(stk, STK_RESULT_TYPE_USSD_OR_SS_USER_TERMINATION); break; + case -ETIMEDOUT: send_simple_response(stk, STK_RESULT_TYPE_NETWORK_UNAVAILABLE); break; - default: - rsp.result.type = STK_RESULT_TYPE_USSD_RETURN_ERROR; - rsp.result.additional = (unsigned char *) &error; - rsp.result.additional_len = 1; - rsp.send_ussd.text.dcs = -1; - - if (stk_respond(stk, &rsp, stk_command_cb)) - stk_command_cb(&failure, stk); + default: + send_simple_response(stk, STK_RESULT_TYPE_USSD_RETURN_ERROR); break; } } -- cgit v1.2.3