about summary refs log tree commit diff stats
path: root/src/roster_list.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-01-05 23:08:11 +0000
committerJames Booth <boothj5@gmail.com>2014-01-05 23:08:11 +0000
commit1d716e48adf7dc6a2639131450c1ca74d48ea105 (patch)
tree73266dd58aad8a343e58d035b6a370613bca801a /src/roster_list.c
parent06ce95f68afe7b4454e50eb23e9891d6e5f30742 (diff)
downloadprofani-tty-1d716e48adf7dc6a2639131450c1ca74d48ea105.tar.gz
Removed roster_list dependency on xmpp module
Diffstat (limited to 'src/roster_list.c')
-rw-r--r--src/roster_list.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/src/roster_list.c b/src/roster_list.c
index c4329a3b..62d99323 100644
--- a/src/roster_list.c
+++ b/src/roster_list.c
@@ -31,7 +31,6 @@
 #include "jid.h"
 #include "tools/autocomplete.h"
 #include "profanity.h"
-#include "xmpp/xmpp.h"
 
 // nicknames
 static Autocomplete name_ac;
@@ -336,41 +335,32 @@ roster_get_group(const char * const group)
 }
 
 void
-roster_add_to_group(const char * const group, const char * const barejid)
+roster_add_to_group(const char * const group, PContact contact)
 {
-    PContact contact = g_hash_table_lookup(contacts, barejid);
+    assert(contact != NULL);
 
-    if (contact != NULL) {
-        if (p_contact_in_group(contact, group)) {
-            if (p_contact_name(contact) != NULL) {
-                prof_handle_already_in_group(p_contact_name(contact), group);
-            } else {
-                prof_handle_already_in_group(p_contact_barejid(contact), group);
-            }
-            return;
+    if (p_contact_in_group(contact, group)) {
+        if (p_contact_name(contact) != NULL) {
+            prof_handle_already_in_group(p_contact_name(contact), group);
+        } else {
+            prof_handle_already_in_group(p_contact_barejid(contact), group);
         }
-
-        roster_send_add_to_group(group, contact);
-
+        return;
     }
 }
 
 void
-roster_remove_from_group(const char * const group, const char * const barejid)
+roster_remove_from_group(const char * const group, PContact contact)
 {
-    PContact contact = g_hash_table_lookup(contacts, barejid);
+    assert(contact != NULL);
 
-    if (contact != NULL) {
-        if (!p_contact_in_group(contact, group)) {
-            if (p_contact_name(contact) != NULL) {
-                prof_handle_not_in_group(p_contact_name(contact), group);
-            } else {
-                prof_handle_not_in_group(p_contact_barejid(contact), group);
-            }
-            return;
+    if (!p_contact_in_group(contact, group)) {
+        if (p_contact_name(contact) != NULL) {
+            prof_handle_not_in_group(p_contact_name(contact), group);
+        } else {
+            prof_handle_not_in_group(p_contact_barejid(contact), group);
         }
-
-        roster_send_remove_from_group(group, contact);
+        return;
     }
 }