 
     msg.reply cmds.join "\n"
 
-    logmsg = "#{modulename}: robot responded to #{msg.envelope.user.name}: " +
+    logmsg = "#{modulename}: robot responded to #{who}: " +
       "displayed #{modulename} help"
     robot.logger.info logmsg
 

    usermsg = "fw: #{list_name} entries expired and have been removed: " +
      "```"+ deleted.join("\n") + "```"
    notifySubscribers usermsg
    fs.writeFileSync fwdata_file, JSON.stringify(fwdata), 'utf-8'


notifySubscribers = (msg, current_un = false) ->
  console.error 'bad robotRef' unless robotRef
  for un in fwdata.notify
    robotRef.send { room: un }, msg unless current_un && un == current_un


notifyAdmins = (msg, current_un = false) ->
  console.error 'bad robotRef' unless robotRef
  for un in admins
    robotRef.send { room: un }, msg unless current_un && un == current_un


showAdmins = (robot, msg) ->

  if fwdata.firewalls.length > 1
    fwdata.firewalls = fwdata.firewalls.sort (a,b) ->
      sortBy('name',a,b) or sortBy('list',a,b) or sortBy('type',a,b)
  writeData()


writeData = ->
  fs.writeFileSync data_file, JSON.stringify(fwdata), 'utf-8'
  logmsg = "#{modulename}: wrote #{data_file}"
  robotRef.logger.info logmsg


module.exports = (robot) ->

