|
|
@@ -46,6 +46,41 @@ Strophe.addConnectionPlugin('emuc', {
|
|
46
|
46
|
this.presMap.length = 0;
|
|
47
|
47
|
this.connection.send(pres);
|
|
48
|
48
|
},
|
|
|
49
|
+ createNonAnonymousRoom: function() {
|
|
|
50
|
+ // http://xmpp.org/extensions/xep-0045.html#createroom-reserved
|
|
|
51
|
+
|
|
|
52
|
+ var getForm = $iq({type: 'get', to: this.roomjid})
|
|
|
53
|
+ .c('query', {xmlns: 'http://jabber.org/protocol/muc#owner'})
|
|
|
54
|
+ .c('x', {xmlns: 'jabber:x:data', type: 'submit'});
|
|
|
55
|
+
|
|
|
56
|
+ this.connection.sendIQ(getForm, function (form){
|
|
|
57
|
+
|
|
|
58
|
+ if (!$(form).find(
|
|
|
59
|
+ '>query>x[xmlns="jabber:x:data"]' +
|
|
|
60
|
+ '>field[var="muc#roomconfig_whois"]').length) {
|
|
|
61
|
+
|
|
|
62
|
+ console.error('non-anonymous rooms not supported');
|
|
|
63
|
+ return;
|
|
|
64
|
+ }
|
|
|
65
|
+
|
|
|
66
|
+ var formSubmit = $iq({to: this.roomjid, type: 'set'})
|
|
|
67
|
+ .c('query', {xmlns: 'http://jabber.org/protocol/muc#owner'});
|
|
|
68
|
+
|
|
|
69
|
+ formSubmit.c('x', {xmlns: 'jabber:x:data', type: 'submit'});
|
|
|
70
|
+
|
|
|
71
|
+ formSubmit.c('field', {'var': 'FORM_TYPE'})
|
|
|
72
|
+ .c('value')
|
|
|
73
|
+ .t('http://jabber.org/protocol/muc#roomconfig').up().up();
|
|
|
74
|
+
|
|
|
75
|
+ formSubmit.c('field', {'var': 'muc#roomconfig_whois'})
|
|
|
76
|
+ .c('value').t('anyone').up().up();
|
|
|
77
|
+
|
|
|
78
|
+ this.connection.sendIQ(formSubmit);
|
|
|
79
|
+
|
|
|
80
|
+ }, function (error){
|
|
|
81
|
+ console.error("Error getting room configuration form");
|
|
|
82
|
+ });
|
|
|
83
|
+ },
|
|
49
|
84
|
onPresence: function (pres) {
|
|
50
|
85
|
var from = pres.getAttribute('from');
|
|
51
|
86
|
var type = pres.getAttribute('type');
|
|
|
@@ -107,12 +142,8 @@ Strophe.addConnectionPlugin('emuc', {
|
|
107
|
142
|
|
|
108
|
143
|
// Parse status.
|
|
109
|
144
|
if ($(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>status[code="201"]').length) {
|
|
110
|
|
- // http://xmpp.org/extensions/xep-0045.html#createroom-instant
|
|
111
|
145
|
this.isOwner = true;
|
|
112
|
|
- var create = $iq({type: 'set', to: this.roomjid})
|
|
113
|
|
- .c('query', {xmlns: 'http://jabber.org/protocol/muc#owner'})
|
|
114
|
|
- .c('x', {xmlns: 'jabber:x:data', type: 'submit'});
|
|
115
|
|
- this.connection.sendIQ(create); // fire away
|
|
|
146
|
+ this.createNonAnonymousRoom();
|
|
116
|
147
|
}
|
|
117
|
148
|
|
|
118
|
149
|
// Parse roles.
|