ESOUI SVN TaosGroupInvite

[/] [trunk/] [TaosGroupInvite/] [logic/] [CommandsHandler.lua] - Rev 3

Compare with Previous | Blame | View Log

--[[
        Addon: Taos Group Invite
        Author: TProg Taonnor
        Created by @Taonnor
]]--

--[[
        Local variables
]]--
local LOG_ACTIVE = true
local _logger = nil

--[[
        Table TGI_CommandsHandler
]]--
TGI_CommandsHandler = {}
TGI_CommandsHandler.__index = TGI_CommandsHandler

--[[
        Table Members
]]--
TGI_CommandsHandler.Name = "TGI-CommandsHandler"

--[[
        Called on /gi command
]]--
function TGI_CommandsHandler.SetGroupInviteString(inviteString)
        if (LOG_ACTIVE) then 
        _logger:logTrace("TGI_CommandsHandler.SetGroupInviteString")
        _logger:logDebug("inviteString", inviteString)
    end

    if (inviteString ~= nil and inviteString ~= "") then
        TGI_SettingsHandler.SetInviteString(inviteString)
    else
        d("Invalid invite string: " .. tostring(inviteString))
    end
end

--[[
        Called on /regroup command
]]--
function TGI_CommandsHandler.ActivateRegroup()
        if (LOG_ACTIVE) then 
        _logger:logTrace("TGI_CommandsHandler.ActivateRegroup")
    end

    TGI_InviteHandler.Regroup()
end

--[[
        Initialize initializes TGI_CommandsHandler
]]--
function TGI_CommandsHandler.Initialize(logger)
    if (LOG_ACTIVE) then 
        logger:logTrace("TGI_CommandsHandler.Initialize")
        logger:logDebug("Commands active:")
        logger:logDebug("/gi <INVITESTRING> - Sets invite string.")
                logger:logDebug("/regroup - Starts regroup.")
    end

    _logger = logger

    -- Define commands
    SLASH_COMMANDS["/gi"] = TGI_CommandsHandler.SetGroupInviteString
        SLASH_COMMANDS["/regroup"] = TGI_CommandsHandler.ActivateRegroup
end

Compare with Previous | Blame