[calls] util: Make dtmf tone checking function public
- From: Evangelos Ribeiro Tzaras <devrtz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [calls] util: Make dtmf tone checking function public
- Date: Tue, 23 Nov 2021 09:39:53 +0000 (UTC)
commit afd1034dd10dd4af60470442a99a4ccc8cf85f3f
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date: Tue Nov 16 15:18:54 2021 +0100
util: Make dtmf tone checking function public
Moves the function out of calls-call.c into util.c
src/calls-call.c | 12 +-----------
src/util.c | 19 +++++++++++++++++++
src/util.h | 2 ++
3 files changed, 22 insertions(+), 11 deletions(-)
---
diff --git a/src/calls-call.c b/src/calls-call.c
index 476a7906..cd02242f 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 002065b2..fcc1a977 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 d94a6461..2d381197 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__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]