Added /roster command with nick option to change handle

This commit is contained in:
James Booth
2013-05-19 02:07:01 +01:00
parent 905571bfb7
commit d300e8e763
8 changed files with 102 additions and 29 deletions

View File

@@ -73,35 +73,22 @@ p_contact_new(const char * const barejid, const char * const name,
return contact;
}
void
p_contact_set_name(const PContact contact, const char * const name)
{
if (contact->name != NULL) {
FREE_SET_NULL(contact->name);
}
contact->name = strdup(name);
}
gboolean
p_contact_remove_resource(PContact contact, const char * const resource)
{
return g_hash_table_remove(contact->available_resources, resource);
}
PContact
p_contact_new_subscription(const char * const barejid,
const char * const subscription, gboolean pending_out)
{
PContact contact = malloc(sizeof(struct p_contact_t));
contact->barejid = strdup(barejid);
contact->name = NULL;
if (subscription != NULL)
contact->subscription = strdup(subscription);
else
contact->subscription = strdup("none");
contact->pending_out = pending_out;
contact->last_activity = NULL;
contact->available_resources = g_hash_table_new_full(g_str_hash, g_str_equal, free,
(GDestroyNotify)resource_destroy);
return contact;
}
void
p_contact_free(PContact contact)
{