1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added equality functions to contact

This commit is contained in:
James Booth 2012-05-23 23:53:10 +01:00
parent cac0ea0742
commit 140deeb566
2 changed files with 16 additions and 0 deletions

View File

@ -95,3 +95,17 @@ const char * p_contact_status(const PContact contact)
{
return contact->status;
}
int p_contact_names_equal(const PContact c1, const PContact c2)
{
return strcmp(c1->name, c2->name);
}
int p_contacts_equal_deep(const PContact c1, const PContact c2)
{
int name_eq = strcmp(c1->name, c2->name);
int show_eq = strcmp(c1->show, c2->show);
int status_eq = strcmp(c1->status, c2->status);
return (name_eq && show_eq && status_eq);
}

View File

@ -32,5 +32,7 @@ void p_contact_free(PContact contact);
const char * p_contact_name(PContact contact);
const char * p_contact_show(PContact contact);
const char * p_contact_status(PContact contact);
int p_contact_names_equal(const PContact c1, const PContact c2);
int p_contacts_equal_deep(const PContact c1, const PContact c2);
#endif