mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-12-12 07:37:35 +00:00
util: Add API to test for USSD command
This commit is contained in:
parent
939a59735c
commit
6af2e26639
2 changed files with 24 additions and 0 deletions
23
src/util.c
23
src/util.c
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue