about summary refs log tree commit diff stats
path: root/src/contact.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-05-19 02:07:01 +0100
committerJames Booth <boothj5@gmail.com>2013-05-19 02:07:01 +0100
commitd300e8e763420e826578d1c6395b29a9ca6db8d9 (patch)
tree2a549cf065e3054c825eea23feac3ee8c509f953 /src/contact.c
parent905571bfb741630c6e82382d1750a4797e18e3db (diff)
downloadprofani-tty-d300e8e763420e826578d1c6395b29a9ca6db8d9.tar.gz
Added /roster command with nick option to change handle
Diffstat (limited to 'src/contact.c')
-rw-r--r--src/contact.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/src/contact.c b/src/contact.c
index 6a8dc7d3..32313fcb 100644
--- a/src/contact.c
+++ b/src/contact.c
@@ -73,33 +73,20 @@ p_contact_new(const char * const barejid, const char * const name,
     return contact;
 }
 
-gboolean
-p_contact_remove_resource(PContact contact, const char * const resource)
+void
+p_contact_set_name(const PContact contact, const char * const name)
 {
-    return g_hash_table_remove(contact->available_resources, resource);
+    if (contact->name != NULL) {
+        FREE_SET_NULL(contact->name);
+    }
+
+    contact->name = strdup(name);
 }
 
-PContact
-p_contact_new_subscription(const char * const barejid,
-    const char * const subscription, gboolean pending_out)
+gboolean
+p_contact_remove_resource(PContact contact, const char * const resource)
 {
-    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;
+    return g_hash_table_remove(contact->available_resources, resource);
 }
 
 void