HydraIRC - API Docs

Written and designed by Dominic Clifton.

APIs

Name Define Description
Input Processor PLUGIN_API_CMDPROC Process user input that is typed in.

General API Notes

Server and Channel ID's

Most calls to plugins will include Server and Channel ID's in their parameters,  these are used by plugins to make sure their output goes back to the right server and channel.  Sometimes an API function will be called where a server or channel ID wouldn't be appropriate.  In this case the ID is set to 0, thus 0 means INVALID ID.  Invalid ID's should not be used further.

An example case would be a call to PLUGIN_API_CMDPROC's PFN_PROCESSINPUT function, this function is called when a user enters text in a server window as well as when a user enters text in a channel window.  In the case of the server window, ChannelID value would be 0 because a server doesn't have a channel ID, but a channel window has both ServerID's and ChannelID's (You can't have a channel without a server!)

Input Processor

Function Overview:

Function Required ? Description
PFN_PROCESSINPUT NO Allows a plugin to handle or change user input
PFN_PROCESSCOMMAND NO Allows a plugin to handle commands
PFN_PROCESSCHANNELCOMMAND NO Allows a plugin to handle channel commands
PFN_PROCESSSERVERCOMMAND NO Allows a plugin to handle server commands

API Define: PLUGIN_API_CMDPROC

Purpose:

Process user input that is typed in.

Example:

A user types in "Hi there hydra, how are you ?", or "/kickban iannoyu"

Possible uses:

* Implement new commands
* fix spelling errors

Examples API Usage:

If you wanted to add a new command, that was only valid for channel windows, then your plugin would provide and process PFN_PROCESSCHANNELCOMMAND calls.

If you wanted to add new commands that can be used anywhere, your plugin would provide and process PFN_PROCESSCOMMAND calls.

If you wanted to fix spelling errors, or provide global command aliases, then your plugin would provide and process PFN_PROCESSINPUT calls.

PFN_PROCESSINPUT:

BOOL (* PFN_PROCESSINPUT) (int ServerID, int ChannelID, char **Command);

BOOL Plugin_ProcessInput(int ServerID, int ChannelID, char **Command)

Inputs:

ServerID,ChannelID - See server and channel ID's, above.

Command - contains a pointer to a pointer that points to the text that the user typed in, as-is.  You can replace the pointer with a pointer to a new string if desired.  The new string must be allocated using the HydraIRC memory allocation routines.

Return:

TRUE - Marks the command as processed, no further command processing is done. Note:return this if you plugin is handling the input.
FALSE - Command processing is continued. Note: Use this if your plugin is correcting/modifying the input

Example Inputs: (1,5,"/msg Hydra hello there!")

PFN_PROCESSCHANNELCOMMAND:

BOOL (* PFN_PROCESSCHANNELCOMMAND) (int ServerID, int ChannelID, char **Command, char **Args);

BOOL Plugin_ProcessChannelCommand(int ServerID, int ChannelID, char **Command, Char **Args)

Inputs:

ServerID,ChannelID - See server and channel ID's, above.

Command - contains a pointer to a pointer that points to the text that the user typed in, after being processed by PFN_PROCESSINPUT.  You can replace the pointer with a pointer to a new string if desired.  The new string must be allocated using the HydraIRC memory allocation routines.

Return:

TRUE - Marks the command as processed, no further command processing is done. Note:return this if you plugin is handling the input.
FALSE - Command processing is continued. Note: Use this if your plugin is correcting/modifying the input

Example Inputs: (1,5,"msg","Hydra hello there!")

PFN_PROCESSSERVERCOMMAND:

BOOL (* PFN_PROCESSSERVERCOMMAND) (int ServerID, char **Command, char **Args);

BOOL Plugin_ProcessServerCommand(int ServerID, char **Command, Char **Args)

Inputs:

ServerID - See server and channel ID's, above.  Note that unlike the other API functions, you don't get a channel ID because this function will only get called if the window the user typed into was a channel window.

Command - contains a pointer to a pointer that points to the command part of the text that the user typed in, after being processed by PFN_PROCESSINPUT.  You can replace the pointer with a pointer to a new string if desired.  The new string must be allocated using the HydraIRC memory allocation routines.

Args - contains a pointer to a pointer that points to the argument part of the text that the user typed in, after being processed by PFN_PROCESSINPUT.  You can replace the pointer with a pointer to a new string if desired.  The new string must be allocated using the HydraIRC memory allocation routines.

Return:

TRUE - Marks the command as processed, no further command processing is done. Note:return this if you plugin is handling the input.
FALSE - Command processing is continued. Note: Use this if your plugin is correcting/modifying the input

Example Inputs: (1,"msg","nickserv identify mypassword!")

PFN_PROCESSCOMMAND:

BOOL (* PFN_PROCESSCOMMAND) (int ServerID, int ChannelID, char **Command, char **Args);

BOOL Plugin_ProcessCommand(int ServerID, int ChannelID, char **Command, Char **Args)

Inputs:

ServerID,ChannelID - See server and channel ID's, above.

Command - contains a pointer to a pointer that points to the text that the user typed in, after being processed by PFN_PROCESSINPUT and PFN_PROCESSCHANNELCOMMAND or PFN_PROCESSSERVERCOMMAND.  You can replace the pointer with a pointer to a new string if desired.  The new string must be allocated using the HydraIRC memory allocation routines.

Return:

TRUE - Marks the command as processed, no further command processing is done. Note:return this if you plugin is handling the input.
FALSE - Command processing is continued. Note: Use this if your plugin is correcting/modifying the input

Example Inputs: (1,5,"msg","Hydra hello there!")