 type        = process.env.HUBOT_IRC_TYPE
 debug       = process.env.HUBOT_HTTP_IRC_DEBUG
 api_key     = process.env.HUBOT_HTTP_IRC_API_KEY
-allow       = process.env.HUBOT_HTTP_IRC_ALLOW
-deny        = process.env.HUBOT_HTTP_IRC_DENY
+allow       = process.env.HUBOT_HTTP_IRC_ALLOW || null
+deny        = process.env.HUBOT_HTTP_IRC_DENY  || null
 allow_flag  = false
 
 send_message = (res, room, msg, query) ->
-  # console.log "room: #{room}"
-  # console.log "msg: #{message}"
   unless room
     console.log "#{prefix}: There is no room to say."
-    res.writeHead 200, {'Content-Type': 'text/plain'}
+    res.writeHead 400, {'Content-Type': 'text/plain'}
     res.end 'Error: There is no room to say.'
+    return
 
   # console.log "query: %j", query
 

    send_message(res, room, message, query)

  robot.router.post "#{path}", (req, res) ->
    check_request req

    query   = querystring.parse(req._parsedUrl.query)
    room    = query.room or ''
    message = req.body.message
    room    = req.body.room unless room

    send_message(res, room, message, req.body)


    @sm.send ["#{room}"], msg, query
  else
    @sm.send ["#{room}"], msg

  res.writeHead 200, {'Content-Type': 'text/plain'}
  res.end 'OK'

