1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-12-12 07:37:35 +00:00

CallsCall: Add method to optain matching contact

This commit is contained in:
Julian Sparber 2021-01-28 17:05:00 +01:00 committed by Evangelos Ribeiro Tzaras
parent 6d3b75262d
commit 501d29145f
2 changed files with 34 additions and 11 deletions

View file

@ -24,6 +24,7 @@
#include "calls-call.h"
#include "calls-message-source.h"
#include "calls-manager.h"
#include "enum-types.h"
#include "util.h"
@ -325,3 +326,22 @@ calls_call_tone_stop (CallsCall *self,
iface->tone_stop (self, key);
}
/**
* calls_call_get_contact:
* @self: a #CallsCall
*
* This a convenience function to optain the #CallsBestMatch matching the
* phone number of the #CallsCall.
*
* Returns: (transfer full): A #CallsBestMatch
*/
CallsBestMatch *
calls_call_get_contact (CallsCall *self)
{
CallsContactsProvider *contacts_provider =
calls_manager_get_contacts_provider (calls_manager_get_default ());
return calls_contacts_provider_lookup_phone_number (contacts_provider,
calls_call_get_number (self));
}

View file

@ -25,6 +25,8 @@
#ifndef CALLS_CALL_H__
#define CALLS_CALL_H__
#include "calls-best-match.h"
#include <glib-object.h>
G_BEGIN_DECLS
@ -73,6 +75,7 @@ void calls_call_tone_start (CallsCall *self,
gboolean calls_call_tone_stoppable (CallsCall *self);
void calls_call_tone_stop (CallsCall *self,
gchar key);
CallsBestMatch * calls_call_get_contact (CallsCall *self);
G_END_DECLS