             application: 'RoQua Hubot'
             event: 'Mention'
             description: msg.message.text
+        when "sms"
+          console.error "Sending sms"
+          sendSms apikey, msg
+        
         when "nma"
-          params = 
+          params =
             apikey: apikey
             application: "Hubot"
             event: "Mention"

# Commands:
#   hubot notify me by prowl with YOUR_PROWL_API_KEY
#   hubot notify me by nma with YOUR_NMA_API_KEY
#   hubot list notifiers
#
# Author:
#   marten

Prowl = require "prowler"
QS = require "querystring"

module.exports = (robot) ->
  robot.hear /@(\w+)/i, (msg) ->
    sender   = msg.message.user.name.toLowerCase()
    username = msg.match[1].toLowerCase()
    notifies = []

    if username == "all" or username == "everyone"
      for username, apikey of robot.brain.data.notifiers
        unless username == sender
          notifies.push apikey
    else if apikey = robot.brain.data.notifiers[username]
      notifies.push apikey

    for notifier in notifies
      [protocol, apikey...] = notifier.split(':')
      apikey = apikey.join('')
      #msg.send("Notified #{protocol} by #{apikey}")

      switch protocol
        when "prowl"

    robot.brain.data.notifiers[msg.message.user.name.toLowerCase()] = "nma:#{apikey}"
    msg.send "OK"

  robot.respond /notify me by sms with (\d+)/i, (msg) ->
    number = msg.match[1].toLowerCase()
    robot.brain.data.notifiers ?= {}
    robot.brain.data.notifiers[msg.message.user.name.toLowerCase()] = "sms:#{number}"
    msg.send "OK"


  robot.respond /list notifiers/i, (msg) ->
    for username, apikey of robot.brain.data.notifiers
      msg.send("I notify #{username} with #{apikey}")
