origin: Allow to fetch country code

This is an optional method as not all origins might support this
(e.g. SIP).
This commit is contained in:
Guido Günther
2022-12-21 19:13:22 +01:00
committed by Evangelos Ribeiro Tzaras
parent d598acd96b
commit 6cdae3fd40
3 changed files with 27 additions and 3 deletions

View File

@@ -229,3 +229,24 @@ calls_origin_supports_protocol (CallsOrigin *self,
return iface->supports_protocol (self, protocol);
}
/**
* calls_origin_get_country_code:
* @self: A #CallsOrigin
*
* Returns: (nullable): The iso country code
*/
const char *
calls_origin_get_country_code (CallsOrigin *self)
{
CallsOriginInterface *iface;
g_return_val_if_fail (CALLS_IS_ORIGIN (self), FALSE);
iface = CALLS_ORIGIN_GET_IFACE (self);
/* country code is optional */
if (iface->get_country_code == NULL)
return NULL;
return iface->get_country_code (self);
}