IRC Defender Module Documentation


NAME

IRC Defender dummy module for developers

Back to Top


DESCRIPTION

An example module that doesn't do much but demonstrates functions, API calls, event names etc. WARNING! Do NOT load this plugin into your setup without reading it through and modifying it, it will /kill all users that connect!

Back to Top


CREDITS

Thanks to the users on irc.chatspike.net for their ongoing patience while this service was tested, suffering multiple kills, shuns, force joins and being bitched at by machines ;-)

Back to Top


SYNOPSIS

All scanning modules for IRC Defender must be under the Modules::Scan namespace and be placed into the Modules/Scan directory. Your modules can be loaded from the config by putting their name into the list, e.g. if your module is ``foomatic.pm'' then you should put ``foomatic'' into the comma seperated list in the config file. Modules are event driven, events being triggered by the core or the protocol module.

Back to Top


Event Subroutines

The following subroutines must be defined by your module.

sub stats

The stats sub is called whenever your module is to display statistics to the log channel. You should use main::message to output stats, and should own up to any kills your module has made here, seperately to any counted by the core and protocol module.

sub scan_user

This subroutine will be called whenever a user connects, with all information about the user. it is up to the protocol module how this information is gathered but the parameter order is always the same.

sub handle_notice

This subroutine will be called whenever a notice is received. Note that some protocol modules may not fill the $ident and $host fields because the information is simply not sent to the server.

sub handle_privmsg

This function works similarly to handle_notice above, except that it receives privmsg commands. Yet again, some protocol modules may omit the values for $ident and $host if they are not passed to them and no caching is in use.

sub init

This function is called before the connection to the irc server takes place, immediately after the module is loaded. You should load files and initialise your modules here.

Back to Top


Core Functions

These functions can be used from any module. They exist in the main:: namespace and are exported by both the core and the protocol module. You MUST use these functions to produce output and fetch information, as you cannot gaurantee the format of the output, which varies from protocol to protocol.

main::message

This function takes one parameter, a string to be sent to the output channel. This may arrive in the channel through various means, depending on the protocol module, but always arrives and displays literally with no changes. You may include irc escapes such as \002 for bold.

main::message_to

This function takes two parameters, a target channel or user and a string to be sent to the target channel. This may arrive in the channel through various means, depending on the protocol module, but always arrives and displays literally with no changes. You may include irc escapes such as \002 for bold.

main::killuser

This function sends a KILL to remove a target user from the network. The actual format of the kill varies between protocols, but has the same effect of closing the users connection with the given kill message. This function also increments the global kill counter, used by 'status', so that you don't have to maintain it. This function takes two parameters, the nick of the user to remove, and the kill reason.

Back to Top


Core Variables

These variables are exported by the core. Warning! these variables are writeable, but be careful not to write to them from your module, accidentally or otherwise! This may be fixed in some future release.

$main::dir

This variable contains the directory of the program, where you may store and retrieve data in files.

$main::domain

This holds the domain name of the irc network, e.g. chatspike.net

$main::nspass

If defined, holds the program's nickserv password. Unused when the server module is loaded.

$main::killurl

A page to refer users to regarding why they have been killed. This is generic and depending on your network may contain related information.

$main::killmail

This variable contains an email address from the config file to which queries about kills should be addressed. This should usually be the akill or admin email for your network.

$main::botnick

This variable contains the nickname of the pseudoclient, or bot, that this program creates. In client mode, the program creates a connection directly as this user, meaning it is limited by the same restrictions as other users on your network. In server mode, the program connects as a server then masquerades this client as a connection of it, meaning there are no real restrictions on this fake client (commonly known as a pseudoclient)

$main::mychan

This is the channel that all output appears on. main::message automatically sends its data here.

$main::botname

This contains the GECOS (fullname field) of the pseudoclient or bot on the network.

$main::netname

This contains the displayed name of the network the program is connected to, e.g. 'ChatSpike'.

@main::modlist

This list is a list of all loaded modules currently in the system. Removing a module from this list will keep it loaded but all event calls to it will cease. You may use this list to, for example, check for dependencies.

Back to Top


AUTHOR

This document was composed by Craig Edwards (aka Brain). Stylesheet from the TrillPerl documentation.

Back to Top


COPYRIGHT

This text and program code it was generated from are (C) Craig Edwards 2004. Permission to modify this text is granted so long as the copyright notice given is preserved. See the comments in the source code for more information.

Back to Top


VERSION

Version 1.0, 20th February 2003

The newest version of this file should always be available at <http://brainbox.winbot.co.uk/~chatspike/modules.html>

Back to Top

 IRC Defender Module Documentation