Commit 6af2e266 authored by Mohammed Sadiq's avatar Mohammed Sadiq

util: Add API to test for USSD command

parent 939a5973
......@@ -144,6 +144,29 @@ calls_date_time_is_same_year (GDateTime *a,
}
gboolean
calls_number_is_ussd (const char *number)
{
/* USSD numbers start with *, #, **, ## or *# and are finished by # */
if (!number ||
(*number != '*' && *number != '#'))
return FALSE;
number++;
if (*number == '#')
number++;
while (g_ascii_isdigit (*number) || *number == '*')
number++;
if (g_str_equal (number, "#"))
return TRUE;
return FALSE;
}
gboolean
calls_find_in_store (GListModel *list,
gpointer item,
......
......@@ -137,6 +137,7 @@ gboolean calls_date_time_is_yesterday (GDateTime *now,
GDateTime *t);
gboolean calls_date_time_is_same_year (GDateTime *a,
GDateTime *b);
gboolean calls_number_is_ussd (const char *number);
gboolean calls_find_in_store (GListModel *list,
gpointer item,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment