I'm looking at dipping my feet into the Unreal modules scene, I've already had one request. To make +W available for all users. Now, I know this is a core module. So I think "sure, there's gonna be a hook for whois, right?"
Wrong.
Is there any other way I can do this rather than using hooks/modifying the core?
Trying to create a module, some help please? :p
Trying to create a module, some help please? :p
-ChatSpike IRC Network [http://www.chatspike.net]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
I plan on using a different usermode.
-ChatSpike IRC Network [http://www.chatspike.net]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
Someone submitted a module like this sometime earlier.. but he made a small mistake, so I mailed him back if he could correct that. Never heard anything from him again ;).
Oh and yes.. overriding the WHOIS cmd and using a different umode is the way to go I think :p.
[sure, adding a hook would be possible, but IMO if you can do something quite easily via cmd overrides then why add a hook :p]
Oh and yes.. overriding the WHOIS cmd and using a different umode is the way to go I think :p.
[sure, adding a hook would be possible, but IMO if you can do something quite easily via cmd overrides then why add a hook :p]
can...someone point me in the right direction as to overriding something
yes, i feel like a moron. but it is my first attempt.
yes, i feel like a moron. but it is my first attempt.
-ChatSpike IRC Network [http://www.chatspike.net]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
CmdoverrideAdd would be your first step.w00t wrote:can...someone point me in the right direction as to overriding something
yes, i feel like a moron. but it is my first attempt.
Naturally you'll need to save the module info in a static variable during MOD_INIT, you need that to get the handle to pass to CmdoverrideAdd. You also need to declare a function like this:
DLLFUNC[1] int my_whois_handler(Cmdoverride* ovr, aClient* cptr, aClient* sptr, int parc, char* parv[]);
Then pass your module handle (modinfo->handle), the command name (eg, "WHOIS") and the function (eg, my_whois_handler) to CmdoverrideAdd. Among the things you'll need to do in your own handler is call unreal's code to handle the normal whois replies. For this you use CallCmdoverride:
CallCmdoverride(ovr, cptr, sptr, parc, parv);
That'll call the next override if there is one, or the m_whois itself.
Actually you don't necessarily need DLLFUNC since you're just passing a pointer to the function - not its name. It's actually permissible to use static, and might even be better so that you don't pollute the dll symbol table with functions that don't need to be in it.