Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#8 Better support for plug-ins implementing /commands

open
nobody
None
5
2004-09-28
2004-09-28
Jens Ayton
No

So, years ago I wrote some ShadowIRC plug-ins which implemented
new /foo commands, and was irritated that setting the
pCommandDataRec.dontProcess flag and returning true when
passed pUserCommandMessage had no apparent effect -
commands were passed to the server anyway.

The other day I wrote a ShadowIRC plug-in which implements new /
foo commands, and had the same niggle.

This patch fixes this behaviour. If a plug-in sets
pCommandDataRec.dontProcess when passed
pUserCommandMessage, this is detected, as before, in
TranslateCommand(). The diff causes the flag's value to be passed
to the caller, HandleCommand(), which will not pass the command
to the server (or display the "You are not connected to a server"
message) if it is non-zero.

An alternative, shorter but arguably uglier method, would be for
TranslateCommand() to set the len field of its LongString *s
parameter to 0 if a plug-in sets pCommandDataRec.dontProcess;
HandleCommand()s existing implementation would then do the Right
Thing.

The nomenclature and distribution of work could perhaps be
improved.

Discussion

  • Jens Ayton
    Jens Ayton
    2004-09-28

    Diff output describing chages

     
    Attachments