about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-10-06 22:59:25 +0100
committerJames Booth <boothj5@gmail.com>2014-10-06 22:59:25 +0100
commit78a1556f1205d0d2ad2f9a5e7a29c4515defa128 (patch)
tree8105789e3ec5b6b55b49ea7ec5002f39818a4c70 /src/xmpp
parent965f048b18f7f7456bcb59dca841784aad3bfa11 (diff)
downloadprofani-tty-78a1556f1205d0d2ad2f9a5e7a29c4515defa128.tar.gz
Added jid autocomplete for affiliation commands
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/presence.c22
-rw-r--r--src/xmpp/stanza.c4
-rw-r--r--src/xmpp/stanza.h4
3 files changed, 22 insertions, 8 deletions
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c
index adc6fc06..00506175 100644
--- a/src/xmpp/presence.c
+++ b/src/xmpp/presence.c
@@ -717,11 +717,18 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
 
                 // kicked from room
                 } else if (g_slist_find_custom(status_codes, "307", (GCompareFunc)g_strcmp0) != NULL) {
-                    char *actor = stanza_get_kick_actor(stanza);
-                    char *reason = stanza_get_kick_reason(stanza);
+                    char *actor = stanza_get_kickban_actor(stanza);
+                    char *reason = stanza_get_kickban_reason(stanza);
                     handle_room_kicked(from_room, actor, reason);
                     free(reason);
 
+                // banned from room
+                } else if (g_slist_find_custom(status_codes, "301", (GCompareFunc)g_strcmp0) != NULL) {
+                    char *actor = stanza_get_kickban_actor(stanza);
+                    char *reason = stanza_get_kickban_reason(stanza);
+                    handle_room_banned(from_room, actor, reason);
+                    free(reason);
+
                 // normal exit
                 } else {
                     handle_leave_room(from_room);
@@ -783,11 +790,18 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
 
                 // kicked from room
                 if (g_slist_find_custom(status_codes, "307", (GCompareFunc)g_strcmp0) != NULL) {
-                    char *actor = stanza_get_kick_actor(stanza);
-                    char *reason = stanza_get_kick_reason(stanza);
+                    char *actor = stanza_get_kickban_actor(stanza);
+                    char *reason = stanza_get_kickban_reason(stanza);
                     handle_room_occupent_kicked(from_room, from_nick, actor, reason);
                     free(reason);
 
+                // banned from room
+                } else if (g_slist_find_custom(status_codes, "301", (GCompareFunc)g_strcmp0) != NULL) {
+                    char *actor = stanza_get_kickban_actor(stanza);
+                    char *reason = stanza_get_kickban_reason(stanza);
+                    handle_room_occupent_banned(from_room, from_nick, actor, reason);
+                    free(reason);
+
                 // normal exit
                 } else {
                     handle_room_member_offline(from_room, from_nick, "offline", status_str);
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c
index 03b81bf3..58194124 100644
--- a/src/xmpp/stanza.c
+++ b/src/xmpp/stanza.c
@@ -1181,7 +1181,7 @@ stanza_get_muc_destroy_reason(xmpp_stanza_t *stanza)
 }
 
 char *
-stanza_get_kick_actor(xmpp_stanza_t *stanza)
+stanza_get_kickban_actor(xmpp_stanza_t *stanza)
 {
     char *stanza_name = xmpp_stanza_get_name(stanza);
     if (g_strcmp0(stanza_name, STANZA_NAME_PRESENCE) == 0) {
@@ -1207,7 +1207,7 @@ stanza_get_kick_actor(xmpp_stanza_t *stanza)
 }
 
 char *
-stanza_get_kick_reason(xmpp_stanza_t *stanza)
+stanza_get_kickban_reason(xmpp_stanza_t *stanza)
 {
     char *stanza_name = xmpp_stanza_get_name(stanza);
     if (g_strcmp0(stanza_name, STANZA_NAME_PRESENCE) == 0) {
diff --git a/src/xmpp/stanza.h b/src/xmpp/stanza.h
index 56aea01b..cbb6d23f 100644
--- a/src/xmpp/stanza.h
+++ b/src/xmpp/stanza.h
@@ -258,7 +258,7 @@ gboolean stanza_room_destroyed(xmpp_stanza_t *stanza);
 char* stanza_get_muc_destroy_alternative_room(xmpp_stanza_t *stanza);
 char* stanza_get_muc_destroy_alternative_password(xmpp_stanza_t *stanza);
 char* stanza_get_muc_destroy_reason(xmpp_stanza_t *stanza);
-char* stanza_get_kick_actor(xmpp_stanza_t *stanza);
-char* stanza_get_kick_reason(xmpp_stanza_t *stanza);
+char* stanza_get_kickban_actor(xmpp_stanza_t *stanza);
+char* stanza_get_kickban_reason(xmpp_stanza_t *stanza);
 
 #endif