Author Topic: IP menu support in UserCommands  (Read 1876 times)

0 Members and 1 Guest are viewing this topic.

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
IP menu support in UserCommands
« 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:
Code: [Select]
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
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

PtokaX forum

IP menu support in UserCommands
« on: 02 March, 2008, 23:49:05 »

Offline Jusper

  • Junior Member
  • **
  • Posts: 18
  • Karma: +11/-1
Re: IP menu support in UserCommands
« Reply #1 on: 03 March, 2008, 09:55:59 »
I want color chat :)

PtokaX forum

Re: IP menu support in UserCommands
« Reply #1 on: 03 March, 2008, 09:55:59 »