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));
}