From 6a9e7bb4d349b419816891e85ae8e95c46b9d2f5 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sun, 28 Oct 2012 10:49:44 +0100 Subject: Further doc relocations and conversions --- share/doc/dbus.md | 199 +++ share/doc/faq.md | 9 +- share/doc/fishlim.md | 33 + share/doc/hexchat-text.md | 3 + share/doc/perl.html | 1207 +++++++++++++++ share/doc/plugins.html | 1141 ++++++++++++++ share/doc/python.md | 545 +++++++ share/doc/tcl.html | 3675 +++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 6806 insertions(+), 6 deletions(-) create mode 100644 share/doc/dbus.md create mode 100644 share/doc/fishlim.md create mode 100644 share/doc/hexchat-text.md create mode 100644 share/doc/perl.html create mode 100644 share/doc/plugins.html create mode 100644 share/doc/python.md create mode 100644 share/doc/tcl.html (limited to 'share') diff --git a/share/doc/dbus.md b/share/doc/dbus.md new file mode 100644 index 00000000..d3c986df --- /dev/null +++ b/share/doc/dbus.md @@ -0,0 +1,199 @@ +# HexChat D-Bus Interface + +For more help you can see the HexChat [plugin interface documentation](https://github.com/hexchat/hexchat/blob/master/share/doc/plugins.md). WARNING: The dbus interface may change in the future. + +You can use the "/org/hexchat/Remote" object with interface "org.hexchat.plugin", but his context can be changed by other clients at any moment and you may receive signal asked by other clients. So for more complex usage it's better to get your own remote object. Using "Connect" method on interface "org.hexchat.connection" + +## Available methods on _org.hexchat.connection_ interface: + +* "Connect" + * Parameters: + * gchar\*: filename + * gchar\*: name + * gchar\*: description + * gchar\*: version + * Returns: + * gchar\*: Your own object's path. + +* "Disconnect" + * No parameter, no return value. It frees your remote object. + +## Available methods on _org.hexchat.plugin_ interface: + +* "Command" + * Parameters: + * gchar\*: the command name without the "/". (e.g. "nick pseudo") + +* "Print" + * Parameters: + * gchar\*: text to print on the HexChat window. + +* "FindContext" + * Parameters: + * gchar\*: the server name. Can be NULL. + * gchar\*: the channel name. Can be NULL. + * Returns: + * guint: context ID. + +* "GetContext" + * Returns: + * guint: current context's ID. + +* "SetContext" + * Parameters: + * guint: context ID to switch, returned by "FindContext" or "GetContext" + * Returns: + * gboolean: + * 1: Success. + * 0: Failure. + +* "GetInfo" + * Parameters: + * gchar\*: ID of the information you want. + * Returns: + * gchar\*: information you requested. + +* "GetPrefs" + * Parameters: + * gchar\*: Setting name required. + * Returns: + * int: + * 0: Failed. + * 1: Returned a string. + * 2: Returned an integer. + * 3: Returned a boolean. + * gchar\*: the information requested if it's a string. + * int: the information requested if it's a integer or boolean. + +* "HookCommand" + * Parameters: + * gchar\*: Name of the command (without the forward slash). + * int: Priority of this command. + * gchar\*: String of text to display when the user executes /help for this command. May be NULL if you're lazy. + * int: Value to returns when the command is catched. See XCHAT\_EAT\_*. + * Returns: + * guint: The ID of the hook. + +* "HookServer" + * Parameters: + * gchar\*: Name of the server event. + * int: Priority of this command. + * int: Value to returns when the command is catched. See XCHAT\_EAT\_*. + * Returns: + * guint: The ID of the hook. + +* "HookPrint" + * Parameters: + * gchar\*: Name of the print event. + * int: Priority of this command. + * int: Value to returns when the command is catched. See XCHAT\_EAT\_*. + * Returns: + * guint: The ID of the hook. + +* "Unhook" + * Parameters: + * guint: ID of the hook to unhook. + (the return value of "HookCommand", "HookServer" or "HookPrint") + +* "ListGet" + * Parameters: + * gchar\*: The list name. + * Returns: + * guint: List ID. + +* "ListNext" + * Parameters: + * guint: List ID returned by "ListGet". + * Returns: + * gboolean: says if there is no more item in the list. + +* "ListStr" + * Parameters: + * guint: List ID returned by "ListGet". + * gchar\*: Name of the information needed. + * Returns: + * gchar\*: The information requested. + +Warning: "context" attribute of "channels" list should be get with "ListInt" + +* "ListInt" + * Parameters: + * guint: List ID returned by "ListGet". + * gchar\*: Name of the information needed. + * Returns: + * guint: The information requested. + +* "ListTime" + * Parameters: + * guint: List ID returned by "ListGet". + * gchar\*: Name of the information needed. + * Returns: + * guint64: The information requested. + +* "ListFields" + * Parameters: + * gchar\*: The list name. + * Returns: + * gchar\*\*: information names in this list. + +* "ListFree" + * Parameters: + * guint: List ID returned by "ListGet". + +* "EmitPrint" + * Parameters: + * gchar\*: Text event to print. + * gchar\*\*: NULL terminated array of string. + * Returns: + * gboolean: + * 1: Success. + * 0: Failure. + +* "Nickcmp" + * Parameters: + * gchar\*: String to compare. + * gchar\*: String to compare. + * Returns: + * int: An integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2. + +* "Strip" + * Parameters: + * gchar\*: String to strip. + * int: Length of the string (or -1 for NULL terminated). + * int: Bit-field of flags: + * 0: Strip mIRC colors. + * 1: Strip text attributes. + * Returns: + * gchar\*: stripped string. + +* "SendModes" + * Parameters: + * gchar\*\*: NULL terminated array of targets (strings). The names of people whom the action will be performed on. + * int: Maximum modes to send per line. + * gchar: Mode sign, '-' or '+'. + * gchar: Mode char, e.g. 'o' for Ops. + +## Available signals: + +* "ServerSignal" + * Parameters: + * gchar\*\*: word returned by HexChat. + * gchar\*\*: word_eol returned by HexChat. + * guint: the ID of the hook (the return value of "HookServer"). + * guint: the ID of the context where the event come from. + +* "CommandSignal" + * Parameters: + * gchar\*\*: word returned by HexChat. + * gchar\*\*: word_eol returned by HexChat. + * guint: the ID of the hook (the return value of "HookCommand"). + * guint: the ID of the context where the event come from. + +* "PrintSignal" + * Parameters: + * gchar\*\*: word returned by HexChat. + * guint: the ID of the hook (the return value of "HookPrint"). + * guint: the ID of the context where the event come from. + +* "UnloadSignal" + * Emitted when the user asks to unload your program. Please exit(0); when received! diff --git a/share/doc/faq.md b/share/doc/faq.md index 99fa85fa..48555e62 100644 --- a/share/doc/faq.md +++ b/share/doc/faq.md @@ -1,8 +1,6 @@ -HexChat Frequently Asked Questions -================================== +# HexChat Frequently Asked Questions -Using HexChat. --------------- +## Using HexChat ### How do I autoconnect and join a channel when HexChat loads? @@ -295,8 +293,7 @@ to modify the global real name, just issue the following command: > 5. Rename *%APPDATA%\\HexChat\\plugin\_\*.conf to %APPDATA%\\HexChat\\addon\_\*.conf -Contributions, Development and Bugs. ------------------------------------- +## Contributions, Development and Bugs. ### I found a bug, what can I do? diff --git a/share/doc/fishlim.md b/share/doc/fishlim.md new file mode 100644 index 00000000..75c8cb99 --- /dev/null +++ b/share/doc/fishlim.md @@ -0,0 +1,33 @@ +# FiSHLiM + +FiSHLiM is an XChat plugin for FiSH IRC encryption. It's my attempt at making a simple, lightweight and secure plugin for this encryption protocol. For more info, please visit the [FiSHLiM website](http://fishlim.kodafritt.se/). + +For installation instructions, see the INSTALL file in the sources. + +## Features + +Working: + + * Sending/receiving messages + * Topic decryption + * Using unecrypted keys / keys without a password from blow.ini + * Pure protocol-level filtering (works with highlighting, nick coloring etc) + * Partially encrypted messages (i.e. prefixed with nickname by a bouncer) + +Not working: + + * Key exchange + * Password-protected key storage + * Topic encryption + * Remote exploitation (hopefully!) + * Plaintext content that contain +OK is decrypted twice + +## Commands + +Keys are stored in the configuration file in ~/.config/hexchat/addon_fishlim.txt. To set the encryption key for the nick or channel to password: + +
/setkey  [nick or #channel]  password
+ +To delete the given nick or channel from the configuration file: + +
/delkey  nick-or-#channel
diff --git a/share/doc/hexchat-text.md b/share/doc/hexchat-text.md new file mode 100644 index 00000000..30d91a31 --- /dev/null +++ b/share/doc/hexchat-text.md @@ -0,0 +1,3 @@ +# HexChat-Text + +HexChat-Text is an experimental text frontend for HexChat. If anyone wants to add ncurses support, they are welcome to. diff --git a/share/doc/perl.html b/share/doc/perl.html new file mode 100644 index 00000000..6092047e --- /dev/null +++ b/share/doc/perl.html @@ -0,0 +1,1207 @@ + + + + +X-Chat 2 Perl Interface + + + + + + + + +
+ X-Chat 2 Perl Interface +
+ + + +
+

+ + + +
+
+ + +

+

+

X-Chat 2 Perl Interface

+

+

+

Introduction

+

This is the new Perl interface for X-Chat 2. However, due to changes in +xchat's plugin code you will need xchat 2.0.8 or above to load this. Scripts +written using the old interface will continue to work. If there are any +problems, questions, comments or suggestions please email them to the address +on the bottom of this page.

+

+

+

Constants

+

+

+

Priorities

+ +

+

+

Return values

+ +

+

+

Timer and fd hooks

+ +

+

+

hook_fd flags

+ +

+

+

Functions

+

+

+

Xchat::register( $name, $version, [$description,[$callback]] )

+ +

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->Advanced->Text Events +hook_timer can be used to create a new timer

+
+

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 only applies to command hooks.
+
+ Default is "". +
flags Specify the flags for a fd hook.
+
+ See hook fd flags section for valid values.
+
+ On Windows if the handle is a pipe you specify
+ Xchat::FD_NOTSOCKET in addition to any other flags you might be using.
+
+ This key only applies to fd hooks.
+ Default is Xchat::FD_READ +

+

+

When callbacks are invoked

+

Each of the hooks will be triggered at different times depending on the type +of hook.

+ + + + + + + + + + + + + +
Hook Type When the callback will be invoked
server hooks a $message message is + received from the server +
command hooks the $command command is + executed, either by the user or from a script +
print hooks X-Chat is about to print the message for the + $event event +
timer hooks called every $timeout milliseconds + (1000 millisecond is 1 second)
+ the callback will be executed in the same context where + the hook_timer was called, if the context no longer exists + then it will execute in a random context +
fd hooks depends on the flags that were passed to hook_fd
+ See hook_fd flags section. +

The value return from these hook functions can be passed to Xchat::unhook +to remove the hook.

+

+

+

Callback Arguments

+

All callback functions will receive their arguments in @_ like every +other Perl subroutine.

+

+Server and command callbacks
+
+$_[0] - array reference containing the IRC message or command and +arguments broken into words
+example:
+/command arg1 arg2 arg3
+$_[0][0] - command
+$_[0][1] - arg1
+$_[0][2] - arg2
+$_[0][3] - arg3
+
+$_[1] - array reference containing the Nth word to the last word
+example:
+/command arg1 arg2 arg3
+$_[1][0] - command arg1 arg2 arg3
+$_[1][1] - arg1 arg2 arg3
+$_[1][2] - arg2 arg3
+$_[1][3] - arg3
+
+$_[2] - the data that was passed to the hook function
+
+Print callbacks
+
+$_[0] - array reference containing the values for the + text event see Settings->Advanced->Text Events
+$_[1] - the data that was passed to the hook function
+
+Timer callbacks
+
+$_[0] - the data that was passed to the hook function
+
fd callbacks
+
+$_[0] - the handle that was passed to hook_fd
+$_[1] - flags indicating why the callback was called
+$_[2] - the data that was passed to the hook function
+

+

+

Callback return values

+

All server, command and print callbacks should return one of +the Xchat::EAT_* constants. +Timer callbacks can return Xchat::REMOVE to remove +the timer or Xchat::KEEP to keep it going

+

+

+

Miscellaneous Hook Related Information

+

For server hooks, if $message is "RAW LINE" then $cb will be called for +every IRC message than X-Chat receives.

+

For command hooks if $command is "" then $cb will be called for +messages entered by the user that is not a command.

+

For print hooks besides those events listed in +Settings->Advanced->Text Events, these additional events can be used.

+ + + + + + + + + + + + + + + +
Event Description
"Open Context" a new context is created
"Close Context" a context has been close
"Focus Tab" when a tab is brought to the front
"Focus Window" when a top level window is focused or the + main tab window is focused by the window manager +
"DCC Chat Text" when text from a DCC Chat arrives. + $_[0] will have these values
+
+ $_[0][0] - Address
+ $_[0][1] - Port
+ $_[0][2] - Nick
+ $_[0][3] - Message
+
"Key Press" used for intercepting key presses
+ $_[0][0] - key value
+ $_[0][1] - state bitfield, 1 - shift, 4 - control, 8 - alt
+ $_[0][2] - string version of the key which might be empty for unprintable keys
+ $_[0][3] - length of the string in $_[0][2]
+

+

+

Xchat::unhook( $hook )

+ +

This function is used to removed a hook previously added with one of +the Xchat::hook_* functions

+

It returns the data that was passed to the Xchat::hook_* function when +the hook was added

+

+

+

Xchat::print( $text | \@lines, [$channel,[$server]] )

+ +

The first argument can either be a string or an array reference of strings. +Either or both of $channel and $server can be undef.

+

If called as Xchat::print( $text ), it will always return true. +If called with either the channel or the channel and the server +specified then it will return true if a context is found and +false otherwise. The text will not be printed if the context +is not found. The meaning of setting $channel or $server to +undef is the same as +find_context.

+

+

+

Xchat::printf( $format, LIST )

+ +

+

+

Xchat::command( $command | \@commands, [$channel,[$server]] )

+ +

The first argument can either be a string or an array reference of strings. +Either or both of $channel and $server can be undef.

+

If called as Xchat::command( $command ), it will always return true. +If called with either the channel or the channel and the server +specified then it will return true if a context is found and false +otherwise. The command will not be executed if the context is not found. +The meaning of setting $channel or $server to undef is the same +as find_context.

+

+

+

Xchat::commandf( $format, LIST )

+ +

+

+

Xchat::find_context( [$channel, [$server]] )

+ +

Either or both of $channel and $server can be undef. Calling +Xchat::find_context() is the same as calling +Xchat::find_context( undef, undef) and +Xchat::find_context( $channel ) is +the same as Xchat::find_context( $channel, undef ).

+

If $server is undef, find any channel named $channel. +If $channel is undef, find the front most window +or tab named $server.If both $channel and +$server are undef, find the currently focused tab or window.

+

Return the context found for one of the above situations or undef if such +a context cannot be found.

+

+

+

Xchat::get_context()

+

Returns the current context.

+

+

+

Xchat::set_context( $context | $channel,[$server] )

+ +

See find_context for more details on $channel and $server.

+

Returns true on success, false on failure

+

+

+

Xchat::get_info( $id )

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IDReturn valueAssociated Command(s)
awayaway reason or undef if you are not awayAWAY, BACK
channelcurrent channel nameSETTAB
charsetcharacter-set used in the current contextCHARSET
event_text <Event Name> text event format string for <Event name>
+ Example: +
+
1
+
+
my $channel_msg_format = Xchat::get_info( "event_text Channel Message" );
+
+
+
hostreal hostname of the current server
idconnection id
inputboxcontents of the inputboxSETTEXT
libdirfsthe system wide directory where xchat will look for plugins. + this string is in the same encoding as the local file system
modesthe current channels modes or undef if not knownMODE
networkcurrent network name or undef, this value is taken from the Network List
nickcurrent nickNICK
nickservnickserv password for this network or undef, this value is taken from the Network List
server current server name
+ (what the server claims to be) undef if not connected +
state_cursorcurrent inputbox cursor position in charactersSETCURSOR
topiccurrent channel topicTOPIC
versionxchat version number
win_statusstatus of the xchat window, possible values are "active", "hidden" + and "normal"GUI
win_ptr native window pointer, GtkWindow * on Unix, HWND on Win32.
+ On Unix if you have the Glib module installed you can use my $window = Glib::Object->new_from_pointer( Xchat::get_info( "win_ptr" ) ); to get a Gtk2::Window object.
+ Additionally when you have detached tabs, each of the windows will return a different win_ptr for the different Gtk2::Window objects.
+ See char_count.pl for a longer example of a script that uses this to show how many characters you currently have in your input box. +
gtkwin_ptrsimilar to win_ptr except it will always be a GtkWindow *
xchatdir xchat config directory encoded in UTF-8
+ examples:
+ /home/user/.xchat2
+ C:\Documents and Settings\user\Application Data\X-Chat 2 +
xchatdirfs same as xchatdir except encoded in the locale file system encoding

This function is used to retrieve certain information about the current +context. If there is an associated command then that command can be used to change the value for a particular ID.

+

+

Xchat::get_prefs( $name )

+ +

This function provides a way to retrieve X-Chat's setting information.

+

Returns undef if there is no setting called called $name.

+

+

+

Xchat::emit_print( $event, LIST )

+ +

This functions is used to generate one of the events listed under +Settings->Advanced->Text Events

+

Note: when using this function you MUST return Xchat::EAT_ALL otherwise you will end up with duplicate events. +One is the original and the second is the one you emit.

+

Returns true on success, false on failure

+

+

+

Xchat::send_modes( $target | \@targets, $sign, $mode, [ $modes_per_line ] )

+ +

Send multiple mode changes for the current channel. It may send multiple MODE lines if the request doesn't fit on one.

+

Example:

+
+
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
+
use strict;
+use warning;
+use Xchat qw(:all);
+
+hook_command( "MODES", sub {
+   my (undef, $who, $sign, $mode) = @{$_[0]};
+   my @targets = split /,/, $who;
+   if( @targets > 1 ) {
+      send_modes( \@targets, $sign, $mode, 1 );
+   } else {
+      send_modes( $who, $sign, $mode );
+   }
+   return EAT_XCHAT;
+});
+
+

+

+

Xchat::nickcmp( $nick1, $nick2 )

+ +

The comparsion is based on the current server. Either a RFC1459 compliant +string compare or plain ascii will be using depending on the server. The +comparison is case insensitive.

+

Returns a number less than, equal to or greater than zero if +$nick1 is +found respectively, to be less than, to match, or be greater than +$nick2.

+

+

+

Xchat::get_list( $name )

+ +

This function will return a list of hash references. The hash references +will have different keys depend on the list. An empty list is returned +if there is no such list.

+

"channels" - list of channels, querys and their server

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Key Description
channel tab name
chantypeschannel types supported by the server, typically "#&"
context can be used with set_context
flags Server Bits:
+ 0 - Connected
+ 1 - Connecting
+ 2 - Away
+ 3 - EndOfMotd(Login complete)
+ 4 - Has WHOX
+ 5 - Has IDMSG (FreeNode)
+
+

The following correspond to the /chanopt command

+ 6 - Hide Join/Part Message (text_hidejoinpart)
+ 7 - unused (was for color paste)
+ 8 - Beep on message (alert_beep)
+ 9 - Blink Tray (alert_tray)
+ 10 - Blink Task Bar (alert_taskbar)
+

Example of checking if the current context has Hide Join/Part messages set:

+
+
1
+
2
+
3
+
+
if( Xchat::context_info->{flags} & (1 << 6) ) {
+  Xchat::print( "Hide Join/Part messages is enabled" );
+}
+
+
id Unique server ID
laglag in milliseconds
maxmodes Maximum modes per line
network network name to which this channel belongs
nickprefixes Nickname prefixes e.g. "+@"
nickmodes Nickname mode chars e.g. "vo"
queuenumber of bytes in the send queue
server server name to which this channel belongs
type the type of this context
+ 1 - server
+ 2 - channel
+ 3 - dialog
+ 4 - notices
+ 5 - server notices
+
users Number of users in this channel

"dcc" - list of DCC file transfers

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Key Value
address32 address of the remote user(ipv4 address)
cps bytes per second(speed)
destfile destination full pathname
file file name
nicknick of the person this DCC connection is connected to
port TCP port number
pos bytes sent/received
poshigh bytes sent/received, high order 32 bits
resume point at which this file was resumed
+ (zero if it was not resumed) +
resumehigh point at which this file was resumed, high order 32 bits
+
size file size in bytes low order 32 bits
sizehigh file size in bytes, high order 32 bits (when the files is > 4GB)
status DCC Status:
+ 0 - queued
+ 1 - active
+ 2 - failed
+ 3 - done
+ 4 - connecting
+ 5 - aborted +
type DCC Type:
+ 0 - send
+ 1 - receive
+ 2 - chatrecv
+ 3 - chatsend +

"ignore" - current ignore list

+ + + + + + +
Key Value
mask ignore mask. e.g: *!*@*.aol.com
flags Bit field of flags.
+ 0 - private
+ 1 - notice
+ 2 - channel
+ 3 - ctcp
+ 4 - invite
+ 5 - unignore
+ 6 - nosave
+ 7 - dcc
+

"notify" - list of people on notify

+ + + + + + + + + + + + + + + + + +
Key Value
networkscomma separated list of networks where you will be notfified about this user's online/offline status or undef if you will be notificed on every network you are connected to
nick nickname
flags 0 = is online
on time when user came online
off time when user went offline
seen time when user was last verified still online

the values indexed by on, off and seen can be passed to localtime +and gmtime, see perldoc -f localtime and perldoc -f gmtime for more +detail

"users" - list of users in the current channel

+ + + + + + + + + + + + + + + + + + + + + +
Key Value
away away status(boolean)
lasttalklast time a user was seen talking, this is the an epoch time(number of seconds since a certain date, that date depends on the OS)
nick nick name
hosthost name in the form: user@host or undef if not known
prefix prefix character, .e.g: @ or +
realnameReal name or undef
selectedselected status in the user list, only works when retrieving the user list of the focused tab. You can use the /USELECT command to select the nicks

"networks" - list of networks and the associated settings from network list

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Key Value
autojoins An object with the following methods:
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
MethodDescription
channels()returns a list of this networks' autojoin channels in list context, a count of the number autojoin channels in scalar context
keys()returns a list of the keys to go with the channels, the order is the same as the channels, if a channel doesn't have a key, '' will be returned in it's place
pairs()a combination of channels() and keys(), returns a list of (channels, keys) pairs. This can be assigned to a hash for a mapping from channel to key.
as_hash()return the pairs as a hash reference
as_string()the original string that was used to construct this autojoin object, this can be used with the JOIN command to join all the channels in the autojoin list
as_array()return an array reference of hash references consisting of the keys "channel" and "key"
as_bool()returns true if the network has autojoins and false otherwise
+
connect_commands An array reference containing the connect commands for a network. An empty array if there aren't any
encoding the encoding for the network
flags + a hash reference corresponding to the checkboxes in the network edit window + + + + + + + + + + + + + + + + + + + + +
allow_invalidtrue if "Accept invalid SSL certificate" is checked
autoconnecttrue if "Auto connect to this network at startup" is checked
cycletrue if "Connect to selected server only" is NOT checked
use_globaltrue if "Use global user information" is checked
use_proxytrue if "Bypass proxy server" is NOT checked
use_ssltrue if "Use SSL for all the servers on this network" is checked
+
irc_nick1Corresponds with the "Nick name" field in the network edit window
irc_nick2Corresponds with the "Second choice" field in the network edit window
irc_real_nameCorresponds with the "Real name" field in the network edit window
irc_user_nameCorresponds with the "User name" field in the network edit window
networkName of the network
nickserv_passwordCorresponds with the "Nickserv password" field in the network edit window
selectedIndex into the list of servers in the "servers" key, this is used if the "cycle" flag is false
server_passwordCorresponds with the "Server password" field in the network edit window
serversAn array reference of hash references with a "host" and "port" key. If a port is not specified then 6667 will be used.

+

+

Xchat::user_info( [$nick] )

+ +

This function is mainly intended to be used as a shortcut for when you need +to retrieve some information about only one user in a channel. Otherwise it +is better to use get_list. +If $nick is found a hash reference containing the same keys as those in the +"users" list of get_list is returned otherwise undef is returned. +Since it relies on get_list this function can only be used in a +channel context.

+

+

+

Xchat::context_info( [$context] )

+ +

This function will return the information normally retrieved with get_info, except this is for the context that is passed in. The information will be returned in the form of a hash. The keys of the hash are the $id you would normally supply to get_info as well as all the keys that are valid for the items in the "channels" list from get_list. Use of this function is more efficient than calling get_list( "channels" ) and searching through the result.

+

Example:

+
+
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
+
use strict;
+use warnings;
+use Xchat qw(:all); # imports all the functions documented on this page
+
+register( "User Count", "0.1",
+   "Print out the number of users on the current channel" );
+hook_command( "UCOUNT", \&display_count );
+sub display_count {
+   prnt "There are " . context_info()->{users} . " users in this channel.";
+   return EAT_XCHAT;
+}
+
+

+

+

Xchat::strip_code( $string )

+ +

This function will remove bold, color, beep, reset, reverse and underline codes from $string. It will also remove ANSI escape codes which might get used by certain terminal based clients. If it is called in void context $string will be modified otherwise a modified copy of $string is returned.

+

+

+

Examples

+

+

+

Asynchronous DNS resolution with hook_fd

+
+
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
+
use strict;
+use warnings;
+use Xchat qw(:all);
+use Net::DNS;
+   
+hook_command( "BGDNS", sub {
+   my $host = $_[0][1];
+   my $resolver = Net::DNS::Resolver->new;
+   my $sock = $resolver->bgsend( $host );
+   
+   hook_fd( $sock, sub {
+      my $ready_sock = $_[0];
+      my $packet = $resolver->bgread( $ready_sock );
+      
+      if( $packet->authority && (my @answers = $packet->answer ) ) {
+         
+         if( @answers ) {
+            prnt "$host:";
+            my $padding = " " x (length( $host ) + 2);
+            for my $answer ( @answers ) {
+               prnt $padding . $answer->rdatastr . ' ' . $answer->type;
+            }
+         }
+      } else {
+         prnt "Unable to resolve $host";
+      }
+      
+      return REMOVE;
+   },
+   {
+      flags => FD_READ,
+   });
+   
+   return EAT_XCHAT;
+});
+
+
+ +

+

+

Contact Information

+

Contact Lian Wan Situ at <atmcmnky [at] yahoo.com> for questions, comments and +corrections about this page or the Perl plugin itself. You can also find me +in #xchat on FreeNode under the nick Khisanth.

+ + +
+ X-Chat 2 Perl Interface +
+ + + + diff --git a/share/doc/plugins.html b/share/doc/plugins.html new file mode 100644 index 00000000..e17f3346 --- /dev/null +++ b/share/doc/plugins.html @@ -0,0 +1,1141 @@ + + + +HexChat 2 Plugin Interface + + + + +

HexChat 2 Plugin Interface

+ + +plugin20.html revision 2.9.1 +
Latest version of this document is available at:
https://github.com/hexchat/hexchat/wiki/Plugins + +

1. Documentation:

+
+1.0 Introduction +
1.1 Sample plugin +
1.2 What is word and word_eol? +
1.3 Lists and fields +
1.4 Plugins on Windows (Win32) +
1.5 Controlling the GUI +
  1.5.1 Basic Control +
  1.5.2 Custom Menu Items +
  1.5.3 System Tray +
1.6 Handling UTF-8/Unicode strings +
+ +

2. Function reference:

+
+xchat_hook_command +
xchat_hook_fd +
xchat_hook_print +
xchat_hook_server +
xchat_hook_timer +
xchat_unhook +
+
xchat_command +
xchat_commandf +
xchat_print +
xchat_printf +
xchat_emit_print +
xchat_send_modes +
+
xchat_find_context +
xchat_get_context +
xchat_get_info +
xchat_get_prefs +
xchat_set_context +
+
xchat_nickcmp +
xchat_strip +
xchat_free +
+
xchat_pluginpref_set_str +
xchat_pluginpref_get_str +
xchat_pluginpref_set_int +
xchat_pluginpref_get_int +
xchat_pluginpref_delete +
xchat_pluginpref_list +
+
xchat_list_get +
xchat_list_free +
xchat_list_fields (not documented yet) +
xchat_list_next +
xchat_list_str +
xchat_list_int +
xchat_list_time +
+
xchat_plugingui_add (not documented yet) +
xchat_plugingui_remove (not documented yet) +

+ +

Introduction

+Plugins for HexChat are written in C. The interface aims to keep 100% +binary compatability. This means that if you upgrade HexChat, you will +not need to recompile your plugins, they'll continue to work. The +interface doesn't depend on any structures and offsets, so compiler +versions shouldn't have an impact either. The only real requirement of +an HexChat plugin, is that it define a "xchat_plugin_init" symbol. This +is your entry point function, see the example below. You should make +all your global variables and functions static, so that a symbol +is not exported. There is no harm in exporting these symbols, but they +are not necessary and only pollute the name-space. Plugins are compiled as shared objects +(.so files), for example: +

+Most UNIX systems:
+	gcc -Wl,--export-dynamic -Wall -O1 -shared -fPIC myplugin.c -o myplugin.so
+
+MacOSX:
+	gcc -no-cpp-precomp -g -O2 -Wall -bundle -flat_namespace -undefined suppress -o myplugin.so myplugin.c
+
+ +See the Windows section on how to compile a plugin +using visual studio. +

+All strings passed to and from plugins are encoded in UTF-8, regardless +of locale. What does this mean? +


+ +

Sample plugin

+This simple plugin autoOps anyone who joins a channel you're in. It also +adds a new command /AUTOOPTOGGLE, which can be used to turn the feature ON +or OFF. Every HexChat plugin must define an xchat_plugin_init function, this +is the normal entry point. xchat_plugin_deinit is optional. +
+
+
+
+#include "xchat-plugin.h"
+
+#define PNAME "AutoOp"
+#define PDESC "Auto Ops anyone that joins"
+#define PVERSION "0.1"
+
+static hexchat_plugin *ph;   /* plugin handle */
+static int enable = 1;
+
+static int join_cb(char *word[], void *userdata)
+{
+   if (enable)
+      /* Op ANYONE who joins */
+      xchat_commandf(ph, "OP %s", word[1]);
+   /* word[1] is the nickname, as in the Settings->Advanced->TextEvents window in xchat */
+
+   return XCHAT_EAT_NONE;  /* don't eat this event, HexChat needs to see it! */
+}
+
+static int autooptoggle_cb(char *word[], char *word_eol[], void *userdata)
+{
+   if (!enable)
+   {
+      enable = 1;
+      xchat_print(ph, "AutoOping now enabled!\n");
+   } else
+   {
+      enable = 0;
+      xchat_print(ph, "AutoOping now disabled!\n");
+   }
+
+   return XCHAT_EAT_ALL;   /* eat this command so HexChat and other plugins can't process it */
+}
+
+void xchat_plugin_get_info(char **name, char **desc, char **version, void **reserved)
+{
+   *name = PNAME;
+   *desc = PDESC;
+   *version = PVERSION;
+}
+
+int xchat_plugin_init(xchat_plugin *plugin_handle,
+                      char **plugin_name,
+                      char **plugin_desc,
+                      char **plugin_version,
+                      char *arg)
+{
+   /* we need to save this for use with any xchat_* functions */
+   ph = plugin_handle;
+
+   /* tell HexChat our info */
+   *plugin_name = PNAME;
+   *plugin_desc = PDESC;
+   *plugin_version = PVERSION;
+
+   xchat_hook_command(ph, "AutoOpToggle", XCHAT_PRI_NORM, autooptoggle_cb, "Usage: AUTOOPTOGGLE, Turns OFF/ON Auto Oping", 0);
+   xchat_hook_print(ph, "Join", XCHAT_PRI_NORM, join_cb, 0);
+
+   xchat_print(ph, "AutoOpPlugin loaded successfully!\n");
+
+   return 1;       /* return 1 for success */
+}
+
+
+
+ +

What's word and word_eol?

+ +They are arrays of strings. They contain the parameters the user entered +for the particular command. For example, if you executed: + +
+/command NICK hi there
+
+word[1] is command
+word[2] is NICK
+word[3] is hi
+word[4] is there
+
+word_eol[1] is command NICK hi there
+word_eol[2] is NICK hi there
+word_eol[3] is hi there
+word_eol[4] is there
+
+These arrays are simply provided for your convenience. You are NOT allowed +to alter them. Both arrays are limited to 32 elements (index 31). word[0] and +word_eol[0] are reserved and should not be read. +


+

Lists and Fields

+Lists of information (DCCs, Channels, Userlist etc) can be retreived +with xchat_list_get. All fields are READ ONLY and must be copied if +needed for a long time after calling xchat_list_str. The types of lists and fields available are: +
+ +"channels" - list of channels, querys and their servers. +
+ + + + + + + + + + + + + + + +
NameDescriptionType
channelChannel or query namestring
chantypesChannel types e.g. "#!&"
(Added in version 2.0.9. Older versions will return NULL)
string
context(xchat_context *) pointer. Can be used with xchat_set_contextstring
flagsServer/Channel Bits:
+ + + + + + + + + + + + + +
Bit #ValueDescription
01Connected
12Connecting in Progress
24You are away
38End of MOTD (Login complete)
416Has WHOX (ircu)
532Has IDMSG (FreeNode)
664Hide Join/Part Messages
7128unused (was Color Paste in old versions)
8256Beep on Message
9512Blink Tray
101024Blink Task Bar
+
(Bits 0-5 added in 2.0.9. Bits 6-8 added in 2.6.6. Bit 9 added in 2.8.0. Bit 10 in 2.8.6)
int
idUnique server ID
(Added in version 2.0.8. Older versions will return -1)
int
lagLag in milliseconds
(Added in version 2.6.8. Older versions will return -1)
int
maxmodesMaximum modes per line
(Added in version 2.0.9. Older versions will return -1)
int
networkNetwork name to which this channel belongs
(Added in version 2.0.2. Older versions will return NULL)
string
nickprefixesNickname prefixes e.g. "@+"
(Added in version 2.0.9. Older versions will return NULL)
string
nickmodesNickname mode chars e.g. "ov"
(Added in version 2.0.9. Older versions will return NULL)
string
queueNumber of bytes in the send-queue
(Added in version 2.6.8. Older versions will return -1)
int
serverServer name to which this channel belongsstring
typeType of context this is: 1-Server 2-Channel 3-Dialog
(Added in version 2.0.2. Older versions will return -1)
int
usersNumber of users in this channel
(Added in version 2.0.8. Older versions will return -1)
int
+
+ +"dcc" - list of DCC file transfers. Fields: +
+ + + + + + + + + + + + + + + +
NameDescriptionType
address32Address of the remote user (ipv4 address)int
cpsBytes per second (speed)int
destfileDestination full pathnamestring
fileFile namestring
nickNickname of person who the file is from/tostring
portTCP port numberint
posBytes sent/receivedint
poshighBytes sent/received, high order 32 bitsint
resumePoint at which this file was resumed (or zero if it was not resumed)int
resumehighPoint at which this file was resumed, high order 32 bitsint
sizeFile size in bytes, low order 32 bits (cast it to unsigned)int
sizehighFile size in bytes, high order 32 bitsint
statusDCC Status: 0-Queued 1-Active 2-Failed 3-Done 4-Connecting 5-Abortedint
typeDCC Type: 0-Send 1-Receive 2-ChatRecv 3-ChatSendint
+
+ +"ignore" - current ignore list. +
+ + + +
NameDescriptionType
maskIgnore mask. .e.g: *!*@*.aol.comstring
flagsBit field of flags. 0=Private 1=Notice 2=Channel 3=Ctcp
+4=Invite 5=UnIgnore 6=NoSave 7=DCC
int
+
+ +"notify" - list of people on notify. +
+ + + + + + + +
NameDescriptionType
networksNetworks to which this nick applies. Comma separated. May be NULL. +
(Added in version 2.6.8)
string
nickNicknamestring
flagsBit field of flags. 0=Is online.int
onTime when user came online.time_t
offTime when user went offline.time_t
seenTime when user the user was last verified still online.time_t
+The entire "notify" list was added in xchat 2.0.8. Fields are +only valid for the context when xchat_list_get() was called +(i.e. you get information about the user ON THAT ONE SERVER ONLY). You +may cycle through the "channels" list to find notify information for every +server. +
+ +"users" - list of users in the current channel. +
+ + + + + + + + +
NameDescriptionType
awayAway status (boolean)
(Added in version 2.0.6. Older versions will return -1)
int
lasttalkLast time the user was seen talking
(Added in version 2.4.2. Older versions will return -1)
time_t
nickNick namestring
hostHost name in the form: user@host (or NULL if not known).string
prefixPrefix character, .e.g: @ or +. Points to a single char.string
realnameReal name or NULL
(Added in version 2.8.6)
string
selectedSelected status in the user list, only works for retrieving the user list of the focused tab
(Added in version 2.6.1. Older versions will return -1)
int
+
+ +
+ +Example: +
+
+   list = xchat_list_get(ph, "dcc");
+   if(list)
+   {
+      xchat_print(ph, "--- DCC LIST ------------------\n"
+                      "File  To/From   KB/s   Position\n");
+
+      while(xchat_list_next(ph, list))
+      {
+         xchat_printf(ph, "%6s %10s %.2f  %d\n",
+             xchat_list_str(ph, list, "file"),
+             xchat_list_str(ph, list, "nick"),
+             xchat_list_int(ph, list, "cps") / 1024,
+             xchat_list_int(ph, list, "pos"));
+      }
+
+      xchat_list_free(ph, list);
+   }
+
+ +
+ +

Plugins on Windows (Win32)

+Yes, it can be done. All you need is either +MSVC (Visual Studio) or +MINGW, both these compilers are free to download. +Simply compile your plugin as a DLL. You should have the following files: + + +
+EXPORTS
+  xchat_plugin_init
+  xchat_plugin_deinit
+  xchat_plugin_get_info
+
+ +
Leave out xchat_plugin_deinit if you don't intend to define that +function. Then, to compile, type this at your command prompt:

+
+MSVC +
 cl -O1 -MD -G5 -DWIN32 -c plugin.c
+
 link /DLL /out:plugin.dll /SUBSYSTEM:WINDOWS plugin.obj /def:plugin.def /base:0x00d40000 +

+GCC (MINGW) +
 gcc -Wall -Os -DWIN32 -c plugin.c
+
 dllwrap --def plugin.def --dllname plugin.dll plugin.o

+
+
For a complete example, have a look at the source code of the DNS Plugin, which also contains a Makefile. +

+Caveat: Plugins compiled on Win32 MUST have a +global variable called ph, which is the plugin_handle, much like +in the sample plugin above. +

+ +

Controlling the GUI

+

+A simple way to perform basic GUI functions is to use the /GUI command. +You can execute this command through the input-box, or by calling +xchat_command(ph, "GUI .....");. +

+
+ + + + + + + + + + + +
GUI ATTACHSame function as "Attach Window" in the HexChat menu (new for 2.6.2).
GUI DETACHSame function as "Detach Tab" in the HexChat menu (new for 2.6.2).
GUI APPLYSimilar to clicking OK in the settings window. Execute this after /SET to activate GUI changes (new for 2.8.0)
GUI COLOR nChange the tab color of the current context, where n is a number from 0 to 3.
GUI FOCUSFocus the current window or tab.
GUI FLASHFlash the taskbar button. It will flash only if the window isn't focused and will stop when it is focused by the user.
GUI HIDEHide the main HexChat window completely (this is used by the Systray plugin).
GUI ICONIFYIconify (minimize to taskbar) the current HexChat window.
GUI MSGBOX textDisplays a asynchronous message box with your text (new for 2.4.5).
GUI SHOWShow the main HexChat window (if currently hidden).
+
+

+Note, the FLASH, ICONIFY and COLOR args were added in xchat 2.0.8, they +will not work with previous versions. +

+Starting from 2.4.5 you can add your own items to the menu bar. The menu command has this syntax: +
+	MENU [-eX] [-i<ICONFILE>] [-k<mod>,<key>] [-m] [-pX] [-rX,group] [-tX] {ADD|DEL} <path> [command] [unselect command]
+For example: +
+	MENU -p5 ADD FServe
+	MENU ADD "FServe/Show File List" "fs list"
+	MENU ADD FServe/-
+	MENU -k4,101 -t1 ADD "FServe/Enabled" "fs on" "fs off"
+	MENU -e0 ADD "FServe/Do Something" "fs action"
+
+In the example above, it would be recommended to execute "MENU DEL FServe" inside your xchat_plugin_deinit function. The special item with name "-" will add a separator line. +

+Parameters and flags: +
+ + + + + + + + +
-eXSet enable flag to X. -e0 for disable, -e1 for enable. This lets you create a disabled (shaded) item.
-iFILEUse an icon filename FILE (new for 2.8.0). Not supported for toggles or radio items.
-k<mod>,<key>Specify a keyboard shortcut. "mod" is the modifier which is a bitwise OR of: 1-SHIFT 4-CTRL 8-ALT in decimal. "key" is the key value in decimal, e.g. -k5,101 would specify SHIFT-CTRL-E.
-mSpecify that this label should be treated as Pango Markup language. Since forward slash ("/") is already used in menu paths, you should replace closing tags with an ASCII 003 instead e.g.: xchat_command(ph, "MENU -m ADD \"<b>Bold Menu<\003b>\""); (new for 2.6.6).
-pXSpecify a menu item's position number. e.g. -p5 will cause the item to be inserted in the 5th place. New for 2.8.0: If the position is a negative number, it will be used as an offset from the bottom/right-most item.
-rX,groupSpecify a radio menu item, with initial state X and a group name (new for 2.8.0). The group name should be the exact label of another menu item (without the path) that this item will be grouped with. For radio items, only a select command will be executed (no unselect command).
-tXSpecify a toggle menu item with an initial state. -t0 for an "unticked" item and -t1 for a "ticked" item.
+
+ +If you want to change an item's toggle state or enabled flag, +just ADD an item with exactly the same name and command and specify the -tX -eX parameters you need. +

It's also possible to add items to HexChat's existing menus, for example:
+
	MENU ADD "Settings/Sub Menu"
+	MENU -t0 ADD "Settings/Sub Menu/My Setting" myseton mysetoff
+
+However, internal names and layouts of HexChat's menu may change in the future, so use at own risk. +

+Here is an example of Radio items: +
	MENU ADD "Language"
+	MENU -r1,"English" ADD "Language/English" cmd1
+	MENU -r0,"English" ADD "Language/Spanish" cmd2
+	MENU -r0,"English" ADD "Language/German" cmd3
+
+From 2.8.0, you can also change menus other than the main one (i.e popup menus). Currently they are: +
+ + + + + + + + +
Root NameMenu
$TABTab menu (right click a channel/query tab or treeview row)
$TRAYSystem Tray menu
$URLURL link menu
$NICKUserlist nick-name popup menu
$CHANMenu when clicking a channel in the text area (since 2.8.4)
+
+
+	Example: MENU -p0 ADD "$TAB/Cycle Channel" cycle
+
+ +
+Starting from 2.8.0 you can manipulate HexChat's system tray icon using the /TRAY command: +
+ Usage: 
+ TRAY -f <timeout> <file1> [<file2>] Flash tray between two icons. Leave off file2 to use default HexChat icon.
+ TRAY -f <filename>                  Set tray to a fixed icon.
+ TRAY -i <number>                    Flash tray with an internal icon.
+                                     2=Message 5=Highlight 8=Private 11=File
+ TRAY -t <text>                      Set the tray tooltip.
+ TRAY -b <title> <text>              Set the tray balloon.
+                                     Supported on Windows from 2.8.1 and 2.8.2 on Linux (libnotify required on Linux).
+
+Filenames can be ICO or PNG format. PNG format is supported on Linux/BSD and Windows XP (but requires installation of GDI+ on Windows 2000). Set a timeout of -1 to use HexChat's default. +

+ +

Handling UTF-8/Unicode strings

+

+The HexChat plugin API specifies that strings passed to and from HexChat must be encoded in UTF-8. +

+What does this mean for the plugin programmer? You just have to be a little careful when +passing strings obtained from IRC to system calls. For example, if you're writing a file-server +bot, someone might message you a filename. Can you pass this filename directly to open()? Maybe! +If you're lazy... The correct thing to do is to convert the string to "system locale encoding", +otherwise your plugin will fail on non-ascii characters. +

+Here are examples on how to do this conversion on Unix and Windows. In this example, someone will +CTCP you the message "SHOWFILE <filename>". +

+

+
+static int ctcp_cb(char *word[], char *word_eol[], void *userdata)
+{
+	if(strcmp(word[1], "SHOWFILE") == 0)
+	{
+		get_file_name(nick, word[2]);
+	}
+
+	return XCHAT_EAT_XCHAT;
+}
+
+static void get_file_name(char *nick, char *fname)
+{
+	char buf[256];
+	FILE *fp;
+
+	/* the fname is in UTF-8, because it came from the HexChat API */
+
#ifdef _WIN32
+	wchar_t wide_name[MAX_PATH];
+
+	/* convert UTF-8 to WIDECHARs (aka UTF-16LE) */
+	if (MultiByteToWideChar(CP_UTF8, 0, fname, -1, wide_name, MAX_PATH) < 1)
+		return;
+
+	/* now we have WIDECHARs, so we can _wopen() or CreateFileW(). */
+	/* _wfopen actually requires NT4, Win2000, XP or newer. */
+	fp = _wfopen(wide_name, "r");
+
#else
+	char *loc_name;
+
+	/* convert UTF-8 to System Encoding */
+	loc_name = g_filename_from_utf8(fname, -1, 0, 0, 0);
+	if(!loc_name)
+		return;
+
+	/* now open using the system's encoding */
+	fp = fopen(loc_name, "r");
+	g_free(loc_name);
+
#endif
+	if (fp)
+	{
+		while (fgets (buf, sizeof(buf), fp))
+		{
+			/* send every line to the user that requested it */
+			xchat_commandf (ph, "QUOTE NOTICE %s :%s", nick, buf);
+		}
+		fclose (fp);
+	}
+}
+
+ + + +

+ +

Functions

+ +

 xchat_hook_command() 

+Prototype: xchat_hook *xchat_hook_command(xchat_plugin *ph, const char *name, int pri, xchat_cmd_cb *callb, const char *help_text, void *userdata); +
+
Description: Adds a new /command. This allows your program to +handle commands entered at the input box. To capture text without a "/" at +the start (non-commands), you may hook a special name of "". i.e xchat_hook_command(ph, "", ...);. +
+Starting from version 2.6.8, commands hooked that begin with a period ('.') will be hidden in /HELP and /HELP -l. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
name: Name of the command (without the forward slash). +
pri: Priority of this command. Use XCHAT_PRI_NORM. +
callb: Callback function. This will be called when the user executes the given command name. +
help_text: String of text to display when the user executes /help for this command. May be NULL if you're lazy. +
userdata: Pointer passed to the callback function.
+Returns: Pointer to the hook. Can be passed to xchat_unhook. +
+
Example: +
+
+static int onotice_cb(char *word[], char *word_eol[], void *userdata)
+{
+	if(word_eol[2][0] == 0)
+	{
+		xchat_printf(ph, "Second arg must be the message!\n");
+		return XCHAT_EAT_ALL;
+	}
+
+	xchat_commandf(ph, "NOTICE @%s :%s", xchat_get_info(ph, "channel"), word_eol[2]);
+	return XCHAT_EAT_ALL;
+}
+
+xchat_hook_command(ph, "ONOTICE", XCHAT_PRI_NORM, onotice_cb,
+                   "Usage: ONOTICE <message> Sends a notice to all ops", NULL);
+
+
+
+ +

 xchat_hook_fd() 

+Prototype: xchat_hook *xchat_hook_fd(xchat_plugin *ph, int fd, int flags, xchat_fd_cb *callb, void *userdata); +
+
Description: Hooks a socket or file descriptor. WIN32: Passing a pipe from MSVCR71, MSVCR80 or other variations is not supported at this time. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
fd: The file descriptor or socket. +
flags: One or more of XCHAT_FD_READ, XCHAT_FD_WRITE, XCHAT_FD_EXCEPTION, XCHAT_FD_NOTSOCKET. Use bitwise OR to combine them. +XCHAT_FD_NOTSOCKET tells HexChat that the provided fd is not a socket, but a "MSVCRT.DLL" pipe. +
callb: Callback function. This will be called when the socket is available for reading/writing or exception (depending on your chosen flags) +
userdata: Pointer passed to the callback function.
+Returns: Pointer to the hook. Can be passed to xchat_unhook. +


+ +

 xchat_hook_print() 

+Prototype: xchat_hook *xchat_hook_print(xchat_plugin *ph, const char *name, int pri, xchat_print_cb *callb, void *userdata); +
+
Description: Registers a function to trap any print events. +The event names may be any available in the "Advanced > Text Events" window. +There are also some extra "special" events you may hook using this function. +Currently they are:
+"Open Context" - Called when a new xchat_context is created. +
"Close Context" - Called when a xchat_context pointer is closed. +
"Focus Tab" - Called when a tab is brought to front. +
"Focus Window" - Called a toplevel window is focused, or the main +tab-window is focused by the window manager. +
"DCC Chat Text" - Called when some text from a DCC Chat arrives. It provides these elements in the word[] array:
word[1] Address +
word[2] Port +
word[3] Nick +
word[4] The Message +
+"Key Press" - Called when some keys are pressed in the input-box (since 2.4.2). It provides these elements in the word[] array:
word[1] Key Value +
word[2] State Bitfield (shift, capslock, alt) +
word[3] String version of the key +
word[4] Length of the string (may be 0 for unprintable keys) +
+
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
name: Name of the print event (as in Edit Event Texts Window). +
pri: Priority of this command. Use XCHAT_PRI_NORM. +
callb: Callback function. This will be called when this event name is printed. +
userdata: Pointer passed to the callback function.
+Returns: Pointer to the hook. Can be passed to xchat_unhook. +
+
Example: +
+
+static int youpart_cb(char *word[], void *userdata)
+{
+	xchat_printf(ph, "You have left channel %s\n", word[3]);
+	return XCHAT_EAT_XCHAT;	/* dont let HexChat do its normal printing */
+}
+
+xchat_hook_print(ph, "You Part", XCHAT_PRI_NORM, youpart_cb, NULL);
+
+
+
+ +

 xchat_hook_server() 

+Prototype: xchat_hook *xchat_hook_server(xchat_plugin *ph, const char *name, int pri, xchat_serv_cb *callb, void *userdata); +
+
Description: Registers a function to be called when a certain server event occurs. You can +use this to trap PRIVMSG, NOTICE, PART, a server numeric etc... If you want to +hook every line that comes from the IRC server, you may use the special name of "RAW LINE". +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
name: Name of the server event. +
pri: Priority of this command. Use XCHAT_PRI_NORM. +
callb: Callback function. This will be called when this event is received from the server. +
userdata: Pointer passed to the callback function.
+Returns: Pointer to the hook. Can be passed to xchat_unhook. +
+
Example: +
+
+static int kick_cb(char *word[], char *word_eol[], void *userdata)
+{
+	xchat_printf(ph, "%s was kicked from %s (reason=%s)\n", word[4], word[3], word_eol[5]);
+	return XCHAT_EAT_NONE;	/* don't eat this event, let other plugins and HexChat see it too */
+}
+
+xchat_hook_server(ph, "KICK", XCHAT_PRI_NORM, kick_cb, NULL);
+
+
+
+ +

 xchat_hook_timer() 

+Prototype: xchat_hook *xchat_hook_timer(xchat_plugin *ph, int timeout, xchat_timer_cb *callb, void *userdata); +
+
Description: Registers a function to be called every "timeout" milliseconds. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
timeout: Timeout in milliseconds (1000 is 1 second). +
callb: Callback function. This will be called every "timeout" milliseconds. +
userdata: Pointer passed to the callback function.
+Returns: Pointer to the hook. Can be passed to xchat_unhook. +
+
Example: +
+
+static xchat_hook *myhook;
+
+static int stop_cb(char *word[], char *word_eol[], void *userdata)
+{
+	if(myhook != NULL)
+	{
+		xchat_unhook(ph, myhook);
+		myhook = NULL;
+		xchat_print(ph, "Timeout removed!\n");
+	}
+
+	return XCHAT_EAT_ALL;
+}
+
+static int timeout_cb(void *userdata)
+{
+	xchat_print(ph, "Annoying message every 5 seconds! Type /STOP to stop it.\n");
+	return 1;	/* return 1 to keep the timeout going */
+}
+
+myhook = xchat_hook_timer(ph, 5000, timeout_cb, NULL);
+xchat_hook_command(ph, "STOP", XCHAT_PRI_NORM, stop_cb, NULL, NULL);
+

+
+ +

 xchat_unhook() 

+Prototype: void *xchat_unhook(xchat_plugin *ph, xchat_hook *hook); +
+
Description: Unhooks any hook registered with xchat_hook_print/server/timer/command. When plugins are unloaded, all of its hooks are automatically +removed, so you don't need to call this within your xchat_plugin_deinit() function. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
hook: Pointer to the hook, as returned by xchat_hook_*. +
+Returns: The userdata you originally gave to xchat_hook_*. +

+ +

 xchat_command() 

+Prototype: void xchat_command(xchat_plugin *ph, const char *command); +
+
Description: Executes a command as if it were typed in HexChat's input box. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
command: Command to execute, without the forward slash "/". +

+
+ +

 xchat_commandf() 

+Prototype: void xchat_commandf(xchat_plugin *ph, const char *format, ...); +
+
Description: Executes a command as if it were typed in HexChat's input box and provides string formating like printf. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
format: The format string. +

+
+ +

 xchat_print() 

+Prototype: void xchat_print(xchat_plugin *ph, const char *text); +
+
Description: Prints some text to the current tab/window. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
text: Text to print. May contain mIRC color codes. +

+
+ +

 xchat_printf() 

+Prototype: void xchat_printf(xchat_plugin *ph, const char *format, ...); +
+
Description: Prints some text to the current tab/window and provides formating like printf. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
format: The format string. +

+
+ +

 xchat_emit_print() 

+Prototype: int xchat_emit_print(xchat_plugin *ph, const char *event_name, ...); +
+
Description: Generates a print event. This can be any +event found in the Preferences > Advanced > Text Events window. The vararg parameter list +MUST always be NULL terminated. Special care should be taken when calling this function +inside a print callback (from xchat_hook_print), as not to cause endless recursion. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
event_name: Text event to print. +

+
+Returns: 1-Success 0-Failure. +

+Example: +
+xchat_emit_print(ph, "Channel Message", "John", "Hi there", "@", NULL);
+
+

+ +

 xchat_send_modes() (new for 2.0.9)

+Prototype: void xchat_send_modes (xchat_plugin *ph, const char *targets[], int ntargets, int modes_per_line, char sign, char mode) +
+
Description: Sends a number of channel mode changes to the current channel. For example, you can Op a whole +group of people in one go. It may send multiple MODE lines if the request doesn't fit on one. Pass 0 for +modes_per_line to use the current server's maximum possible. This function should only be called while +in a channel context. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
targets: Array of targets (strings). The names of people whom the action will be performed on. +
ntargets: Number of elements in the array given. +
modes_per_line: Maximum modes to send per line. +
sign: Mode sign, '-' or '+'. +
mode: Mode char, e.g. 'o' for Ops.
+
+Example: (Ops the three names given) +
+const char *names_to_Op[] = {"John", "Jack", "Jill"};
+xchat_send_modes(ph, names_to_Op, 3, 0, '+', 'o');
+
+

+ +

 xchat_find_context() 

+Prototype: xchat_context *xchat_find_context(xchat_plugin *ph, const char *servname, const char *channel); +
+
Description: Finds a context based on a channel and servername. If servname is NULL, it finds any channel (or query) by the given name. If channel is NULL, it finds the front-most tab/window of the given servname. If NULL is given for both arguments, the currently focused tab/window will be returned.
+Changed in 2.6.1. If servname is NULL, it finds the channel (or query) by the given name in the same server group as the current context. If that doesn't exists then find any by the given name. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
servname: Servername or NULL. +
channel: Channelname or NULL. +
+
+Returns: Context pointer (for use with xchat_set_context) or NULL. +


+ +

 xchat_get_context() 

+Prototype: xchat_context *xchat_get_context(xchat_plugin *ph); +
+
Description: Returns the current context for your plugin. You can use this later with xchat_set_context. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
+
+Returns: Context pointer (for use with xchat_set_context). +


+ +

 xchat_get_info() 

+Prototype: const char *xchat_get_info(xchat_plugin *ph, const char *id); +
+
Description: Returns information based on your current context. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
id: ID of the information you want. Currently supported IDs are (case sensitive): +
+ + + + + + + + + + + + + + + + + + + + +
awayaway reason or NULL if you are not away.
channelcurrent channel name.
charsetcharacter-set used in the current context (since 2.4.2).
event_text <name>text event format string for name (since 2.8.2).
gtkwin_ptr(GtkWindow *) (since 2.8.9).
hostreal hostname of the server you connected to.
inputboxthe input-box contents, what the user has typed (since 2.4.1).
libdirfslibrary directory. e.g. /usr/lib/xchat. The same directory used for auto-loading plugins (since 2.4.0).This string isn't necessarily UTF-8, but local file system encoding.
modeschannel modes, if known, or NULL (since 2.8.1).
networkcurrent network name or NULL.
nickyour current nick name.
nickservnickserv password for this network or NULL (since 2.4.3).
servercurrent server name (what the server claims to be). NULL if you are not connected.
topiccurrent channel topic.
versionxchat version number.
win_ptrnative window pointer. Unix: (GtkWindow *) Win32: HWND (since 2.6.0).
win_statuswindow status: "active", "hidden" or "normal" (since 2.0.9).
xchatdirxchat config directory, e.g.: /home/user/.xchat2 This string is encoded in UTF-8, which means you _should_ convert it to "locale" encoding before using functions like open() or OpenFile(). For best Unicode support on Linux, convert this string using g_filename_from_utf8 and on Windows convert this string to UTF-16LE (wide) and use OpenFileW() etc.
xchatdirfsxchat config directory, e.g.: /home/user/.xchat2 (since 2.0.9).This string is encoded in local file system encoding, making it ideal for direct use with functions like open() or OpenFile(). For real Unicode support on Windows, it's best not to use HexChatdirfs, but HexChatdir instead.
+
+
+Returns: A string of the requested information, or NULL. This string must +not be freed and must be copied if needed after the call to xchat_get_info. +


+ +

 xchat_get_prefs() 

+Prototype: int xchat_get_prefs(xchat_plugin *ph, const char *name, const char **string, int *integer); +
+
Description: Provides xchat's setting information (that which is available through the /set command). +A few extra bits of information are available that don't appear in the /set list, currently they are: +
+
+ + + +
state_cursorCurrent input-box cursor position (characters, not bytes). Since 2.4.2.
idUnique server id. Since 2.6.1.
+
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
name: Setting name required. +
string: Pointer-pointer which to set. +
integer: Pointer to an integer to set, if setting is a Boolean or Integer type. +
+Returns: 0-Failed 1-Returned a string 2-Returned an Integer 3-Returned a Boolean. +

Example: +
+
+{
+	int i;
+	const char *str;
+
+	if (xchat_get_prefs (ph, "irc_nick1", &str, &i) == 1)
+	{
+		xchat_printf (ph, "Current nickname setting: %s\n", str);
+	}
+}
+
+

+ + +

 xchat_set_context() 

+Prototype: int xchat_set_context(xchat_plugin *ph, xchat_context *ctx); +
+
Description: Changes your current context to the one given. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
ctx: Context to change to (obtained with xchat_get_context or xchat_find_context). +
+
+Returns: 1 for success, 0 for failure. +


+ +

 xchat_nickcmp() 

+Prototype: int xchat_nickcmp(xchat_plugin *ph, const char *s1, const char *s2); +
+
Description: Performs a nick name comparision, based on the current server connection. This might be a RFC1459 compliant string compare, or +plain ascii (in the case of DALNet). Use this to compare channels and nicknames. The function works the same way as strcasecmp. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
s1: String to compare. +
s2: String to compare s1 to. +
+
+Quote from RFC1459: +
+ Because of IRC's scandanavian origin, the characters {}| are + considered to be the lower case equivalents of the characters []\, + respectively. This is a critical issue when determining the + equivalence of two nicknames. +
+Returns: + An integer + less than, equal to, or greater than zero if s1 is found, + respectively, to be less than, to match, or be greater than s2. +


+ +

 xchat_strip() (new for 2.4.2)

+Prototype: char *xchat_strip(xchat_plugin *ph, const char *str, int len, int flags); +
+
Description: Strips mIRC color codes and/or text attributes (bold, underlined etc) from the given string and returns a newly allocated string. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
str: String to strip. +
len: Length of the string (or -1 for NULL terminated). +
flags: Bit-field of flags: 0-Strip mIRC colors, 1-Strip text attributes. +
+
+Returns: +A newly allocated string or NULL for failure. You must free this string with xchat_free. +

Example: +
+
+{
+	char *new_text;
+
+	/* strip both colors and attributes by using the 0 and 1 bits (1 BITWISE-OR 2) */
+	new_text = xchat_strip(ph, "\00312Blue\003 \002Bold!\002", -1, 1 | 2);
+
+	if(new_text)
+	{
+		/* new_text should now contain only "Blue Bold!" */
+		xchat_printf(ph, "%s\n", new_text);
+		xchat_free(ph, new_text);
+	}
+}
+
+ +

+ +

 xchat_free() (new for 2.4.2)

+Prototype: void xchat_free(xchat_plugin *ph, void *ptr); +
+
Description: Frees a string returned by xchat_* functions. Currently only used to free strings from xchat_strip. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
ptr: Pointer to free. +
+
+ +

+ +

 xchat_pluginpref_set_str() (new for 2.9.0)

+Prototype: int xchat_pluginpref_set_str (xchat_plugin *ph, const char *var, const char *value); +
+
Description: Saves a plugin-specific setting with string value to a plugin-specific config file. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
var: Name of the setting to save. +
value: String value of the the setting. +
+
+Returns: 1 for success, 0 for failure. +

Example: +
+
int xchat_plugin_init (xchat_plugin *plugin_handle,
+			char **plugin_name,
+			char **plugin_desc,
+			char **plugin_version,
+			char *arg)
+{
+	ph = plugin_handle;
+	*plugin_name = "Tester Thingie";
+	*plugin_desc = "Testing stuff";
+	*plugin_version = "1.0";
+
+	xchat_pluginpref_set_str (ph, "myvar1", "I want to save this string!");
+	xchat_pluginpref_set_str (ph, "myvar2", "This is important, too.");
+
+	return 1;       /* return 1 for success */
+}
+
+In the example above, the settings will be saved to the plugin_tester_thingie.conf file, and its content will be: +
+
myvar1 = I want to save this string!
+myvar2 = This is important, too.
+
+You should never need to edit this file manually. +


+ +

 xchat_pluginpref_get_str() (new for 2.9.0)

+Prototype: int xchat_pluginpref_get_str (xchat_plugin *ph, const char *var, char *dest); +
+
Description: Loads a plugin-specific setting with string value from a plugin-specific config file. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
var: Name of the setting to load. +
dest: Array to save the loaded setting's string value to. +
+
+Returns: 1 for success, 0 for failure. +


+ +

 xchat_pluginpref_set_int() (new for 2.9.0)

+Prototype: int xchat_pluginpref_set_int (xchat_plugin *ph, const char *var, int value); +
+
Description: Saves a plugin-specific setting with decimal value to a plugin-specific config file. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
var: Name of the setting to save. +
value: Decimal value of the the setting. +
+
+Returns: 1 for success, 0 for failure. +

Example: +
+
static int saveint_cb (char *word[], char *word_eol[], void *user_data)
+{
+	int buffer = atoi (word[2]);
+
+	if (buffer > 0 && buffer < INT_MAX)
+	{
+		if (xchat_pluginpref_set_int (ph, "myint1", buffer))
+		{
+			xchat_printf (ph, "Setting successfully saved!\n");
+		}
+		else
+		{
+			xchat_printf (ph, "Error while saving!\n");
+		}
+	}
+	else
+	{
+		xchat_printf (ph, "Invalid input!\n");
+	}
+
+	return XCHAT_EAT_XCHAT;
+}
+
+You only need these kind of complex checks if you're saving user input, which can be non-numeric. +


+ +

 xchat_pluginpref_get_int() (new for 2.9.0)

+Prototype: int xchat_pluginpref_get_int (xchat_plugin *ph, const char *var); +
+
Description: Loads a plugin-specific setting with decimal value from a plugin-specific config file. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
var: Name of the setting to load. +
+
+Returns: The decimal value of the requested setting upon success, -1 for failure. +


+ +

 xchat_pluginpref_delete() (new for 2.9.0)

+Prototype: int xchat_pluginpref_delete (xchat_plugin *ph, const char *var); +
+
Description: Deletes a plugin-specific setting from a plugin-specific config file. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
var: Name of the setting to delete. +
+
+Returns: 1 for success, 0 for failure. If the given setting didn't exist, it also returns 1, so 1 only indicates that the setting won't exist after the call. +


+ +

 xchat_pluginpref_list() (new for 2.9.0)

+Prototype: int xchat_pluginpref_list (xchat_plugin *ph, char *dest); +
+
Description: Builds a comma-separated list of the currently saved settings from a plugin-specific config file. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
dest: Array to save the list to. +
+
+Returns: 1 for success, 0 for failure (nonexistent, empty or inaccessible config file). +


+ + + diff --git a/share/doc/python.md b/share/doc/python.md new file mode 100644 index 00000000..d998f9d3 --- /dev/null +++ b/share/doc/python.md @@ -0,0 +1,545 @@ +# HexChat Python Interface + +Features +-------- + +Here are some of the features of the python plugin interface: + +- Comprehensive, consistent and straightforward API +- Load, unload, reload, and autoload support +- Per plugin independent interpreter state +- Python interactive console +- Python interactive command execution +- Full thread support +- Stdout and stderr redirected to xchat console +- Dynamic list management +- Nice context treatment +- Plugin preferences + +Commands +-------- + +The following commands will be intercepted by the Python Plugin interface module, when it is loaded. + +--------------------------------------------------------------------------------------------------------------------------------------------- +*Command* *Description* +---------------------------------- --------------------------------------------------------------------------------------------------------- +/py load Load module with given filename. + +/py unload Unload module with given filename, or module name. + +/py reload Reload module with given filename, or module name. + +/py list List Python modules loaded. + +/py exec Execute given Python command interactively. For example: + `/py exec import xchat` + `/py exec print xchat.get_info('channel')` + +/py console Open the Python interactive console in a query (>>python<<). + Every message sent will be intercepted by the Python plugin interface, and interpreted interactively. + Notice that the console and /py exec commands live in the same interpreter state. + +/py about Show some information about the Python plugin interface. +---------------------------------------------------------------------------------------------------------------------------------------------- + + +Autoloading modules +------------------- + +If you want some module to be autoloaded together with the Python plugin +interface (which usually loads at startup time), just make sure it has a +`.py` extension and put it in your HexChat directory (~/.config/hexchat/addons, %APPDATA%\\HexChat\\addons). + +Context theory +-------------- + +Before starting to explain what the API offers, I'll do a short +introduction about the xchat context concept. Not because it's something +hard to understand, but because you'll understand better the API +explanations if you know what I'm talking about. + +You can think about a context as an xchat channel, server, or query tab. +Each of these tabs, has its own context, and is related to a given +server and channel (queries are a special kind of channel). + +The *current* context is the one where xchat passes control to the +module. For example, when xchat receives a command in a specific +channel, and you have asked xchat to tell you about this event, the +current context will be set to this channel before your module is +called. + +Hello world +----------- + +Here is the traditional *hello world* example. + +~~~~~~~~~~ {.python} + __module_name__ = "helloworld" + __module_version__ = "1.0" + __module_description__ = "Python module example" + + print "Hello world!" +~~~~~~~~~~ + +This module will print "Hello world!" in the xchat console, and sleep +forever until it's unloaded. It's a simple module, but already +introduces some concepts. Notice how the module information is set. This +information is obligatory, and will be shown when listing the loaded +xchat modules. + +xchat module +------------ + +The xchat module is your passport to every xchat functionality offered +by the Python plugin interface. Here's a simple example: + +~~~~~~~~~~ {.python} + import xchat + xchat.prnt("Hi everyone!") +~~~~~~~~~~ + +The following functions are available in the xchat module. + +### Generic functions + +#### xchat.prnt(string) + +This function will print string in the current context. It's mainly +useful as a parameter to pass to some other function, since the usual +print statement will have the same results. You have a usage example +above. + +This function is badly +named because `"print"` is a reserved keyword of the Python language. + +#### xchat.emit_print(event_name, *args) + +This function will generate a *print event* with the given arguments. To +check which events are available, and the number and meaning of +arguments, have a look at the `Settings > Lists > Text Events` window. +Here is one example: + +~~~~~~~~~~ {.python} + xchat.emit_print("Channel Message", "John", "Hi there", "@") +~~~~~~~~~~` + +#### xchat.command(string) + +Execute the given command in the current context. This has the same +results as executing a command in the xchat window, but notice that the +`/` prefix is not used. Here is an example: + +~~~~~~~~~~ {.python} + xchat.command("server irc.openprojects.net") +~~~~~~~~~~ + +#### xchat.nickcmp(s1, s2) + +This function will do an RFC1459 compliant string comparing between `s1` +and `s2`, and is useful to compare channels and nicknames. It returns an +integer less than, equal to, or greater than zero if `s1` is found, +respectively, to be less than, to match, or be greater than `s2`. For +example: + +~~~~~~~~~~ {.python} + if xchat.nickcmp(nick, "mynick") == 0: + print "They are the same!" +~~~~~~~~~~ + +### Information retreiving functions + +#### xchat.get_info(type) + +Retrieve the information specified by the `type` string in the current +context. At the moment of this writing, the following information types +are available to be queried: + +----------------------------------------------------------------------------------------------- +*Type* *Description* +-------- ----------------------------------------------------------------------------------- +away Away reason or None if you are not away. + +channels Channel of the current context. + +hostname Real hostname of the server you connected to. + +network Current network name or None. + +nick Your current nick name. + +server Current server name (what the server claims to be) or None if you are not connected. + +topic Current channel topic. + +version hexchat version number. + +xchatdir hexchat config directory e.g.: "~/.config/hexchat". +------------------------------------------------------------------------------------------------ + +Example: + +~~~~~~~~~~ {.python} + if xchat.get_info("server") is None: + xchat.prnt("Not connected!") +~~~~~~~~~~ + +#### xchat.get_prefs(name) + +Retrieve the xchat setting information specified by the `name` string, +as available by the `/set` command. For example: + +~~~~~~~~~~ {.python} + print "Current preferred nick:", xchat.get_prefs("irc_nick1") +~~~~~~~~~~ + +#### xchat.get_list(type) + +With this function you may retrieve a list containing the selected +information from the current context, like a DCC list, a channel list, a +user list, etc. Each list item will have its attributes set dynamically +depending on the information provided by the list type. + +The example below is a rewrite of the example provided with xchat's +plugin API documentation. It prints a list of every DCC transfer +happening at the moment. Notice how similar the interface is to the C +API provided by xchat. + +~~~~~~~~~~ {.python} + list = xchat.get_list("dcc") + if list: + print "--- DCC LIST ------------------" + print "File To/From KB/s Position" + for i in list: + print "%6s %10s %.2f %d" % (i.file, i.nick, i.cps/1024, i.pos) +~~~~~~~~~~ + +Below you will find what each list type has to offer. + +This information was +taken from xchat's plugin documentation. You may find any types not +listed here, if they exist at all, in an updated xchat documentation. +Any list types accepted by xchat should be dynamically accepted by the +Python plugin interface. + +##### channels + +The channels list type gives you access to the channels, queries and +their servers. The folloing attributes are available in each list item: + +------------------------------------------------------------------- +*Type* *Description* +------- ------------------------------------------------------- +channel Channel or query name. + +context A context object, giving access to that channel/server. + +network Network name to which this channel belongs. + +server Server name to which this channel belongs. + +type Type of context (1=Server, 2=Channel, 3=Dialog). +------------------------------------------------------------------- + +##### dcc + +The dcc list type gives you access to a list of DCC file transfers. The +following attributes are available in each list item: + +--------------------------------------------------------------------------------------- +*Type* *Description* +--------- --------------------------------------------------------------------------- +address32 Address of the remote user (ipv4 address, as an int). + +cps Bytes per second (speed). + +destfile Destination full pathname. + +file Filename. + +nick Nickname of person who the file is from/to. + +port TCP port number. + +pos Bytes sent/received. + +resume Point at which this file was resumed (or zero if it was not resumed). + +size File size in bytes. + +status DCC status (queued=0, active=1, failed=2, done=3, connecting=4, aborted=5). + +type DCC type (send=0, receive=1, chatrecv=2, chatsend=3). +--------------------------------------------------------------------------------------- + +##### users + +The users list type gives you access to a list of users in the current +channel. The following attributes are available in each list item: + +---------------------------------------------------------------- +*Type* *Description* +------ -------------------------------------------------------- +nick Nick name. + +host Host name in the form user@host (or None, if not known). + +prefix Prefix character, .e.g: @ or +. Points to a single char. +---------------------------------------------------------------- + +##### ignore + +The ignore list type gives you access to the current ignored list. The +following attributes are available in each list item: + +----------------------------------------------------------------------------------------------------------- +*Type* *Description* +----- --------------------------------------------------------------------------------------------------- +mask Ignore mask (for example, "*!*@*.aol.com"). + +flags Bit field of flags (0=private, 1=notice, 2=channel, 3=ctcp, 4=invite, 5=unignore, 6=nosave, 7=dcc). +----------------------------------------------------------------------------------------------------------- + +### Hook functions + +These functions allow one to hook into xchat events. + +#### Priorities + +When a priority keyword parameter is accepted, it means that this +callback may be hooked with five different priorities: PRI_HIGHEST, +PRI_HIGH, PRI_NORM, PRI_LOW, and PRI_LOWEST. The usage of these +constants, which are available in the xchat module, will define the +order in which your plugin will be called. Most of the time, you won't +want to change its default value (PRI_NORM). + +#### Parameters word and word_eol + +These parameters, when available in a callback, are lists of strings +which contain the parameters the user entered for the particular +command. For example, if you executed: + +> /command NICK Hi there! + +- **word[0]** is `command` +- **word[1]** is `NICK` +- **word[2]** is `Hi` +- **word[3]** is `there!` +- **word_eol[0]** is `command NICK Hi there!` +- **word_eol[1]** is `NICK Hi there!` +- **word_eol[2]** is `Hi there!` +- **word_eol[3]** is `there!` + +#### Parameter userdata + +The parameter userdata, if given, allows you to pass a custom object to +your callback. + +#### Callback return constants (EAT_*) + +When a callback is supposed to return one of the EAT_* macros, it is +able control how xchat will proceed after the callback returns. These +are the available constants, and their meanings: + +--------------------------------------------------------- +*Constant* *Description* +----------- --------------------------------------------- +EAT_PLUGIN Don't let any other plugin receive this event. + +EAT_XCHAT Don't let xchat treat this event as usual. + +EAT_ALL Eat the event completely. + +EAT_NONE Let everything happen as usual. +--------------------------------------------------------- + +Returning `None` is the same as returning `EAT_NONE`. + +#### xchat.hook_command(name, callback, userdata=None, priority=PRI_NORM, help=None) + +This function allows you to hook into the name xchat command. It means +that everytime you type `/name ...`, `callback` will be called. +Parameters `userdata` and `priority` have their meanings explained +above, and the parameter help, if given, allows you to pass a help text +which will be shown when `/help name` is executed. This function returns +a hook handler which may be used in the `xchat.unhook()` function. For +example: + +~~~~~~~~~~ {.python} + def onotice_cb(word, word_eol, userdata): + if len(word) < 2: + print "Second arg must be the message!" + else: + xchat.command("NOTICE @%s %s" % (xchat.get_info("channel"), word_eol[1])) + return xchat.EAT_ALL + + xchat.hook_command("ONOTICE", onotice_cb, help="/ONOTICE Sends a notice to all ops") +~~~~~~~~~~ + +You may return one of `EAT_*` constants in the callback, to control +xchat's behavior, as explained above. + +#### xchat.hook_print(name, callback, userdata=None, priority=PRI_NORM) + +This function allows you to register a callback to trap any print +events. The event names are available in the *Edit Event Texts* window. +Parameters `userdata` and `priority` have their meanings explained +above. This function returns a hook handler which may be used in the +`xchat.unhook()` function. For example: + +~~~~~~~~~~ {.python} + def youpart_cb(word, word_eol, userdata): + print "You have left channel", word[2] + return xchat.EAT_XCHAT # Don't let xchat do its normal printing + + xchat.hook_print("You Part", youpart_cb) +~~~~~~~~~~ + +You may return one of `EAT_*` constants in the callback, to control +xchat's behavior, as explained above. + +#### xchat.hook_server(name, callback, userdata=None, priority=PRI_NORM) + +This function allows you to register a callback to be called when a +certain server event occurs. You can use this to trap `PRIVMSG`, +`NOTICE`, `PART`, a server numeric, etc. Parameters `userdata` and +`priority` have their meanings explained above. This function returns a +hook handler which may be used in the `xchat.unhook()` function. For +example: + +~~~~~~~~~~ {.python} + def kick_cb(word, word_eol, userdata): + print "%s was kicked from %s (%s)" % (word[3], word[2], word_eol[4]) + # Don't eat this event, let other plugins and xchat see it too + return xchat.EAT_NONE + + xchat.hook_server("KICK", kick_cb) +~~~~~~~~~~ + +You may return one of `EAT_*` constants in the callback, to control +xchat's behavior, as explained above. + +#### xchat.hook_timer(timeout, callback, userdata=None) + +This function allows you to register a callback to be called every +timeout milliseconds. Parameters userdata and priority have their +meanings explained above. This function returns a hook handler which may +be used in the `xchat.unhook()` function. For example: + +~~~~~~~~~~ {.python} + myhook = None + + def stop_cb(word, word_eol, userdata): + global myhook + if myhook is not None: + xchat.unhook(myhook) + myhook = None + print "Timeout removed!" + + def timeout_cb(userdata): + print "Annoying message every 5 seconds! Type /STOP to stop it." + return 1 # Keep the timeout going + + myhook = xchat.hook_timer(5000, timeout_cb) + xchat.hook_command("STOP", stop_cb) +~~~~~~~~~~ + +If you return a true value from the callback, the timer will be keeped, +otherwise it is removed. + +#### xchat.hook_unload(timeout, callback, userdata=None) + +This function allows you to register a callback to be called when the +plugin is going to be unloaded. Parameters `userdata` and `priority` +have their meanings explained above. This function returns a hook +handler which may be used in the `xchat.unhook()` function. For example: + +~~~~~~~~~~ {.python} + def unload_cb(userdata): + print "We're being unloaded!" + + xchat.hook_unload(unload_cb) +~~~~~~~~~~ + +#### xchat.unhook(handler) + +Unhooks any hook registered with the hook functions above. + +### Plugin preferences + +You can use pluginpref to easily store and retrieve settings. This was added in the Python plugin version 0.9 + +#### xchat.set_pluginpref(name, value) + +If neccessary creates a .conf file in the HexChat config dir named addon_python.conf and stores the value in it. Returns 1 on success 0 on failure. + +> Note: Until the plugin uses different a conf file per script it's recommened to use 'PluginName-SettingName' to avoid conflicts. + +#### xchat.get_pluginpref(name) + +This will return the value of the variable of that name. If there is none by this name it will return `None`. Numbers are always returned as Integers. + +#### xchat.del_pluginpref(name) + +Deletes specified variable. Returns 1 on success (or never existing), 0 on failure. + +#### xchat.list_pluginpref() + +Returns a list of all currently set preferences. + +### Context handling + +Below you will find information about how to work with contexts. + +#### Context objects + +As explained in the Context theory session above, contexts give access +to a specific channel/query/server tab of xchat. Every function +available in the xchat module will be evaluated in the current context, +which will be specified by xchat itself before passing control to the +module. Sometimes you may want to work in a specific context, and that's +where context objects come into play. + +You may create a context object using the `xchat.get_context()` or +`xchat.find_context()`, functions as explained below, or trough the +`xchat.get_list()` function, as explained in its respective session. + +Each context object offers the following methods: + +------------------------------------------------------------------------------------------------------------------------- +*Methods* *Description* +---------------------------------------- ----------------------------------------------------------------------------- +context.set() Changes the current context to be the one represented by this context object. + +context.prnt(string) Does the same as the xchat.prnt() function, but in the given context. + +context.emit_print(event_name, *args) Does the same as the emit_print() function, but in the given context. + +context.command(string) Does the same as the xchat.command() function, but in the given context. + +context.get_info(type) Does the same as the xchat.get_info() function, but in the given context. + +context.get_list(type) Does the same as the xchat.get_list() function, but in the given context. +------------------------------------------------------------------------------------------------------------------------- + +#### xchat.get_context() + +Returns a context object corresponding the the current context. + +#### xchat.find_context(server=None, channel=None) + +Finds a context based on a channel and servername. If `server` is +`None`, it finds any channel (or query) by the given name. If `channel` +is `None`, it finds the front-most tab/window of the given server. For +example: + +~~~~~~~~~~ {.python} + cnc = xchat.find_context(channel='#conectiva') + cnc.command('whois niemeyer') +~~~~~~~~~~ + +* * * * * + +Original Author: Gustavo Niemeyer [gustavo@niemeyer.net](mailto:gustavo@niemeyer.net) + +For purty html: `pandoc --toc python.md -s --highlight-style haddock -o python.html` diff --git a/share/doc/tcl.html b/share/doc/tcl.html new file mode 100644 index 00000000..e4fed393 --- /dev/null +++ b/share/doc/tcl.html @@ -0,0 +1,3675 @@ + + +

Tcl Plugin for XChat 2.x

+

This file includes names, descriptions and examples of added commands and TCL language extensions for XChat IRC Client. + +


Note to Eggdrop Scripters:  The Tcl Plugin for XChat will not run eggdrop scripts. + Contrary to popular belief, Tcl was not invented by or for eggdrop.  Eggdrop, +like many other successful projects is just another happy user of Tcl.  Tcl was around long +before Eggdrop and is broadly considered the industry standard language for automation. +
+ +

Tcl Plugin XChat Commands:
+/reload, /source, /tcl +

Tcl Plugin TCL Commands:
+alias, +away, +channel, +channels, +chats, +command, +complete, +dcclist, +findcontext, +getcontext, +getinfo, +getlist, +host, +ignores, +killtimer, +me, +network, +nickcmp, +off, +on, +print, +queries, +raw, +server, +servers, +setcontext, +timer, +timerexists, +timers, +topic, +users, +version, +xchatdir +

Tcl Plugin XChat Commands

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:/reload - Clear and reload all tcl scripts.
Synopsis:
/reload
Description:Clears out and reloads all tcl scripts. Any variables defined and any open files are lost.
See Also:/source
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:/source - Load a specific tcl script file.
Synopsis:
/source filename
Description:Loads a tcl script into XChat.
See Also:/reload
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:/tcl - Execute any tcl command
Synopsis:
/tcl command ?args?
Description:Allows for the immediate execution of any tcl command.
Example:
/tcl puts "Hello, XChat World!"
+/tcl xchatdir
Downloads:Download recommended Tcl plugin support scripts.
+

+ +

Tcl Plugin TCL Commands

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:alias - Creates a new xchat command.
Synopsis:
alias name { script }
Description:Creates a new xchat command and executes script when that command is entered. +
+
+Upon executing the alias, the following variables will be set: +
+ +
+ + + + + + + + + +
$_cmd the alias name +
$_rest params included with alias +

+ +
+You can also hook all text (non-commands) sent to any given tab/window by pre-pending the name of any tab with an '@'.
Example:
# do 'ls -al' command on any directory
+alias ls {
+  print "[eval "exec ls -al $_rest"]"
+  complete
+}
+
+# uppercase everything I say in #somechannel
+alias @#somechannel {
+  /say [string toupper $_rest]
+  complete
+}
+
+# brag about my uptime
+alias uptime {
+ /say [bold][me]'s Uptime:[bold] [string trim [exec uptime]]
+}
See Also:complete, on
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:away - Returns your /away message.
Synopsis:
away ?server|context?
Description:Returns your /away message. If no server or context is omitted, the current server is assumed.
Example:
set awaymsg [away]
See Also:findcontext, getcontext
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:channel - Return the current query/channel name.
Synopsis:
channel ?context?
Description:Returns the name of the current channel or query. You may also specify a specific context to get the name of.
Example:
set thischannel [channel]
See Also:channels, findcontext, getcontext, server, servers
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:channels - Returns of list of all channels you are in.
Synopsis:
channels ?server|context?
Description:Returns a list of all channels you are in. If server or context is omitted, the current server is assumed.
Example:
alias mychannels {
+  foreach s [servers] {
+    print "Server: $s"
+    foreach c [channels $s] {
+      print " - Channel: $c - [topic $s $c]"
+    }
+  }
+  complete
+}
See Also:channel, findcontext, getcontext, server, servers
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:chats - Returns a list of opened dcc chats.
Synopsis:
chats
Description:Returns the name of the current active dcc chats.
Example:
set mychats [chats]
+print "I am directly connected to [join $mychats ", "]"
See Also:channels, dcclist, queries
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:command - Simulate a command entered into xchat.
Synopsis:
command ?server|context? ?channel|nick? text
Description:Executes any internal or external chat command as if it had been typed into xchat directly. If server or channel|nick are omitted, the current ones are assumed.
Example:
command "whois [me]"
+command #mychannel "me wonders what this does."
+command irc.myserver.com #thatchannel "say Hello, World!"
+command irc.nyserver.com "away I'm gone"
See Also:findcontext, getcontext, raw
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:complete - Set return mode of an 'on' or 'alias' script
Synopsis:
complete ?retcode?
Description:Similar to TCL's return command, complete halts further processing of an on or alias script and sets a return value. +
+ +
+ + + + + + + + + + + + + + + + + +
EAT_NONE Allows all other plugins and xchat to see this event. +
EAT_XCHAT Halts further processing by xchat +
EAT_PLUGIN Halts further processing by other plugins (default). +
EAT_ALL Halts further processing by other plugins and xchat.

+
Example:
on XC_TABOPEN whatever {
+  print "Hello from [channel]"
+  complete
+}
+
+alias bar {
+  /me has been on irc long enough to still be traumatized by !bar scripts.
+  complete
+}
See Also:alias, on
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:dcclist - Returns detailed information about all dcc chats and files transfers.
Synopsis:
dcclist
Description:Returns a list of all dcc chats and transfers. +
+ +
+Each list entry is made up of the following elements: +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
type chatsend, chatrecv, filesend, filerecv. +
status queued, active, failed, done, connecting, aborted. +
nick Nick of other user. +
filename Name of file being sent or reveived. +
size size of file being sent or reveived. +
resume resume position of file being sent or reveived. +
pos current position of file being sent or reveived. +
cps current transfer speed in bytes per second. +
address address of remote connection. +
port port of the remote connection.

+
Example:
foreach entry [dcclist] {
+  print "$entry"
+}
See Also:chats
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:findcontext - Finds a context based on a channel and/or server name.
Synopsis:
findcontext ?server? ?channel|nick?
Description:Finds a context based on a channel and/or server name. If the server is omitted, it finds any channel (or query) by the given name on the current server. If channel|nick is omitted, it finds the default server tab for that server. +
Example:
set context [findcontext irc.whatever.com]
+set context [findcontext #mychannel]
+set context [findcontext irc.whatever.com #thatchannel]
+set context [findcontext]
Notes:This function is not normally needed with the tclplugin. It is included only to add completeness with the XChat C API.
See Also:getcontext, setcontext
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:getcontext - Returns the current context for your plugin.
Synopsis:
getcontext
Description:Returns the current context for your plugin. You can use this later with setcontext.
Example:
set context [getcontext]
Notes:This function is not normally needed with the tclplugin. It is included only to add completeness with the XChat C API.
See Also:findcontext, setcontext
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:getinfo - Returns information based on your current context.
Synopsis:
getinfo field
Description:Provides direct access to XChat C API command xhat_get_info. Most of these have replacement tcl plugin commands that offer more functionality. +
+ +
+The following fields are currently defined: +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
away away reason or NULL if you are not away. +
channel current channel name. +
host real hostname of the server you connected to. +
network current network name or NULL. +
nick your current nick name. +
server current server name (what the server claims to be). +
topic current channel topic. +
version xchat version number. +
xchatdir xchat config directory, e.g.: /home/user/.xchat.

+
Example:
print "I am using XChat [getinfo version]"
See Also:away, channel, host, me, network, server, topic, version, xchatdir
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:getlist - Returns information from XChats list of lists
Synopsis:
getlist ?listname?
Description:Returns a list of information from XChat's internal list of lists. If listname is omitted, the names of all the available lists are returned. +
+ +
+The first entry in the list is the names of all the fields for that list. The rest of list are the actual list entries.
See Also:channels, dcclist, ignores, queries, servers
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:host - Returns the hostname of the server.
Synopsis:
host ?server|context?
Description:Returns the hostname of the server you connected to. If you connected to a networks round-robin name, e.g. irc.openprojects.org, irc.newnet.net, etc., it will return that name. If server is omitted, the current one is assumed.
Example:
print "I attempted to connect to [host] on [network]."
+print "I am actually connected to [server]."
Notes:If you want to know the exact server name, use server.
See Also:findcontext, getcontext, network, server
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:ignores - Returns list of ignored hosts.
Synopsis:
ignores
Description:Returns a list of all ignored hosts. +
+ +
+Each list entry is made up the hostmask being ignored, followed by a sub-list of the types of ignores on that mask.
Example:
set ignorelist [ignores]
+foreach entry $ignorelist {
+  print "Ignoring:"
+  print "[lindex $entry 0]: [lindex $entry 1]"
+}
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:killtimer - Kills the specified timer.
Synopsis:
killtimer timerID
Description:Removes the specified timerID from the timer queue.
See Also:timer, timerexists, timers
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:me - Returns your nick.
Synopsis:
me ?server|context?
Description:Returns your current nick. If server is omitted, the current one is used by default.
See Also:findcontext, getcontext
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:network - Returns the name of the network.
Synopsis:
network ?server|context?
Description:Returns the name of the network, relative to the server list, that you are connected to. If no serveris omitted, the current one current one is used by default.
Example:
print "I attempted to connect to [host] on [network]."
+print "I am actually connected to [server]."
See Also:findcontext, getcontext, host, server
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:nickcmp - Performs an RFC1459 compliant string compare.
Synopsis:
nickcmp string1 string2
Description:This command performs an RFC1459 compliant string compare. Use this to compare channels and nicknames. The function works the same way as strcasecmp. +
+ +
+Because of IRC's scandanavian origin, the characters {}| are considered to be the lower case equivalents of the characters [], respectively. This is a critical issue when determining the equivalence of two nicknames.
Returns:An integer less than, equal to, or greater than zero if string1 is found, respectively, to be less than, to match, or be greater than string2.
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:off - Removes a script previously assigned with on
Synopsis:
off token ?label?
Description:Removes a script from the specified XChat token and label. If label is omitted, all scripts for that token are removed.
See Also:on
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:on - Execute a command on an irc event
Synopsis:
on token label { script | procname }
Description:Whenever token is triggered, script will be executed. label is some descriptive word that identifies which script is being executed when you have multiple scripts assigned to the same event. It is suggested that you use your initials or the name of your script as the 'label'. +
+ +
+The token can be any server token or an internal XChat event. When executing your script, the following variables will be set: +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
$_label As defined by the 'on' command. +
$_src source of the event. nick!ident@host -or- irc.servername.com +
$_cmd irc command. JOIN, PRIVMSG, KICK, etc. +
$_dest intended target of this event. nick,
$_rest the rest of the message. +
$_raw the raw line received from the irc server. +
$_private '0' means the message was public, '1' = private. +

+ +
+You may further use splitsrc command to create the additional variables: +
+ +
+ + + + + + + + + + + + + +
$_nick irc user nick extracted from $_src +
$_ident irc user ident extracted from $_src +
$_host irc user hostname extracted from $_src +

+ +
+For channel management scripts, you may use any word with '!' in front (e.g. !pingme") as the token. Any time someone uses that command in a channel or in a private message, the script will be executed. +
+ +
+The following custom XChat internal token are also available: +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
INVITE (rfc1459) Invited to channel. +
JOIN (rfc1459) Joined a channel +
KICK (rfc1459) Kicked from a channel +
KILL (rfc1459) Killed from server +
MODE (rfc1459) Channel or User mode change +
NICK (rfc1459) Nick change. +
NOTICE (rfc1459) Private Notice +
PART (rfc1459) Parted a channel +
PING (rfc1459) Server Ping +
PRIVMSG (rfc1459) Private Message +
QUIT (rfc1459) Quit the server. +
TOPIC (rfc1459) Channel topic change +
WALLOPS (rfc1459) Wallops +
ACTION Incoming /me whatever action command. +
CHAT Incoming line of text from dcc chat conversation. +
CTCP Incoming CTCP (PING, VERSION, etc) +
CTCR Incoming reply from your CTCP to someone else. +
SNOTICE Incoming notice from a server. +
001 (rfc1459) RPL_WELCOME +
002 (rfc1459) RPL_YOURHOST +
003 (rfc1459) RPL_CREATED +
004 (rfc1459) RPL_MYINFO +
005 (rfc1459) RPL_PROTOCTL +
006 (rfc1459) RPL_MAP +
007 (rfc1459) RPL_MAPEND +
200 (rfc1459) RPL_TRACELINK +
201 (rfc1459) RPL_TRACECONNECTING +
202 (rfc1459) RPL_TRACEHANDSHAKE +
203 (rfc1459) RPL_TRACEUNKNOWN +
204 (rfc1459) RPL_TRACEOPERATOR +
205 (rfc1459) RPL_TRACEUSER +
206 (rfc1459) RPL_TRACESERVER +
207 (rfc1459) RPL_TRACESERVICE +
208 (rfc1459) RPL_TRACENEWTYPE +
209 (rfc1459) RPL_TRACECLASS +
211 (rfc1459) RPL_STATSLINKINFO +
212 (rfc1459) RPL_STATSCOMMANDS +
213 (rfc1459) RPL_STATSCLINE +
214 (rfc1459) RPL_STATSOLDNLINE +
215 (rfc1459) RPL_STATSILINE +
216 (rfc1459) RPL_STATSKLINE +
217 (rfc1459) RPL_STATSQLINE +
218 (rfc1459) RPL_STATSYLINE +
219 (rfc1459) RPL_ENDOFSTATS +
220 (rfc1459) RPL_STATSBLINE +
221 (rfc1459) RPL_UMODEIS +
222 (rfc1459) RPL_SQLINE_NICK +
223 (rfc1459) RPL_STATSGLINE +
224 (rfc1459) RPL_STATSTLINE +
225 (rfc1459) RPL_STATSELINE +
226 (rfc1459) RPL_STATSNLINE +
227 (rfc1459) RPL_STATSVLINE +
231 (rfc1459) RPL_SERVICEINFO +
232 (rfc1459) RPL_RULES +
233 (rfc1459) RPL_SERVICE +
234 (rfc1459) RPL_SERVLIST +
235 (rfc1459) RPL_SERVLISTEND +
241 (rfc1459) RPL_STATSLLINE +
242 (rfc1459) RPL_STATSUPTIME +
243 (rfc1459) RPL_STATSOLINE +
244 (rfc1459) RPL_STATSHLINE +
245 (rfc1459) RPL_STATSSLINE +
247 (rfc1459) RPL_STATSXLINE +
248 (rfc1459) RPL_STATSULINE +
249 (rfc1459) RPL_STATSDEBUG +
250 (rfc1459) RPL_STATSCONN +
251 (rfc1459) RPL_LUSERCLIENT +
252 (rfc1459) RPL_LUSEROP +
253 (rfc1459) RPL_LUSERUNKNOWN +
254 (rfc1459) RPL_LUSERCHANNELS +
255 (rfc1459) RPL_LUSERME +
256 (rfc1459) RPL_ADMINME +
257 (rfc1459) RPL_ADMINLOC1 +
258 (rfc1459) RPL_ADMINLOC2 +
259 (rfc1459) RPL_ADMINEMAIL +
261 (rfc1459) RPL_TRACELOG +
265 (rfc1459) RPL_LOCALUSERS +
266 (rfc1459) RPL_GLOBALUSERS +
271 (rfc1459) RPL_SILELIST +
272 (rfc1459) RPL_ENDOFSILELIST +
275 (rfc1459) RPL_STATSDLINE +
290 (rfc1459) RPL_HELPHDR +
291 (rfc1459) RPL_HELPOP +
292 (rfc1459) RPL_HELPTLR +
293 (rfc1459) RPL_HELPHLP +
294 (rfc1459) RPL_HELPFWD +
295 (rfc1459) RPL_HELPIGN +
300 (rfc1459) RPL_NONE +
301 (rfc1459) RPL_AWAY +
302 (rfc1459) RPL_USERHOST +
303 (rfc1459) RPL_ISON +
304 (rfc1459) RPL_TEXT +
305 (rfc1459) RPL_UNAWAY +
306 (rfc1459) RPL_NOWAWAY +
307 (rfc1459) RPL_WHOISREGNICK +
308 (rfc1459) RPL_RULESSTART +
309 (rfc1459) RPL_ENDOFRULES +
310 (rfc1459) RPL_WHOISHELPOP +
311 (rfc1459) RPL_WHOISUSER +
312 (rfc1459) RPL_WHOISSERVER +
313 (rfc1459) RPL_WHOISOPERATOR +
314 (rfc1459) RPL_WHOWASUSER +
315 (rfc1459) RPL_ENDOFWHO +
316 (rfc1459) RPL_WHOISCHANOP +
317 (rfc1459) RPL_WHOISIDLE +
318 (rfc1459) RPL_ENDOFWHOIS +
319 (rfc1459) RPL_WHOISCHANNELS +
320 (rfc1459) RPL_WHOISSPECIAL +
321 (rfc1459) RPL_LISTSTART +
322 (rfc1459) RPL_LIST +
323 (rfc1459) RPL_LISTEND +
324 (rfc1459) RPL_CHANNELMODEIS +
329 (rfc1459) RPL_CREATIONTIME +
331 (rfc1459) RPL_NOTOPIC +
332 (rfc1459) RPL_TOPIC +
333 (rfc1459) RPL_TOPICWHOTIME +
334 (rfc1459) RPL_LISTSYNTAX +
335 (rfc1459) RPL_WHOISBOT +
341 (rfc1459) RPL_INVITING +
342 (rfc1459) RPL_SUMMONING +
343 (rfc1459) RPL_TICKER +
346 (rfc1459) RPL_INVITELIST +
347 (rfc1459) RPL_ENDOFINVITELIST +
348 (rfc1459) RPL_EXLIST +
349 (rfc1459) RPL_ENDOFEXLIST +
351 (rfc1459) RPL_VERSION +
352 (rfc1459) RPL_WHOREPLY +
353 (rfc1459) RPL_NAMREPLY +
361 (rfc1459) RPL_KILLDONE +
362 (rfc1459) RPL_CLOSING +
363 (rfc1459) RPL_CLOSEEND +
364 (rfc1459) RPL_LINKS +
365 (rfc1459) RPL_ENDOFLINKS +
366 (rfc1459) RPL_ENDOFNAMES +
367 (rfc1459) RPL_BANLIST +
368 (rfc1459) RPL_ENDOFBANLIST +
369 (rfc1459) RPL_ENDOFWHOWAS +
371 (rfc1459) RPL_INFO +
372 (rfc1459) RPL_MOTD +
373 (rfc1459) RPL_INFOSTART +
374 (rfc1459) RPL_ENDOFINFO +
375 (rfc1459) RPL_MOTDSTART +
376 (rfc1459) RPL_ENDOFMOTD +
378 (rfc1459) RPL_WHOISHOST +
379 (rfc1459) RPL_WHOISMODES +
381 (rfc1459) RPL_YOUREOPER +
382 (rfc1459) RPL_REHASHING +
383 (rfc1459) RPL_YOURESERVICE +
384 (rfc1459) RPL_MYPORTIS +
385 (rfc1459) RPL_NOTOPERANYMORE +
386 (rfc1459) RPL_QLIST +
387 (rfc1459) RPL_ENDOFQLIST +
388 (rfc1459) RPL_ALIST +
389 (rfc1459) RPL_ENDOFALIST +
391 (rfc1459) RPL_TIME +
392 (rfc1459) RPL_USERSSTART +
393 (rfc1459) RPL_USERS +
394 (rfc1459) RPL_ENDOFUSERS +
395 (rfc1459) RPL_NOUSERS +
401 (rfc1459) ERR_NOSUCHNICK +
402 (rfc1459) ERR_NOSUCHSERVER +
403 (rfc1459) ERR_NOSUCHCHANNEL +
404 (rfc1459) ERR_CANNOTSENDTOCHAN +
405 (rfc1459) ERR_TOOMANYCHANNELS +
406 (rfc1459) ERR_WASNOSUCHNICK +
407 (rfc1459) ERR_TOOMANYTARGETS +
408 (rfc1459) ERR_NOSUCHSERVICE +
409 (rfc1459) ERR_NOORIGIN +
411 (rfc1459) ERR_NORECIPIENT +
412 (rfc1459) ERR_NOTEXTTOSEND +
413 (rfc1459) ERR_NOTOPLEVEL +
414 (rfc1459) ERR_WILDTOPLEVEL +
421 (rfc1459) ERR_UNKNOWNCOMMAND +
422 (rfc1459) ERR_NOMOTD +
423 (rfc1459) ERR_NOADMININFO +
424 (rfc1459) ERR_FILEERROR +
425 (rfc1459) ERR_NOOPERMOTD +
431 (rfc1459) ERR_NONICKNAMEGIVEN +
432 (rfc1459) ERR_ERRONEUSNICKNAME +
433 (rfc1459) ERR_NICKNAMEINUSE +
434 (rfc1459) ERR_NORULES +
435 (rfc1459) ERR_SERVICECONFUSED +
436 (rfc1459) ERR_NICKCOLLISION +
437 (rfc1459) ERR_BANNICKCHANGE +
438 (rfc1459) ERR_NCHANGETOOFAST +
439 (rfc1459) ERR_TARGETTOOFAST +
440 (rfc1459) ERR_SERVICESDOWN +
441 (rfc1459) ERR_USERNOTINCHANNEL +
442 (rfc1459) ERR_NOTONCHANNEL +
443 (rfc1459) ERR_USERONCHANNEL +
444 (rfc1459) ERR_NOLOGIN +
445 (rfc1459) ERR_SUMMONDISABLED +
446 (rfc1459) ERR_USERSDISABLED +
447 (rfc1459) ERR_NONICKCHANGE +
451 (rfc1459) ERR_NOTREGISTERED +
455 (rfc1459) ERR_HOSTILENAME +
459 (rfc1459) ERR_NOHIDING +
460 (rfc1459) ERR_NOTFORHALFOPS +
461 (rfc1459) ERR_NEEDMOREPARAMS +
462 (rfc1459) ERR_ALREADYREGISTRED +
463 (rfc1459) ERR_NOPERMFORHOST +
464 (rfc1459) ERR_PASSWDMISMATCH +
465 (rfc1459) ERR_YOUREBANNEDCREEP +
466 (rfc1459) ERR_YOUWILLBEBANNED +
467 (rfc1459) ERR_KEYSET +
468 (rfc1459) ERR_ONLYSERVERSCANCHANGE +
469 (rfc1459) ERR_LINKSET +
470 (rfc1459) ERR_LINKCHANNEL +
471 (rfc1459) ERR_CHANNELISFULL +
472 (rfc1459) ERR_UNKNOWNMODE +
473 (rfc1459) ERR_INVITEONLYCHAN +
474 (rfc1459) ERR_BANNEDFROMCHAN +
475 (rfc1459) ERR_BADCHANNELKEY +
476 (rfc1459) ERR_BADCHANMASK +
477 (rfc1459) ERR_NEEDREGGEDNICK +
478 (rfc1459) ERR_BANLISTFULL +
479 (rfc1459) ERR_LINKFAIL +
480 (rfc1459) ERR_CANNOTKNOCK +
481 (rfc1459) ERR_NOPRIVILEGES +
482 (rfc1459) ERR_CHANOPRIVSNEEDED +
483 (rfc1459) ERR_CANTKILLSERVER +
484 (rfc1459) ERR_ATTACKDENY +
485 (rfc1459) ERR_KILLDENY +
486 (rfc1459) ERR_HTMDISABLED +
491 (rfc1459) ERR_NOOPERHOST +
492 (rfc1459) ERR_NOSERVICEHOST +
501 (rfc1459) ERR_UMODEUNKNOWNFLAG +
502 (rfc1459) ERR_USERSDONTMATCH +
511 (rfc1459) ERR_SILELISTFULL +
512 (rfc1459) ERR_TOOMANYWATCH +
513 (rfc1459) ERR_NEEDPONG +
518 (rfc1459) ERR_NOINVITE +
519 (rfc1459) ERR_ADMONLY +
520 (rfc1459) ERR_OPERONLY +
521 (rfc1459) ERR_LISTSYNTAX +
600 (rfc1459) RPL_LOGON +
601 (rfc1459) RPL_LOGOFF +
602 (rfc1459) RPL_WATCHOFF +
603 (rfc1459) RPL_WATCHSTAT +
604 (rfc1459) RPL_NOWON +
605 (rfc1459) RPL_NOWOFF +
606 (rfc1459) RPL_WATCHLIST +
607 (rfc1459) RPL_ENDOFWATCHLIST +
610 (rfc1459) RPL_MAPMORE +
640 (rfc1459) RPL_DUMPING +
641 (rfc1459) RPL_DUMPRPL +
642 (rfc1459) RPL_EODUMP +
999 (rfc1459) ERR_NUMERICERR +
XC_TABOPEN (xchat) A new channel/nick/server tabs was created. +
XC_TABCLOSE (xchat) One of the channel/nick/server tabs was closed. +
XC_TABFOCUS (xchat) You changed focus to a new tab. +
XC_ADDNOTIFY (xchat) Add Notify +
XC_BANLIST (xchat) Ban List +
XC_BANNED (xchat) Banned +
XC_CHANGENICK (xchat) Change Nick +
XC_CHANACTION (xchat) Channel Action +
XC_HCHANACTION (xchat) Channel Action Hilight +
XC_CHANBAN (xchat) Channel Ban +
XC_CHANDATE (xchat) Channel Creation +
XC_CHANDEHOP (xchat) Channel DeHalfOp +
XC_CHANDEOP (xchat) Channel DeOp +
XC_CHANDEVOICE (xchat) Channel DeVoice +
XC_CHANEXEMPT (xchat) Channel Exempt +
XC_CHANHOP (xchat) Channel Half-Operator +
XC_CHANINVITE (xchat) Channel INVITE +
XC_CHANLISTHEAD (xchat) Channel List +
XC_CHANMSG (xchat) Channel Message +
XC_CHANMODEGEN (xchat) Channel Mode Generic +
XC_CHANMODES (xchat) Channel Modes +
XC_HCHANMSG (xchat) Channel Msg Hilight +
XC_CHANNOTICE (xchat) Channel Notice +
XC_CHANOP (xchat) Channel Operator +
XC_CHANRMEXEMPT (xchat) Channel Remove Exempt +
XC_CHANRMINVITE (xchat) Channel Remove Invite +
XC_CHANRMKEY (xchat) Channel Remove Keyword +
XC_CHANRMLIMIT (xchat) Channel Remove Limit +
XC_CHANSETKEY (xchat) Channel Set Key +
XC_CHANSETLIMIT (xchat) Channel Set Limit +
XC_CHANUNBAN (xchat) Channel UnBan +
XC_CHANVOICE (xchat) Channel Voice +
XC_CONNECTED (xchat) Connected +
XC_CONNECT (xchat) Connecting +
XC_CONNFAIL (xchat) Connection Failed +
XC_CTCPGEN (xchat) CTCP Generic +
XC_CTCPGENC (xchat) CTCP Generic to Channel +
XC_CTCPSEND (xchat) CTCP Send +
XC_CTCPSND (xchat) CTCP Sound +
XC_DCCCHATABORT (xchat) DCC CHAT Abort +
XC_DCCCONCHAT (xchat) DCC CHAT Connect +
XC_DCCCHATF (xchat) DCC CHAT Failed +
XC_DCCCHATOFFER (xchat) DCC CHAT Offer +
XC_DCCCHATOFFERING (xchat) DCC CHAT Offering +
XC_DCCCHATREOFFER (xchat) DCC CHAT Reoffer +
XC_DCCCONFAIL (xchat) DCC Conection Failed +
XC_DCCGENERICOFFER (xchat) DCC Generic Offer +
XC_DCCHEAD (xchat) DCC Header +
XC_MALFORMED (xchat) DCC Malformed +
XC_DCCOFFER (xchat) DCC Offer +
XC_DCCIVAL (xchat) DCC Offer Not Valid +
XC_DCCRECVABORT (xchat) DCC RECV Abort +
XC_DCCRECVCOMP (xchat) DCC RECV Complete +
XC_DCCCONRECV (xchat) DCC RECV Connect +
XC_DCCRECVERR (xchat) DCC RECV Failed +
XC_DCCFILEERR (xchat) DCC RECV File Open Error +
XC_DCCRENAME (xchat) DCC Rename +
XC_DCCRESUMEREQUEST (xchat) DCC RESUME Request +
XC_DCCSENDABORT (xchat) DCC SEND Abort +
XC_DCCSENDCOMP (xchat) DCC SEND Complete +
XC_DCCCONSEND (xchat) DCC SEND Connect +
XC_DCCSENDFAIL (xchat) DCC SEND Failed +
XC_DCCSENDOFFER (xchat) DCC SEND Offer +
XC_DCCSTALL (xchat) DCC Stall +
XC_DCCTOUT (xchat) DCC Timeout +
XC_DELNOTIFY (xchat) Delete Notify +
XC_DISCON (xchat) Disconnected +
XC_FOUNDIP (xchat) Found IP +
XC_IGNOREADD (xchat) Ignore Add +
XC_IGNORECHANGE (xchat) Ignore Changed +
XC_IGNOREFOOTER (xchat) Ignore Footer +
XC_IGNOREHEADER (xchat) Ignore Header +
XC_IGNOREREMOVE (xchat) Ignore Remove +
XC_IGNOREEMPTY (xchat) Ignorelist Empty +
XC_INVITE (xchat) Invite +
XC_INVITED (xchat) Invited +
XC_JOIN (xchat) Join +
XC_KEYPRESS (xchat) Key Press +
XC_KEYWORD (xchat) Keyword +
XC_KICK (xchat) Kick +
XC_KILL (xchat) Killed +
XC_MSGSEND (xchat) Message Send +
XC_MOTD (xchat) Motd +
XC_MOTDSKIP (xchat) MOTD Skipped +
XC_NICKCLASH (xchat) Nick Clash +
XC_NICKFAIL (xchat) Nick Failed +
XC_NODCC (xchat) No DCC +
XC_NOCHILD (xchat) No Running Process +
XC_NOTICE (xchat) Notice +
XC_NOTICESEND (xchat) Notice Send +
XC_NOTIFYEMPTY (xchat) Notify Empty +
XC_NOTIFYHEAD (xchat) Notify Header +
XC_NOTIFYNUMBER (xchat) Notify Number +
XC_NOTIFYOFFLINE (xchat) Notify Offline +
XC_NOTIFYONLINE (xchat) Notify Online +
XC_PART (xchat) Part +
XC_PARTREASON (xchat) Part with Reason +
XC_PINGREP (xchat) Ping Reply +
XC_PINGTIMEOUT (xchat) Ping Timeout +
XC_PRIVMSG (xchat) Private Message +
XC_DPRIVMSG (xchat) Private Message to Dialog +
XC_ALREADYPROCESS (xchat) Process Already Running +
XC_QUIT (xchat) Quit +
XC_RAWMODES (xchat) Raw Modes +
XC_WALLOPS (xchat) Receive Wallops +
XC_RESOLVINGUSER (xchat) Resolving User +
XC_SERVERCONNECTED (xchat) Server Connected +
XC_SERVERERROR (xchat) Server Error +
XC_SERVERLOOKUP (xchat) Server Lookup +
XC_SERVNOTICE (xchat) Server Notice +
XC_SERVTEXT (xchat) Server Text +
XC_STOPCONNECT (xchat) Stop Connection +
XC_TOPIC (xchat) Topic +
XC_TOPICDATE (xchat) Topic Creation +
XC_NEWTOPIC (xchat) Topic Change +
XC_UKNHOST (xchat) Unknown Host +
XC_USERLIMIT (xchat) User Limit +
XC_USERSONCHAN (xchat) Users On Channel +
XC_WHOIS5 (xchat) WhoIs Away Line +
XC_WHOIS2 (xchat) WhoIs Channel/Oper Line +
XC_WHOIS6 (xchat) WhoIs End +
XC_WHOIS4 (xchat) WhoIs Idle Line +
XC_WHOIS4T (xchat) WhoIs Idle Line with Signon +
XC_WHOIS1 (xchat) WhoIs Name Line +
XC_WHOIS3 (xchat) WhoIs Server Line +
XC_UJOIN (xchat) You Join +
XC_UPART (xchat) You Part +
XC_UPARTREASON (xchat) You Part with Reason +
XC_UKICK (xchat) You Kicked +
XC_UINVITE (xchat) Your Invitation +
XC_UCHANMSG (xchat) Your Message +
XC_UCHANGENICK (xchat) Your Nick Changing

+
Example:
on PRIVMSG example {
+  if { [string match -nocase "*[me]*" $_rest] } {
+    play mynick.wav
+    complete
+  }
+}
+
+on !opme example {
+  splitsrc
+  /op $_nick
+  complete
+}
+
+on XC_TABOPEN example {
+  switch [string index [channel] 0] {
+    "#" -
+    "&" -
+    "(" -
+    "" { return }
+  }
+  play attention.wav
+  print "Now in private conversation with [channel]."
+  complete
+}
Notes:All events starting with XC_ correspond to the events listed in the Settings->Lists->EventTexts window in XChat. All parameters are appended to $_raw, e.g: +
+
arg1 is [lindex $_raw 1] +
arg2 is [lindex $_raw 2] +
arg3 is [lindex $_raw 3] +
arg4 is [lindex $_raw 4]
See Also:alias, off
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:print - Print text to an xchat window/tab
Synopsis:
print ?server|context? ?channel|nick? text
Description:Prints text to a window. If a channel|nick is included, the text is printed to that channel/nick. You may also include a specific server.
Example:
# print text to the current window
+print "Hello, World!"
+
+# print text to the channel or nick window
+print #channel "Hello, World!"
+
+# print text to the channel window
+# belonging to a specific server.
+print irc.blahblah.com #channel "Hello, World!"
See Also:findcontext, getcontext, puts
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:queries - Returns a list of private queries.
Synopsis:
queries ?server|context?
Description:Returns a list of all private queries. If server is omitted, the server belonging to the current server is used by default.
Example:
alias myqueries {
+  foreach s [servers] {
+    print "Server: $s"
+    foreach q [queries $s] {
+      print " - Query: $q"
+    }
+  }
+  complete
+}
See Also:channels, chats, findcontext, getcontext
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:raw - Send a line directly to the server.
Synopsis:
raw ?server|context? ?channel|nick? text
Description:This command sends text directly to the server without further processing or interpretation by xchat. If server or channel|nick name is omitted, the current ones are used by default.
Example:
raw "PRIVMSG bubba :Howdy Bubba!"
See Also:command, findcontext, getcontext
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:server - Return the current server.
Synopsis:
server ?context?
Description:Returns the current server name (what the server claims to be).
Example:
print "I attempted to connect to [host] on [network]."
+print "I am actually connected to [server]."
See Also:findcontext, getcontext, host
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:servers - Returns of list of all servers you are on.
Synopsis:
servers
Description:Returns a list of all servers you are currently connected to.
Example:
alias mychannels {
+  foreach s [servers] {
+    print "Server: $s"
+    foreach c [channels $s] {
+      print " - Channel: $c - [topic $s $c]"
+    }
+  }
+  complete
+}
See Also:channel, channels, server
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:setcontext - Changes your current context to the one given.
Synopsis:
setcontext context
Description:Changes your current context to the one given. The argument context must have been returned by getcontext or findcontext.
Example:
set context [findcontext #channel]
+setcontext $context
Notes:This function is not normally needed with the tclplugin. It is included only to add completeness with the XChat C API.
See Also:findcontext, getcontext
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:timer - Executes tcl command after a certain number of seconds have passed.
Synopsis:
timer ?-repeat? ?-count times? seconds {script | procname ?args?}
Description:Executes a tcl command or script after a certain number of seconds have passed. +
+ +
+If the -repeat flag is included, it will will keep repeating until killed with killtimer. If the -count flag is added, it will repeat the number of times specified after the flag. In all other cases, it is executed only once.
Example:
timer 5 { /say Times up! }
Returns:timer ID code is to identify the timer with for use with other timer commands.
See Also:killtimer, timerexists, timers
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:timerexists - Returns 1 if the specified timer exists.
Synopsis:
timerexists timerID
Description:Determines of the specified timerID exists.
Returns:1 if the specified timer exists, 0 otherwise
See Also:killtimer, timer, timers
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:timers - Returns a list of timers currently active.
Synopsis:
timers
Description:Returns a list of active timers; each entry in the list contains the timerID, the number of seconds left till activation, the command that will be executed, the number of seconds specified, and the number of times left to be executed.
Example:
timer 5 { print "Important message coming soon!" }
+timer 10 { print "It is now 10 seconds later!  Yay!!!!!" }
+print "[timers]"
See Also:killtimer, timer, timerexists
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:topic - Returns the topic of a channel.
Synopsis:
topic ?server|context? ?channel?
Description:Returns the channel topic from the current channel or from a specific server and channel.
Example:
alias mychannels {
+  foreach s [servers] {
+    print "Server: $s"
+    foreach c [channels $s] {
+      print " - Channel: $c - [topic $s $c]"
+    }
+  }
+  complete
+}
See Also:channel, channels, findcontext, getcontext, users
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:users - Returns a list of users in a channel.
Synopsis:
users ?server|context? ?channel?
Description:Returns a list of all the users in a channel. The list consists of 4 elements; nick, hostmask, channel status and selected.
Example:
alias listusers {
+  print "- --------------- ----------------------------------------"
+  foreach user [users] {
+    print "[format "%-1s" [lindex $user 2]] [format "%-15s" [lindex $user 0]] [lindex $user 1]"
+  }
+}
See Also:channels, findcontext, getcontext, getlist, servers
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:version - Returns XChat version number.
Synopsis:
version
Description:Returns the full XChat version number.
Example:
print "I am using XChat version [version]"
See Also:xchatdir
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name:xchatdir - Returns the current xchat config directory.
Synopsis:
xchatdir
Description:Returns the current xchat config dir within your own user space.
Example:
print "My XChat config directory is [xchatdir]"
See Also:version
Downloads:Download recommended Tcl plugin support scripts.
+

+ + + + -- cgit 1.4.1