Skip to content

Commit 8056cbc

Browse files
committed
Merge pull request #38 from pelish8/master
Added ability to invite multiple users.
2 parents a4c977c + 0d5dfc0 commit 8056cbc

2 files changed

Lines changed: 68 additions & 0 deletions

File tree

muc/strophe.muc.coffee

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,33 @@ Strophe.addConnectionPlugin 'muc',
212212
@_connection.send invitation
213213
return msgid
214214

215+
###Function
216+
Send a mediated multiple invitation.
217+
Parameters:
218+
(String) room - The multi-user chat room name.
219+
(Array) receivers - The invitation's receivers.
220+
(String) reason - Optional reason for joining the room.
221+
Returns:
222+
msgiq - the unique id used to send the invitation
223+
###
224+
multipleInvites: (room, receivers, reason) ->
225+
msgid = @_connection.getUniqueId()
226+
invitation = $msg(
227+
from: @_connection.jid
228+
to: room
229+
id: msgid )
230+
.c('x', xmlns: Strophe.NS.MUC_USER)
231+
232+
for receiver in receivers
233+
invitation.c 'invite', to: receiver
234+
if reason?
235+
invitation.c 'reason', reason
236+
invitation.up()
237+
invitation.up()
238+
239+
@_connection.send invitation
240+
return msgid
241+
215242
###Function
216243
Send a direct invitation.
217244
Parameters:
@@ -603,6 +630,9 @@ class XmppRoom
603630
invite: (receiver, reason) ->
604631
@client.invite @name, receiver, reason
605632

633+
multipleInvites: (receivers, reason) ->
634+
@client.invite @name, receivers, reason
635+
606636
directInvite: (receiver, reason) ->
607637
@client.directInvite @name, receiver, reason, @password
608638

muc/strophe.muc.js

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)