Skip to content

Commit

Permalink
Merge pull request #38 from pelish8/master
Browse files Browse the repository at this point in the history
Added ability to invite multiple users.
  • Loading branch information
jcbrand committed Sep 20, 2014
2 parents a4c977c + 0d5dfc0 commit 8056cbc
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
30 changes: 30 additions & 0 deletions muc/strophe.muc.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,33 @@ Strophe.addConnectionPlugin 'muc',
@_connection.send invitation
return msgid

###Function
Send a mediated multiple invitation.
Parameters:
(String) room - The multi-user chat room name.
(Array) receivers - The invitation's receivers.
(String) reason - Optional reason for joining the room.
Returns:
msgiq - the unique id used to send the invitation
###
multipleInvites: (room, receivers, reason) ->
msgid = @_connection.getUniqueId()
invitation = $msg(
from: @_connection.jid
to: room
id: msgid )
.c('x', xmlns: Strophe.NS.MUC_USER)

for receiver in receivers
invitation.c 'invite', to: receiver
if reason?
invitation.c 'reason', reason
invitation.up()
invitation.up()

@_connection.send invitation
return msgid

###Function
Send a direct invitation.
Parameters:
Expand Down Expand Up @@ -603,6 +630,9 @@ class XmppRoom
invite: (receiver, reason) ->
@client.invite @name, receiver, reason

multipleInvites: (receivers, reason) ->
@client.invite @name, receivers, reason

directInvite: (receiver, reason) ->
@client.directInvite @name, receiver, reason, @password

Expand Down
38 changes: 38 additions & 0 deletions muc/strophe.muc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8056cbc

Please sign in to comment.