diff --git a/src/calls-call.c b/src/calls-call.c index 476a790..cd02242 100644 --- a/src/calls-call.c +++ b/src/calls-call.c @@ -340,16 +340,6 @@ calls_call_get_protocol (CallsCall *self) return CALLS_CALL_GET_CLASS (self)->get_protocol (self); } -static inline gboolean -tone_key_is_valid (gchar key) -{ - return - (key >= '0' && key <= '9') - || (key >= 'A' && key <= 'D') - || key == '*' - || key == '#'; -} - /** * calls_call_can_dtmf: * @self: a #CallsCall @@ -379,7 +369,7 @@ calls_call_send_dtmf_tone (CallsCall *self, gchar key) { g_return_if_fail (CALLS_IS_CALL (self)); - g_return_if_fail (tone_key_is_valid (key)); + g_return_if_fail (dtmf_tone_key_is_valid (key)); CALLS_CALL_GET_CLASS (self)->send_dtmf_tone (self, key); } diff --git a/src/util.c b/src/util.c index 002065b..fcc1a97 100644 --- a/src/util.c +++ b/src/util.c @@ -254,3 +254,22 @@ get_protocol_from_address_with_fallback (const char *target) return protocol; } + +/** + * dtmf_tone_is_valid: + * @key: + * + * Checks if @key is a valid DTMF keytone + * + * Returns: %TRUE if @key is 0-9, A-D, * or #, %FALSE otherwise + */ +gboolean +dtmf_tone_key_is_valid (gchar key) +{ + return + (key >= '0' && key <= '9') + || (key >= 'A' && key <= 'D') + || key == '*' + || key == '#'; +} + diff --git a/src/util.h b/src/util.h index d94a646..2d38119 100644 --- a/src/util.h +++ b/src/util.h @@ -141,6 +141,8 @@ gboolean calls_find_in_store (GListModel *list, const char* get_protocol_from_address (const char *target); const char* get_protocol_from_address_with_fallback (const char *target); +gboolean dtmf_tone_key_is_valid (char key); + G_END_DECLS #endif /* CALLS__UTIL_H__ */