# HexChat Perl Interface ## Introduction This is the Perl interface for HexChat. If there are any problems, questions, comments or suggestions please email them to the address on the bottom of this page. ## Constants ###Priorities * **`Xchat::PRI_HIGHEST`** * **`Xchat::PRI_HIGH`** * **`Xchat::PRI_NORM`** * **`Xchat::PRI_LOW`** * **`Xchat::PRI_LOWEST`** ### Return values * **`Xchat::EAT_NONE`** - pass the event along * **`Xchat::EAT_XCHAT`** - don't let HexChat see this event * **`Xchat::EAT_PLUGIN`** - don't let other scripts and plugins see this event but xchat will still see it * **`Xchat::EAT_ALL`** - don't let anything else see this event #### Timer and fd hooks * **`Xchat::KEEP`** - keep the timer going or hook watching the handle * **`Xchat::REMOVE`** - remove the timer or hook watching the handle ### hook\_fd flags * **`Xchat::FD_READ`** - invoke the callback when the handle is ready for reading * **`Xchat::FD_WRITE`** - invoke the callback when the handle is ready for writing * **`Xchat::FD_EXCEPTION`** - invoke the callback if an exception occurs * **`Xchat::FD_NOTSOCKET`** - indicate that the handle being hooked is not a socket ## Functions ### `Xchat::register( $name, $version, [$description,[$callback]] )` * `$name` - The name of this script * `$version` - This script's version * `$description` - A description for this script * `$callback` - This is a function that will be called when the is script unloaded. This can be either a reference to a function or an anonymous sub reference. This is the first thing to call in every script. ### `Xchat::hook_server( $message, $callback, [\%options] )` ### `Xchat::hook_command( $command, $callback, [\%options] )` ### `Xchat::hook_print( $event,$callback, [\%options] )` ### `Xchat::hook_timer( $timeout,$callback, [\%options | $data] )` ### `Xchat::hook_fd( $handle, $callback, [ \%options ] )` These functions can be to intercept various events. hook\_server can be used to intercept any incoming message from the IRC server. hook\_command can be used to intercept any command, if the command doesn't currently exist then a new one is created. hook\_print can be used to intercept any of the events listed in _Setttings_ `->` _Text Events_. hook\_timer can be used to create a new timer * **`$message`** - server message to hook such as PRIVMSG * **`$command`** - command to intercept, without the leading / * **`$event`** - one of the events listed in _Settings_ `->` _Text Events_ * **`$timeout`** - timeout in milliseconds * **`$handle`** - the I/O handle you want to monitor with hook\_fd. This must be something that has a fileno. See perldoc -f fileno or [fileno](http://perldoc.perl.org/functions/fileno.html) * **`$callback`** - callback function, this is called whenever the hooked event is trigged, the following are the conditions that will trigger the different hooks. This can be either a reference to a function or an anonymous sub reference. * **`\%options`** - a hash reference containing addional options for the hooks Valid keys for \%options:
data | Additional data that is to be associated with the hook. For timer hooks this value can be provided either as Xchat::hook_timer( $timeout, $cb,{data=>$data}) or Xchat::hook_timer( $timeout, $cb, $data ) .However, this means that hook_timer cannot be provided with a hash reference containing data as a key. example: my $options = { data => [@arrayOfStuff] }; Xchat::hook_timer( $timeout, $cb, $options ); In this example, the timer's data will be [@arrayOfStuff] and not { data => [@arrayOfStuff] } This key is valid for all of the hook functions. Default is undef. |
priority | Sets the priority for the hook. It can be set to one of the Xchat::PRI_* constants.This key only applies to server, command and print hooks. Default is Xchat::PRI_NORM .
|
help_text | Text displayed for /help $command. This key ## Process with automake to produce Makefile.in
# To create a standalone tarball of your plugin run the plugin_dist
# target. Note: you must configure the main source tree with
# --enable-maintainer-mode
# These two must be defined.
PLUGIN=mailcheck
PLUGIN_VERSION=0.1
# This file must be in the form PLUGIN-config.h.in, it can be empty but
# must exist
EXTRA_DIST = mailcheck-config.h.in
# Remember to include this line in your Makefile.am
include @top_srcdir@/plugins/Make.plugin
libdir = $(hexchatdir)/plugins
lib_LTLIBRARIES = mailcheck.la
mailcheck_la_SOURCES = mailcheck.c
mailcheck_la_LDFLAGS = -avoid-version -module
INCLUDES = $(COMMON_CFLAGS) $(PLUGIN_INCLUDES)
DISTCLEANFILES = pg_dir/*
|