about summary refs log tree commit diff stats
path: root/src/contact.c
diff options
context:
space:
mode:
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