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:
parent
cac0ea0742
commit
140deeb566
14
contact.c
14
contact.c
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user