about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-01-05 21:55:32 +0000
committerJames Booth <boothj5@gmail.com>2014-01-05 21:55:32 +0000
commitb8672d709af78870c5bcb66414b7541ab9cf0021 (patch)
tree29d0bd49b09ebe17af7febdd523fb83bc580c57c /src
parent4bcd766d34c567d0e55a72d521c60d4d7b0c4fce (diff)
downloadprofani-tty-b8672d709af78870c5bcb66414b7541ab9cf0021.tar.gz
Moved roster handlers to server_events
Diffstat (limited to 'src')
-rw-r--r--src/profanity.c23
-rw-r--r--src/profanity.h3
-rw-r--r--src/server_events.c23
-rw-r--r--src/server_events.h5
-rw-r--r--src/xmpp/roster.c7
5 files changed, 32 insertions, 29 deletions
diff --git a/src/profanity.c b/src/profanity.c
index 0437222a..d74c518c 100644
--- a/src/profanity.c
+++ b/src/profanity.c
@@ -134,22 +134,6 @@ prof_handle_not_in_group(const char * const contact,
 }
 
 void
-prof_handle_group_add(const char * const contact,
-    const char * const group)
-{
-    ui_group_added(contact, group);
-    ui_current_page_off();
-}
-
-void
-prof_handle_group_remove(const char * const contact,
-    const char * const group)
-{
-    ui_group_removed(contact, group);
-    ui_current_page_off();
-}
-
-void
 prof_handle_roster_add(const char * const barejid, const char * const name)
 {
     ui_roster_add(barejid, name);
@@ -157,13 +141,6 @@ prof_handle_roster_add(const char * const barejid, const char * const name)
 }
 
 void
-prof_handle_roster_remove(const char * const barejid)
-{
-    ui_roster_remove(barejid);
-    ui_current_page_off();
-}
-
-void
 prof_handle_disconnect(const char * const jid)
 {
     cons_show("%s logged out successfully.", jid);
diff --git a/src/profanity.h b/src/profanity.h
index f8e9250b..50002b09 100644
--- a/src/profanity.h
+++ b/src/profanity.h
@@ -35,10 +35,7 @@ void prof_handle_idle(void);
 void prof_handle_activity(void);
 void prof_handle_duck_help(const char * const result);
 void prof_handle_roster_add(const char * const barejid, const char * const name);
-void prof_handle_roster_remove(const char * const barejid);
 void prof_handle_already_in_group(const char * const contact, const char * const group);
 void prof_handle_not_in_group(const char * const contact, const char * const group);
-void prof_handle_group_add(const char * const contact, const char * const group);
-void prof_handle_group_remove(const char * const contact, const char * const group);
 
 #endif
diff --git a/src/server_events.c b/src/server_events.c
index 967b0c88..cbf2de3c 100644
--- a/src/server_events.c
+++ b/src/server_events.c
@@ -343,3 +343,26 @@ handle_room_member_nick_change(const char * const room,
     ui_room_member_nick_change(room, old_nick, nick);
     ui_current_page_off();
 }
+
+void
+handle_group_add(const char * const contact,
+    const char * const group)
+{
+    ui_group_added(contact, group);
+    ui_current_page_off();
+}
+
+void
+handle_group_remove(const char * const contact,
+    const char * const group)
+{
+    ui_group_removed(contact, group);
+    ui_current_page_off();
+}
+
+void
+handle_roster_remove(const char * const barejid)
+{
+    ui_roster_remove(barejid);
+    ui_current_page_off();
+}
diff --git a/src/server_events.h b/src/server_events.h
index 8509bd07..b79e9c7b 100644
--- a/src/server_events.h
+++ b/src/server_events.h
@@ -66,5 +66,10 @@ void handle_room_member_offline(const char * const room, const char * const nick
     const char * const show, const char * const status);
 void handle_room_member_nick_change(const char * const room,
     const char * const old_nick, const char * const nick);
+void handle_group_add(const char * const contact,
+    const char * const group);
+void handle_group_remove(const char * const contact,
+    const char * const group);
+void handle_roster_remove(const char * const barejid);
 
 #endif
diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c
index 52bda5ce..3da8c7d3 100644
--- a/src/xmpp/roster.c
+++ b/src/xmpp/roster.c
@@ -29,6 +29,7 @@
 
 #include "log.h"
 #include "profanity.h"
+#include "server_events.h"
 #include "tools/autocomplete.h"
 #include "xmpp/connection.h"
 #include "xmpp/roster.h"
@@ -149,7 +150,7 @@ _group_add_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
 {
     if (userdata != NULL) {
         GroupData *data = userdata;
-        prof_handle_group_add(data->name, data->group);
+        handle_group_add(data->name, data->group);
         free(data->name);
         free(data->group);
         free(userdata);
@@ -196,7 +197,7 @@ _group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
 {
     if (userdata != NULL) {
         GroupData *data = userdata;
-        prof_handle_group_remove(data->name, data->group);
+        handle_group_remove(data->name, data->group);
         free(data->name);
         free(data->group);
         free(userdata);
@@ -240,7 +241,7 @@ _roster_handle_push(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
 
         roster_remove(name, barejid);
 
-        prof_handle_roster_remove(barejid);
+        handle_roster_remove(barejid);
 
     // otherwise update local roster
     } else {