Further doc relocations and conversions

This commit is contained in:
Berke Viktor
2012-10-28 10:49:44 +01:00
parent fe6bda343b
commit 6a9e7bb4d3
13 changed files with 3914 additions and 785 deletions

View File

@@ -1,45 +0,0 @@
FiSHLiM
http://fishlim.kodafritt.se/
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 installation instructions, see the INSTALL file.
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
--------
/setkey [nick or #channel] password
Sets the encryption key for the nick or channel to password. The keys
are stored in the configuration file in ~/.xchat2/blow.ini
/delkey nick-or-#channel
Deletes the given nick or channel from the configuration file.

File diff suppressed because it is too large Load Diff

View File

@@ -1,475 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>XChat - IRC (chat) client for UNIX</title>
<style type="text/css">
body{font-family:sans-serif;background-color:#FFFBF0;}
:link{color:#00C;}
:visited{color:#609;}
:active{color:#C00;}
.date{background-color:#dddddd;font-family:terminal;font-size:small;}
th,td{font-family:sans-serif;}
h2{font-family:sans-serif;color:#990066;}
</style></head>
<body>
<h1><center>This interface is deprecated</center></h1>
<table width="90%" cellpadding="0" cellspacing="0" border="0">
<tbody><tr>
<td align="left" valign="top">
<blockquote>
<h2>Xchat Perl Docs</h2>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial" color="#990066">
Introduction
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
<p>Good Hello!</p>
<p>The purpose of this page is to give people some quick documentation on the
things that they will encounter when they try to code scripts for X-Chat.
It is <strong>not</strong> meant to be a comprehensive programming tutorial,
by any means. If that's what you're looking for, then you can just keep on
looking.</p>
<p>If you're going to do any scripting with X-Chat at all, you will
need to know perl. It also won't hurt to have had experience writing tcl for
eggdrops or ircII scripts. Otherwise you're going to have to be very careful
to avoid creating conditions which could flood you offline or do other
not-so-optimal things. ;) Thankfully, it shouldn't take most intelligent
people more than a week (month on the outside) enough perl to do some nice
things in it.
<a HREF="http://www.perl.com">Perl</a> is a very flexible language.</p>
<p>You should probably also go read (or at least skim over and then carefully
bookmark this copy of the thing that defines how IRC works: <a HREF="http://www.irchelp.org/irchelp/rfc1459.html">RFC 1459</a>.
Other documents that scripters might find useful would be this
<a HREF="http://www.irchelp.org/irchelp/ircd/numerics.html">nice list of server
numerics</a>, and this list of <a HREF="http://www.irchelp.org/irchelp/ircd/hybrid6.html">changes
for Hybrid 6</a> which is something everyone on EFNet should read. In fact, I
<strong>strongly</strong> suggest saving copies of these documents to your local
hard drive, because you <i>will</i> be back to look at them again soon.</p>
<p>One last thing... While you may hear that RFC 1459 isn't being followed very
well, and this is partly true, do your absolute best to stick with RFC-compliant
behaviours anyway because otherwise there's a good chance that your script will
never interoperate properly with others, or at least just piss off a lot of other
people. <i>Pay special attention to section 2.2 of the RFC.</i></p>
</blockquote>
<table ALIGN=CENTER WIDTH="75%" CELLPADDING=5 CELLSPACING=0>
<tr><td ALIGN=CENTER BGCOLOR="#FF7070">
<font COLOR="#FFFFFF" FACE="Verdana, Helvetica, Arial, Sans"><b>Standard Disclaimer</b>
</font>
</td></tr><tr> <td BGCOLOR="#FFCECE" ALIGN=CENTER><font COLOR="#800000" FACE="Helvetica, Lucida, Arial, Sans">
This documentation is provided on an "as-is" basis and comes with no warranty of accuracy or usefulness, either expressed or implied. It is subject to change without any notice, and may contain omissions or errors which could cause your genitalia to shrivel and fall off, or spontaneously combust. If you have any further questions,<br>please feel free to seek professional help.</font>
</td></tr></table>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial" color="#990066;">
About Handlers
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
There are [currently] four basic ways to make things call the subroutines you write for X-Chat and they are:
<ul><li>message handlers - Triggered by messagse sent from the IRC server to your client</li>
<li>command handlers - triggered by / commands typed in by the user at the keyboard</li>
<li>timeout handlers - triggered by gtk+</li>
<li>print handlers - triggered just before xchat calls its built in print handlers for events</li></ul>
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial" color="#990066;">
About Exit Codes
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
These are very important. Every time you set up a handler, it takes precedent over the built-in functions and commands of X-Chat. That is, whatever thing which triggered your subroutine will go to your code before it goes to X-Chat to be dealt with. In this way you can replace almost every built-in function that the client has with your own routines. The thing to remember is that if your code exits by hitting the end of your subroutine, or by a plain 'return' statement, processing of the event will go on to whatever other things have set up hooks for the event, and then (provided nothing else exits with a return value of 1) to X-Chat itself. There is only one problem with this, (which is solved by the brokering handler that I'll explain that later) and that is that you cannot really control what order the custom routines get called. Normally they will execute in order of which ones were installed first, but a single script has no real way of knowing this. Beware.
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial" color="#990066;">
About @_
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
If you've never heard of @_ before, then you've obviously not coded in perl. When a message handler triggers, the raw line from the IRC server is passed to the subroutine you specify in @_. When a command handler is triggered, only the arguments are passed to the routine through @_ and they are not broken into a list, but left as one long string. You'll have to parse those yourself with split. (I advise using s/\s+/ /g to collapse the blank space to single space first.) When a timer handler is triggered, I *think* absolutely nothing is passed in @_, but it's not like anything terrifically important could be passed along anyway. Be especially careful when setting up message handlers for mode changes, since the modes are not broken up into individual events like they are with eggdrop. The upside of this is that X-Chat has no mode hooks of it's own, so you don't have to worry about it too much. (This is not the case with the brokering handler, however.)
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial" color="#990066;">
About Context
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
There are some really nice things about coding for X-Chat, and the biggest one is that it's fairly good about determining the proper context for things. If a server sends something that triggers a message handler, then you can be sure that unless you specify otherwise, that your IRC::print or IRC::command function call will go back to that server and that server alone. If you really really need to know what the current context is, use the IRC::get_info function as detailed below.
</blockquote>
<hr width="95%">
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial" color="#990066;">
script initialization commands
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::register(scriptname, version, shutdownroutine, unused);
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
<p>This is the first function your script should call, example:</p>
<blockquote><p>IRC::register ("my script", "1.0", "", "");</p></blockquote>
<p>The "shutdownroutine" arg is a function that will be called when X-Chat shuts down, so you get a chance to save config files etc. You can omit this arg, it is optional. The "unused" arg is reserved for future use, for now just provide "". This function also returns X-Chat's version number. </p>
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial" color="#990066;">
Handler initialization commands
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::add_message_handler(message, subroutine_name);
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
<p>This function allows you to set up hooks to subroutines so that when a particular message arrives from the IRC server that you are connected to, it can be passed to a subroutine to be dealt with appropriately. The message argument is essentially the second solid token from the raw line sent by the IRC server, and X-Chat doesn't know that some numeric messages have associated text messages, so for now set up a handler for both if you want to be sure odd servers don't screw up your expectations. (Read: fear IRCNet.) The entire line sent by the IRC server will be passed to your subroutine in @_. For the completely uninitiated, messages are things like 'PRIVMSG', 'NOTICE', '372', etc.</p>
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::add_command_handler(command, subroutine_name);
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
<p>This function allows you to set up hooks for actual commands that the user can type into the text window. The arguments are passed to the subroutine via @_, and arrive as a single string. @_ will be null if no arguments are supplied. It's recommended that you be sure and collapse the excess whitespace with s/\s+/ /g before attempting to chop the line up with split. As mentioned earlier, exiting with an undefined return value will allow the command to be parsed by other handlers, while using a return value of 1 will signal the program that no further parsing needs to be done with this command.</p>
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::add_timeout_handler(interval, subroutine_name);
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
<p>This function allows you to set up hooks for subroutines to be called at a particular interval. The interval is measured in milliseconds, so don't use a particularly small value unless you wish to drive the CPU load through the roof. 1000ms = 1 second. No values will be passed to the routine via @_ and return values don't affect anything either.</p>
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::add_print_handler(message, subroutine_name);
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
<p>This function allows you to catch the system messages (those who generally start by three stars) and to execute a function each time an event appear. The events are those you can see in "Settings->Edit Events Texts". message is the name of the event (you can find it in the Edit Events box, "Events" column) , subroutine_name is the name of the function that will get messages. Be carrful: all the arguments are sent to function in $_[0] separated by spaces. </p>
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial" color="#990066;">
Output commands
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::print(text);
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
This is a very simple routine. All it does is put the contents of the text string to the current window. The current window will be whichever window a command was typed into when called from a command handler, or in whichever window the message command is appropriate to if it is called from within a message handler. As with any perl program, newlines are not assumed, so don't forget to end the line with \n if you don't want things to look screwey.
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::print_with_channel( text, channelname, servername );
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
This routine does the same thing as IRC::Print does, except it allows you to direct the output to a specific window. It returns 1 on success, 0 on fail.
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::command(text);
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
This routine allows you to execute commands in the current context. The text string containing the command will be parsed by everything that would normally parse a command, including your own command handlers, so be careful. Newlines are assumed, thankfully.
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::command_with_server(text, servername);
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
This routine allows you to specify the context of the server for which the command will be executed. It's not particularly useful unless you're managing a connection manually, yet the command still exists for it's usefulness in doing things like managing a bnc connection, etc. Newlines are assumed here as well.
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::send_raw(text);
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
This routine is very useful in that it allows you to send a string directly to the IRC server you are connected to. It is assumed that the server will be the one you first connected to if there is no clear context for the command, otherwise it will go to whatever server triggered the message handler or command handler window. You must specify newlines here always or you can be guaranteed that strange things will happen. The text message you specify should be a proper RAW IRC message, so don't play with it if you don't know how to do these. Additionally, while newlines are also not assumed here as with the IRC::print function, the RFC specifies that newlines are a CR+LF pair, even if most servers will accept a mere newline. It's best to play it safe and use \r\n instead of just \n.
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial" color="#990066;">
Information retrieval commands
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::get_info(integer);
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
This function returns a bit of selected information depending on what the value of the integer is.
Here's a list of the currently supported values:
<ul><li>0 - xchat version</li>
<li>1 - your nickname</li>
<li>2 - channel</li>
<li>3 - server</li>
<li>4 - xchatdir</li>
<li>5 - away status</li>
<li>6 - network name</li>
<li>7 - server hostname</li>
<li>8 - channel topic</li></ul>
<p>If you are requesting information that isn't available in the current context, then it will return null.</p>
<p>Any numbers other than the above will return an error message.</p>
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::get_prefs(var);
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
This command lets you read the preferences that are set in the xchat configuration file. Just look at the xchat.conf dir to see what variables are available to use with this command. Returns the value of the variable requested or "Unknown Variable" if the variable isn't available.
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::user_info( nickname );
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
Returns a flat list of information on the nickname specified consisting of... nickname, nick host, and whether they have op or voice in the current context.
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::channel_list( );
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
This command returns a flat list which contains the current channel, server, and nickname for all channels the client is currently in. You'll have to break the list up into groups of three yourself. No arguments are necessary, or used [currently].
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::server_list( );
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
This command returns a flat list of servers. (Note, it is incompatible with xchat 1.8 in that it also returns a list of servers you are NOT connected to as well.)
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::user_list(channel, server);
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
<p>Works very much like the dcc_list command below, except that is returns information about the users on the channel provided as first argument. The second argument is the server and is optional.</p>
<p>NOTE: If a user has both op and voice, only the op flag will be set to 1 by this command in xchat2.</p>
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::user_list_short(channel, server);
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
<p>A simpler version of IRC::user_list that returns pairs of nick & user@host suitable for assigning to a hash.</p>
<p>NOTE: If a user has both op and voice, only the op flag will be set to 1 by this command in xchat2.</p>
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::dcc_list( );
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
This command does essentially the same thing as channel_list, giving you the details of each DCC connection currently in progress. I have no idea exactly what is returned because I haven't had a chance to poke at this one much, but suffice it to say that it's a flat list, and the first time you play with it the meaning of the returned values should be pretty obvious.
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial">
IRC::ignore_list( );
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
This command returns a flat list of the contents of your ignore list. You'll have to play with it a little as I have not had a chance to yet. Works basically the same as the other list commands.
</blockquote>
<table width="95%" cellpadding="0" cellspacing="3" border="0" align="center">
<tbody><tr><td bgcolor="#000000">
<table width="100%" cellpadding="2" cellspacing="1" border="0"><tbody><tr>
<td width="20%" align="left" bgcolor="#dddddd">
<font face="Lucida, Helvetica, Arial" color="#990066;">
Unimplemented commands that were available in xchat 1.8.x
</font></td>
</tr></tbody></table>
</td></tr></tbody></table>
<blockquote>
add_user_list , sub_user_list , clear_user_list, notify_list were available in xchat 1.8.x but are not implemented in xchat 2 at this time.
</blockquote>
</blockquote>
</td>
</tr>
</tbody></table>
<br><hr>
<font size="-10">This document originally written by Dagmar d'Surreal on March 26th, 1998 for xchat 1.4<br>
Updated on July 30th, 1999 by Peter Zelezny<br>
Updated on May 16th, 2003 by DaNumber8 to comply with the perl plugin for xchat2 version 2.0.3</font>
</body></html>

File diff suppressed because it is too large Load Diff

View File

@@ -1,545 +0,0 @@
% 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 <filename> Load module with given filename.
/py unload <filename|module name> Unload module with given filename, or module name.
/py reload <filename|module name> Reload module with given filename, or module name.
/py list List Python modules loaded.
/py exec <command> 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 <message> 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`

View File

@@ -1,55 +0,0 @@
Please read this document before asking questions.
(1) WHAT IS THE TCL PLUGIN?
The XChat Tcl Plugin adds the complete Tcl scripting language to the
XChat 1.9.x and 2.x IRC client. The design philosophy behind the tcl
plugin was to give all the power of the C API. yet completely shield
the user from all the complexities of it. It is lightly modeled after
after Xircon; an old windows TCL enabled client with a little bit of
eggdrop functionality to it.
Features:
* Uses the popular TCL scripting language.
* Familiar to eggdrop bot owners.
* Adds many new XChat specific commands to the Tcl language for
handling of events, user commands, timers, etc.
* It's actually documented! (Hey, what a concept!)
* Works with XChat 1.9.x and 2.x.
* Open source (GPL)
The supplied documentation for Tcl Plugin commands can be
found in doc/tclplugin.html
For a comprehensive list of IRC server tokens, see
doc/tokens.txt
(2) HOW TO GET TCL PLUGIN
You can always find the latest version of the Tcl Plugin at:
http://www.scriptkitties.com/tclplugin
You must also have Tcl 8.3 or higher installed on your system.
Tcl can be obtained from:
http://sourceforge.net/projects/tcl
http://tcl.activestate.com (pre-compiled binaries)
Tcl Man Pages
http://tcl.activestate.com/man/
Tcl Tutorials:
http://hegel.ittc.ukans.edu/topics/tcltk/tutorial-noplugin/
http://jan.netcomp.monash.edu.au/ProgrammingUnix/tcl/tcl_tut.html
http://users.belgacom.net/bruno.champagne/tcl.html
(3) QUICK STARTUP
SEE 'INSTALL'