1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-11-16 17:26:23 +00:00

best-match: Preliminary handling of SIP addresses

This does not perform any contact lookup, but instead introduces a benign
hack to be able to get something sensible when calling
`calls_best_match_get_name()` and avoids unnecessary warnings.
This commit is contained in:
Evangelos Ribeiro Tzaras 2021-07-01 02:01:32 +02:00
parent fd45f04886
commit c293b7029d

View file

@ -39,6 +39,7 @@ struct _CallsBestMatch
FolksIndividual *best_match; FolksIndividual *best_match;
char *phone_number; char *phone_number;
char *country_code; char *country_code;
char *name_sip;
gboolean had_country_code_last_time; gboolean had_country_code_last_time;
}; };
@ -205,6 +206,7 @@ dispose (GObject *object)
g_clear_object (&self->view); g_clear_object (&self->view);
g_clear_pointer (&self->phone_number, g_free); g_clear_pointer (&self->phone_number, g_free);
g_clear_pointer (&self->country_code, g_free); g_clear_pointer (&self->country_code, g_free);
g_clear_pointer (&self->name_sip, g_free);
if (self->best_match) { if (self->best_match) {
g_signal_handlers_disconnect_by_data (self->best_match, self); g_signal_handlers_disconnect_by_data (self->best_match, self);
@ -328,6 +330,14 @@ calls_best_match_set_phone_number (CallsBestMatch *self,
g_clear_object (&self->view); g_clear_object (&self->view);
if (self->phone_number) { if (self->phone_number) {
/* This is a SIP address, don' try parsing it as a phone number */
if (g_str_has_prefix (self->phone_number, "sip")) {
g_auto (GStrv) split = g_strsplit_set (self->phone_number, ":@", -1);
self->name_sip = g_strdup (split[1]);
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_PHONE_NUMBER]);
return;
}
number = e_phone_number_from_string (phone_number, self->country_code, &error); number = e_phone_number_from_string (phone_number, self->country_code, &error);
if (!number) { if (!number) {