PtokaX forum

Stuff => Offtopic => Topic started by: PPK on 02 March, 2008, 23:49:05

Title: IP menu support in UserCommands
Post by: PPK on 02 March, 2008, 23:49:05
Long time ago on end of year 2002 CZDC++ introduced color chat and part of that are better menus in chat with support for IP addresses.
Many clients used and use that code but problem of this code is that it's supporting only few hardcoded commands, and as far as i know nobody fixed it.
So after many years i'm fixed that problem and released CzDC with IP menu support in UserCommands.

Context for IP menu is 0x10 (or better 16, because that is what is used in $UserCommand). It is not in any way breaking compatibility, clients not supporting that context simply ignore it 8)

Example script for PtokaX:

function OpConnected(curUser)
    Core.GetUserData(curUser, 12) -- get bUserCommands

    if curUser.bUserCommand then
        permissions = ProfMan.GetProfilePermissions(curUser.iProfile)
        local usrcmds = "$UserCommand 255 15|"
        usrcmds = usrcmds.."$UserCommand 0 3|"

        if permissions.bBan then
            usrcmds = usrcmds.."$UserCommand 1 16 Ban Menu\\Ban IP$<%[mynick]> !banip %[userI4] %[line:Enter reason]&#124;|"
            usrcmds = usrcmds.."$UserCommand 1 16 Ban Menu\\Fullban IP$<%[mynick]> !fullbanip %[userI4] %[line:Enter reason]&#124;|"
        end
        if permissions.bUnban then
            usrcmds = usrcmds.."$UserCommand 1 16 Ban Menu\\Unban IP$<%[mynick]> !unban %[userI4]&#124;|"
        end
        if permissions.bTempBan then
            usrcmds = usrcmds.."$UserCommand 1 16 Ban Menu\\Temporary ban IP$<%[mynick]> !tempbanip %[userI4] %[line:Enter time] %[line:Enter reason]&#124;|"
            usrcmds = usrcmds.."$UserCommand 1 16 Ban Menu\\Temporary fullban IP$<%[mynick]> !fulltempbanip %[userI4] %[line:Enter time] %[line:Enter reason]&#124;|"
        end
        if permissions.bTempUnban then
            usrcmds = usrcmds.."$UserCommand 1 16 Ban Menu\\Temp unban IP$<%[mynick]> !tempunban %[userI4]&#124;|"
        end

        Core.SendToUser(curUser, usrcmds)
    end
end
Title: Re: IP menu support in UserCommands
Post by: Jusper on 03 March, 2008, 09:55:59
I want color chat :)