diff options
author | Denis Kenzior <denkenz@gmail.com> | 2009-10-28 13:06:34 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-10-28 13:06:34 -0500 |
commit | db44cc0e1c03c605602955fd029b540d8cdd6c95 (patch) | |
tree | 21f9e7a01ca36fc8ccacbad95b3b70a374eec5c7 /src/voicecall.c | |
parent | 24d8a5722b0c72c01a04d0aa84995643db7dd705 (diff) | |
download | ofono-db44cc0e1c03c605602955fd029b540d8cdd6c95.tar.bz2 |
Add utility to parse CLIR option
Diffstat (limited to 'src/voicecall.c')
-rw-r--r-- | src/voicecall.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/voicecall.c b/src/voicecall.c index 51d75dda..2d841884 100644 --- a/src/voicecall.c +++ b/src/voicecall.c @@ -755,6 +755,22 @@ static DBusMessage *manager_get_properties(DBusConnection *conn, return reply; } +static ofono_bool_t clir_string_to_clir(const char *clirstr, + enum ofono_clir_option *clir) +{ + if (strlen(clirstr) == 0 || !strcmp(clirstr, "default")) { + *clir = OFONO_CLIR_OPTION_DEFAULT; + return TRUE; + } else if (!strcmp(clirstr, "disabled")) { + *clir = OFONO_CLIR_OPTION_SUPPRESSION; + return TRUE; + } else if (!strcmp(clirstr, "enabled")) { + *clir = OFONO_CLIR_OPTION_INVOCATION; + return TRUE; + } else + return FALSE; +} + static DBusMessage *manager_dial(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -778,13 +794,7 @@ static DBusMessage *manager_dial(DBusConnection *conn, if (!valid_phone_number_format(number)) return __ofono_error_invalid_format(msg); - if (strlen(clirstr) == 0 || !strcmp(clirstr, "default")) - clir = OFONO_CLIR_OPTION_DEFAULT; - else if (!strcmp(clirstr, "disabled")) - clir = OFONO_CLIR_OPTION_SUPPRESSION; - else if (!strcmp(clirstr, "enabled")) - clir = OFONO_CLIR_OPTION_INVOCATION; - else + if (clir_string_to_clir(clirstr, &clir) == FALSE) return __ofono_error_invalid_format(msg); if (!vc->driver->dial) |