Commit 8eb6dab7 authored by Mohammed Sadiq's avatar Mohammed Sadiq
Browse files

Strip invalid characters from phone number

the characters "() -" are used for formatting a phone number.  But
ModemManager works only with plain numbers without any formatting.

Only characters used for formatting numbers are stripped.
parent c4ba6e19
Pipeline #57400 passed with stages
in 3 minutes and 29 seconds
......@@ -663,6 +663,19 @@ pur_mm_delete_sms (PurSmsProps *sms_props)
}
static char *
strip_phone_number (const char *number)
{
g_auto(GStrv) phone = NULL;
if (!number || !*number)
return NULL;
phone = g_strsplit_set (number, "() -", 0);
return g_strjoinv ("", phone);
}
static gboolean
pur_mm_create_sms (const gchar *number,
const gchar *message,
......@@ -680,8 +693,11 @@ pur_mm_create_sms (const gchar *number,
}
if ((message[0] != '\0') && (number[0] != '\0')) {
g_autofree char *phone = NULL;
phone = strip_phone_number (number);
mm_sms_properties_set_text (properties, message);
mm_sms_properties_set_number (properties, number);
mm_sms_properties_set_number (properties, phone);
mm_sms_properties_set_delivery_report_request (properties, delivery_report);
if (valadity) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment