From 7c2373033b2499fb170071fcbc8339f88e036e6b Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Fri, 11 Aug 2017 23:26:46 +0100 Subject: [PATCH] Add chime_connection_contact_by_id() --- chime-contact.c | 10 ++++++++++ chime-contact.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/chime-contact.c b/chime-contact.c index 6d685f2..df1b6de 100644 --- a/chime-contact.c +++ b/chime-contact.c @@ -614,6 +614,16 @@ ChimeContact *chime_connection_contact_by_email(ChimeConnection *cxn, return g_hash_table_lookup(priv->contacts.by_name, email); } +ChimeContact *chime_connection_contact_by_id(ChimeConnection *cxn, + const gchar *id) +{ + g_return_val_if_fail(CHIME_IS_CONNECTION(cxn), NULL); + g_return_val_if_fail(id != NULL, NULL); + ChimeConnectionPrivate *priv = CHIME_CONNECTION_GET_PRIVATE (cxn); + + return g_hash_table_lookup(priv->contacts.by_id, id); +} + struct foreach_contact_st { ChimeConnection *cxn; ChimeContactCB cb; diff --git a/chime-contact.h b/chime-contact.h index d173788..730ace9 100644 --- a/chime-contact.h +++ b/chime-contact.h @@ -65,6 +65,8 @@ gboolean chime_contact_get_contacts_list(ChimeContact *contact); ChimeContact *chime_connection_contact_by_email(ChimeConnection *cxn, const gchar *email); +ChimeContact *chime_connection_contact_by_id(ChimeConnection *cxn, + const gchar *id); /* Designed to match the NEW_CONTACT signal handler */ typedef void (*ChimeContactCB) (ChimeConnection *, ChimeContact *, gpointer); -- 2.51.0