Browse Source

Handles two domains one for anonymous users, and one for authorized one, where only authorized users can create chat rooms.

master
Damian Minkov 11 years ago
parent
commit
aeaa70ca0c
3 changed files with 13 additions and 1 deletions
  1. 1
    1
      app.js
  2. 1
    0
      config.js
  3. 11
    0
      muc.js

+ 1
- 1
app.js View File

66
         return;
66
         return;
67
     }
67
     }
68
 
68
 
69
-    var jid = document.getElementById('jid').value || config.hosts.domain || window.location.hostname;
69
+    var jid = document.getElementById('jid').value || config.hosts.anonymousdomain || config.hosts.domain || window.location.hostname;
70
     connect(jid);
70
     connect(jid);
71
 }
71
 }
72
 
72
 

+ 1
- 0
config.js View File

1
 var config = {
1
 var config = {
2
     hosts: {
2
     hosts: {
3
         domain: 'jitsi-meet.example.com',
3
         domain: 'jitsi-meet.example.com',
4
+        //anonymousdomain: 'guest.example.com',
4
         muc: 'conference.jitsi-meet.example.com', // FIXME: use XEP-0030
5
         muc: 'conference.jitsi-meet.example.com', // FIXME: use XEP-0030
5
         bridge: 'jitsi-videobridge.jitsi-meet.example.com', // FIXME: use XEP-0030
6
         bridge: 'jitsi-videobridge.jitsi-meet.example.com', // FIXME: use XEP-0030
6
         //call_control: 'callcontrol.jitsi-meet.example.com'
7
         //call_control: 'callcontrol.jitsi-meet.example.com'

+ 11
- 0
muc.js View File

157
         var from = pres.getAttribute('from');
157
         var from = pres.getAttribute('from');
158
         if ($(pres).find('>error[type="auth"]>not-authorized[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
158
         if ($(pres).find('>error[type="auth"]>not-authorized[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
159
             $(document).trigger('passwordrequired.muc', [from]);
159
             $(document).trigger('passwordrequired.muc', [from]);
160
+        } else if ($(pres).find(
161
+                '>error[type="cancel"]>not-allowed[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
162
+            var toDomain = Strophe.getDomainFromJid(pres.getAttribute('to'));
163
+            if(toDomain === config.hosts.anonymousdomain) {
164
+                // we are connected with anonymous domain and only non anonymous users can create rooms
165
+                // we must authorize the user
166
+                $(document).trigger('passwordrequired.main');
167
+            }
168
+            else
169
+                console.warn('onPresError ', pres);
170
+
160
         } else {
171
         } else {
161
             console.warn('onPresError ', pres);
172
             console.warn('onPresError ', pres);
162
         }
173
         }

Loading…
Cancel
Save