Page 1 of 1

Adding/editing commands.

Posted: Sun Nov 14, 2004 3:10 am
by chevyman2002
I was wondering how to add/edit commands. I thought there was no /umode but learned there was a /umode2.. confused some users so i was going to try to change it.. Not sure if i have to create a Module to do this or what. Thanks for input :)

Posted: Sun Nov 14, 2004 3:33 am
by katsklaw
well modifying the code is not supported and adding/changing commands would be doing just that.

There are ways to unload commands that exist without modifying the code which is supported :)

Posted: Sun Nov 14, 2004 4:52 am
by chevyman2002
ic, so in other words, i won't find help here on adding/editing the commands? ;P | How do you go on about removing them? Although i don't know of any i want to remove, part of the reason im doing all this is the learn as much about all this stuff as i can so.. still interested ;)

Posted: Sun Nov 14, 2004 5:59 am
by katsklaw
chevyman2002 wrote:ic, so in other words, i won't find help here on adding/editing the commands? ;P | How do you go on about removing them? Although i don't know of any i want to remove, part of the reason im doing all this is the learn as much about all this stuff as i can so.. still interested ;)
removing some commands are rather easy, simply because they are in the form of modules. take sjoin for example.

If you exchange

Code: Select all

loadmodule "modules/commands.so";
for

Code: Select all

loadmodule "modules/m_*.so";
Then you delete the modules you don't want to use. so if you don't like the /sjoin command .. then delete or rename the m_sjoin.so module.

Posted: Sun Nov 14, 2004 11:54 am
by AngryWolf
Well, as far as I know, module coding is somewhat supported, that's why this forum exists here, and adding/editing/removing commands can be done through 3rd party modules.
To add a new command, module coders generally use CommandAdd, to remove, CommandDel, and to modify the behaviour of a command, CmdoverrideAdd.

However, CommandDel might not be useful to remove, for example, command UMODE2. This command - among many others - is added with function add_Command that leaves out creating module objects, so you might want to use del_Command, but it will be much more tricky...

Oh, and the best way to learn about module coding is to read the UnrealIRCd source code a lot. :)

Posted: Sun Nov 14, 2004 6:57 pm
by codemastr
If you were to remove/disable UMODE2, you would break Unreal. Unreal relies on this command for propagation of usermodes across servers.

Posted: Sun Nov 14, 2004 8:01 pm
by chevyman2002
hmm, ok, thanks much guys :). Now all i need to do is learn how to script all this stuff ;)

Posted: Sun Nov 14, 2004 10:42 pm
by aquanight
Real command aliases are in planning, so if it's just a question of having a UMODE command instead of UMODE2, you can wait until that's done and then just alias UMODE to UMODE2. Aside from that a quick module could easily do it.

Posted: Sun Nov 14, 2004 11:32 pm
by chevyman2002
Ya, the /umode2 thing isn't a big problem or anything, i can simply tell users how to do that or something. I was debating adding a few very simple commands for services. Like on ConferenceRoom, when you type "/ns" -- it sends "/ns help" rather than "no text to send." Just minor things like that, and might would add a couple commands that i'd like to see that weren't only for U:Lines (such as sqline). Not sure what i'll do yet, for now i may tackle some miscoding on Auspice as /cs close and /ns forbid cause seg faults. Thanks much guys :).

Posted: Sun Nov 14, 2004 11:39 pm
by aquanight
chevyman2002 wrote:Like on ConferenceRoom, when you type "/ns" -- it sends "/ns help" rather than "no text to send."
This is easy to do.

Code: Select all

alias ns {
    format "^$" {
        target "NickServ";
        type services;
        parameters "HELP";
    };
    format "^.+$" {
        target "NickServ";
        type services;
        parameters "%1-";
    };
    type command;
};

Posted: Sun Nov 14, 2004 11:58 pm
by chevyman2002
oh wow.. thanks! :D

Posted: Mon Nov 15, 2004 5:20 am
by AngryWolf
Sorry, aquanight, but that alias will still say "no text to send" if you simply type "/ns" (this checking is hard coded, not configurable), and doesn't have a "type" directive with the value "command", anyway.

Posted: Mon Nov 15, 2004 5:30 am
by aquanight
AngryWolf wrote:Sorry, aquanight, but that alias will still say "no text to send" if you simply type "/ns" (this checking is hard coded, not configurable), and doesn't have a "type" directive with the value "command", anyway.
whoops... but darn... hardcoded text checking? argh :(