1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-11-17 07:46:03 +00:00

util: Add API to test for USSD command

This commit is contained in:
Mohammed Sadiq 2020-07-07 18:09:22 +05:30
parent 939a59735c
commit 6af2e26639
2 changed files with 24 additions and 0 deletions

View file

@ -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 gboolean
calls_find_in_store (GListModel *list, calls_find_in_store (GListModel *list,
gpointer item, gpointer item,

View file

@ -137,6 +137,7 @@ gboolean calls_date_time_is_yesterday (GDateTime *now,
GDateTime *t); GDateTime *t);
gboolean calls_date_time_is_same_year (GDateTime *a, gboolean calls_date_time_is_same_year (GDateTime *a,
GDateTime *b); GDateTime *b);
gboolean calls_number_is_ussd (const char *number);
gboolean calls_find_in_store (GListModel *list, gboolean calls_find_in_store (GListModel *list,
gpointer item, gpointer item,