xmppify 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +29 -0
  6. data/Rakefile +1 -0
  7. data/app/assets/javascripts/xmpp/index.js +0 -0
  8. data/app/assets/javascripts/xmpp/scripts/checkplayer.js +12 -0
  9. data/app/assets/javascripts/xmpp/scripts/crossdomain.xml +7 -0
  10. data/app/assets/javascripts/xmpp/scripts/flXHR.js +2 -0
  11. data/app/assets/javascripts/xmpp/scripts/flXHR.swf +0 -0
  12. data/app/assets/javascripts/xmpp/scripts/flXHR.vbs +44 -0
  13. data/app/assets/javascripts/xmpp/scripts/flensed.js +12 -0
  14. data/app/assets/javascripts/xmpp/scripts/strophe.flxhr.js +31 -0
  15. data/app/assets/javascripts/xmpp/scripts/strophe.js +3538 -0
  16. data/app/assets/javascripts/xmpp/scripts/swfobject.js +5 -0
  17. data/app/assets/javascripts/xmpp/scripts/updateplayer.swf +0 -0
  18. data/app/assets/javascripts/xmpp/scripts/xmpp.js.coffee +386 -0
  19. data/app/assets/javascripts/xmpp/strophejs-plugins/LICENSE.txt +19 -0
  20. data/app/assets/javascripts/xmpp/strophejs-plugins/README.markdown +95 -0
  21. data/app/assets/javascripts/xmpp/strophejs-plugins/archive/README.markdown +14 -0
  22. data/app/assets/javascripts/xmpp/strophejs-plugins/archive/iso8601_support.js +32 -0
  23. data/app/assets/javascripts/xmpp/strophejs-plugins/archive/strophe.archive.js +88 -0
  24. data/app/assets/javascripts/xmpp/strophejs-plugins/caps/README.markdown +53 -0
  25. data/app/assets/javascripts/xmpp/strophejs-plugins/caps/sha1.js +202 -0
  26. data/app/assets/javascripts/xmpp/strophejs-plugins/caps/strophe.CAPS.coffee +153 -0
  27. data/app/assets/javascripts/xmpp/strophejs-plugins/caps/strophe.CAPS.js +88 -0
  28. data/app/assets/javascripts/xmpp/strophejs-plugins/caps/strophe.caps.jsonly.js +240 -0
  29. data/app/assets/javascripts/xmpp/strophejs-plugins/chatstates/strophe.chatstates.js +80 -0
  30. data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/README.markdown +47 -0
  31. data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/spec/GetUrlComamndSpec.js +66 -0
  32. data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/spec/strophe.cmds.spec.coffee +145 -0
  33. data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/spec/support/jasmine.json +16 -0
  34. data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/src/strophe.cmds.coffee +265 -0
  35. data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/src/strophe.cmds.js +403 -0
  36. data/app/assets/javascripts/xmpp/strophejs-plugins/dataforms/README.markdown +82 -0
  37. data/app/assets/javascripts/xmpp/strophejs-plugins/dataforms/spec/strophe.x.coffee +715 -0
  38. data/app/assets/javascripts/xmpp/strophejs-plugins/dataforms/src/strophe.x.coffee +443 -0
  39. data/app/assets/javascripts/xmpp/strophejs-plugins/dataforms/src/strophe.x.js +854 -0
  40. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/.gitignore +1 -0
  41. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/README.markdown +0 -0
  42. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/convert.js +13 -0
  43. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/jasmine.json +11 -0
  44. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/lib/strophe.disco.js +137 -0
  45. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/public/javascript/strophe.disco.js +137 -0
  46. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/01_querying_information.xml +6 -0
  47. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/02_result_set_for_information_request.xml +22 -0
  48. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/03_target_entity_does_not_exist.xml +10 -0
  49. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/04_service_unavailable.xml +11 -0
  50. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/09_querying_specific_jid_and_node_combination.xml +7 -0
  51. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/10_jid_and_node_result.xml +12 -0
  52. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/11_requesting_all_items.xml +6 -0
  53. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/12_result_set_for_all_items.xml +23 -0
  54. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/13_empty_result_set.xml +7 -0
  55. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/17_service_returns_nodes.xml +16 -0
  56. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/18_requesting_further_nodes.xml +7 -0
  57. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/24_jid_and_node_error.xml +11 -0
  58. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/DiscoNodeSpec.js +50 -0
  59. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/SpecHelper.js +51 -0
  60. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/Stanzas.js +0 -0
  61. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/strophe.disco.spec.helper.js +54 -0
  62. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/strophe.disco.spec.js +0 -0
  63. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/support/jasmine.json +13 -0
  64. data/app/assets/javascripts/xmpp/strophejs-plugins/disco/strophe.disco.js +232 -0
  65. data/app/assets/javascripts/xmpp/strophejs-plugins/epic/public/javascript/jquery.epic.js +61 -0
  66. data/app/assets/javascripts/xmpp/strophejs-plugins/epic/spec/SpecHelper.js +9 -0
  67. data/app/assets/javascripts/xmpp/strophejs-plugins/epic/spec/jquery.epic.js +39 -0
  68. data/app/assets/javascripts/xmpp/strophejs-plugins/epic/spec/support/jasmine.json +22 -0
  69. data/app/assets/javascripts/xmpp/strophejs-plugins/iexdomain/iexdomain.js +36 -0
  70. data/app/assets/javascripts/xmpp/strophejs-plugins/joap/README.markdown +117 -0
  71. data/app/assets/javascripts/xmpp/strophejs-plugins/joap/buster.js +23 -0
  72. data/app/assets/javascripts/xmpp/strophejs-plugins/joap/jid.coffee +64 -0
  73. data/app/assets/javascripts/xmpp/strophejs-plugins/joap/jid.js +92 -0
  74. data/app/assets/javascripts/xmpp/strophejs-plugins/joap/spec/browserSetup.coffee +1 -0
  75. data/app/assets/javascripts/xmpp/strophejs-plugins/joap/spec/jid.spec.coffee +96 -0
  76. data/app/assets/javascripts/xmpp/strophejs-plugins/joap/spec/strophe.joap.spec.coffee +461 -0
  77. data/app/assets/javascripts/xmpp/strophejs-plugins/joap/strophe.joap.coffee +304 -0
  78. data/app/assets/javascripts/xmpp/strophejs-plugins/joap/strophe.joap.js +522 -0
  79. data/app/assets/javascripts/xmpp/strophejs-plugins/mam/LICENSE.txt +19 -0
  80. data/app/assets/javascripts/xmpp/strophejs-plugins/mam/README.markdown +52 -0
  81. data/app/assets/javascripts/xmpp/strophejs-plugins/mam/strophe.mam.js +62 -0
  82. data/app/assets/javascripts/xmpp/strophejs-plugins/muc/LICENSE.txt +20 -0
  83. data/app/assets/javascripts/xmpp/strophejs-plugins/muc/strophe.muc.js +1003 -0
  84. data/app/assets/javascripts/xmpp/strophejs-plugins/ping/README.markdown +28 -0
  85. data/app/assets/javascripts/xmpp/strophejs-plugins/ping/strophe.ping.js +68 -0
  86. data/app/assets/javascripts/xmpp/strophejs-plugins/private/README.markdown +16 -0
  87. data/app/assets/javascripts/xmpp/strophejs-plugins/private/strophe.private.js +192 -0
  88. data/app/assets/javascripts/xmpp/strophejs-plugins/pubsub/strophe.pubsub.js +555 -0
  89. data/app/assets/javascripts/xmpp/strophejs-plugins/receipts/strophe.receipts.js +155 -0
  90. data/app/assets/javascripts/xmpp/strophejs-plugins/register/README.markdown +44 -0
  91. data/app/assets/javascripts/xmpp/strophejs-plugins/register/strophe.register.js +431 -0
  92. data/app/assets/javascripts/xmpp/strophejs-plugins/roster/public/javascript/strophe.roster.js +40 -0
  93. data/app/assets/javascripts/xmpp/strophejs-plugins/roster/spec/strophe.roster.spec.js +65 -0
  94. data/app/assets/javascripts/xmpp/strophejs-plugins/roster/spec/support/jasmine.json +15 -0
  95. data/app/assets/javascripts/xmpp/strophejs-plugins/roster/strophe.roster.js +438 -0
  96. data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/.gitignore +6 -0
  97. data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/README.md +113 -0
  98. data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/buster.js +11 -0
  99. data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/lib/strophe.js +4198 -0
  100. data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/spec/strophe.rpc.spec.helper.js +38 -0
  101. data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/spec/strophe.rpc.spec.js +262 -0
  102. data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/strophe.rpc.js +464 -0
  103. data/app/assets/javascripts/xmpp/strophejs-plugins/rsm/strophe.rsm.js +52 -0
  104. data/app/assets/javascripts/xmpp/strophejs-plugins/serverdate/strophe.serverdate.js +58 -0
  105. data/app/assets/javascripts/xmpp/strophejs-plugins/vcard/examples/index.html +17 -0
  106. data/app/assets/javascripts/xmpp/strophejs-plugins/vcard/examples/strophevcard.js +0 -0
  107. data/app/assets/javascripts/xmpp/strophejs-plugins/vcard/strophe.vcard.coffee +44 -0
  108. data/app/assets/javascripts/xmpp/strophejs-plugins/vcard/strophe.vcard.js +66 -0
  109. data/app/assets/stylesheets/xmpp/index.css +0 -0
  110. data/app/controllers/omniauth_callbacks_controller.rb +15 -0
  111. data/app/controllers/ruby_bosh.rb +221 -0
  112. data/app/models/identity.rb +3 -0
  113. data/app/models/user.rb +40 -0
  114. data/bin/rails +8 -0
  115. data/db/migrate/20140329065635_create_users.rb +10 -0
  116. data/db/migrate/20140329070238_create_identities.rb +11 -0
  117. data/lib/xmppify/version.rb +3 -0
  118. data/lib/xmppify.rb +6 -0
  119. data/xmppify.gemspec +23 -0
  120. metadata +197 -0
@@ -0,0 +1,1003 @@
1
+ // Generated by CoffeeScript 1.4.0
2
+
3
+ /*
4
+ *Plugin to implement the MUC extension.
5
+ http://xmpp.org/extensions/xep-0045.html
6
+ *Previous Author:
7
+ Nathan Zorn <nathan.zorn@gmail.com>
8
+ *Complete CoffeeScript rewrite:
9
+ Andreas Guth <guth@dbis.rwth-aachen.de>
10
+ */
11
+
12
+
13
+ (function() {
14
+ var Occupant, RoomConfig, XmppRoom,
15
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
16
+
17
+ Strophe.addConnectionPlugin('muc', {
18
+ _connection: null,
19
+ rooms: [],
20
+ /*Function
21
+ Initialize the MUC plugin. Sets the correct connection object and
22
+ extends the namesace.
23
+ */
24
+
25
+ init: function(conn) {
26
+ this._connection = conn;
27
+ this._muc_handler = null;
28
+ Strophe.addNamespace('MUC_OWNER', Strophe.NS.MUC + "#owner");
29
+ Strophe.addNamespace('MUC_ADMIN', Strophe.NS.MUC + "#admin");
30
+ Strophe.addNamespace('MUC_USER', Strophe.NS.MUC + "#user");
31
+ return Strophe.addNamespace('MUC_ROOMCONF', Strophe.NS.MUC + "#roomconfig");
32
+ },
33
+ /*Function
34
+ Join a multi-user chat room
35
+ Parameters:
36
+ (String) room - The multi-user chat room to join.
37
+ (String) nick - The nickname to use in the chat room. Optional
38
+ (Function) msg_handler_cb - The function call to handle messages from the
39
+ specified chat room.
40
+ (Function) pres_handler_cb - The function call back to handle presence
41
+ in the chat room.
42
+ (String) password - The optional password to use. (password protected
43
+ rooms only)
44
+ */
45
+
46
+ join: function(room, nick, msg_handler_cb, pres_handler_cb, roster_cb, password, history_attrs) {
47
+ var msg, room_nick, _base, _ref, _ref1,
48
+ _this = this;
49
+ room_nick = this.test_append_nick(room, nick);
50
+ msg = $pres({
51
+ from: this._connection.jid,
52
+ to: room_nick
53
+ }).c("x", {
54
+ xmlns: Strophe.NS.MUC
55
+ });
56
+ if (history_attrs != null) {
57
+ msg = msg.c("history", history_attrs);
58
+ }
59
+ if (password != null) {
60
+ msg.cnode(Strophe.xmlElement("password", [], password));
61
+ }
62
+ if ((_ref = this._muc_handler) == null) {
63
+ this._muc_handler = this._connection.addHandler(function(stanza) {
64
+ var from, handler, handlers, id, roomname, x, xmlns, xquery, _i, _len;
65
+ from = stanza.getAttribute('from');
66
+ if (!from) {
67
+ return true;
68
+ }
69
+ roomname = from.split("/")[0];
70
+ if (!_this.rooms[roomname]) {
71
+ return true;
72
+ }
73
+ room = _this.rooms[roomname];
74
+ handlers = {};
75
+ if (stanza.nodeName === "message") {
76
+ handlers = room._message_handlers;
77
+ } else if (stanza.nodeName === "presence") {
78
+ xquery = stanza.getElementsByTagName("x");
79
+ if (xquery.length > 0) {
80
+ for (_i = 0, _len = xquery.length; _i < _len; _i++) {
81
+ x = xquery[_i];
82
+ xmlns = x.getAttribute("xmlns");
83
+ if (xmlns && xmlns.match(Strophe.NS.MUC)) {
84
+ handlers = room._presence_handlers;
85
+ break;
86
+ }
87
+ }
88
+ }
89
+ }
90
+ for (id in handlers) {
91
+ handler = handlers[id];
92
+ if (!handler(stanza, room)) {
93
+ delete handlers[id];
94
+ }
95
+ }
96
+ return true;
97
+ });
98
+ }
99
+ if ((_ref1 = (_base = this.rooms)[room]) == null) {
100
+ _base[room] = new XmppRoom(this, room, nick, password);
101
+ }
102
+ if (pres_handler_cb) {
103
+ this.rooms[room].addHandler('presence', pres_handler_cb);
104
+ }
105
+ if (msg_handler_cb) {
106
+ this.rooms[room].addHandler('message', msg_handler_cb);
107
+ }
108
+ if (roster_cb) {
109
+ this.rooms[room].addHandler('roster', roster_cb);
110
+ }
111
+ return this._connection.send(msg);
112
+ },
113
+ /*Function
114
+ Leave a multi-user chat room
115
+ Parameters:
116
+ (String) room - The multi-user chat room to leave.
117
+ (String) nick - The nick name used in the room.
118
+ (Function) handler_cb - Optional function to handle the successful leave.
119
+ (String) exit_msg - optional exit message.
120
+ Returns:
121
+ iqid - The unique id for the room leave.
122
+ */
123
+
124
+ leave: function(room, nick, handler_cb, exit_msg) {
125
+ var presence, presenceid, room_nick;
126
+ delete this.rooms[room];
127
+ if (this.rooms.length === 0) {
128
+ this._connection.deleteHandler(this._muc_handler);
129
+ this._muc_handler = null;
130
+ }
131
+ room_nick = this.test_append_nick(room, nick);
132
+ presenceid = this._connection.getUniqueId();
133
+ presence = $pres({
134
+ type: "unavailable",
135
+ id: presenceid,
136
+ from: this._connection.jid,
137
+ to: room_nick
138
+ });
139
+ if (exit_msg != null) {
140
+ presence.c("status", exit_msg);
141
+ }
142
+ if (handler_cb != null) {
143
+ this._connection.addHandler(handler_cb, null, "presence", null, presenceid);
144
+ }
145
+ this._connection.send(presence);
146
+ return presenceid;
147
+ },
148
+ /*Function
149
+ Parameters:
150
+ (String) room - The multi-user chat room name.
151
+ (String) nick - The nick name used in the chat room.
152
+ (String) message - The plaintext message to send to the room.
153
+ (String) html_message - The message to send to the room with html markup.
154
+ (String) type - "groupchat" for group chat messages o
155
+ "chat" for private chat messages
156
+ Returns:
157
+ msgiq - the unique id used to send the message
158
+ */
159
+
160
+ message: function(room, nick, message, html_message, type) {
161
+ var msg, msgid, parent, room_nick;
162
+ room_nick = this.test_append_nick(room, nick);
163
+ type = type || (nick != null ? "chat" : "groupchat");
164
+ msgid = this._connection.getUniqueId();
165
+ msg = $msg({
166
+ to: room_nick,
167
+ from: this._connection.jid,
168
+ type: type,
169
+ id: msgid
170
+ }).c("body", {
171
+ xmlns: Strophe.NS.CLIENT
172
+ }).t(message);
173
+ msg.up();
174
+ if (html_message != null) {
175
+ msg.c("html", {
176
+ xmlns: Strophe.NS.XHTML_IM
177
+ }).c("body", {
178
+ xmlns: Strophe.NS.XHTML
179
+ }).t(html_message);
180
+ if (msg.node.childNodes.length === 0) {
181
+ parent = msg.node.parentNode;
182
+ msg.up().up();
183
+ msg.node.removeChild(parent);
184
+ } else {
185
+ msg.up().up();
186
+ }
187
+ }
188
+ msg.c("x", {
189
+ xmlns: "jabber:x:event"
190
+ }).c("composing");
191
+ this._connection.send(msg);
192
+ return msgid;
193
+ },
194
+ /*Function
195
+ Convenience Function to send a Message to all Occupants
196
+ Parameters:
197
+ (String) room - The multi-user chat room name.
198
+ (String) message - The plaintext message to send to the room.
199
+ (String) html_message - The message to send to the room with html markup.
200
+ Returns:
201
+ msgiq - the unique id used to send the message
202
+ */
203
+
204
+ groupchat: function(room, message, html_message) {
205
+ return this.message(room, null, message, html_message);
206
+ },
207
+ /*Function
208
+ Send a mediated invitation.
209
+ Parameters:
210
+ (String) room - The multi-user chat room name.
211
+ (String) receiver - The invitation's receiver.
212
+ (String) reason - Optional reason for joining the room.
213
+ Returns:
214
+ msgiq - the unique id used to send the invitation
215
+ */
216
+
217
+ invite: function(room, receiver, reason) {
218
+ var invitation, msgid;
219
+ msgid = this._connection.getUniqueId();
220
+ invitation = $msg({
221
+ from: this._connection.jid,
222
+ to: room,
223
+ id: msgid
224
+ }).c('x', {
225
+ xmlns: Strophe.NS.MUC_USER
226
+ }).c('invite', {
227
+ to: receiver
228
+ });
229
+ if (reason != null) {
230
+ invitation.c('reason', reason);
231
+ }
232
+ this._connection.send(invitation);
233
+ return msgid;
234
+ },
235
+ /*Function
236
+ Send a direct invitation.
237
+ Parameters:
238
+ (String) room - The multi-user chat room name.
239
+ (String) receiver - The invitation's receiver.
240
+ (String) reason - Optional reason for joining the room.
241
+ (String) password - Optional password for the room.
242
+ Returns:
243
+ msgiq - the unique id used to send the invitation
244
+ */
245
+
246
+ directInvite: function(room, receiver, reason, password) {
247
+ var attrs, invitation, msgid;
248
+ msgid = this._connection.getUniqueId();
249
+ attrs = {
250
+ xmlns: 'jabber:x:conference',
251
+ jid: room
252
+ };
253
+ if (reason != null) {
254
+ attrs.reason = reason;
255
+ }
256
+ if (password != null) {
257
+ attrs.password = password;
258
+ }
259
+ invitation = $msg({
260
+ from: this._connection.jid,
261
+ to: receiver,
262
+ id: msgid
263
+ }).c('x', attrs);
264
+ this._connection.send(invitation);
265
+ return msgid;
266
+ },
267
+ /*Function
268
+ Queries a room for a list of occupants
269
+ (String) room - The multi-user chat room name.
270
+ (Function) success_cb - Optional function to handle the info.
271
+ (Function) error_cb - Optional function to handle an error.
272
+ Returns:
273
+ id - the unique id used to send the info request
274
+ */
275
+
276
+ queryOccupants: function(room, success_cb, error_cb) {
277
+ var attrs, info;
278
+ attrs = {
279
+ xmlns: Strophe.NS.DISCO_ITEMS
280
+ };
281
+ info = $iq({
282
+ from: this._connection.jid,
283
+ to: room,
284
+ type: 'get'
285
+ }).c('query', attrs);
286
+ return this._connection.sendIQ(info, success_cb, error_cb);
287
+ },
288
+ /*Function
289
+ Start a room configuration.
290
+ Parameters:
291
+ (String) room - The multi-user chat room name.
292
+ (Function) handler_cb - Optional function to handle the config form.
293
+ Returns:
294
+ id - the unique id used to send the configuration request
295
+ */
296
+
297
+ configure: function(room, handler_cb, error_cb) {
298
+ var config, stanza;
299
+ config = $iq({
300
+ to: room,
301
+ type: "get"
302
+ }).c("query", {
303
+ xmlns: Strophe.NS.MUC_OWNER
304
+ });
305
+ stanza = config.tree();
306
+ return this._connection.sendIQ(stanza, handler_cb, error_cb);
307
+ },
308
+ /*Function
309
+ Cancel the room configuration
310
+ Parameters:
311
+ (String) room - The multi-user chat room name.
312
+ Returns:
313
+ id - the unique id used to cancel the configuration.
314
+ */
315
+
316
+ cancelConfigure: function(room) {
317
+ var config, stanza;
318
+ config = $iq({
319
+ to: room,
320
+ type: "set"
321
+ }).c("query", {
322
+ xmlns: Strophe.NS.MUC_OWNER
323
+ }).c("x", {
324
+ xmlns: "jabber:x:data",
325
+ type: "cancel"
326
+ });
327
+ stanza = config.tree();
328
+ return this._connection.sendIQ(stanza);
329
+ },
330
+ /*Function
331
+ Save a room configuration.
332
+ Parameters:
333
+ (String) room - The multi-user chat room name.
334
+ (Array) config- Form Object or an array of form elements used to configure the room.
335
+ Returns:
336
+ id - the unique id used to save the configuration.
337
+ */
338
+
339
+ saveConfiguration: function(room, config, success_cb, error_cb) {
340
+ var conf, iq, stanza, _i, _len;
341
+ iq = $iq({
342
+ to: room,
343
+ type: "set"
344
+ }).c("query", {
345
+ xmlns: Strophe.NS.MUC_OWNER
346
+ });
347
+ if (config instanceof Form) {
348
+ config.type = "submit";
349
+ iq.cnode(config.toXML());
350
+ } else {
351
+ iq.c("x", {
352
+ xmlns: "jabber:x:data",
353
+ type: "submit"
354
+ });
355
+ for (_i = 0, _len = config.length; _i < _len; _i++) {
356
+ conf = config[_i];
357
+ iq.cnode(conf).up();
358
+ }
359
+ }
360
+ stanza = iq.tree();
361
+ return this._connection.sendIQ(stanza, success_cb, error_cb);
362
+ },
363
+ /*Function
364
+ Parameters:
365
+ (String) room - The multi-user chat room name.
366
+ Returns:
367
+ id - the unique id used to create the chat room.
368
+ */
369
+
370
+ createInstantRoom: function(room, success_cb, error_cb) {
371
+ var roomiq;
372
+ roomiq = $iq({
373
+ to: room,
374
+ type: "set"
375
+ }).c("query", {
376
+ xmlns: Strophe.NS.MUC_OWNER
377
+ }).c("x", {
378
+ xmlns: "jabber:x:data",
379
+ type: "submit"
380
+ });
381
+ return this._connection.sendIQ(roomiq.tree(), success_cb, error_cb);
382
+ },
383
+ /*Function
384
+ Set the topic of the chat room.
385
+ Parameters:
386
+ (String) room - The multi-user chat room name.
387
+ (String) topic - Topic message.
388
+ */
389
+
390
+ setTopic: function(room, topic) {
391
+ var msg;
392
+ msg = $msg({
393
+ to: room,
394
+ from: this._connection.jid,
395
+ type: "groupchat"
396
+ }).c("subject", {
397
+ xmlns: "jabber:client"
398
+ }).t(topic);
399
+ return this._connection.send(msg.tree());
400
+ },
401
+ /*Function
402
+ Internal Function that Changes the role or affiliation of a member
403
+ of a MUC room. This function is used by modifyRole and modifyAffiliation.
404
+ The modification can only be done by a room moderator. An error will be
405
+ returned if the user doesn't have permission.
406
+ Parameters:
407
+ (String) room - The multi-user chat room name.
408
+ (Object) item - Object with nick and role or jid and affiliation attribute
409
+ (String) reason - Optional reason for the change.
410
+ (Function) handler_cb - Optional callback for success
411
+ (Function) error_cb - Optional callback for error
412
+ Returns:
413
+ iq - the id of the mode change request.
414
+ */
415
+
416
+ _modifyPrivilege: function(room, item, reason, handler_cb, error_cb) {
417
+ var iq;
418
+ iq = $iq({
419
+ to: room,
420
+ type: "set"
421
+ }).c("query", {
422
+ xmlns: Strophe.NS.MUC_ADMIN
423
+ }).cnode(item.node);
424
+ if (reason != null) {
425
+ iq.c("reason", reason);
426
+ }
427
+ return this._connection.sendIQ(iq.tree(), handler_cb, error_cb);
428
+ },
429
+ /*Function
430
+ Changes the role of a member of a MUC room.
431
+ The modification can only be done by a room moderator. An error will be
432
+ returned if the user doesn't have permission.
433
+ Parameters:
434
+ (String) room - The multi-user chat room name.
435
+ (String) nick - The nick name of the user to modify.
436
+ (String) role - The new role of the user.
437
+ (String) affiliation - The new affiliation of the user.
438
+ (String) reason - Optional reason for the change.
439
+ (Function) handler_cb - Optional callback for success
440
+ (Function) error_cb - Optional callback for error
441
+ Returns:
442
+ iq - the id of the mode change request.
443
+ */
444
+
445
+ modifyRole: function(room, nick, role, reason, handler_cb, error_cb) {
446
+ var item;
447
+ item = $build("item", {
448
+ nick: nick,
449
+ role: role
450
+ });
451
+ return this._modifyPrivilege(room, item, reason, handler_cb, error_cb);
452
+ },
453
+ kick: function(room, nick, reason, handler_cb, error_cb) {
454
+ return this.modifyRole(room, nick, 'none', reason, handler_cb, error_cb);
455
+ },
456
+ voice: function(room, nick, reason, handler_cb, error_cb) {
457
+ return this.modifyRole(room, nick, 'participant', reason, handler_cb, error_cb);
458
+ },
459
+ mute: function(room, nick, reason, handler_cb, error_cb) {
460
+ return this.modifyRole(room, nick, 'visitor', reason, handler_cb, error_cb);
461
+ },
462
+ op: function(room, nick, reason, handler_cb, error_cb) {
463
+ return this.modifyRole(room, nick, 'moderator', reason, handler_cb, error_cb);
464
+ },
465
+ deop: function(room, nick, reason, handler_cb, error_cb) {
466
+ return this.modifyRole(room, nick, 'participant', reason, handler_cb, error_cb);
467
+ },
468
+ /*Function
469
+ Changes the affiliation of a member of a MUC room.
470
+ The modification can only be done by a room moderator. An error will be
471
+ returned if the user doesn't have permission.
472
+ Parameters:
473
+ (String) room - The multi-user chat room name.
474
+ (String) jid - The jid of the user to modify.
475
+ (String) affiliation - The new affiliation of the user.
476
+ (String) reason - Optional reason for the change.
477
+ (Function) handler_cb - Optional callback for success
478
+ (Function) error_cb - Optional callback for error
479
+ Returns:
480
+ iq - the id of the mode change request.
481
+ */
482
+
483
+ modifyAffiliation: function(room, jid, affiliation, reason, handler_cb, error_cb) {
484
+ var item;
485
+ item = $build("item", {
486
+ jid: jid,
487
+ affiliation: affiliation
488
+ });
489
+ return this._modifyPrivilege(room, item, reason, handler_cb, error_cb);
490
+ },
491
+ ban: function(room, jid, reason, handler_cb, error_cb) {
492
+ return this.modifyAffiliation(room, jid, 'outcast', reason, handler_cb, error_cb);
493
+ },
494
+ member: function(room, jid, reason, handler_cb, error_cb) {
495
+ return this.modifyAffiliation(room, jid, 'member', reason, handler_cb, error_cb);
496
+ },
497
+ revoke: function(room, jid, reason, handler_cb, error_cb) {
498
+ return this.modifyAffiliation(room, jid, 'none', reason, handler_cb, error_cb);
499
+ },
500
+ owner: function(room, jid, reason, handler_cb, error_cb) {
501
+ return this.modifyAffiliation(room, jid, 'owner', reason, handler_cb, error_cb);
502
+ },
503
+ admin: function(room, jid, reason, handler_cb, error_cb) {
504
+ return this.modifyAffiliation(room, jid, 'admin', reason, handler_cb, error_cb);
505
+ },
506
+ /*Function
507
+ Change the current users nick name.
508
+ Parameters:
509
+ (String) room - The multi-user chat room name.
510
+ (String) user - The new nick name.
511
+ */
512
+
513
+ changeNick: function(room, user) {
514
+ var presence, room_nick;
515
+ room_nick = this.test_append_nick(room, user);
516
+ presence = $pres({
517
+ from: this._connection.jid,
518
+ to: room_nick,
519
+ id: this._connection.getUniqueId()
520
+ });
521
+ return this._connection.send(presence.tree());
522
+ },
523
+ /*Function
524
+ Change the current users status.
525
+ Parameters:
526
+ (String) room - The multi-user chat room name.
527
+ (String) user - The current nick.
528
+ (String) show - The new show-text.
529
+ (String) status - The new status-text.
530
+ */
531
+
532
+ setStatus: function(room, user, show, status) {
533
+ var presence, room_nick;
534
+ room_nick = this.test_append_nick(room, user);
535
+ presence = $pres({
536
+ from: this._connection.jid,
537
+ to: room_nick
538
+ });
539
+ if (show != null) {
540
+ presence.c('show', show).up();
541
+ }
542
+ if (status != null) {
543
+ presence.c('status', status);
544
+ }
545
+ return this._connection.send(presence.tree());
546
+ },
547
+ /*Function
548
+ List all chat room available on a server.
549
+ Parameters:
550
+ (String) server - name of chat server.
551
+ (String) handle_cb - Function to call for room list return.
552
+ (String) error_cb - Function to call on error.
553
+ */
554
+
555
+ listRooms: function(server, handle_cb, error_cb) {
556
+ var iq;
557
+ iq = $iq({
558
+ to: server,
559
+ from: this._connection.jid,
560
+ type: "get"
561
+ }).c("query", {
562
+ xmlns: Strophe.NS.DISCO_ITEMS
563
+ });
564
+ return this._connection.sendIQ(iq, handle_cb, error_cb);
565
+ },
566
+ test_append_nick: function(room, nick) {
567
+ return room + (nick != null ? "/" + (Strophe.escapeNode(nick)) : "");
568
+ }
569
+ });
570
+
571
+ XmppRoom = (function() {
572
+
573
+ XmppRoom.prototype.roster = {};
574
+
575
+ XmppRoom.prototype._message_handlers = {};
576
+
577
+ XmppRoom.prototype._presence_handlers = {};
578
+
579
+ XmppRoom.prototype._roster_handlers = {};
580
+
581
+ XmppRoom.prototype._handler_ids = 0;
582
+
583
+ function XmppRoom(client, name, nick, password) {
584
+ this.client = client;
585
+ this.name = name;
586
+ this.nick = nick;
587
+ this.password = password;
588
+ this._roomRosterHandler = __bind(this._roomRosterHandler, this);
589
+ this._addOccupant = __bind(this._addOccupant, this);
590
+ if (client.muc) {
591
+ this.client = client.muc;
592
+ }
593
+ this.name = Strophe.getBareJidFromJid(name);
594
+ this.client.rooms[this.name] = this;
595
+ this.addHandler('presence', this._roomRosterHandler);
596
+ }
597
+
598
+ XmppRoom.prototype.join = function(msg_handler_cb, pres_handler_cb, roster_cb) {
599
+ return this.client.join(this.name, this.nick, msg_handler_cb, pres_handler_cb, roster_cb, this.password);
600
+ };
601
+
602
+ XmppRoom.prototype.leave = function(handler_cb, message) {
603
+ this.client.leave(this.name, this.nick, handler_cb, message);
604
+ return delete this.client.rooms[this.name];
605
+ };
606
+
607
+ XmppRoom.prototype.message = function(nick, message, html_message, type) {
608
+ return this.client.message(this.name, nick, message, html_message, type);
609
+ };
610
+
611
+ XmppRoom.prototype.groupchat = function(message, html_message) {
612
+ return this.client.groupchat(this.name, message, html_message);
613
+ };
614
+
615
+ XmppRoom.prototype.invite = function(receiver, reason) {
616
+ return this.client.invite(this.name, receiver, reason);
617
+ };
618
+
619
+ XmppRoom.prototype.directInvite = function(receiver, reason) {
620
+ return this.client.directInvite(this.name, receiver, reason, this.password);
621
+ };
622
+
623
+ XmppRoom.prototype.configure = function(handler_cb) {
624
+ return this.client.configure(this.name, handler_cb);
625
+ };
626
+
627
+ XmppRoom.prototype.cancelConfigure = function() {
628
+ return this.client.cancelConfigure(this.name);
629
+ };
630
+
631
+ XmppRoom.prototype.saveConfiguration = function(config) {
632
+ return this.client.saveConfiguration(this.name, config);
633
+ };
634
+
635
+ XmppRoom.prototype.queryOccupants = function(success_cb, error_cb) {
636
+ return this.client.queryOccupants(this.name, success_cb, error_cb);
637
+ };
638
+
639
+ XmppRoom.prototype.setTopic = function(topic) {
640
+ return this.client.setTopic(this.name, topic);
641
+ };
642
+
643
+ XmppRoom.prototype.modifyRole = function(nick, role, reason, success_cb, error_cb) {
644
+ return this.client.modifyRole(this.name, nick, role, reason, success_cb, error_cb);
645
+ };
646
+
647
+ XmppRoom.prototype.kick = function(nick, reason, handler_cb, error_cb) {
648
+ return this.client.kick(this.name, nick, reason, handler_cb, error_cb);
649
+ };
650
+
651
+ XmppRoom.prototype.voice = function(nick, reason, handler_cb, error_cb) {
652
+ return this.client.voice(this.name, nick, reason, handler_cb, error_cb);
653
+ };
654
+
655
+ XmppRoom.prototype.mute = function(nick, reason, handler_cb, error_cb) {
656
+ return this.client.mute(this.name, nick, reason, handler_cb, error_cb);
657
+ };
658
+
659
+ XmppRoom.prototype.op = function(nick, reason, handler_cb, error_cb) {
660
+ return this.client.op(this.name, nick, reason, handler_cb, error_cb);
661
+ };
662
+
663
+ XmppRoom.prototype.deop = function(nick, reason, handler_cb, error_cb) {
664
+ return this.client.deop(this.name, nick, reason, handler_cb, error_cb);
665
+ };
666
+
667
+ XmppRoom.prototype.modifyAffiliation = function(jid, affiliation, reason, success_cb, error_cb) {
668
+ return this.client.modifyAffiliation(this.name, jid, affiliation, reason, success_cb, error_cb);
669
+ };
670
+
671
+ XmppRoom.prototype.ban = function(jid, reason, handler_cb, error_cb) {
672
+ return this.client.ban(this.name, jid, reason, handler_cb, error_cb);
673
+ };
674
+
675
+ XmppRoom.prototype.member = function(jid, reason, handler_cb, error_cb) {
676
+ return this.client.member(this.name, jid, reason, handler_cb, error_cb);
677
+ };
678
+
679
+ XmppRoom.prototype.revoke = function(jid, reason, handler_cb, error_cb) {
680
+ return this.client.revoke(this.name, jid, reason, handler_cb, error_cb);
681
+ };
682
+
683
+ XmppRoom.prototype.owner = function(jid, reason, handler_cb, error_cb) {
684
+ return this.client.owner(this.name, jid, reason, handler_cb, error_cb);
685
+ };
686
+
687
+ XmppRoom.prototype.admin = function(jid, reason, handler_cb, error_cb) {
688
+ return this.client.admin(this.name, jid, reason, handler_cb, error_cb);
689
+ };
690
+
691
+ XmppRoom.prototype.changeNick = function(nick) {
692
+ this.nick = nick;
693
+ return this.client.changeNick(this.name, nick);
694
+ };
695
+
696
+ XmppRoom.prototype.setStatus = function(show, status) {
697
+ return this.client.setStatus(this.name, this.nick, show, status);
698
+ };
699
+
700
+ /*Function
701
+ Adds a handler to the MUC room.
702
+ Parameters:
703
+ (String) handler_type - 'message', 'presence' or 'roster'.
704
+ (Function) handler - The handler function.
705
+ Returns:
706
+ id - the id of handler.
707
+ */
708
+
709
+
710
+ XmppRoom.prototype.addHandler = function(handler_type, handler) {
711
+ var id;
712
+ id = this._handler_ids++;
713
+ switch (handler_type) {
714
+ case 'presence':
715
+ this._presence_handlers[id] = handler;
716
+ break;
717
+ case 'message':
718
+ this._message_handlers[id] = handler;
719
+ break;
720
+ case 'roster':
721
+ this._roster_handlers[id] = handler;
722
+ break;
723
+ default:
724
+ this._handler_ids--;
725
+ return null;
726
+ }
727
+ return id;
728
+ };
729
+
730
+ /*Function
731
+ Removes a handler from the MUC room.
732
+ This function takes ONLY ids returned by the addHandler function
733
+ of this room. passing handler ids returned by connection.addHandler
734
+ may brake things!
735
+ Parameters:
736
+ (number) id - the id of the handler
737
+ */
738
+
739
+
740
+ XmppRoom.prototype.removeHandler = function(id) {
741
+ delete this._presence_handlers[id];
742
+ delete this._message_handlers[id];
743
+ return delete this._roster_handlers[id];
744
+ };
745
+
746
+ /*Function
747
+ Creates and adds an Occupant to the Room Roster.
748
+ Parameters:
749
+ (Object) data - the data the Occupant is filled with
750
+ Returns:
751
+ occ - the created Occupant.
752
+ */
753
+
754
+
755
+ XmppRoom.prototype._addOccupant = function(data) {
756
+ var occ;
757
+ occ = new Occupant(data, this);
758
+ this.roster[occ.nick] = occ;
759
+ return occ;
760
+ };
761
+
762
+ /*Function
763
+ The standard handler that managed the Room Roster.
764
+ Parameters:
765
+ (Object) pres - the presence stanza containing user information
766
+ */
767
+
768
+
769
+ XmppRoom.prototype._roomRosterHandler = function(pres) {
770
+ var data, handler, id, newnick, nick, _ref;
771
+ data = XmppRoom._parsePresence(pres);
772
+ nick = data.nick;
773
+ newnick = data.newnick || null;
774
+ switch (data.type) {
775
+ case 'error':
776
+ return;
777
+ case 'unavailable':
778
+ if (newnick) {
779
+ data.nick = newnick;
780
+ if (this.roster[nick] && this.roster[newnick]) {
781
+ this.roster[nick].update(this.roster[newnick]);
782
+ this.roster[newnick] = this.roster[nick];
783
+ }
784
+ if (this.roster[nick] && !this.roster[newnick]) {
785
+ this.roster[newnick] = this.roster[nick].update(data);
786
+ }
787
+ }
788
+ delete this.roster[nick];
789
+ break;
790
+ default:
791
+ if (this.roster[nick]) {
792
+ this.roster[nick].update(data);
793
+ } else {
794
+ this._addOccupant(data);
795
+ }
796
+ }
797
+ _ref = this._roster_handlers;
798
+ for (id in _ref) {
799
+ handler = _ref[id];
800
+ if (!handler(this.roster, this)) {
801
+ delete this._roster_handlers[id];
802
+ }
803
+ }
804
+ return true;
805
+ };
806
+
807
+ /*Function
808
+ Parses a presence stanza
809
+ Parameters:
810
+ (Object) data - the data extracted from the presence stanza
811
+ */
812
+
813
+
814
+ XmppRoom._parsePresence = function(pres) {
815
+ var a, c, c2, data, _i, _j, _len, _len1, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7;
816
+ data = {};
817
+ a = pres.attributes;
818
+ data.nick = Strophe.getResourceFromJid(a.from.textContent);
819
+ data.type = ((_ref = a.type) != null ? _ref.textContent : void 0) || null;
820
+ data.states = [];
821
+ _ref1 = pres.childNodes;
822
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
823
+ c = _ref1[_i];
824
+ switch (c.nodeName) {
825
+ case "status":
826
+ data.status = c.textContent || null;
827
+ break;
828
+ case "show":
829
+ data.show = c.textContent || null;
830
+ break;
831
+ case "x":
832
+ a = c.attributes;
833
+ if (((_ref2 = a.xmlns) != null ? _ref2.textContent : void 0) === Strophe.NS.MUC_USER) {
834
+ _ref3 = c.childNodes;
835
+ for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
836
+ c2 = _ref3[_j];
837
+ switch (c2.nodeName) {
838
+ case "item":
839
+ a = c2.attributes;
840
+ data.affiliation = ((_ref4 = a.affiliation) != null ? _ref4.textContent : void 0) || null;
841
+ data.role = ((_ref5 = a.role) != null ? _ref5.textContent : void 0) || null;
842
+ data.jid = ((_ref6 = a.jid) != null ? _ref6.textContent : void 0) || null;
843
+ data.newnick = ((_ref7 = a.nick) != null ? _ref7.textContent : void 0) || null;
844
+ break;
845
+ case "status":
846
+ if (c2.attributes.code) {
847
+ data.states.push(c2.attributes.code.textContent);
848
+ }
849
+ }
850
+ }
851
+ }
852
+ }
853
+ }
854
+ return data;
855
+ };
856
+
857
+ return XmppRoom;
858
+
859
+ })();
860
+
861
+ RoomConfig = (function() {
862
+
863
+ function RoomConfig(info) {
864
+ this.parse = __bind(this.parse, this); if (info != null) {
865
+ this.parse(info);
866
+ }
867
+ }
868
+
869
+ RoomConfig.prototype.parse = function(result) {
870
+ var attr, attrs, child, field, identity, query, _i, _j, _k, _len, _len1, _len2, _ref;
871
+ query = result.getElementsByTagName("query")[0].childNodes;
872
+ this.identities = [];
873
+ this.features = [];
874
+ this.x = [];
875
+ for (_i = 0, _len = query.length; _i < _len; _i++) {
876
+ child = query[_i];
877
+ attrs = child.attributes;
878
+ switch (child.nodeName) {
879
+ case "identity":
880
+ identity = {};
881
+ for (_j = 0, _len1 = attrs.length; _j < _len1; _j++) {
882
+ attr = attrs[_j];
883
+ identity[attr.name] = attr.textContent;
884
+ }
885
+ this.identities.push(identity);
886
+ break;
887
+ case "feature":
888
+ this.features.push(attrs["var"].textContent);
889
+ break;
890
+ case "x":
891
+ attrs = child.childNodes[0].attributes;
892
+ if ((!attrs["var"].textContent === 'FORM_TYPE') || (!attrs.type.textContent === 'hidden')) {
893
+ break;
894
+ }
895
+ _ref = child.childNodes;
896
+ for (_k = 0, _len2 = _ref.length; _k < _len2; _k++) {
897
+ field = _ref[_k];
898
+ if (!(!field.attributes.type)) {
899
+ continue;
900
+ }
901
+ attrs = field.attributes;
902
+ this.x.push({
903
+ "var": attrs["var"].textContent,
904
+ label: attrs.label.textContent || "",
905
+ value: field.firstChild.textContent || ""
906
+ });
907
+ }
908
+ }
909
+ }
910
+ return {
911
+ "identities": this.identities,
912
+ "features": this.features,
913
+ "x": this.x
914
+ };
915
+ };
916
+
917
+ return RoomConfig;
918
+
919
+ })();
920
+
921
+ Occupant = (function() {
922
+
923
+ function Occupant(data, room) {
924
+ this.room = room;
925
+ this.update = __bind(this.update, this);
926
+ this.admin = __bind(this.admin, this);
927
+ this.owner = __bind(this.owner, this);
928
+ this.revoke = __bind(this.revoke, this);
929
+ this.member = __bind(this.member, this);
930
+ this.ban = __bind(this.ban, this);
931
+ this.modifyAffiliation = __bind(this.modifyAffiliation, this);
932
+ this.deop = __bind(this.deop, this);
933
+ this.op = __bind(this.op, this);
934
+ this.mute = __bind(this.mute, this);
935
+ this.voice = __bind(this.voice, this);
936
+ this.kick = __bind(this.kick, this);
937
+ this.modifyRole = __bind(this.modifyRole, this);
938
+ this.update(data);
939
+ }
940
+
941
+ Occupant.prototype.modifyRole = function(role, reason, success_cb, error_cb) {
942
+ return this.room.modifyRole(this.nick, role, reason, success_cb, error_cb);
943
+ };
944
+
945
+ Occupant.prototype.kick = function(reason, handler_cb, error_cb) {
946
+ return this.room.kick(this.nick, reason, handler_cb, error_cb);
947
+ };
948
+
949
+ Occupant.prototype.voice = function(reason, handler_cb, error_cb) {
950
+ return this.room.voice(this.nick, reason, handler_cb, error_cb);
951
+ };
952
+
953
+ Occupant.prototype.mute = function(reason, handler_cb, error_cb) {
954
+ return this.room.mute(this.nick, reason, handler_cb, error_cb);
955
+ };
956
+
957
+ Occupant.prototype.op = function(reason, handler_cb, error_cb) {
958
+ return this.room.op(this.nick, reason, handler_cb, error_cb);
959
+ };
960
+
961
+ Occupant.prototype.deop = function(reason, handler_cb, error_cb) {
962
+ return this.room.deop(this.nick, reason, handler_cb, error_cb);
963
+ };
964
+
965
+ Occupant.prototype.modifyAffiliation = function(affiliation, reason, success_cb, error_cb) {
966
+ return this.room.modifyAffiliation(this.jid, affiliation, reason, success_cb, error_cb);
967
+ };
968
+
969
+ Occupant.prototype.ban = function(reason, handler_cb, error_cb) {
970
+ return this.room.ban(this.jid, reason, handler_cb, error_cb);
971
+ };
972
+
973
+ Occupant.prototype.member = function(reason, handler_cb, error_cb) {
974
+ return this.room.member(this.jid, reason, handler_cb, error_cb);
975
+ };
976
+
977
+ Occupant.prototype.revoke = function(reason, handler_cb, error_cb) {
978
+ return this.room.revoke(this.jid, reason, handler_cb, error_cb);
979
+ };
980
+
981
+ Occupant.prototype.owner = function(reason, handler_cb, error_cb) {
982
+ return this.room.owner(this.jid, reason, handler_cb, error_cb);
983
+ };
984
+
985
+ Occupant.prototype.admin = function(reason, handler_cb, error_cb) {
986
+ return this.room.admin(this.jid, reason, handler_cb, error_cb);
987
+ };
988
+
989
+ Occupant.prototype.update = function(data) {
990
+ this.nick = data.nick || null;
991
+ this.affiliation = data.affiliation || null;
992
+ this.role = data.role || null;
993
+ this.jid = data.jid || null;
994
+ this.status = data.status || null;
995
+ this.show = data.show || null;
996
+ return this;
997
+ };
998
+
999
+ return Occupant;
1000
+
1001
+ })();
1002
+
1003
+ }).call(this);