Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Commit

Permalink
Party line
Browse files Browse the repository at this point in the history
  • Loading branch information
farski committed May 14, 2013
1 parent 9eb5688 commit b838526
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions scripts/party-line.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Description:
# Set up an XMPP party line
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# None

Xmpp = require 'node-xmpp'

module.exports = (robot) ->
robot.catchAll (msg) ->
from = new Xmpp.JID(msg.message.room)
text = "#{from.user}: #{msg.message.text}"

for jid in robot.xmppRoster
if from.user != jid.user
params =
to: jid.toString()
type: 'chat'

message = new Xmpp.Element('message', params).c('body').t(text)
robot.xmppClient.send message


# console.log "#{from.user} says #{text}"
# console.log "#{robot.xmppRoster}"

0 comments on commit b838526

Please sign in to comment.