about summary refs log tree commit diff stats
path: root/src/xmpp/message.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmpp/message.c')
-rw-r--r--src/xmpp/message.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 1817d5ab..4ecb334b 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -368,11 +368,18 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
             reason = xmpp_stanza_get_text(reason_st);
         }
 
-        handle_room_invite(INVITE_MEDIATED, invitor, room, reason);
+        char *password = NULL;
+        xmpp_stanza_t *password_st = xmpp_stanza_get_child_by_name(xns_muc_user, STANZA_NAME_PASSWORD);
+        password = xmpp_stanza_get_text(password_st);
+
+        handle_room_invite(INVITE_MEDIATED, invitor, room, reason, password);
         jid_destroy(jidp);
-        if (reason != NULL) {
+        if (reason) {
             xmpp_free(ctx, reason);
         }
+        if (password) {
+            xmpp_free(ctx, password);
+        }
     }
 
     return 1;
@@ -387,13 +394,14 @@ _conference_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
     char *room = NULL;
     char *invitor = NULL;
     char *reason = NULL;
+    char *password = NULL;
 
     if (from == NULL) {
         log_warning("Message received with no from attribute, ignoring");
         return 1;
     }
 
-    // XEP-0429
+    // XEP-0249
     room = xmpp_stanza_get_attribute(xns_conference, STANZA_ATTR_JID);
     if (room == NULL) {
         return 1;
@@ -406,8 +414,9 @@ _conference_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
     invitor = jidp->barejid;
 
     reason = xmpp_stanza_get_attribute(xns_conference, STANZA_ATTR_REASON);
+    password = xmpp_stanza_get_attribute(xns_conference, STANZA_ATTR_PASSWORD);
 
-    handle_room_invite(INVITE_DIRECT, invitor, room, reason);
+    handle_room_invite(INVITE_DIRECT, invitor, room, reason, password);
 
     jid_destroy(jidp);