fgwirc scripting

Fgwirc is fungw based and can be scripted in any of the dozen scripting language offered by fungw. Furthermore fgwirc offers a dumb action script language for easy, shell-like "/ command" and rc file sytnax.

Fgwirc functionality is implemented in form of actions. An action is a named function. Executing any action is implemented by calling the corresponding function. Each action can be implemented in C or in any of the scripting languages supported by fungw.

Actions can do anything:

Below is a list of all different ways actions can be called.

The command line interface

The user may enter a text message or a command using the line editor on the bottom of the screen. Commands start with a slash ("/") character. Any command is a call to an action named in the first word of the command line. The rest of the command line is split to words and used as an argument list for the action function call. Double quotes can be used to specify a multi-word argument.

The rc file

The rc file, by default ~/fgwirc.rc (can be overridden by the -c command line argument) is an action script file.

User scripts

An user script is loaded using the load action. The init section of the user script typically registers actions that then can be called by the user or other scripts or can react on IRC messages. The user script is active until it is unloaded or fgwirc exits.

C plugin

It is possible to write a fungw engine that acts as a C plugin. Much like an user script, it can be loaded and unloaded any time, and it can register actions.

Actions as user commands

If script:

it becomes an user command that can be called with slash (e.g. /foo).

Function arguments shall be the same as command arguments. There must be at least one argument, because of the help mechanism.

For the script help, the function _MUST_ call the help handler before doing anyting else: script_help(firstarg, "help1", "help2", "help3") The first argument of the function must be passed to hook_help. If the return value of script_help() is non-zero, the help was served and the function shall return without doing anything else.

Actions as event hooks

Events, such as timer ticks or messages received from the IRC server cause fgwirc to run hook actions. A hook action has a standard name, e.g. on_privmsg, on_tick_minute. Multiple scripts can define the same action and all them are called.

For more details on scripting hook actions, see hooks.txt