provider: Add API to query supported protocols

These are the protocols that the provider plugin may support. The origins
must be queried independently whether or not they support any given protocol.

Example: A SIP origin/account may or may not support the "tel" protocol.
This commit is contained in:
Evangelos Ribeiro Tzaras
2021-04-19 19:07:00 +02:00
parent 6d8c227b24
commit 7ad0f4cdd6
6 changed files with 70 additions and 0 deletions

View File

@@ -72,6 +72,12 @@ calls_provider_real_get_origins (CallsProvider *self)
return NULL;
}
static const char * const *
calls_provider_real_get_protocols (CallsProvider *self)
{
g_assert_not_reached ();
}
static void
calls_provider_get_property (GObject *object,
@@ -101,6 +107,7 @@ calls_provider_class_init (CallsProviderClass *klass)
klass->get_name = calls_provider_real_get_name;
klass->get_status = calls_provider_real_get_status;
klass->get_origins = calls_provider_real_get_origins;
klass->get_protocols = calls_provider_real_get_protocols;
props[PROP_STATUS] =
g_param_spec_string ("status",
@@ -223,3 +230,17 @@ calls_provider_unload_plugin (const char *name)
else
g_warning ("Can't unload plugin: No plugin with name %s found", name);
}
/**
* calls_provider_get_protocols:
* @self: A #CallsProvider
*
* Returns: (transfer none): A null-terminated array of strings
*/
const char * const *
calls_provider_get_protocols (CallsProvider *self)
{
g_return_val_if_fail (CALLS_IS_PROVIDER (self), NULL);
return CALLS_PROVIDER_GET_CLASS (self)->get_protocols (self);
}

View File

@@ -47,6 +47,7 @@ struct _CallsProviderClass
const char *(*get_name) (CallsProvider *self);
const char *(*get_status) (CallsProvider *self);
GListModel *(*get_origins) (CallsProvider *self);
const char * const *(*get_protocols) (CallsProvider *self);
};
const char *calls_provider_get_name (CallsProvider *self);
@@ -54,6 +55,7 @@ const char *calls_provider_get_status (CallsProvider *self);
GListModel *calls_provider_get_origins (CallsProvider *self);
CallsProvider *calls_provider_load_plugin (const char *name);
void calls_provider_unload_plugin (const char *name);
const char * const *calls_provider_get_protocols (CallsProvider *self);
G_END_DECLS