-- // action.lua
-- // Converts all /me and +me into the IRC action form

dcpp:setListener("ownChat", "ownChat_action", function(hub, text)
   if string.find(string.sub(text,1,4), "^[\+|/]me%s") then
      local nick = hub:getOwnNick()
      hub:injectChat(" ** "..DC():ToUtf8(nick)..string.gsub(text,"^[\+|/]me",""))
      return 1
   end
   return nil
end)

dcpp:setListener("chat", "chat_action", function(hub, user, text)
   if string.find(string.sub(text,1,4), "^[\+|/]me%s") then
      local nick = user:getNick()
      hub:injectChat(" ** "..DC():ToUtf8(nick)..string.gsub(text,"^[\+|/]me",""))
      return 1
   end
   return nil
end)

DC():PrintDebug( " ** Loaded action.lua **")
