[calls/gnome-41] application: Do not prepend country code when dialing
- From: Evangelos Ribeiro Tzaras <devrtz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [calls/gnome-41] application: Do not prepend country code when dialing
- Date: Thu, 28 Oct 2021 12:34:11 +0000 (UTC)
commit 849e971199656024c7b3188311390d5622d74b23
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date: Tue Sep 7 14:03:27 2021 +0200
application: Do not prepend country code when dialing
Fixes #176
(cherry picked from commit 1a14075945029b54d52ed5b00bbc7d8b0ac7cba2)
src/calls-application.c | 77 ++++++++++++++++++++++++-------------------------
1 file changed, 37 insertions(+), 40 deletions(-)
---
diff --git a/src/calls-application.c b/src/calls-application.c
index 62a7a296..7a265997 100644
--- a/src/calls-application.c
+++ b/src/calls-application.c
@@ -46,7 +46,6 @@
#include <glib/gi18n.h>
#include <handy.h>
#include <libcallaudio.h>
-#include <libebook-contacts/libebook-contacts.h>
/**
* SECTION: calls-application
@@ -254,6 +253,36 @@ extract_dial_string (const char *number)
}
+static void
+call_number (CallsApplication *self,
+ const char *number)
+{
+ g_autofree char *dial_string = NULL;
+ gboolean number_ok;
+
+ number_ok = check_dial_number (number);
+ if (!number_ok) {
+ g_warning ("Dial number `%s' is not a valid dial string",
+ number);
+ return;
+ }
+
+ dial_string = extract_dial_string (number);
+ if (!dial_string) {
+ return;
+ }
+
+ g_debug ("Dialing dial string `%s' extracted from number `%s'",
+ dial_string, number);
+
+ start_proper (self);
+
+ calls_main_window_dial (self->main_window,
+ dial_string);
+
+}
+
+
static void
dial_action (GSimpleAction *action,
GVariant *parameter,
@@ -261,31 +290,11 @@ dial_action (GSimpleAction *action,
{
CallsApplication *self = CALLS_APPLICATION (user_data);
const char *number;
- gboolean number_ok;
- g_autofree char *dial_string = NULL;
number = g_variant_get_string (parameter, NULL);
g_return_if_fail (number != NULL);
- number_ok = check_dial_number (number);
- if (!number_ok) {
- g_warning ("Dial number `%s' is not a valid dial string",
- number);
- return;
- }
-
- dial_string = extract_dial_string (number);
- if (!dial_string) {
- return;
- }
-
- g_debug ("Dialing dial string `%s' extracted from number `%s'",
- dial_string, number);
-
- start_proper (self);
-
- calls_main_window_dial (self->main_window,
- dial_string);
+ call_number (self, number);
}
static void
@@ -520,35 +529,23 @@ static void
open_tel_uri (CallsApplication *self,
const char *uri)
{
- g_autoptr (EPhoneNumber) number = NULL;
- g_autoptr (GError) error = NULL;
- g_autofree char *dial_str = NULL;
- g_autofree char *country_code = NULL;
-
- g_object_get (calls_manager_get_default (),
- "country-code", &country_code,
- NULL);
+ const char *number = NULL;
g_debug ("Opening tel URI `%s'", uri);
- number = e_phone_number_from_string (uri, country_code, &error);
- if (!number) {
+ number = &uri[4]; // tel:NUMBER
+ if (!number || number[0] == '\0') {
g_autofree char *msg =
- g_strdup_printf (_("Tried dialing unparsable tel URI `%s'"), uri);
+ g_strdup_printf (_("Tried invalid tel URI `%s'"), uri);
g_signal_emit_by_name (calls_manager_get_default (),
"error",
msg);
- g_warning ("Ignoring unparsable tel URI `%s': %s",
- uri, error->message);
+ g_warning ("Ignoring invalid tel URI `%s'", uri);
return;
}
- dial_str = e_phone_number_to_string
- (number, E_PHONE_NUMBER_FORMAT_E164);
-
- calls_main_window_dial (self->main_window,
- dial_str);
+ call_number (self, number);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]