diff --git a/configure.in b/configure.in index 99794c467..3c98ee91f 100644 --- a/configure.in +++ b/configure.in @@ -402,6 +402,8 @@ esac AC_OUTPUT([Makefile doc/Makefile + doc/fr/Makefile + doc/en/Makefile src/Makefile src/common/Makefile src/irc/Makefile diff --git a/doc/Makefile.am b/doc/Makefile.am index ec9d20969..66ab6651e 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (c) 2003-2005 FlashCode +# Copyright (c) 2003-2006 FlashCode # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,17 +12,11 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # +SUBDIRS = fr en + man_MANS = weechat-curses.1 -info_TEXINFOS = weechat_doc_fr.texi weechat_doc_en.texi \ - weechat_doc_es.texi weechat_doc_pt.texi - -#weechat_TEXINFOS = weechat_doc_fr.texi weechat_doc_en.texi \ -# weechat_doc_es.texi weechat_doc_pt.texi - -AM_MAKEINFOHTMLFLAGS = --no-split --number-sections - -EXTRA_DIST = $(man_MANS) +EXTRA_DIST = $(man_MANS) weechat-doc.css weechat-html-one.xsl weechat-html.xsl diff --git a/doc/buildxml.pl b/doc/buildxml.pl new file mode 100755 index 000000000..0b578c2bf --- /dev/null +++ b/doc/buildxml.pl @@ -0,0 +1,169 @@ +#!/usr/bin/perl +# +# Copyright (c) 2003-2006 FlashCode +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +# +# Build some XML code for WeeChat doc +# with weechat-curses command +# + +@all_lang = ("fr_FR", "en_US"); +%all_encodings = ("fr_FR" => "iso-8859-1", + "en_US" => "iso-8859-1"); +%all_types = ("fr_FR" => "type", + "en_US" => "type", + "es_ES" => "tipo"); +%all_values = ("fr_FR" => "valeurs", + "en_US" => "values", + "es_ES" => "valores"); +%all_default = ("fr_FR" => "valeur par défaut", + "en_US" => "default values", + "es_ES" => "valor por defecto"); +%all_desc = ("fr_FR" => "description", + "en_US" => "description", + "es_ES" => "descripción"); + +foreach $lng (@all_lang) +{ + create_commands ($lng, $all_encodings{$lng}, + "weechat-curses -w | tail +3", "weechat_commands"); + create_commands ($lng, $all_encodings{$lng}, + "weechat-curses -i | tail +3", "irc_commands"); + create_key_func ($lng, $all_encodings{$lng}, + "weechat-curses -f | tail +3", "key_functions"); + create_config ($lng, $all_encodings{$lng}, + "weechat-curses -c | tail +3", "config"); + print "\n"; +} + +sub create_commands +{ + $lang = $_[0]; + $lang2 = substr ($lang, 0, 2); + $encoding = $_[1]; + $command = $_[2]; + $file = $_[3]; + print "Creating $lang2/$file.xml ($lang)...\n"; + open XML, ">$lang2/$file.xml" or die "Error: can't write file!"; + print XML "\n"; + + $started = 0; + $ENV{"LANG"} = $lang; + foreach (`$command`) + { + if (/\* (.*)/) + { + print XML "\n" if ($started == 1); + $started = 1; + print XML "$1\n"; + print XML ""; + } + else + { + chomp ($_); + print XML "$_\n"; + } + } + print XML "\n"; + close XML; + iconv_file ($lang2."/".$file, $encoding); +} + +sub create_key_func +{ + $lang = $_[0]; + $lang2 = substr ($lang, 0, 2); + $encoding = $_[1]; + $command = $_[2]; + $file = $_[3]; + print "Creating $lang2/$file.xml ($lang)...\n"; + open XML, ">$lang2/$file.xml" or die "Error: can't write file!"; + print XML "\n"; + + $ENV{"LANG"} = $lang; + foreach (`$command`) + { + if (/\* (.*): (.*)/) + { + print XML "\n"; + print XML " $1\n"; + print XML " $2\n"; + print XML "\n"; + } + } + close XML; + iconv_file ($lang2."/".$file, $encoding); +} + +sub create_config +{ + $lang = $_[0]; + $lang2 = substr ($lang, 0, 2); + $encoding = $_[1]; + $command = $_[2]; + $file = $_[3]; + print "Creating $lang2/$file.xml ($lang)...\n"; + open XML, ">$lang2/$file.xml" or die "Error: can't write file!"; + print XML "\n"; + $type = ""; + $values = ""; + $default = ""; + $desc = ""; + + $ENV{"LANG"} = $lang; + foreach (`weechat-curses -c`) + { + if (/\* (.*):/) + { + print XML "\n"; + print XML " \n"; + } + elsif (/ \. $all_types{$lang}: (.*)/) + { + $type = $1; + } + elsif (/ \. $all_values{$lang}: (.*)/) + { + $values = $1; + } + elsif (/ \. $all_default{$lang}: (.*)/) + { + $default = $1; + } + elsif (/ \. $all_desc{$lang}: (.*)/) + { + $_ = $1; + s/(.*)/\u$1/; + $desc = $_; + print XML " ".$type."\n"; + print XML " ".$values."\n"; + print XML " ".$default."\n"; + print XML " ".$desc."\n"; + print XML "\n"; + } + } + close XML; + iconv_file ($lang2."/".$file, $encoding); +} + +sub iconv_file +{ + print "Converting $_[0].xml to $_[1]...\n"; + system ("iconv -t $encoding -o $_[0].xml.$_[1] $_[0].xml"); + system ("mv $_[0].xml.$_[1] $_[0].xml"); +} diff --git a/doc/en/Makefile.am b/doc/en/Makefile.am new file mode 100644 index 000000000..6baa7cc0d --- /dev/null +++ b/doc/en/Makefile.am @@ -0,0 +1,59 @@ +# Copyright (c) 2003-2006 FlashCode +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +LANGCODE = en +BOOK = weechat.$(LANGCODE) +BOOK_INCLUDE = weechat_commands.xml irc_commands.xml key_functions.xml config.xml + +EXTRA_DIST = $(BOOK).xml $(BOOK_INCLUDE) + +docdir = $(datadir)/doc/$(PACKAGE) + +all-local: html-stamp + +# HTML output with chunks (many pages) + +html: html-stamp + +html-stamp: $(BOOK).xml $(BOOK_INCLUDE) ../weechat-html.xsl ../weechat-doc.css + mkdir -p html/ + xsltproc -o html/ ../weechat-html.xsl $(BOOK).xml || true + cp ../weechat-doc.css html/ + touch html-stamp + +# HTML output, all in one page + +html1: html1-stamp + +html1-stamp: $(BOOK).xml $(BOOK_INCLUDE) ../weechat-html-one.xsl ../weechat-doc.css + mkdir -p html1/ + xsltproc -o html1/$(BOOK).html ../weechat-html-one.xsl $(BOOK).xml || true + cp ../weechat-doc.css html1/ + touch html1-stamp + +# install docs + +install-data-hook: + $(mkinstalldirs) $(DESTDIR)$(docdir)/html/$(LANGCODE)/ + $(INSTALL_DATA) html/* $(DESTDIR)$(docdir)/html/$(LANGCODE)/ + +# clean + +clean-local: + -rm -f *.html *.pdf *.txt + -rm -rf html/ html1/ + -rm -f html-stamp html1-stamp diff --git a/doc/en/weechat.en.xml b/doc/en/weechat.en.xml new file mode 100644 index 000000000..6ac8678c7 --- /dev/null +++ b/doc/en/weechat.en.xml @@ -0,0 +1,3483 @@ + + + + + + + + +]> + + + + + + WeeChat 0.1.7-cvs - User guide + Fast, light and extensible IRC client + + + Sébastien + Helleu + flashcode AT flashtux.org + + + + 2006 + Sébastien Helleu + + + + + This manual is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA + + + + + + This manual documents WeeChat IRC client, it is part of WeeChat. + + + Latest version of this document can be found on this page: + + http://weechat.flashtux.org/doc.php + + + + + + + + + + Introduction + + + This chapter describes WeeChat and pre-requisites for its installation. + + +
+ Description + + + WeeChat (Wee Enhanced Environment for Chat) is a free + IRC client, fast and light, designed for many + operating systems. + + + + Main features are: + + + + multi-servers connection (with SSL, IPv6, proxy) + + + + + many GUI: Curses, wxWidgets, Gtk and Qt + + + + + small, fast and light + + + + + customizable and extensible with plugins and scripts + + + + + compliant with RFCs + 1459, + 2810, + 2811, + 2812 and + 2813 + + + + + multi-platform (GNU/Linux, *BSD, MacOS X, Windows and other) + + + + + 100% GPL, free software + + + + + + + WeeChat homepage is here: + + http://weechat.flashtux.org + + + +
+ +
+ Pre-requisites + + + In order to install WeeChat, you need: + + + + a running GNU/Linux system (with compiler tools for source + package) + + + + + "root" privileges (to install WeeChat) + + + + + according to GUI, one of the following libraries: + + + + Curses: ncurses library + + + + + Gtk: *** GUI not developed *** + + + + + WxWidgets: *** GUI not developed *** + + + + + Qt: *** GUI not developed *** + + + + + + + + +
+
+ + + + + Installation + + + This chapter explains how to install WeeChat. + + +
+ Binary packages + + + Binary packages are available for these distributions: + + + + Debian (or any Debian compatible distribution): + apt-get install weechat + + + + + Mandriva/RedHat (or any RPM compatible distribution): + + rpm -i /chemin/weechat-x.y.z-1.i386.rpm + + + + + + Gentoo : + emerge weechat + + + + + For other distributions, please look at your manual for + installation instructions. + + +
+ +
+ Source package + + + All you have to do is to run in a console or a terminal: +$ ./configure +$ make + + + Then get root privileges and install WeeChat: +$ su +(enter root password) +# make install + + +
+ +
+ CVS sources + + + Warning: CVS sources are for advanced users: it may not compile + or not be stable. You're warned! + + + + To get CVS sources, issue this command: +$ cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/weechat co weechat + + + + Execute this script: + ./autogen.sh + + + + Then follow instructions for source package + (see ) + + +
+ +
+ + + + + Usage + + + This chapter explains how to run WeeChat, the default key bindings + used, internal and IRC commands, setup file, and FIFO pipe use. + + +
+ Run WeeChat + + + Command line arguments: + + + + + Parameter + Description + + + + + -a, --no-connect + + Disable auto-connect to servers at startup + + + + -c, --config + + Display config help (list of options) + + + + -f, --key-functions + + Display WeeChat internal functions for keys + + + + -h, --help + + Display help + + + + -i, --irc-commands + + Display IRC commands list + + + + -k, --keys + + Display WeeChat default keys + + + + -l, --license + + Display WeeChat license + + + + -p, --no-plugin + + Disable plugins auto-load + + + + -v, --version + + Display WeeChat version + + + + -w, --weechat-commands + + Display WeeChat commands list + + + + + + + + + It is also possible to give URL for one or many IRC servers, as + follow: + irc[6][s]://[pseudo[:mot_passe]@]irc.example.org[:port][/channel][,channel[...] + Example to join #weechat and #toto on + "irc.freenode.net" server, default port (6667), + with "nono" nick: + $ weechat-curses irc://nono@irc.freenode.net/#weechat,#toto + + + + To start WeeChat, issue this command: + + + + for Curses GUI: weechat-curses + + + + + for Gtk GUI: weechat-gtk + + + + + for wxWidgets GUI: weechat-wxwidgets + + + + + for Qt GUI: weechat-qt + + + + + + + When you run WeeChat for the first time, a default configuration + file is created, with default options. + The default configuration file is: + "~/.weechat/weechat.rc" + + + + You can edit thie file at your convenience to configure WeeChat + (ONLY if WeeChat is not running), or you can set parameters with + "/set" command in WeeChat + (see ) + + +
+ +
+ Key bindings + + + + + + + Key + Action + + + + + Left arrow + + Go to previous char in command line + + + + Right arrow + + Go to next char in command line + + + + Ctrl + left arrow + + Go to previous word in command line + + + + Ctrl + right arrow + + Go to next word in command line + + + + Home / Ctrl + A + + Go to the beginning of command line + + + + End / Ctrl + E + + Go to the end of command line + + + + Ctrl + K + + Delete from cursor until end of command line + + + + Ctrl + L + + Redraw whole window + + + + Ctrl + U + + Delete from cursor until beginning of command line + + + + Ctrl + W + + Delete previous word of command line + + + + Backspace + + Delete previous char in command line + + + + Delete + + Delete next char in command line + + + + Tab + + Complete command or nick + (Tab again: find next completion) + + + + Any char + + Insert char at cursor position in command line + + + + Enter + + Execute command or send message + + + + Up arrow / Down arrow + + Call again last commands/messages + + + + Ctrl + up arrow / Ctrl + down arrow + + Call again last commands/messages in global history + (common for all buffers) + + + + PageUp / PageDown + + Show buffer history + + + + F5 / Alt + left arrow + + Switch to previous buffer + + + + F6 / Alt + right arrow + + Switch to next buffer + + + + F7 + + Switch to previous window + + + + F8 + + Switch to next window + + + + F10 + + Remove last infobar message + + + + F11 / F12 + + Scroll nicklist + + + + Alt + Home / Alt + End + + Go to the beginning / the end of nicklist + + + + Alt + A + + Switch to next buffer with activity + (with priority: highlight, message, other) + + + + Alt + B + + Go to previous word in command line + + + + Alt + D + + Delete next word in command line + + + + Alt + F + + Go to next word in command line + + + + Alt + H + + Clear hotlist + (activity notification on other buffers) + + + + Alt + J then Alt + D + + Display DCC buffer + + + + Alt + J then Alt + L + + Switch to last buffer + + + + Alt + J then Alt + S + + Switch to server buffer + + + + Alt + J puis Alt + X + + Switch to first channel of next buffer + (or server buffer if no channel is opened) + + + + Alt + digit (0-9) + + Switch to buffer by number (0 = 10) + + + + Alt + J then number (01-99) + + Switch to buffer by number + + + + Alt + K + + Grab a key and insert its code in command line + + + + Alt + N + + Scroll to next highlight + + + + Alt + P + + Scroll to previous highlight + + + + Alt + R + + Delete entire command line + + + + Alt + S + + Switch servers on servers buffer + (if option "look_one_server_buffer" is enabled) + + + + Alt + U + + Scroll to first unread line in buffer + + + + Alt + W then Alt + flèche + + Switch to window with direction + + + + + + + +
+ +
+ WeeChat / IRC commands + + + This chapter lists all WeeChat and IRC commands. + + +
+ WeeChat commands + + + &weechat_commands.xml; + + +
+ +
+ Key functions + + + + + + + Function + Description + + + + + &key_functions.xml; + + + + + + +
+ +
+ IRC commands + + + &irc_commands.xml; + + +
+ +
+ +
+ Configuration file + + + List of options for config file: + + + + + Option + Type + Values + Default + Description + + + + + &config.xml; + + + + + + + + Colors for Curses GUI are: + + + + + Keyword + Color + + + + + default + default color (transparent for background) + + + black + black + + + red + dark red + + + lightred + light red + + + green + dark green + + + lightgreen + light green + + + brown + brown + + + yellow + yellow + + + blue + dark blue + + + lightblue + light blue + + + magenta + dark magenta + + + lightmagenta + light magenta + + + cyan + dark cyan + + + lightcyan + light cyan + + + white + white + + + + + + +
+ +
+ FIFO pipe + + + You can remote control WeeChat, by sending commands or text to a + FIFO pipe (you have to enable option "irc_fifo_pipe", it is disabled + by default). + + + + The FIFO pipe is located in "~/.weechat/" and is + called "weechat_fifo_xxxxx" (where xxxxx is the process ID (PID) of + running WeeChat). So if many WeeChat are running, you have many FIFO + pipes, one for each session. + + + + The syntax for the FIFO pipe commands/text is: + server,channel *text or command here + where server and channel are optional, but if channel is here, server + should be too. + + + + Some examples: + + + + nick change on freenode to "mynick|out" : + $ echo "freenode */nick mynick|out" >~/.weechat/weechat_fifo_12345 + + + + + display text on #weechat channel: + $ echo "freenode,#weechat *hello everybody!" >~/.weechat/weechat_fifo_12345 + + + + + display text on current channel (buffer displayed by WeeChat): + $ echo "*hello!" >~/.weechat/weechat_fifo_12345 + Warning: this is dangerous and you should + not do that except if you know what you do! + + + + + send two commands to unload/reload Perl scripts (you have to + separate them with "\n"): + $ echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345 + + + + + + + You can write a script to send command to all running WeeChat at same + time, for example: + +#!/bin/sh +if [ $# -eq 1 ]; then + for fifo in $(/bin/ls ~/.weechat/weechat_fifo_* 2>/dev/null); do + echo -e "$1" >$fifo + done +fi + + If the script is called "auto_weechat_command", you can run it with: + $ ./auto_weechat_command "freenode,#weechat *hello" + + +
+ +
+ + + + + Plugins + + + This chapter describes WeeChat plugins interface (API) and + the default scripts plugins (Perl, Python, Ruby), provided with + WeeChat. + + +
+ Plugins in WeeChat + + + A plugin is a C program which can call WeeChat functions defined in + an interface. + + + + This C program does not need WeeChat sources to compile and can be + dynamically loaded into WeeChat with command + /plugin. + + + + The plugin has to be a dynamic library, for dynamic loading by + operating system. + Under GNU/Linux, the file has ".so" extension, ".dll" under + Windows. + + +
+ +
+ Write a plugin + + + The plugin has to include "weechat-plugin.h" file (available in + WeeChat source code). + This file defines structures and types used to communicate with + WeeChat. + + + + The plugin must have some variables and functions (mandatory, + without them the plugin can't load): + + + + + Variable + Description + + + + + char plugin_name[] + plugin name + + + char plugin_version[] + plugin version + + + char plugin_description[] + short description of plugin + + + + + + + + + + Function + Description + + + + + int weechat_plugin_init (t_weechat_plugin *plugin) + + function called when plugin is loaded, must return + PLUGIN_RC_OK if successful, PLUGIN_RC_KO if error + (if error, plugin will NOT be loaded) + + + + void weechat_plugin_end (t_weechat_plugin *plugin) + function called when plugin is unloaded + + + + + + +
+ API functions + +
+ ascii_strcasecmp + + + Prototype: + + int ascii_strcasecmp (t_weechat_plugin *plugin, + char *string1, char *string2) + + + + Locale and case independent string comparison. + + + Arguments: + + + + : pointer to plugin structure + + + + + : first string for comparison + + + + + : second string for comparison + + + + + + Return value: difference between two strings: negative if + string1 < string2, zero if string1 == string2, positive if + string1 > string2 + + + Example: + if (plugin->ascii_strcasecmp (plugin, "abc", "def") != 0) ... + +
+ +
+ ascii_strncasecmp + + + Prototype: + + int ascii_strncasecmp (t_weechat_plugin *plugin, + char *string1, char *string2, int max) + + + + Locale and case independent string comparison, for "max" chars. + + + Arguments: + + + + : pointer to plugin struct + + + + + : first string for comparison + + + + + : second string for comparison + + + + + : max number of chars for comparison + + + + + + Return value: difference between two strings: negative if + string1 < string2, zero if string1 == string2, positive if + string1 > string2 + + + Example: + if (plugin->ascii_strncasecmp (plugin, "abc", "def", 2) != 0) ... + +
+ +
+ explode_string + + + Prototype: + + char **explode_string (t_weechat_plugin *plugin, char *string, + char *separators, int num_items_max, int *num_items) + + + + Explode a string according to one or more delimiter(s). + + + Arguments: + + + + : pointer to plugin struct + + + + + : string to explode + + + + + : delimiters used for explosion + + + + + : maximum number of items + created (0 = no limit) + + + + + : pointer to int which will + contain number of items created + + + + + + Return value: array of strings, NULL if problem. + + + Note: result has to be free by a call to "free_exloded_string" + after use. + + + Example: + +char **argv; +int argc; +argv = plugin->explode_string (plugin, string, " ", 0, &argc); +... +if (argv != NULL) + plugin->free_exploded_string (plugin, argv); + + +
+ +
+ free_exploded_string + + + Prototype: + + char **free_exploded_string (t_weechat_plugin *plugin, + char **string) + + + + Free memory used by a string explosion. + + + Arguments: + + + + : pointer to plugin structure + + + + + : string exploded by + "explode_string" function + + + + + + Return value: none. + + + Example: + +char *argv; +int argc; +argv = plugin->explode_string (plugin, string, " ", 0, &argc); +... +if (argv != NULL) + plugin->free_exploded_string (plugin, argv); + + +
+ +
+ exec_on_files + + + Prototype: + + void exec_on_files (t_weechat_plugin *plugin, char *repertoire, + int (*callback)(t_weechat_plugin *, char *)) + + + + Execute a function on all files of a directory. + + + Arguments: + + + + : pointer tu plugin structure + + + + + : directory for searching files + + + + + : function called for each file + found + + + + + + Return value: none. + + + Example: + +int callback (t_weechat_plugin *plugin, char *file) +{ + plugin->printf_server (plugin, "file: %s", file); + return 1; +} +... +plugin->exec_on_files (plugin, "/tmp", &callback); + + +
+ +
+ printf + + + Prototype: + + void printf (t_weechat_plugin *plugin, + char *server, char *channel, char *message, ...) + + + + Display a message on a WeeChat buffer, identified by server and + channel (both may be NULL for current buffer). + + + Arguments: + + + + : pointer to plugin structure + + + + + : internal name of server to find + buffer for message display (may be NULL) + + + + + : name of channel to find buffer + for message display (may be NULL) + + + + + : message + + + + + + Return value: none. + + + Examples: + +plugin->printf (plugin, NULL, NULL, "hello"); +plugin->printf (plugin, NULL, "#weechat", "hello"); +plugin->printf (plugin, "freenode", "#weechat", "hello"); + + +
+ +
+ printf_server + + + Prototype: + + void printf_server (t_weechat_plugin *plugin, + char *message, ...) + + + + Display a message on current server buffer. + + + Arguments: + + + + : pointer to plugin structure + + + + + : message + + + + + + Return value: none. + + + Example: plugin->printf_server (plugin, "hello"); + +
+ +
+ printf_infobar + + + Prototype: + + void printf_infobar (t_weechat_plugin *plugin, + int time, char *message, ...) + + + + Display a message in infobar for a specified time. + + + Arguments: + + + + : pointer to plugin structure + + + + + : time (in seconds) for displaying + message (0 = never erased) + + + + + + Return value: none. + + + Example: + +plugin->printf_infobar (plugin, 5, "hello"); + + +
+ +
+ msg_handler_add + + + Prototype: + + t_plugin_handler *msg_handler_add (t_weechat_plugin + *plugin, char *message, t_plugin_handler_func *function, + char *handler_args, void *handler_pointer) + + + + Add an IRC message handler, called when an IRC message is + received. + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of IRC message. + To know list of IRC messages, please consult + RFCs + 1459 and + 2812 + + + + + : function called when message + is received + + + + + : arguments given to function + when called + + + + + : pointer given to function + when called + + + + + + Return value: pointer to new message handler. + + + Note: function called when message is received has to return + one of following values: + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfully + completed + + + + + PLUGIN_RC_OK_IGNORE_WEECHAT: message + will not be sent to WeeChat + + + + + PLUGIN_RC_OK_IGNORE_PLUGINS: message + will not be sent to other plugins + + + + + PLUGIN_RC_OK_IGNORE_ALL: message + will not be sent to WeeChat neither other plugins + + + + + + Example: + +int msg_kick (t_weechat_plugin *plugin, char *server, char *command, + char *arguments, char *handler_args, void *handler_pointer) +{ + plugin->printf (plugin, serveur, NULL, "KICK received"); + return PLUGIN_RC_OK; +} +... +plugin->msg_handler_add (plugin, "KICK", &msg_kick, NULL, NULL); + + +
+ +
+ cmd_handler_add + + + Prototype: + + t_plugin_handler *cmd_handler_add (t_weechat_plugin + *plugin, char *command, char *description, char *arguments, + char *arguments_description, char *completion_template, + t_plugin_handler_func *fonction, char *handler_args, + void *handler_pointer) + + + + Add a WeeChat command handler, called when user uses command + (for example /command). + + + Arguments: + + + + : pointer to plugin structure + + + + + : the new command name, which + may be an existing command (be careful, replaced command + will not be available until plugin is unloaded) + + + + + : short command description + (displayed by /help command) + + + + + : short description of command + arguments (displayed by /help command) + + + + + : long description + of command arguments (displayed by /help command) + + + + + : template for + completion, like "abc|%w def|%i" + which means "abc" or a WeeChat command for first argument, + "def" or IRC command for second. + An empty string lets WeeChat complete any argument with + a nick from current channel, NULL disable completion for + all command arguments. + + + Following codes can be used: + + + + + Code + Description + + + + + %- + no completion for argument + + + %a + alias + + + %A + + alias and commandes (WeeChat, IRC and plugins) + + + + %c + current channel + + + %C + channels of current server + + + %f + filename + + + %h + plugins commands + + + %i + IRC commands (sent) + + + %I + IRC commands (received) + + + %k + key functions + + + %n + nicks of current channel + + + %o + setup options + + + %p + default "part" message + + + %q + default "quit" message + + + %s + current server name + + + %S + all servers names + + + %t + topic of current channel + + + %v + setup option value + + + %w + WeeChat commands + + + %y + default "away" message + + + + + + + + + : function called when command + is executed + + + + + : arguments given to function + when called + + + + + : pointer given to function + when called + + + + + + Return value: pointer to new command handler. + + + Note: function called when command is executed has to return + one of following values: + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfulle + completed + + + + + + Example: + +int cmd_test (t_weechat_plugin *plugin, char *server, + char *command, char *arguments, char *handler_args, + void *handler_pointer) +{ + plugin->printf (plugin, serveur, NULL, + "test command, nick: %s", + (arguments) ? arguments : "none"); + return PLUGIN_RC_OK; +} +... +plugin->cmd_handler_add (plugin, "test", "Test command", + "[nick]", "nick: nick of channel", + "%n", &cmd_test, NULL, NULL); + + +
+ +
+ handler_remove + + + Prototype: + + void handler_remove (t_weechat_plugin *plugin, + t_plugin_handler *handler) + + + + Remove a handler. + + + Arguments: + + + + : pointer to plugin structure + + + + + : handler to remove + + + + + + Return value: none. + + + Example: + plugin->handler_remove (plugin, my_handler); + +
+ +
+ handler_remove_all + + + Prototype: + + void handler_remove_all (t_weechat_plugin *plugin) + + + + Remove all handlers for a plugin. + + + Arguments: + + + + : pointer to plugin structure + + + + + + Return value: none. + + + Example: + plugin->handler_remove_all (plugin); + +
+ +
+ exec_command + + + Prototype: + + void exec_command (t_weechat_plugin + *plugin, char *server, char *channel, char *command) + + + + Execute a WeeChat command (or send a message to a channel). + + + Arguments: + + + + : pointer to plugin structure + + + + + : internal name of server for + executing command (may be NULL) + + + + + : name of channel for executing + command (may be NULL) + + + + + : command + + + + + + Return value: none. + + + Examples: + +plugin->exec_command (plugin, NULL, NULL, "/help nick"); +plugin->exec_command (plugin, "freenode", "#weechat", "hello"); + + +
+ +
+ get_info + + + Prototype: + + char *get_info (t_weechat_plugin *plugin, + char *info, char *server) + + + + Return an info about WeeChat or a channel. + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of info to read: + + + + + Info + Description + + + + + version + WeeChat's version + + + nick + nick + + + channel + + name of channel (NULL for a server or private) + + + + server + name of server + + + away + "away" flag + + + weechat_dir + + WeeChat home dir + (by default: ~/.weechat/) + + + + weechat_libdir + WeeChat system lib directory + + + weechat_sharedir + WeeChat system share directory + + + + + + + + + : internal name of server for + reading info (if needed) + + + + + + Return value: information asked, NULL if not found. + + + Note: result has to be free by a call to "free" function after + use. + + + Examples: + +char *version = plugin->get_info (plugin, "version", NULL); +char *nick = plugin->get_info (plugin, "nick", "freenode"); + + +
+ +
+ get_dcc_info + + + Prototype: + + t_plugin_info_dcc *get_dcc_info (t_weechat_plugin *plugin) + + + + Return list of DCC currently active or finished. + + + Arguments: + + + + : pointer to plugin structure + + + + + + Return value: linked list of DCC. + + + + + Field + Description + + + + + server + IRC server + + + channel + IRC channel + + + type + + DCC type: + 0 = chat received, + 1 = chat sent, + 2 = file received, + 3 = file sent + + + + status + + DCC status: + 0 = waiting, + 1 = connecting, + 2 = active, + 3 = finished, + 4 = failed, + 5 = interrupted by user + + + + start_time + date/time of DCC creation + + + start_transfer + date/time of DCC transfert start + + + addr + IP address of remote user + + + port + port used for DCC + + + nick + remote nick + + + filename + file name + + + local_filename + local file name + + + size + file size + + + pos + position in file + + + start_resume + start position after interruption + + + bytes_per_sec + + number of bytes per second since transfert start + + + + + + + + Note: result has to be free by a call to "free_dcc_info" function + after use. + + + Examples: + +t_plugin_dcc_info *dcc_info = plugin->get_dcc_info (plugin); +for (ptr_dcc = dcc_info; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc) +{ + plugin->printf_server (plugin, "DCC type=%d, with: %s", + ptr_dcc->type, ptr_dcc->nick); +} +if (dcc_info) + plugin->free_dcc_info (plugin, dcc_info); + + +
+ +
+ free_dcc_info + + + Prototype : + + void free_dcc_info (t_weechat_plugin *plugin, + t_plugin_dcc_info *dcc_info) + + + + Free memory used by a DCC list. + + + Arguments: + + + + : pointer to plugin structure + + + + + : pointer to DCC list returned by + "get_dcc_info" function + + + + + + Return value: none. + + + Example: + plugin->free_dcc_info (plugin, dcc_info); + +
+ +
+ get_config + + + Prototype : + + char *get_config (t_weechat_plugin *plugin, char *option) + + + + Return value of a WeeChat config option. + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of option to read + + + + + + Return value: option value, NULL if not found. + + + Note: result has to be free by a call to "free" function after + use. + + + Examples: + +char *value1 = plugin->get_config (plugin, "look_set_title"); +char *value2 = plugin->get_config (plugin, "freenode.server_autojoin"); + + +
+ +
+ set_config + + + Prototype: + + int set_config (t_weechat_plugin *plugin, + char *option, char *value) + + + + Update value of a WeeChat config option. + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of option to update + + + + + : new value for option + + + + + + Return value: 1 if option was successfully updated, 0 if an + error occured. + + + Example: + +plugin->set_config (plugin, "look_nicklist", "off"); + + +
+ +
+ get_plugin_config + + + Prototype: + + char *get_plugin_config (t_weechat_plugin *plugin, char *option) + + + + Return value of a plugin option. + Option is read from file "~/.weechat/plugins.rc" + and is like: "plugin.option=value" + (note: plugin name is automatically added). + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of option to read + + + + + + Return value: option value, NULL if not found. + + + Note: result has to be free by a call to "free" function after + use. + + + Example: + +char *value = plugin->get_plugin_config (plugin, "my_var"); + + +
+ +
+ set_plugin_config + + + Prototype: + + int set_plugin_config (t_weechat_plugin *plugin, + char *option, char *value) + + + + Update value of a plugin option. + Option is written in file "~/.weechat/plugins.rc" + and is like: "plugin.option=value" + (note: plugin name is automatically added). + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of option to update + + + + + : new value for option + + + + + + Return value: 1 if option was successfully updated, 0 if an + error occurred. + + + Example : + +plugin->set_plugin_config (plugin, "my_var", "value"); + + +
+ +
+ +
+ Compile plugin + + + Compile does not need WeeChat sources, only file + "weechat-plugin.h". + + + + To compile a plugin which has one file "toto.c" (sous GNU/Linux): + +$ gcc -fPIC -Wall -c toto.c +$ gcc -shared -fPIC -o libtoto.so toto.o + + + +
+ +
+ Load plugin into WeeChat + + + Copy "libtoto.so" file into system plugins dir (for example + "/usr/local/lib/weechat/plugins") or into + user's plugins dir (for example + "/home/xxxxx/.weechat/plugins"). + + + + Under WeeChat: + /plugin load toto + + +
+ +
+ Plugin example + + + Full example of plugin, which adds a /double command, which displays + two times arguments on current channel (ok that's not very useful, but + that's just an example!): + +#include <stdlib.h> + +#include "weechat-plugin.h" + +char plugin_name[] = "Double"; +char plugin_version[] = "0.1"; +char plugin_description[] = "Test plugin for WeeChat"; + +/* gestionnaire de commande "/double" */ + +int double_cmd (t_weechat_plugin *plugin, char *server, + char *command, char *arguments, + char *handler_args, void *handler_pointer) +{ + if (arguments && arguments[0] && (arguments[0] != '/')) + { + plugin->exec_command (plugin, NULL, NULL, arguments); + plugin->exec_command (plugin, NULL, NULL, arguments); + } + return PLUGIN_RC_OK; +} + +int weechat_plugin_init (t_weechat_plugin *plugin) +{ + plugin->cmd_handler_add (plugin, "double", + "Display two times a message", + "msg", + "msg: message to display two times", + NULL, + &double_cmd, + NULL, NULL); + return PLUGIN_RC_OK; +} + +void weechat_plugin_end (t_weechat_plugin *plugin) +{ + /* nothing done here */ +} + + + +
+ +
+ +
+ Scripts plugins + + + Three plugins are provided with WeeChat to use script languages: + Perl, Python and Ruby. + + +
+ Load / unload scripts + + + Scripts are loaded and unloaded with /perl, + /python and /ruby commands + (type /help in WeeChat for help about commands). + + + + Examples: + + + + Load a Perl script: + /perl load /tmp/test.pl + + + + + List all loaded Perl scripts: + /perl + + + + + Load a Python script: + /python load /tmp/test.py + + + + + List all loaded Python scripts: + /python + + + + + Load a Ruby script: + /ruby load /tmp/test.rb + + + + + List all loaded Ruby scripts: + /ruby + + + + + +
+ +
+ WeeChat / scripts API + +
+ register + + + Perl prototype: + + weechat::register ( name, version, end_function, description ); + + + + Python prototype: + + weechat.register ( name, version, end_function, description ) + + + + Ruby prototype: + + Weechat.register ( name, version, end_function, description ) + + + + This is first function to call in script. + All WeeChat scripts have to call this function. + + + Arguments: + + + + : unique name to identify script + (each script must have unique name) + + + + + : script version + + + + + : function called when script is + unloaded (optional parameter, empty string means nothing is + called at the end) + + + + + : short description of script + + + + + + Return value: 1 if script was registered, 0 if an error occured. + + + Examples: + +# perl +weechat::register ("test", "1.0", "end_test", "Test script!"); + +# python +weechat.register ("test", "1.0", "end_test", "Test script!") + +# ruby +Weechat.register ("test", "1.0", "end_test", "Test script!") + + +
+ +
+ print + + + Perl prototype: + + weechat::print ( message, [channel, [server]] ) + + + + Python prototype: + + weechat.prnt ( message, [channel, [server]] ) + + + + Ruby prototype: + + Weechat.print ( message, [channel, [server]] ) + + + + Display a message on a WeeChat buffer, identified by server + and channel. + + + Arguments: + + + + : message + + + + + : name of channel to find buffer + for message display + + + + + : internal name of server to find + buffer for message display + + + + + + Return value: 1 if success, 0 if an error occured. + + + Examples: + +# perl +weechat::print ("message"); +weechat::print ("message", "#weechat"); +weechat::print ("message", "#weechat", "freenode"); + +# python +weechat.prnt ("message") +weechat.prnt ("message", "#weechat") +weechat.prnt ("message", "#weechat", "freenode") + +# ruby +Weechat.print ("message") +Weechat.print ("message", "#weechat") +Weechat.print ("message", "#weechat", "freenode") + + +
+ +
+ print_infobar + + + Perl prototype: + + weechat::print_infobar ( time, message ); + + + + Python prototype: + + weechat.print_infobar ( time, message ) + + + + Ruby prototype: + + Weechat.print_infobar ( time, message ) + + + + Display a message in infobar for a specified time. + + + Arguments: + + + + : time (in seconds) for displaying + message (0 = never erased) + + + + + : message + + + + + + Return value: 1 if success, 0 if an error occured. + + + Examples: + +# perl +weechat::print_infobar (5, "message"); + +# python +weechat.print_infobar (5, "message") + +# ruby +Weechat.print_infobar (5, "message") + + +
+ +
+ add_message_handler + + + Perl prototype: + + weechat::add_message_handler ( message, function ); + + + + Python prototype: + + weechat.add_message_handler ( message, function ) + + + + Ruby prototype: + + Weechat.add_message_handler ( message, function ) + + + + Add an IRC message handler, called when an IRC message is + received. + + + Arguments: + + + + : name of IRC message. To know list + of IRC messages, please consult RFCs + 1459 and + 2812 + + + + + : function called when message is + received + + + + + + Return value: 1 if success, 0 if an error occured. + + + Examples: + +# perl +weechat::add_message_handler ("privmsg", my_function); +sub my_function +{ + weechat::print ("server=$_[0]\n"); + ($null, $channel, $message) = split ":",$_[1],3; + ($mask, $null, $channel) = split " ", $channel; + weechat::print ("mask=$mask, channel=$channel, msg=$message\n"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_message_handler ("privmsg", my_function) +def ma_fonction(server, args): + weechat.prnt("server="+serveur) + null, channel, message = string.split(args, ":", 2) + masque, null, channel = string.split(string.strip(channel), " ", 2) + weechat.prnt("mask="+mask+", canal="+channel+", message="+message) + return weechat.PLUGIN_RC_OK + + + + Note: function called when message is received has to return one + of following values (prefixed by weechat::" for Perl, "weechat." + for Python or "Weechat." for Ruby): + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfully + completed + + + + + PLUGIN_RC_OK_IGNORE_WEECHAT: message + will not be sent to WeeChat + + + + + PLUGIN_RC_OK_IGNORE_PLUGINS: message + will not be sent to other plugins + + + + + PLUGIN_RC_OK_IGNORE_ALL: message + will not be sent to WeeChat neither other plugins + + + + +
+ +
+ add_command_handler + + + Perl prototype: + + weechat::add_command_handler ( command, function, + [description, arguments, arguments_description, + completion_template] ); + + + + Python prototype: + + weechat.add_command_handler ( command, function, + [description, arguments, arguments_description, + completion_template] ) + + + + Ruby prototype: + + Weechat.add_command_handler ( command, function, + [description, arguments, arguments_description, + completion_template] ) + + + + Add a WeeChat command handler, called when user uses command + (for example /command). + + + Paramètres : + + + + : the new command name, which + may be an existing command (be careful, replaced command + will not be available until script is unloaded) + + + + + : fonction appelée lorsque la + commande est exécutée + + + + + : short description of command + arguments (displayed by /help command) + + + + + : long description + of command arguments (displayed by /help command) + + + + + : template for + completion, like "abc|%w def|%i" which + means "abc" or a WeeChat command for first argument, + "def" or IRC command for second. + (see ) + + + + + + Return value: 1 if success, 0 if an error occured. + + + Examples: + +# perl +weechat::add_command_handler ("command", my_command); +sub my_command +{ + weechat::print("Server: $_[0], arguments: $_[1]\n"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_command_handler ("command", my_command) +def ma_commande(server, args): + weechat.prnt("server:"+serveur+" arguments:"+args) + return weechat.PLUGIN_RC_OK + + + + Notes: function called when command is executed has to return one + of following values (prefixed by "weechat::" for Perl, "weechat." + for Python or "Weechat." for Ruby): + + + + PLUGIN_RC_KO : function failed + + + + + PLUGIN_RC_OK : function successfully + completed + + + + +
+ +
+ remove_handler + + + Perl prototype: + + weechat::remove_handler ( name, function ); + + + + Python prototype: + + weechat.remove_handler ( name, function ) + + + + Ruby prototype: + + Weechat.remove_handler ( name, function ) + + + + Remove a handler. + + + Arguments: + + + + : name of IRC message or command + + + + + : function + + + + + + Return value: 1 if success, 0 if an error occured. + + + Examples: + +# perl +weechat::remove_handler ("command", my_command); + +# python +weechat.remove_handler ("command", my_command) + +# ruby +Weechat.remove_handler ("command", my_command) + + +
+ +
+ command + + + Perl prototype: + + weechat::command ( command, [channel, [server]] ); + + + + Python prototype: + + weechat.command ( command, [channel, [server]] ) + + + + Ruby prototype: + + Weechat.command ( command, [channel, [server]] ) + + + + Execute a WeeChat command (or send a message to a channel). + + + Arguments: + + + + : command + + + + + : name of channel for executing + command + + + + + : internal name of server for + executing command + + + + + + Return value: 1 if success, 0 if an error occured. + + + Examples: + +# perl +weechat::command ("hello everybody!"); +weechat::command ("/kick toto please leave this channel", "#weechat"); +weechat::command ("/nick newnick", "", "freenode"); + +# python +weechat.command ("hello everybody!") +weechat.command ("/kick toto please leave this channel", "#weechat") +weechat.command ("/nick newnick", "", "freenode") + +# ruby +Weechat.command ("hello everybody!") +Weechat.command ("/kick toto please leave this channel", "#weechat") +Weechat.command ("/nick newnick", "", "freenode") + + +
+ +
+ get_info + + + Perl prototype: + + weechat::get_info ( name, [server] ); + + + + Python prototype: + + weechat.get_info ( name, [server] ) + + + + Ruby prototype: + + Weechat.get_info ( name, [server] ) + + + + Return an info about WeeChat or a channel. + + + Arguments: + + + + : name of info to read + (see ) + + + + + : internal name of server for + reading info (if needed) + + + + + + Return value: information asked, empty string if an error + occured + + + Examples: + +# perl +$version = get_info("version"); +$nick = get_info("nick", "freenode"); + +# python +version = weechat.get_info ("version") +nick = weechat.get_info ("nick", "freenode") + + +
+ +
+ get_dcc_info + + + Perl prototype: + + weechat::get_dcc_info ( ); + + + + Python prototype: + + weechat.get_dcc_info ( ) + + + + Ruby prototype : + + Weechat.get_dcc_info ( ) + + + + Return list of DCC currently active or finished. + + + Return value: list of DCC + (see ). + +
+ +
+ get_config + + + Perl prototype: + + weechat::get_config ( option ); + + + + Python prototype: + + weechat.get_config ( option ) + + + + Ruby prototype: + + Weechat.get_config ( option ) + + + + Return value of a WeeChat config option. + + + Arguments: + + + + : name of option to read + + + + + + Return value: option value, empty string if not found. + + + Examples: + +# perl +$value1 = weechat::get_config ("look_nicklist"); +$value2 = weechat::get_config ("freenode.server_autojoin"); + +# python +value1 = weechat.get_config ("look_nicklist") +value2 = weechat.get_config ("freenode.server_autojoin") + + +
+ +
+ set_config + + + Perl prototype: + + weechat::set_config ( option, value ); + + + + Python prototype: + + weechat.set_config ( option, value ) + + + + Ruby prototype: + + Weechat.set_config ( option, value ) + + + + Update value of a WeeChat config option. + + + Arguments: + + + + : name of option to update + + + + + : new value for option + + + + + + Return value: 1 if option was successfully updated, 0 if an error + occured. + + + Examples: + +# perl +weechat::set_config ("look_nicklist", "off"); +weechat::set_config ("freenode.server_autojoin, "#weechat"); + +# python +weechat.set_config ("look_nicklist", "off") +weechat.set_config ("freenode.server_autojoin, "#weechat") + +# ruby +Weechat.set_config ("look_nicklist", "off") +Weechat.set_config ("freenode.server_autojoin, "#weechat") + + +
+ +
+ get_plugin_config + + + Perl prototype: + + weechat::get_plugin_config ( option ); + + + + Python prototype: + + weechat.get_plugin_config ( option ) + + + + Ruby prototype: + + Weechat.get_plugin_config ( option ) + + + + Return value of a plugin option. Option is read from file + "~/.weechat/plugins.rc" and is like: + "plugin.option=value" (note: plugin name + is automatically added). + + + Arguments: + + + + : name of option to read + + + + + + Return value: value of option, empty string if not found. + + + Examples : + +# perl +$value = weechat::get_plugin_config ("my_var"); + +# python +value = weechat.get_plugin_config ("my_var") + + +
+ +
+ set_plugin_config + + + Perl prototype: + + weechat::set_plugin_config ( option, valeur ); + + + + Python prototype: + + weechat.set_plugin_config ( option, valeur ) + + + + Ruby prototype: + + Weechat.set_plugin_config ( option, valeur ) + + + + Update value of a plugin option. Option is written in file + "~/.weechat/plugins.rc" and is like: + "plugin.option=value" (note: plugin name + is automatically added). + + + Arguments: + + + + : name of option to update + + + + + : new value for option + + + + + + Return value: 1 if option was successfully updated, 0 if an error + occured. + + + Examples: + +# perl +weechat::set_plugin_config ("my_var", "value"); + +# python +weechat.set_plugin_config ("my_var", "value") + +# ruby +Weechat.set_plugin_config ("my_var", "value") + + +
+ +
+ +
+ +
+ + + + + Authors / Support + + + This chapter lists authors and contributors for WeeChat, and + shows ways to get support. + + +
+ Authors + + + WeeChat is developed by: + + + + FlashCode (Sébastien Helleu) + flashcode AT flashtux.org - + main developer + + + + + Kolter + kolter AT free.fr - + developer + + + + + Ptitlouis + ptitlouis AT sysif.net - + Debian packager + + + + + +
+ +
+ Contributors + + + Following people contributed to WeeChat: + + + + Jiri Golembiovsky - + czech translation + + + + + Rudolf Polzer - + patches + + + + + Jim Ramsay - + patches + + + + + Pistos - + patches + + + + + +
+ +
+ Get support + + + Before asking for support, be sure you've read documentation and FAQ + provided with WeeChat (documentation is this document, if you don't + read all lines until this sentence, you can start again!) + + + + + + + IRC: server "irc.freenode.net", + channel "#weechat" + + + + + WeeChat forum: + + http://forums.flashtux.org + + + + + + Mailing list: + + + + To subscribe: + + http://mail.nongnu.org/mailman/listinfo/weechat-support + + + + + + To send a mail on mailing list: + weechat-support@nongnu.org + + + + Mailing list archives are available here: + + http://mail.nongnu.org/archive/html/weechat-support + + + + + + +
+ +
+ +
diff --git a/doc/fr/Makefile.am b/doc/fr/Makefile.am new file mode 100644 index 000000000..52e9ad23b --- /dev/null +++ b/doc/fr/Makefile.am @@ -0,0 +1,59 @@ +# Copyright (c) 2003-2006 FlashCode +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +LANGCODE = fr +BOOK = weechat.$(LANGCODE) +BOOK_INCLUDE = weechat_commands.xml irc_commands.xml key_functions.xml config.xml + +EXTRA_DIST = $(BOOK).xml $(BOOK_INCLUDE) + +docdir = $(datadir)/doc/$(PACKAGE) + +all-local: html-stamp + +# HTML output with chunks (many pages) + +html: html-stamp + +html-stamp: $(BOOK).xml $(BOOK_INCLUDE) ../weechat-html.xsl ../weechat-doc.css + mkdir -p html/ + xsltproc -o html/ ../weechat-html.xsl $(BOOK).xml || true + cp ../weechat-doc.css html/ + touch html-stamp + +# HTML output, all in one page + +html1: html1-stamp + +html1-stamp: $(BOOK).xml $(BOOK_INCLUDE) ../weechat-html-one.xsl ../weechat-doc.css + mkdir -p html1/ + xsltproc -o html1/$(BOOK).html ../weechat-html-one.xsl $(BOOK).xml || true + cp ../weechat-doc.css html1/ + touch html1-stamp + +# install docs + +install-data-hook: + $(mkinstalldirs) $(DESTDIR)$(docdir)/html/$(LANGCODE)/ + $(INSTALL_DATA) html/* $(DESTDIR)$(docdir)/html/$(LANGCODE)/ + +# clean + +clean-local: + -rm -f *.html *.pdf *.txt + -rm -rf html/ html1/ + -rm -f html-stamp html1-stamp diff --git a/doc/fr/weechat.fr.xml b/doc/fr/weechat.fr.xml new file mode 100644 index 000000000..e809b9c04 --- /dev/null +++ b/doc/fr/weechat.fr.xml @@ -0,0 +1,3542 @@ + + + + + + + + +]> + + + + + + WeeChat 0.1.7-cvs - Guide utilisateur + Client IRC rapide, léger et extensible + + + Sébastien + Helleu + flashcode AT flashtux.org + + + + 2006 + Sébastien Helleu + + + + + This manual is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA + + + + + + Ce manuel documente le client IRC WeeChat, il fait partie de WeeChat. + + + La dernière version de ce document peut être téléchargée + sur cette page : + + http://weechat.flashtux.org/doc.php + + + + + + + + + + Introduction + + + Ce chapître décrit WeeChat et les pré-requis pour son installation. + + +
+ Description + + + WeeChat (Wee Enhanced Environment for Chat) est un client + IRC libre, rapide et léger, conçu pour + différents systèmes d'exploitation. + + + + Ses principales caractéristiques sont les suivantes : + + + + connexion multi-serveurs (avec SSL, IPv6, proxy) + + + + + plusieurs interfaces : Curses, wxWidgets, Gtk et Qt + + + + + petit, rapide et léger + + + + + paramétrable et extensible avec des extensions et des scripts + + + + + conforme aux RFCs + 1459, + 2810, + 2811, + 2812 et + 2813 + + + + + multi-plateformes (GNU/Linux, *BSD, MacOS X, Windows et + d'autres systèmes) + + + + + 100% GPL, logiciel libre + + + + + + + La page d'accueil de WeeChat est ici : + + http://weechat.flashtux.org + + + +
+ +
+ Pré-requis + + + Pour installer WeeChat, vous devez avoir : + + + + un système GNU/Linux (avec le compilateur et les outils + associés pour le paquet des sources) + + + + + droits "root" (pour installer WeeChat) + + + + + selon l'interface, une des bibliothèques + suivantes : + + + + Curses : la bibliothèque ncurses + + + + + Gtk : *** interface non développée *** + + + + + WxWidgets : *** interface non développée *** + + + + + Qt : *** interface non développée *** + + + + + + + + +
+
+ + + + + Installation + + + Ce chapître explique comment installer WeeChat. + + +
+ Paquets binaires + + + Les paquets binaires sont disponibles pour les distributions + suivantes : + + + + Debian (ou toute distribution compatible Debian) : + apt-get install weechat + + + + + Mandriva/RedHat (ou toute distribution compatible avec les RPM) : + + rpm -i /chemin/weechat-x.y.z-1.i386.rpm + + + + + + Gentoo : + emerge weechat + + + + + Pour les autres distributions supportées, merci de vous + référer au manuel de la distribution pour la méthode d'installation. + + +
+ +
+ Paquet source + + + Tapez simplement dans une console ou un terminal : +$ ./configure +$ make + + + Obtenez les droits root et installez WeeChat : +$ su +(entrez le mot de passe root) +# make install + + +
+ +
+ Sources CVS + + + Attention : les sources CVS sont réservées aux utilisateurs + avancés : il se peut que WeeChat ne compile pas et qu'il soit + très instable. Vous êtes prévenus ! + + + + Pour récupérer les sources CVS, tapez cette commande : +$ cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/weechat co weechat + + + + Exécutez ce script : + ./autogen.sh + + + + Suivez alors les instructions du paquet source + (voir ) + + +
+ +
+ + + + + Utilisation + + + Ce chapître explique comment lancer WeeChat, les touches utilisées par + défaut, les commandes internes et IRC, le fichier de configuration et + l'utilisation du tube FIFO. + + +
+ Lancer WeeChat + + + Paramètres de ligne de commande : + + + + + Paramètre + Description + + + + + -a, --no-connect + + Supprimer la connexion automatique aux serveurs lors du démarrage + + + + -c, --config + + Afficher l'aide sur le fichier de config (liste des options) + + + + -f, --key-functions + + Afficher la liste des fonctions internes WeeChat pour les touches + + + + -h, --help + + Afficher l'aide + + + + -i, --irc-commands + + Afficher la liste des commandes IRC + + + + -k, --keys + + Afficher les touches par défaut de WeeChat + + + + -l, --license + + Afficher la licence de WeeChat + + + + -p, --no-plugin + + Supprimer le chargement automatique des extensions au + démarrage + + + + -v, --version + + Afficher la version de WeeChat + + + + -w, --weechat-commands + + Afficher la liste des commandes WeeChat + + + + + + + + + Il est également possible de passer une URL pour un ou plusieurs + serveurs IRC, de la forme : + irc[6][s]://[pseudo[:mot_passe]@]irc.exemple.org[:port][/canal][,canal[...] + Exemple pour rejoindre #weechat et #toto sur le serveur + "irc.freenode.net", port par défaut (6667), sous + le pseudo "nono" : + $ weechat-curses irc://nono@irc.freenode.net/#weechat,#toto + + + + Pour lancer WeeChat, tapez cette commande : + + + + pour l'interface Curses : weechat-curses + + + + + pour l'interface Gtk : weechat-gtk + + + + + pour l'interface wxWidgets : weechat-wxwidgets + + + + + pour l'interface Qt : weechat-qt + + + + + + + Lorsque vous lancez WeeChat pour la première fois, un fichier de + configuration par défaut est créé, avec les options par défaut. + Le fichier de configuration par défaut est : + "~/.weechat/weechat.rc" + + + + Vous pouvez éditer ce fichier pour configurer WeeChat à votre + convenance (SEULEMENT si WeeChat ne tourne pas), ou vous pouvez + modifier les paramètres dans WeeChat avec la commande + "/set" + (voir ) + + +
+ +
+ Raccourcis clavier + + + + + + + Touche + Action + + + + + Flèche gauche + + Aller au caractère précédent sur la ligne de commande + + + + Flèche droite + + Aller au caractère suivant sur la ligne de commande + + + + Ctrl + flèche gauche + + Aller au mot précédent sur la ligne de commande + + + + Ctrl + flèche droite + + Aller au mot suivant sur la ligne de commande + + + + Home / Ctrl + A + + Aller au début de la ligne de commande + + + + End / Ctrl + E + + Aller à la fin de la ligne de commande + + + + Ctrl + K + + Effacer du curseur jusqu'à la fin de la ligne de commande + + + + Ctrl + L + + Réafficher toute la fenêtre + + + + Ctrl + U + + Effacer du curseur jusqu'au début de la ligne de commande + + + + Ctrl + W + + Effacer le mot précédent sur la ligne de commande + + + + Backspace + + Effacer le caractère précédent sur la ligne de commande + + + + Delete + + Effacer le caractère suivant sur la ligne de commande + + + + Tab + + Compléter la commande ou le pseudo + (Tab de nouveau: trouver la complétion suivante) + + + + Tout caractère + + Insérer le caractère à la position du curseur + sur la ligne de commande + + + + Entrée + + Exécuter la commande ou envoyer le message + + + + Flèche haut / flèche bas + + Rappeler les dernières commandes ou messages + + + + Ctrl + flèche haut / Ctrl + flèche bas + + Rappeler les dernières commandes ou messages dans + l'historique global (commun à tous les tampons) + + + + PageUp / PageDown + + Afficher l'historique du tampon + + + + F5 / Alt + flèche gauche + + Aller au tampon précédent + + + + F6 / Alt + flèche droite + + Aller au tampon suivant + + + + F7 + + Aller à la fenêtre précédente + + + + F8 + + Aller à la fenêtre suivante + + + + F10 + + Effacer le dernier message de la barre d'infos + + + + F11 / F12 + + Faire défiler la liste des pseudos + + + + Alt + Home / Alt + End + + Aller au début / à la fin de la liste des pseudos + + + + Alt + A + + Sauter au prochain tampon avec activité + (avec priorité : highlight, message, autre) + + + + Alt + B + + Aller au mot précédent + + + + Alt + D + + Effacer le mot suivant + + + + Alt + F + + Aller au mot suivant + + + + Alt + H + + Vider la hotlist + (notification d'actitivé sur les autres tampons) + + + + Alt + J puis Alt + D + + Afficher le tampon des DCC + + + + Alt + J puis Alt + L + + Sauter au dernier tampon + + + + Alt + J puis Alt + S + + Sauter au tampon du serveur + + + + Alt + J puis Alt + X + + Sauter au premier canal du serveur suivant + (ou tampon du serveur si aucun canal n'est ouvert) + + + + Alt + chiffre (0-9) + + Sauter au tampon qui porte ce numéro (0 = 10) + + + + Alt + J puis nombre (01-99) + + Sauter au tampon qui porte ce numéro + + + + Alt + K + + Capturer une touche et insérer son code sur la ligne + de commande + + + + Alt + N + + Se positionner sur le highlight suivant + + + + Alt + P + + Se positionner sur le highlight précédent + + + + Alt + R + + Effacer entièrement la ligne de commande + + + + Alt + S + + Changer de serveur sur le tampon des serveurs + (si l'option "look_one_server_buffer" est activée) + + + + Alt + U + + Se positionner sur la première ligne non lue du tampon + + + + Alt + W puis Alt + flèche + + Sauter à une fenêtre avec une direction + + + + + + + +
+ +
+ Commandes WeeChat / IRC + + + Ce chapître liste toutes les commandes WeeChat et IRC. + + +
+ Commandes WeeChat + + + &weechat_commands.xml; + + +
+ +
+ Fonctions pour les touches + + + + + + + Fonction + Description + + + + + &key_functions.xml; + + + + + + +
+ +
+ Commandes IRC + + + &irc_commands.xml; + + +
+ +
+ +
+ Fichier de configuration + + + Liste des options du fichier de configuration : + + + + + Option + Type + Valeurs + Défaut + Description + + + + + &config.xml; + + + + + + + + Les couleurs pour l'interface Curses sont : + + + + + Mot clé + Couleur + + + + + default + couleur par défaut (transparent pour le fond) + + + black + noir + + + red + rouge foncé + + + lightred + rouge clair + + + green + vert foncé + + + lightgreen + vert clair + + + brown + marron + + + yellow + jaune + + + blue + bleu foncé + + + lightblue + bleu clair + + + magenta + violet foncé + + + lightmagenta + violet clair + + + cyan + cyan foncé + + + lightcyan + cyan clair + + + white + blanc + + + + + + +
+ +
+ Tube FIFO + + + Vous pouvez contrôler WeeChat à distance, en envoyant des commandes + ou du texte dans un tube FIFO (l'option "irc_fifo_pipe" doit être + activée, elle est désactivée par défaut). + + + + Le tube FIFO est dans le répertoire "~/.weechat/" + et s'appelle "weechat_fifo_xxxxx" (où xxxxx est l'ID du processus + (PID) du WeeChat qui tourne). Donc si plusieurs WeeChat tournent, il + y a plusieurs tubes FIFO, un pour chaque session. + + + + La syntaxe pour envoyer des commandes ou du texte dans le tube FIFO + est la suivante : + serveur,canal *texte ou commande ici + où le serveur et le canal sont facultatifs, mais si le canal est là, + le serveur doit l'être aussi. + + + + Quelques exemples : + + + + changement du pseudo sur freenode en "pseudo|absent" : + $ echo "freenode */nick pseudo|absent" >~/.weechat/weechat_fifo_12345 + + + + + affichage de texte sur le canal #weechat : + $ echo "freenode,#weechat *bonjour tout le monde !" >~/.weechat/weechat_fifo_12345 + + + + + affichage de texte sur le canal courant (le tampon affiché + par WeeChat) : + $ echo "*bonjour !" >~/.weechat/weechat_fifo_12345 + Attention : ceci est dangereux et vous ne + devriez pas le faire sauf si vous savez ce que vous faites ! + + + + + envoyer deux commandes pour décharger/recharger les scripts Perl + (vous devez les séparer par "\n") : + $ echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345 + + + + + + + Vous pouvez écrire un script qui envoie les commandes à tous les + WeeChat qui tournent en même temps, par exemple : + +#!/bin/sh +if [ $# -eq 1 ]; then + for fifo in $(/bin/ls ~/.weechat/weechat_fifo_* 2>/dev/null); do + echo -e "$1" >$fifo + done +fi + + Si le script s'appelle "auto_weechat_command", vous pouvez le lancer + ainsi : + $ ./auto_weechat_command "freenode,#weechat *bonjour" + + +
+ +
+ + + + + Extensions + + + Ce chapître décrit l'interface des extensions (API) et les extensions + pour scripts (Perl, Python, Ruby), fournies avec WeeChat. + + +
+ Les extensions dans WeeChat + + + Une extension ("plugin" en anglais) est un programme écrit en C + qui peut appeler des fonctions de WeeChat définies dans une interface. + + + + Ce programme C n'a pas besoin des sources WeeChat pour être + compilé et peut être chargé/déchargé dynamiquement dans + WeeChat via la commande /plugin. + + + + L'extension doit être au format bibliothèque, chargeable + dynamiquement par le systême d'exploitation. + Sous GNU/Linux, il s'agit d'un fichier ayant pour extension ".so", + sous Windows ".dll". + + +
+ +
+ Ecrire une extension + + + L'extension doit inclure le fichier "weechat-plugin.h" + (disponible dans les sources de WeeChat). + Ce fichier définit les structures et types dont l'extension aura + besoin pour communiquer avec WeeChat. + + + + L'extension doit comporter certaines variables et fonctions + obligatoires (sans quoi l'extension ne peut être chargée) : + + + + + Variable + Description + + + + + char plugin_name[] + le nom de l'extension + + + char plugin_version[] + la version de l'extension + + + char plugin_description[] + une courte description de l'extension + + + + + + + + + + Fonction + Description + + + + + int weechat_plugin_init (t_weechat_plugin *plugin) + + fonction appelée au chargement de l'extension + qui doit renvoyer PLUGIN_RC_OK en cas de succès, + PLUGIN_RC_KO en cas d'erreur (si erreur, l'extension + ne sera PAS chargée) + + + + void weechat_plugin_end (t_weechat_plugin *plugin) + fonction appelée au déchargement de l'extension + + + + + + +
+ Fonctions de l'interface (API) + +
+ ascii_strcasecmp + + + Prototype : + + int ascii_strcasecmp (t_weechat_plugin *plugin, + char *chaine1, char *chaine2) + + + + Effectue une comparaison entre deux chaînes, sans tenir compte des + majuscules/minuscules ni de la locale. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : la première chaîne à comparer + + + + + : la deuxième chaîne à comparer + + + + + + Valeur renvoyée : la différence entre les deux chaînes : négatif + si chaine1 < chaine2, zéro si chaine1 == chaine2, positif si + chaine1 > chaine2 + + + Exemple : + if (plugin->ascii_strcasecmp (plugin, "abc", "def") != 0) ... + +
+ +
+ ascii_strncasecmp + + + Prototype : + + int ascii_strncasecmp (t_weechat_plugin *plugin, + char *chaine1, char *chaine2, int max) + + + + Effectue une comparaison entre deux chaînes, sans tenir compte des + majuscules/minuscules ni de la locale, en comparant au plus "max" + caractères. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : la première chaîne à comparer + + + + + : la deuxième chaîne à comparer + + + + + : nombre de caractères max à comparer + + + + + + Valeur renvoyée : la différence entre les deux chaînes : négatif + si chaine1 < chaine2, zéro si chaine1 == chaine 2, positif si + chaine1 > chaine2 + + + Exemple : + if (plugin->ascii_strncasecmp (plugin, "abc", "def", 2) != 0) ... + +
+ +
+ explode_string + + + Prototype : + + char **explode_string (t_weechat_plugin *plugin, char *chaine, + char *separateurs, int num_items_max, int *num_items) + + + + Explose une chaîne en plusieurs selon un/des délimiteur(s). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : la chaîne à exploser + + + + + : les délimiteurs utilisés + pour exploser la chaîne + + + + + : nombre maximum de + sous-chaînes créées (0 = pas de limite) + + + + + : pointeur vers un entier qui + contiendra le nombre de sous-chaînes créées en retour + + + + + + Valeur renvoyée : un tableau de chaînes, ou NULL si un problème + a été rencontré. + + + Note : le résultat doit être libéré par un appel à la fonction + "free_exploded_string" après utilisation. + + + Exemple : + +char **argv; +int argc; +argv = plugin->explode_string (plugin, chaine, " ", 0, &argc); +... +if (argv != NULL) + plugin->free_exploded_string (plugin, argv); + + +
+ +
+ free_exploded_string + + + Prototype : + + char **free_exploded_string (t_weechat_plugin *plugin, + char **chaine) + + + + Libère la mémoire utilisée pour une explosion de chaîne. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : la chaîne explosée par la fonction + "explode_string" + + + + + + Valeur renvoyée : aucune. + + + Exemple : + +char *argv; +int argc; +argv = plugin->explode_string (plugin, chaine, " ", 0, &argc); +... +if (argv != NULL) + plugin->free_exploded_string (plugin, argv); + + +
+ +
+ exec_on_files + + + Prototype : + + void exec_on_files (t_weechat_plugin *plugin, char *repertoire, + int (*callback)(t_weechat_plugin *, char *)) + + + + Exécute une fonction sur tous les fichiers d'un répertoire. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : le répertoire où les fichiers + sont recherchés + + + + + : une fonction appelée pour chaque + fichier trouvé + + + + + + Valeur renvoyée : aucune. + + + Exemple : + +int callback (t_weechat_plugin *plugin, char *fichier) +{ + plugin->printf_server (plugin, "fichier: %s", fichier); + return 1; +} +... +plugin->exec_on_files (plugin, "/tmp", &callback); + + +
+ +
+ printf + + + Prototype : + + void printf (t_weechat_plugin *plugin, + char *serveur, char *canal, char *message, ...) + + + + Affiche un message sur un tampon WeeChat, identifié par le serveur + et le canal (tous deux pouvant être NULL pour le tampon courant). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom interne du serveur pour + trouver le tampon dans lequel afficher (peut être NULL) + + + + + : nom du canal pour trouver le + tampon dans lequel afficher (peut être NULL) + + + + + : message à afficher + + + + + + Valeur renvoyée : aucune. + + + Exemples : + +plugin->printf (plugin, NULL, NULL, "hello"); +plugin->printf (plugin, NULL, "#weechat", "hello"); +plugin->printf (plugin, "freenode", "#weechat", "hello"); + + +
+ +
+ printf_server + + + Prototype : + + void printf_server (t_weechat_plugin *plugin, + char *message, ...) + + + + Affiche un message sur le tampon du serveur courant. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : message à afficher + + + + + + Valeur renvoyée : aucune. + + + Exemple : plugin->printf_server (plugin, "hello"); + +
+ +
+ printf_infobar + + + Prototype : + + void printf_infobar (t_weechat_plugin *plugin, + int temps, char *message, ...) + + + + Affiche un message sur la barre d'infos pour un temps déterminé. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : temps (en secondes) pendant lequel + le message est affiché (0 = jamais effacé) + + + + + + Valeur renvoyée : aucune. + + + Exemple : plugin->printf_infobar (plugin, 5, "hello"); + +
+ +
+ msg_handler_add + + + Prototype : + + t_plugin_handler *msg_handler_add (t_weechat_plugin + *plugin, char *message, t_plugin_handler_func *fonction, + char *handler_args, void *handler_pointer) + + + + Ajoute un gestionnaire de messages IRC, appelé dès qu'un message + IRC est reçu. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom du message IRC pour lequel la + fonction est appelée. + Pour connaître la liste des messages IRC disponibles, merci + de consulter les RFCs + 1459 et + 2812 + + + + + : fonction appelée lorsque le + message est reçu + + + + + : paramètres passés à la + fonction appelée + + + + + : pointeur passé à la + fonction appelée + + + + + + Valeur renvoyée : le pointeur vers le nouveau gestionnaire de + messages. + + + Note : la fonction appelée lorsque le message est reçu doit + renvoyer une des valeurs suivantes : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + + PLUGIN_RC_OK_IGNORE_WEECHAT : le message + ne sera pas transmis à WeeChat + + + + + PLUGIN_RC_OK_IGNORE_PLUGINS : le message + ne sera pas transmis à d'autres extensions + + + + + PLUGIN_RC_OK_IGNORE_ALL : le message + ne sera ni transmis à WeeChat ni à d'autres extensions + + + + + + Exemple : + +int msg_kick (t_weechat_plugin *plugin, char *serveur, char *commande, + char *arguments, char *handler_args, void *handler_pointer) +{ + plugin->printf (plugin, serveur, NULL, "KICK reçu"); + return PLUGIN_RC_OK; +} +... +plugin->msg_handler_add (plugin, "KICK", &msg_kick, NULL, NULL); + + +
+ +
+ cmd_handler_add + + + Prototype : + + t_plugin_handler *cmd_handler_add (t_weechat_plugin + *plugin, char *commande, char *description, char *arguments, + char *arguments_description, char *modele_completion, + t_plugin_handler_func *fonction, char *handler_args, + void *handler_pointer) + + + + Ajoute un gestionnaire de commande WeeChat, appelé dès que + l'utilisateur utilise la commande (par exemple /commande). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de la nouvelle commande, + qui peut être une commande déjà existante (attention la + commande remplacée ne sera plus disponible jusqu'à ce que + l'extension soit déchargée) + + + + + : brève description de la + commande (affichée par /help commande) + + + + + : brève description des + paramètres de la commande (affichée par /help commande) + + + + + : longue description + des paramètres de la commande (affichée par /help commande) + + + + + : modèle pour la + complétion sous la forme "abc|%w def|%i" + qui signigie "abc" ou une commande WeeChat pour le premier + paramètre, et "def" ou une commande IRC pour le deuxième. + Une chaîne vide indique à WeeChat de compléter tout + paramètre avec un pseudo du canal courant, une valeur NULL + désactive toute complétion pour tous les paramètres de la + commande. + + + Les codes suivants peuvent être utilisés : + + + + + Code + Description + + + + + %- + aucune complétion pour le paramètre + + + %a + alias + + + %A + + alias et commandes (WeeChat, IRC et extensions) + + + + %c + canal courant + + + %C + canaux du serveur courant + + + %f + nom de fichier + + + %h + commandes définies par des extensions + + + %i + commandes IRC (envoyées) + + + %I + commandes IRC (reçues) + + + %k + fonctions associées aux touches + + + %n + pseudos du canal courant + + + %o + options de configuration + + + %p + message de "part" par défaut + + + %q + message de "quit" par défaut + + + %s + nom du serveur courant + + + %S + tous les serveurs + + + %t + titre du canal courant + + + %v + valeur d'une option de configuration + + + %w + commandes WeeChat + + + %y + message d'absence ("away") par défaut + + + + + + + + + : fonction appelée lorsque la + commande est exécutée + + + + + : paramètres passés à la + fonction appelée + + + + + : pointeur passé à la + fonction appelée + + + + + + Valeur renvoyée : le pointeur vers le nouveau gestionnaire de + commande. + + + Note : la fonction appelée lorsque la commande est exécutée doit + renvoyer une des valeurs suivantes : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + + + Exemple : + +int cmd_test (t_weechat_plugin *plugin, char *serveur, + char *commande, char *arguments, char *handler_args, + void *handler_pointer) +{ + plugin->printf (plugin, serveur, NULL, + "commande test, pseudo: %s", + (arguments) ? arguments : "aucun"); + return PLUGIN_RC_OK; +} +... +plugin->cmd_handler_add (plugin, "test", "Commande test", + "[pesudo]", "pseudo: un pseudo du canal", + "%n", &cmd_test, NULL, NULL); + + + +
+ +
+ handler_remove + + + Prototype : + + void handler_remove (t_weechat_plugin *plugin, + t_plugin_handler *handler) + + + + Supprime un gestionnaire. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : le gestionnaire à supprimer + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->handler_remove (plugin, mon_handler); + +
+ +
+ handler_remove_all + + + Prototype : + + void handler_remove_all (t_weechat_plugin *plugin) + + + + Supprime tous les gestionnaires d'une extension. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->handler_remove_all (plugin); + +
+ +
+ exec_command + + + Prototype : + + void exec_command (t_weechat_plugin + *plugin, char *serveur, char *canal, char *commande) + + + + Execute une commande WeeChat ou envoie un message à un canal. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom interne du serveur où + exécuter la commande (peut être NULL) + + + + + : nom du canal où exécuter la + commande (peut être NULL) + + + + + : la commande à exécuter + + + + + + Valeur renvoyée : aucune. + + + Exemples : + +plugin->exec_command (plugin, NULL, NULL, "/help nick"); +plugin->exec_command (plugin, "freenode", "#weechat", "bonjour"); + + +
+ +
+ get_info + + + Prototype : + + char *get_info (t_weechat_plugin *plugin, + char *info, char *serveur) + + + + Renvoie une information sur WeeChat ou un canal. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de l'info à obtenir : + + + + + Info + Description + + + + + version + version de WeeChat + + + nick + pesudo + + + channel + + nom du canal (NULL pour un serveur ou un privé) + + + + server + nom du serveur + + + away + drapeau "away" + + + weechat_dir + + répertoire maison de WeeChat + (par défaut: ~/.weechat/) + + + + weechat_libdir + répertoire "lib" système de WeeChat + + + weechat_sharedir + répertoire "share" système de WeeChat + + + + + + + + + : nom interne du serveur où + récupérer l'information (si nécessaire) + + + + + + Valeur renvoyée : l'information recherchée, NULL si non trouvée. + + + Note : le résultat doit être libéré par un appel à la fonction + "free" après utilisation. + + + Exemples : + +char *version = plugin->get_info (plugin, "version", NULL); +char *nick = plugin->get_info (plugin, "nick", "freenode"); + + +
+ +
+ get_dcc_info + + + Prototype : + + t_plugin_info_dcc *get_dcc_info (t_weechat_plugin *plugin) + + + + Renvoie la liste des DCC en cours ou terminés. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + + Valeur renvoyée : la liste chaînée des DCC. + + + + + Champ + Description + + + + + server + le serveur IRC + + + channel + le canal IRC + + + type + + le type de DCC : + 0 = discussion reçue, + 1 = discussion envoyée, + 2 = fichier reçu, + 3 = fichier envoyé + + + + status + + le statut du DCC : + 0 = en attente, + 1 = en cours de connexion, + 2 = actif, + 3 = terminé, + 4 = échoué, + 5 = interrompu par l'utilisateur + + + + start_time + la date et heure de création du DCC + + + start_transfer + la date et heure de démarrage du transfert + + + addr + adresse IP de l'utilisateur distant + + + port + port utilisé pour le DCC + + + nick + pseudo de l'utilisateur distant + + + filename + nom de fichier + + + local_filename + nom de fichier local + + + size + taille du fichier + + + pos + position actuelle dans le fichier + + + start_resume + position de démarrage après une interruption + + + bytes_per_sec + + nombre d'octets transmis par seconde depuis le début + du transfert + + + + + + + + Note : le résultat doit être libéré par un appel à la fonction + "free_dcc_info" après utilisation. + + + Exemples : + +t_plugin_dcc_info *dcc_info = plugin->get_dcc_info (plugin); +for (ptr_dcc = dcc_info; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc) +{ + plugin->printf_server (plugin, "DCC type=%d, avec: %s", + ptr_dcc->type, ptr_dcc->nick); +} +if (dcc_info) + plugin->free_dcc_info (plugin, dcc_info); + + +
+ +
+ free_dcc_info + + + Prototype : + + void free_dcc_info (t_weechat_plugin *plugin, + t_plugin_dcc_info *dcc_info) + + + + Libère la mémoire utilisée par une liste de DCC. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : pointeur vers la liste DCC + renvoyée par la fonction "get_dcc_info" + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->free_dcc_info (plugin, dcc_info); + +
+ +
+ get_config + + + Prototype : + + char *get_config (t_weechat_plugin *plugin, char *option) + + + + Renvoie la valeur d'une option de configuration WeeChat. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de l'option à lire + + + + + + Valeur renvoyée : la valeur de l'option, NULL si non trouvée. + + + Note : le résultat doit être libéré par un appel à la fonction + "free" après utilisation. + + + Exemples : + +char *value1 = plugin->get_config (plugin, "look_set_title"); +char *value2 = plugin->get_config (plugin, "freenode.server_autojoin"); + + +
+ +
+ set_config + + + Prototype : + + int set_config (t_weechat_plugin *plugin, + char *option, char *valeur) + + + + Modifie la valeur d'une option de configuration WeeChat. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de l'option à mettre à jour + + + + + : nouvelle valeur pour l'option + + + + + + Valeur renvoyée : 1 si l'option a été modifiée avec succès, 0 si + une erreur s'est produite. + + + Exemple : + +plugin->set_config (plugin, "look_nicklist", "off"); + + +
+ +
+ get_plugin_config + + + Prototype : + + char *get_plugin_config (t_weechat_plugin *plugin, char *option) + + + + Renvoie la valeur d'une option de l'extension. + L'option est lue depuis le fichier + "~/.weechat/plugins.rc" et est + sous cette forme : "extension.option=valeur" + (NB : le nom de l'extension est ajouté automatiquement). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de l'option à lire + + + + + + Valeur renvoyée : la valeur de l'option, NULL si non trouvée. + + + Note : le résultat doit être libéré par un appel à la fonction + "free" après utilisation. + + + Exemple : + +char *value = plugin->get_plugin_config (plugin, "ma_variable"); + + +
+ +
+ set_plugin_config + + + Prototype : + + int set_plugin_config (t_weechat_plugin *plugin, + char *option, char *valeur) + + + + Modifie la valeur d'une option de l'extension. + L'option est écrite dans le fichier + "~/.weechat/plugins.rc" et est + sous cette forme : "extension.option=valeur" + (NB : le nom de l'extension est ajouté automatiquement). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de l'option à mettre à jour + + + + + : nouvelle valeur pour l'option + + + + + + Valeur renvoyée : 1 si l'option a été modifiée avec succès, 0 si + une erreur s'est produite. + + + Exemple : + +plugin->set_plugin_config (plugin, "ma_variable", "valeur"); + + +
+ +
+ +
+ Compiler l'extension + + + La compilation ne nécessite pas les sources WeeChat, mais seulement + le fichier "weechat-plugin.h". + + + + Pour compiler une extension composée d'un fichier "toto.c" (sous + GNU/Linux) : + +$ gcc -fPIC -Wall -c toto.c +$ gcc -shared -fPIC -o libtoto.so toto.o + + + +
+ +
+ Charger l'extension dans WeeChat + + + Copier le fichier "libtoto.so" dans le répertoire système des + extensions (par exemple + "/usr/local/lib/weechat/plugins)" ou bien dans + celui de l'utilisateur (par exemple + "/home/xxxxx/.weechat/plugins"). + + + + Sous WeeChat : + /plugin load toto + + +
+ +
+ Exemple d'extension + + + Un exemple complet d'extension, qui ajoute une commande /double + affichant deux fois les paramètres passés sur le canal courant + (d'accord ce n'est pas très utile mais ceci est un exemple !) : + +#include <stdlib.h> + +#include "weechat-plugin.h" + +char plugin_name[] = "Double"; +char plugin_version[] = "0.1"; +char plugin_description[] = "Plugin de test pour WeeChat"; + +/* gestionnaire de commande "/double" */ + +int double_cmd (t_weechat_plugin *plugin, char *serveur, + char *commande, char *arguments, + char *handler_args, void *handler_pointer) +{ + if (arguments && arguments[0] && (arguments[0] != '/')) + { + plugin->exec_command (plugin, NULL, NULL, arguments); + plugin->exec_command (plugin, NULL, NULL, arguments); + } + return PLUGIN_RC_OK; +} + +int weechat_plugin_init (t_weechat_plugin *plugin) +{ + plugin->cmd_handler_add (plugin, "double", + "Affiche deux fois un message", + "msg", + "msg: message a afficher deux fois", + NULL, + &double_cmd, + NULL, NULL); + return PLUGIN_RC_OK; +} + +void weechat_plugin_end (t_weechat_plugin *plugin) +{ + /* on ne fait rien ici */ +} + + + +
+ +
+ +
+ Extensions pour scripts + + + Trois extensions sont fournies en standard avec WeeChat pour utiliser + des langages de script : Perl, Python et Ruby. + + +
+ Charger / décharger des scripts + + + Les scripts sont chargés et déchargés avec les commandes + /perl, /python et + /ruby (tapez /help dans + WeeChat pour obtenir de l'aide sur les commandes). + + + + Exemples : + + + + Charger un script Perl : + /perl load /tmp/essai.pl + + + + + Lister les scripts Perl chargés : + /perl + + + + + Charger un script Python : + /python load /tmp/essai.py + + + + + Lister les scripts Python chargés : + /python + + + + + Charger un script Ruby : + /ruby load /tmp/essai.rb + + + + + Lister les scripts Ruby chargés : + /ruby + + + + + +
+ +
+ Interface WeeChat / scripts + +
+ register + + + Prototype Perl : + + weechat::register ( nom, version, fonction_de_fin, description ); + + + + Prototype Python : + + weechat.register ( nom, version, fonction_de_fin, description ) + + + + Prototype Ruby : + + Weechat.register ( nom, version, fonction_de_fin, description ) + + + + C'est la première fonction à appeler dans le script. + Tout script pour WeeChat doit appeler cette fonction. + + + Paramètres : + + + + : nom unique pour identifier le script + (chaque script doit avoir un nom différent) + + + + + : version du script + + + + + : fonction appelée quand + le script est déchargé (paramètre facultatif, une chaîne + vide signifiant qu'il n'y a pas de fonction à appeler) + + + + + : brève description du script + + + + + + Valeur renvoyée : 1 si le script a été enregistré, 0 si une erreur + s'est produite. + + + Exemples : + +# perl +weechat::register ("essai", "1.0", "fin_essai", "Script d'essai !"); + +# python +weechat.register ("essai", "1.0", "fin_essai", "Script d'essai !") + +# ruby +Weechat.register ("essai", "1.0", "fin_essai", "Script d'essai !") + + +
+ +
+ print + + + Prototype Perl : + + weechat::print ( message, [canal, [serveur]] ) + + + + Prototype Python : + + weechat.prnt ( message, [canal, [serveur]] ) + + + + Prototype Ruby : + + Weechat.print ( message, [canal, [serveur]] ) + + + + Affiche un message sur un tampon WeeChat, identifié par le + serveur et le canal. + + + Paramètres : + + + + : message à afficher + + + + + : nom du canal pour trouver le + tampon dans lequel afficher + + + + + : nom interne du serveur pour + trouver le tampon dans lequel afficher + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::print ("message"); +weechat::print ("message", "#weechat"); +weechat::print ("message", "#weechat", "freenode"); + +# python +weechat.prnt ("message") +weechat.prnt ("message", "#weechat") +weechat.prnt ("message", "#weechat", "freenode") + +# ruby +Weechat.print ("message") +Weechat.print ("message", "#weechat") +Weechat.print ("message", "#weechat", "freenode") + + +
+ +
+ print_infobar + + + Prototype Perl : + + weechat::print_infobar ( temps, message ); + + + + Prototype Python : + + weechat.print_infobar ( temps, message ) + + + + Prototype Ruby : + + Weechat.print_infobar ( temps, message ) + + + + Affiche un message sur la barre d'infos pour un temps déterminé. + + + Paramètres : + + + + : temps (en secondes) pendant + lequel le message est affiché (0 = jamais effacé) + + + + + : message à afficher + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::print_infobar (5, "message"); + +# python +weechat.print_infobar (5, "message") + +# ruby +Weechat.print_infobar (5, "message") + + +
+ +
+ add_message_handler + + + Prototype Perl : + + weechat::add_message_handler ( message, fonction ); + + + + Prototype Python : + + weechat.add_message_handler ( message, fonction ) + + + + Prototype Ruby : + + Weechat.add_message_handler ( message, fonction ) + + + + Ajoute un gestionnaire de messages IRC, appelé dès qu'un message + IRC est reçu. + + + Paramètres : + + + + : nom du message IRC pour lequel la + fonction est appelée. + Pour connaître la liste des messages IRC disponibles, merci + de consulter les RFCs + 1459 et + 2812 + + + + + : fonction appelée lorsque le message + est reçu + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::add_message_handler ("privmsg", ma_fonction); +sub ma_fonction +{ + weechat::print ("serveur=$_[0]\n"); + ($null, $canal, $message) = split ":",$_[1],3; + ($masque, $null, $canal) = split " ", $canal; + weechat::print ("masque=$masque, canal=$canal, msg=$message\n"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_message_handler ("privmsg", ma_fonction) +def ma_fonction(serveur, args): + weechat.prnt("serveur="+serveur) + null, canal, message = string.split(args, ":", 2) + masque, null, canal = string.split(string.strip(canal), " ", 2) + weechat.prnt("masque="+masque+", canal="+canal+", message="+message) + return weechat.PLUGIN_RC_OK + + + + Note : la fonction appelée lorsque le message est reçu doit + renvoyer une des valeurs suivantes (préfixée par "weechat::" pour + Perl, "weechat." pour Python ou "Weechat." pour Ruby) : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + + PLUGIN_RC_OK_IGNORE_WEECHAT : le message + ne sera pas transmis à WeeChat + + + + + PLUGIN_RC_OK_IGNORE_PLUGINS : le message + ne sera pas transmis à d'autres extensions + + + + + PLUGIN_RC_OK_IGNORE_ALL : le message + ne sera ni transmis à WeeChat ni à d'autres extensions + + + + +
+ +
+ add_command_handler + + + Prototype Perl : + + weechat::add_command_handler ( commande, fonction, + [description, arguments, arguments_description, + modele_completion] ); + + + + Prototype Python : + + weechat.add_command_handler ( commande, fonction, + [description, arguments, arguments_description, + modele_completion] ) + + + + Prototype Ruby : + + Weechat.add_command_handler ( commande, fonction, + [description, arguments, arguments_description, + modele_completion] ) + + + + Ajoute un gestionnaire de commande WeeChat, appelé dès que + l'utilisateur utilise la commande (par exemple /commande). + + + Paramètres : + + + + : nom de la nouvelle commande, + qui peut être une commande déjà existante (attention la + commande remplacée ne sera plus disponible jusqu'à ce que + le script soit déchargé) + + + + + : fonction appelée lorsque la + commande est exécutée + + + + + : brève description des + paramètres de la commande (affichée par /help commande) + + + + + : longue description + des paramètres de la commande (affichée par /help commande) + + + + + : modèle pour la + complétion sous la forme "abc|%w def|%i" + qui signigie "abc" ou une commande WeeChat pour le premier + paramètre, et "def" ou une commande IRC pour le deuxième. + (voir ) + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::add_command_handler ("commande", ma_commande); +sub ma_commande +{ + weechat::print("Serveur: $_[0], paramètres: $_[1]\n"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_command_handler ("commande", ma_commande) +def ma_commande(serveur, args): + weechat.prnt("serveur:"+serveur+" paramètres:"+args) + return weechat.PLUGIN_RC_OK + + + + Notes : la fonction appelée lorsque le message est exécutée doit + renvoyer une des valeurs suivantes (préfixée par "weechat::" pour + Perl, "weechat." pour Python ou "Weechat." pour Ruby) : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + +
+ +
+ remove_handler + + + Prototype Perl : + + weechat::remove_handler ( nom, fonction ); + + + + Prototype Python : + + weechat.remove_handler ( nom, fonction ) + + + + Prototype Ruby : + + Weechat.remove_handler ( nom, fonction ) + + + + Supprime un gestionnaire. + + + Paramètres : + + + + : nom du message IRC ou de la commande + + + + + : fonction associée + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::remove_handler ("commande", ma_commande); + +# python +weechat.remove_handler ("commande", ma_commande) + +# ruby +Weechat.remove_handler ("commande", ma_commande) + + +
+ +
+ command + + + Prototype Perl : + + weechat::command ( commande, [canal, [serveur]] ); + + + + Prototype Python : + + weechat.command ( commande, [canal, [serveur]] ) + + + + Prototype Ruby : + + Weechat.command ( commande, [canal, [serveur]] ) + + + + Exécute une commande ou envoie un message à un canal. + + + Paramètres : + + + + : la commande à exécuter + + + + + : nom du canal où exécuter la + commande + + + + + : nom interne du serveur où + exécuter la commande + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::command ("bonjour tout le monde !"); +weechat::command ("/kick toto merci de quitter ce canal", "#weechat"); +weechat::command ("/nick newnick", "", "freenode"); + +# python +weechat.command ("bonjour tout le monde !") +weechat.command ("/kick toto merci de quitter ce canal", "#weechat") +weechat.command ("/nick newnick", "", "freenode") + +# ruby +Weechat.command ("bonjour tout le monde !") +Weechat.command ("/kick toto merci de quitter ce canal", "#weechat") +Weechat.command ("/nick newnick", "", "freenode") + + +
+ +
+ get_info + + + Prototype Perl : + + weechat::get_info ( nom, [serveur] ); + + + + Prototype Python : + + weechat.get_info ( nom, [serveur] ) + + + + Prototype Ruby : + + Weechat.get_info ( nom, [serveur] ) + + + + Renvoie une information sur WeeChat ou un canal. + + + Paramètres : + + + + : nom de l'info à obtenir + (voir ) + + + + + : nom interne du serveur où + récupérer l'information (si nécessaire) + + + + + + Valeur renvoyée : l'information demandée, chaîne vide si une + erreur s'est produite ou que l'information n'a pas été trouvée. + + + Exemples : + +# perl +$version = get_info("version"); +$nick = get_info("nick", "freenode"); + +# python +version = weechat.get_info ("version") +nick = weechat.get_info ("nick", "freenode") + + +
+ +
+ get_dcc_info + + + Prototype Perl : + + weechat::get_dcc_info ( ); + + + + Prototype Python : + + weechat.get_dcc_info ( ) + + + + Prototype Ruby : + + Weechat.get_dcc_info ( ) + + + + Renvoie la liste des DCC en cours ou terminés. + + + Valeur renvoyée : la liste des DCC + (voir ). + +
+ +
+ get_config + + + Prototype Perl : + + weechat::get_config ( option ); + + + + Prototype Python : + + weechat.get_config ( option ) + + + + Prototype Ruby : + + Weechat.get_config ( option ) + + + + Renvoie la valeur d'une option de configuration WeeChat. + + + Paramètres : + + + + : nom de l'option + + + + + + Valeur renvoyée : la valeur de l'option, chaîne vide si l'option + n'a pas été trouvée. + + + Exemples : + +# perl +$value1 = weechat::get_config ("look_nicklist"); +$value2 = weechat::get_config ("freenode.server_autojoin"); + +# python +value1 = weechat.get_config ("look_nicklist") +value2 = weechat.get_config ("freenode.server_autojoin") + + +
+ +
+ set_config + + + Prototype Perl : + + weechat::set_config ( option, valeur ); + + + + Prototype Python : + + weechat.set_config ( option, valeur ) + + + + Prototype Ruby : + + Weechat.set_config ( option, valeur ) + + + + Modifie la valeur d'une option de configuration WeeChat. + + + Paramètres : + + + + : nom de l'option + + + + + : la nouvelle valeur pour + l'option + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est + produite. + + + Exemples : + +# perl +weechat::set_config ("look_nicklist", "off"); +weechat::set_config ("freenode.server_autojoin, "#weechat"); + +# python +weechat.set_config ("look_nicklist", "off") +weechat.set_config ("freenode.server_autojoin, "#weechat") + +# ruby +Weechat.set_config ("look_nicklist", "off") +Weechat.set_config ("freenode.server_autojoin, "#weechat") + + +
+ +
+ get_plugin_config + + + Prototype Perl : + + weechat::get_plugin_config ( option ); + + + + Prototype Python : + + weechat.get_plugin_config ( option ) + + + + Prototype Ruby : + + Weechat.get_plugin_config ( option ) + + + + Renvoie la valeur d'une option de l'extension. + L'option est lue depuis le fichier + "~/.weechat/plugins.rc" et est + sous cette forme : + "extension.script.option=valeur" + (NB : le nom de l'extension et du script sont ajoutés + automatiquement). + + + Paramètres : + + + + : nom de l'option + + + + + + Valeur renvoyée : la valeur de l'option, chaîne vide si l'option + n'a pas été trouvée. + + + Exemples : + +# perl +$value = weechat::get_plugin_config ("ma_variable"); + +# python +value = weechat.get_plugin_config ("ma_variable") + + +
+ +
+ set_plugin_config + + + Prototype Perl : + + weechat::set_plugin_config ( option, valeur ); + + + + Prototype Python : + + weechat.set_plugin_config ( option, valeur ) + + + + Prototype Ruby : + + Weechat.set_plugin_config ( option, valeur ) + + + + Modifie la valeur d'une option de l'extension. + L'option est écrite dans le fichier + "~/.weechat/plugins.rc" et est + sous cette forme : + "extension.script.option=valeur" + (NB : le nom de l'extension et du script sont rajoutés + automatiquement). + + + Paramètres : + + + + : nom de l'option + + + + + : la nouvelle valeur pour + l'option + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est + produite. + + + Exemples : + +# perl +weechat::set_plugin_config ("ma_variable", "valeur"); + +# python +weechat.set_plugin_config ("ma_variable", "valeur") + +# ruby +Weechat.set_plugin_config ("ma_variable", "valeur") + + +
+ +
+ +
+ +
+ + + + + Auteurs / Support + + + Ce chapître liste les auteurs et contributeurs pour WeeChat, et + indique les moyens d'obtenir du support. + + +
+ Auteurs + + + WeeChat est développé par : + + + + FlashCode (Sébastien Helleu) + flashcode AT flashtux.org - + développeur principal + + + + + Kolter + kolter AT free.fr - + développeur + + + + + Ptitlouis + ptitlouis AT sysif.net - + empaqueteur Debian + + + + + +
+ +
+ Contributeurs + + + Les personnes suivantes ont contribué à WeeChat : + + + + Jiri Golembiovsky - + traduction tchèque + + + + + Rudolf Polzer - + patchs + + + + + Jim Ramsay - + patchs + + + + + Pistos - + patchs + + + + + +
+ +
+ Obtenir du support + + + Avant de faire appel au support, merci de lire la documentation et + la FAQ de WeeChat (la documentation est le document que vous êtes + en train de lire, si vous n'avez pas tout lu jusqu'ici, il est encore + temps de recommencer !) + + + + + + + IRC : serveur "irc.freenode.net", + canal "#weechat" + + + + + Forum WeeChat : + + http://forums.flashtux.org + + + + + + Liste de diffusion : + + + + Pour souscrire : + + http://mail.nongnu.org/mailman/listinfo/weechat-support + + + + + + Pour envoyer un mail à la liste de diffusion : + weechat-support@nongnu.org + + + + Les archives de la liste de diffusion sont ici : + + http://mail.nongnu.org/archive/html/weechat-support + + + + + + +
+ +
+ +
diff --git a/doc/weechat-doc.css b/doc/weechat-doc.css new file mode 100644 index 000000000..6f8650351 --- /dev/null +++ b/doc/weechat-doc.css @@ -0,0 +1,49 @@ +/* + * WeeChat doc CSS + * (c) 2006 by FlashCode + */ + +body { + font-size: 12px; +} + +table { + font-size: 12px; +} + +.informaltable table { + font-size: 11px; + font-family: Verdana; + border-collapse: collapse; +} + +.informaltable table th { + padding: 2px 5px 2px 5px; + border: solid 1px #AAAAAA; + background-color: #DDDDFF; +} + +.informaltable table td { + padding: 2px 5px 2px 5px; + border: solid 1px #AAAAAA; +} + +.oddrow { + background-color: #F0F0F0; +} + +.synopsis { + font-size: 11px; +} + +.programlisting { + font-size: 11px; +} + +pre.screen { + font-size: 11px; + background-color: #F5F5F5; + border: solid 1px #CCCCCC; + padding: 4px; + margin: 0 40px 0 40px; +} diff --git a/doc/weechat-html-one.xsl b/doc/weechat-html-one.xsl new file mode 100644 index 000000000..5427dbb3a --- /dev/null +++ b/doc/weechat-html-one.xsl @@ -0,0 +1,27 @@ + + + + + + + + + + + + + +weechat-doc.css + + + + + + + + oddrow + + + + + diff --git a/doc/weechat-html.xsl b/doc/weechat-html.xsl new file mode 100644 index 000000000..56fb6f96d --- /dev/null +++ b/doc/weechat-html.xsl @@ -0,0 +1,27 @@ + + + + + + + + + + + + + +weechat-doc.css + + + + + + + + oddrow + + + + + diff --git a/weechat/configure.in b/weechat/configure.in index 99794c467..3c98ee91f 100644 --- a/weechat/configure.in +++ b/weechat/configure.in @@ -402,6 +402,8 @@ esac AC_OUTPUT([Makefile doc/Makefile + doc/fr/Makefile + doc/en/Makefile src/Makefile src/common/Makefile src/irc/Makefile diff --git a/weechat/doc/Makefile.am b/weechat/doc/Makefile.am index ec9d20969..66ab6651e 100644 --- a/weechat/doc/Makefile.am +++ b/weechat/doc/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (c) 2003-2005 FlashCode +# Copyright (c) 2003-2006 FlashCode # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -12,17 +12,11 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # +SUBDIRS = fr en + man_MANS = weechat-curses.1 -info_TEXINFOS = weechat_doc_fr.texi weechat_doc_en.texi \ - weechat_doc_es.texi weechat_doc_pt.texi - -#weechat_TEXINFOS = weechat_doc_fr.texi weechat_doc_en.texi \ -# weechat_doc_es.texi weechat_doc_pt.texi - -AM_MAKEINFOHTMLFLAGS = --no-split --number-sections - -EXTRA_DIST = $(man_MANS) +EXTRA_DIST = $(man_MANS) weechat-doc.css weechat-html-one.xsl weechat-html.xsl diff --git a/weechat/doc/buildxml.pl b/weechat/doc/buildxml.pl new file mode 100755 index 000000000..0b578c2bf --- /dev/null +++ b/weechat/doc/buildxml.pl @@ -0,0 +1,169 @@ +#!/usr/bin/perl +# +# Copyright (c) 2003-2006 FlashCode +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +# +# Build some XML code for WeeChat doc +# with weechat-curses command +# + +@all_lang = ("fr_FR", "en_US"); +%all_encodings = ("fr_FR" => "iso-8859-1", + "en_US" => "iso-8859-1"); +%all_types = ("fr_FR" => "type", + "en_US" => "type", + "es_ES" => "tipo"); +%all_values = ("fr_FR" => "valeurs", + "en_US" => "values", + "es_ES" => "valores"); +%all_default = ("fr_FR" => "valeur par défaut", + "en_US" => "default values", + "es_ES" => "valor por defecto"); +%all_desc = ("fr_FR" => "description", + "en_US" => "description", + "es_ES" => "descripción"); + +foreach $lng (@all_lang) +{ + create_commands ($lng, $all_encodings{$lng}, + "weechat-curses -w | tail +3", "weechat_commands"); + create_commands ($lng, $all_encodings{$lng}, + "weechat-curses -i | tail +3", "irc_commands"); + create_key_func ($lng, $all_encodings{$lng}, + "weechat-curses -f | tail +3", "key_functions"); + create_config ($lng, $all_encodings{$lng}, + "weechat-curses -c | tail +3", "config"); + print "\n"; +} + +sub create_commands +{ + $lang = $_[0]; + $lang2 = substr ($lang, 0, 2); + $encoding = $_[1]; + $command = $_[2]; + $file = $_[3]; + print "Creating $lang2/$file.xml ($lang)...\n"; + open XML, ">$lang2/$file.xml" or die "Error: can't write file!"; + print XML "\n"; + + $started = 0; + $ENV{"LANG"} = $lang; + foreach (`$command`) + { + if (/\* (.*)/) + { + print XML "\n" if ($started == 1); + $started = 1; + print XML "$1\n"; + print XML ""; + } + else + { + chomp ($_); + print XML "$_\n"; + } + } + print XML "\n"; + close XML; + iconv_file ($lang2."/".$file, $encoding); +} + +sub create_key_func +{ + $lang = $_[0]; + $lang2 = substr ($lang, 0, 2); + $encoding = $_[1]; + $command = $_[2]; + $file = $_[3]; + print "Creating $lang2/$file.xml ($lang)...\n"; + open XML, ">$lang2/$file.xml" or die "Error: can't write file!"; + print XML "\n"; + + $ENV{"LANG"} = $lang; + foreach (`$command`) + { + if (/\* (.*): (.*)/) + { + print XML "\n"; + print XML " $1\n"; + print XML " $2\n"; + print XML "\n"; + } + } + close XML; + iconv_file ($lang2."/".$file, $encoding); +} + +sub create_config +{ + $lang = $_[0]; + $lang2 = substr ($lang, 0, 2); + $encoding = $_[1]; + $command = $_[2]; + $file = $_[3]; + print "Creating $lang2/$file.xml ($lang)...\n"; + open XML, ">$lang2/$file.xml" or die "Error: can't write file!"; + print XML "\n"; + $type = ""; + $values = ""; + $default = ""; + $desc = ""; + + $ENV{"LANG"} = $lang; + foreach (`weechat-curses -c`) + { + if (/\* (.*):/) + { + print XML "\n"; + print XML " \n"; + } + elsif (/ \. $all_types{$lang}: (.*)/) + { + $type = $1; + } + elsif (/ \. $all_values{$lang}: (.*)/) + { + $values = $1; + } + elsif (/ \. $all_default{$lang}: (.*)/) + { + $default = $1; + } + elsif (/ \. $all_desc{$lang}: (.*)/) + { + $_ = $1; + s/(.*)/\u$1/; + $desc = $_; + print XML " ".$type."\n"; + print XML " ".$values."\n"; + print XML " ".$default."\n"; + print XML " ".$desc."\n"; + print XML "\n"; + } + } + close XML; + iconv_file ($lang2."/".$file, $encoding); +} + +sub iconv_file +{ + print "Converting $_[0].xml to $_[1]...\n"; + system ("iconv -t $encoding -o $_[0].xml.$_[1] $_[0].xml"); + system ("mv $_[0].xml.$_[1] $_[0].xml"); +} diff --git a/weechat/doc/en/Makefile.am b/weechat/doc/en/Makefile.am new file mode 100644 index 000000000..6baa7cc0d --- /dev/null +++ b/weechat/doc/en/Makefile.am @@ -0,0 +1,59 @@ +# Copyright (c) 2003-2006 FlashCode +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +LANGCODE = en +BOOK = weechat.$(LANGCODE) +BOOK_INCLUDE = weechat_commands.xml irc_commands.xml key_functions.xml config.xml + +EXTRA_DIST = $(BOOK).xml $(BOOK_INCLUDE) + +docdir = $(datadir)/doc/$(PACKAGE) + +all-local: html-stamp + +# HTML output with chunks (many pages) + +html: html-stamp + +html-stamp: $(BOOK).xml $(BOOK_INCLUDE) ../weechat-html.xsl ../weechat-doc.css + mkdir -p html/ + xsltproc -o html/ ../weechat-html.xsl $(BOOK).xml || true + cp ../weechat-doc.css html/ + touch html-stamp + +# HTML output, all in one page + +html1: html1-stamp + +html1-stamp: $(BOOK).xml $(BOOK_INCLUDE) ../weechat-html-one.xsl ../weechat-doc.css + mkdir -p html1/ + xsltproc -o html1/$(BOOK).html ../weechat-html-one.xsl $(BOOK).xml || true + cp ../weechat-doc.css html1/ + touch html1-stamp + +# install docs + +install-data-hook: + $(mkinstalldirs) $(DESTDIR)$(docdir)/html/$(LANGCODE)/ + $(INSTALL_DATA) html/* $(DESTDIR)$(docdir)/html/$(LANGCODE)/ + +# clean + +clean-local: + -rm -f *.html *.pdf *.txt + -rm -rf html/ html1/ + -rm -f html-stamp html1-stamp diff --git a/weechat/doc/en/weechat.en.xml b/weechat/doc/en/weechat.en.xml new file mode 100644 index 000000000..6ac8678c7 --- /dev/null +++ b/weechat/doc/en/weechat.en.xml @@ -0,0 +1,3483 @@ + + + + + + + + +]> + + + + + + WeeChat 0.1.7-cvs - User guide + Fast, light and extensible IRC client + + + Sébastien + Helleu + flashcode AT flashtux.org + + + + 2006 + Sébastien Helleu + + + + + This manual is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA + + + + + + This manual documents WeeChat IRC client, it is part of WeeChat. + + + Latest version of this document can be found on this page: + + http://weechat.flashtux.org/doc.php + + + + + + + + + + Introduction + + + This chapter describes WeeChat and pre-requisites for its installation. + + +
+ Description + + + WeeChat (Wee Enhanced Environment for Chat) is a free + IRC client, fast and light, designed for many + operating systems. + + + + Main features are: + + + + multi-servers connection (with SSL, IPv6, proxy) + + + + + many GUI: Curses, wxWidgets, Gtk and Qt + + + + + small, fast and light + + + + + customizable and extensible with plugins and scripts + + + + + compliant with RFCs + 1459, + 2810, + 2811, + 2812 and + 2813 + + + + + multi-platform (GNU/Linux, *BSD, MacOS X, Windows and other) + + + + + 100% GPL, free software + + + + + + + WeeChat homepage is here: + + http://weechat.flashtux.org + + + +
+ +
+ Pre-requisites + + + In order to install WeeChat, you need: + + + + a running GNU/Linux system (with compiler tools for source + package) + + + + + "root" privileges (to install WeeChat) + + + + + according to GUI, one of the following libraries: + + + + Curses: ncurses library + + + + + Gtk: *** GUI not developed *** + + + + + WxWidgets: *** GUI not developed *** + + + + + Qt: *** GUI not developed *** + + + + + + + + +
+
+ + + + + Installation + + + This chapter explains how to install WeeChat. + + +
+ Binary packages + + + Binary packages are available for these distributions: + + + + Debian (or any Debian compatible distribution): + apt-get install weechat + + + + + Mandriva/RedHat (or any RPM compatible distribution): + + rpm -i /chemin/weechat-x.y.z-1.i386.rpm + + + + + + Gentoo : + emerge weechat + + + + + For other distributions, please look at your manual for + installation instructions. + + +
+ +
+ Source package + + + All you have to do is to run in a console or a terminal: +$ ./configure +$ make + + + Then get root privileges and install WeeChat: +$ su +(enter root password) +# make install + + +
+ +
+ CVS sources + + + Warning: CVS sources are for advanced users: it may not compile + or not be stable. You're warned! + + + + To get CVS sources, issue this command: +$ cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/weechat co weechat + + + + Execute this script: + ./autogen.sh + + + + Then follow instructions for source package + (see ) + + +
+ +
+ + + + + Usage + + + This chapter explains how to run WeeChat, the default key bindings + used, internal and IRC commands, setup file, and FIFO pipe use. + + +
+ Run WeeChat + + + Command line arguments: + + + + + Parameter + Description + + + + + -a, --no-connect + + Disable auto-connect to servers at startup + + + + -c, --config + + Display config help (list of options) + + + + -f, --key-functions + + Display WeeChat internal functions for keys + + + + -h, --help + + Display help + + + + -i, --irc-commands + + Display IRC commands list + + + + -k, --keys + + Display WeeChat default keys + + + + -l, --license + + Display WeeChat license + + + + -p, --no-plugin + + Disable plugins auto-load + + + + -v, --version + + Display WeeChat version + + + + -w, --weechat-commands + + Display WeeChat commands list + + + + + + + + + It is also possible to give URL for one or many IRC servers, as + follow: + irc[6][s]://[pseudo[:mot_passe]@]irc.example.org[:port][/channel][,channel[...] + Example to join #weechat and #toto on + "irc.freenode.net" server, default port (6667), + with "nono" nick: + $ weechat-curses irc://nono@irc.freenode.net/#weechat,#toto + + + + To start WeeChat, issue this command: + + + + for Curses GUI: weechat-curses + + + + + for Gtk GUI: weechat-gtk + + + + + for wxWidgets GUI: weechat-wxwidgets + + + + + for Qt GUI: weechat-qt + + + + + + + When you run WeeChat for the first time, a default configuration + file is created, with default options. + The default configuration file is: + "~/.weechat/weechat.rc" + + + + You can edit thie file at your convenience to configure WeeChat + (ONLY if WeeChat is not running), or you can set parameters with + "/set" command in WeeChat + (see ) + + +
+ +
+ Key bindings + + + + + + + Key + Action + + + + + Left arrow + + Go to previous char in command line + + + + Right arrow + + Go to next char in command line + + + + Ctrl + left arrow + + Go to previous word in command line + + + + Ctrl + right arrow + + Go to next word in command line + + + + Home / Ctrl + A + + Go to the beginning of command line + + + + End / Ctrl + E + + Go to the end of command line + + + + Ctrl + K + + Delete from cursor until end of command line + + + + Ctrl + L + + Redraw whole window + + + + Ctrl + U + + Delete from cursor until beginning of command line + + + + Ctrl + W + + Delete previous word of command line + + + + Backspace + + Delete previous char in command line + + + + Delete + + Delete next char in command line + + + + Tab + + Complete command or nick + (Tab again: find next completion) + + + + Any char + + Insert char at cursor position in command line + + + + Enter + + Execute command or send message + + + + Up arrow / Down arrow + + Call again last commands/messages + + + + Ctrl + up arrow / Ctrl + down arrow + + Call again last commands/messages in global history + (common for all buffers) + + + + PageUp / PageDown + + Show buffer history + + + + F5 / Alt + left arrow + + Switch to previous buffer + + + + F6 / Alt + right arrow + + Switch to next buffer + + + + F7 + + Switch to previous window + + + + F8 + + Switch to next window + + + + F10 + + Remove last infobar message + + + + F11 / F12 + + Scroll nicklist + + + + Alt + Home / Alt + End + + Go to the beginning / the end of nicklist + + + + Alt + A + + Switch to next buffer with activity + (with priority: highlight, message, other) + + + + Alt + B + + Go to previous word in command line + + + + Alt + D + + Delete next word in command line + + + + Alt + F + + Go to next word in command line + + + + Alt + H + + Clear hotlist + (activity notification on other buffers) + + + + Alt + J then Alt + D + + Display DCC buffer + + + + Alt + J then Alt + L + + Switch to last buffer + + + + Alt + J then Alt + S + + Switch to server buffer + + + + Alt + J puis Alt + X + + Switch to first channel of next buffer + (or server buffer if no channel is opened) + + + + Alt + digit (0-9) + + Switch to buffer by number (0 = 10) + + + + Alt + J then number (01-99) + + Switch to buffer by number + + + + Alt + K + + Grab a key and insert its code in command line + + + + Alt + N + + Scroll to next highlight + + + + Alt + P + + Scroll to previous highlight + + + + Alt + R + + Delete entire command line + + + + Alt + S + + Switch servers on servers buffer + (if option "look_one_server_buffer" is enabled) + + + + Alt + U + + Scroll to first unread line in buffer + + + + Alt + W then Alt + flèche + + Switch to window with direction + + + + + + + +
+ +
+ WeeChat / IRC commands + + + This chapter lists all WeeChat and IRC commands. + + +
+ WeeChat commands + + + &weechat_commands.xml; + + +
+ +
+ Key functions + + + + + + + Function + Description + + + + + &key_functions.xml; + + + + + + +
+ +
+ IRC commands + + + &irc_commands.xml; + + +
+ +
+ +
+ Configuration file + + + List of options for config file: + + + + + Option + Type + Values + Default + Description + + + + + &config.xml; + + + + + + + + Colors for Curses GUI are: + + + + + Keyword + Color + + + + + default + default color (transparent for background) + + + black + black + + + red + dark red + + + lightred + light red + + + green + dark green + + + lightgreen + light green + + + brown + brown + + + yellow + yellow + + + blue + dark blue + + + lightblue + light blue + + + magenta + dark magenta + + + lightmagenta + light magenta + + + cyan + dark cyan + + + lightcyan + light cyan + + + white + white + + + + + + +
+ +
+ FIFO pipe + + + You can remote control WeeChat, by sending commands or text to a + FIFO pipe (you have to enable option "irc_fifo_pipe", it is disabled + by default). + + + + The FIFO pipe is located in "~/.weechat/" and is + called "weechat_fifo_xxxxx" (where xxxxx is the process ID (PID) of + running WeeChat). So if many WeeChat are running, you have many FIFO + pipes, one for each session. + + + + The syntax for the FIFO pipe commands/text is: + server,channel *text or command here + where server and channel are optional, but if channel is here, server + should be too. + + + + Some examples: + + + + nick change on freenode to "mynick|out" : + $ echo "freenode */nick mynick|out" >~/.weechat/weechat_fifo_12345 + + + + + display text on #weechat channel: + $ echo "freenode,#weechat *hello everybody!" >~/.weechat/weechat_fifo_12345 + + + + + display text on current channel (buffer displayed by WeeChat): + $ echo "*hello!" >~/.weechat/weechat_fifo_12345 + Warning: this is dangerous and you should + not do that except if you know what you do! + + + + + send two commands to unload/reload Perl scripts (you have to + separate them with "\n"): + $ echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345 + + + + + + + You can write a script to send command to all running WeeChat at same + time, for example: + +#!/bin/sh +if [ $# -eq 1 ]; then + for fifo in $(/bin/ls ~/.weechat/weechat_fifo_* 2>/dev/null); do + echo -e "$1" >$fifo + done +fi + + If the script is called "auto_weechat_command", you can run it with: + $ ./auto_weechat_command "freenode,#weechat *hello" + + +
+ +
+ + + + + Plugins + + + This chapter describes WeeChat plugins interface (API) and + the default scripts plugins (Perl, Python, Ruby), provided with + WeeChat. + + +
+ Plugins in WeeChat + + + A plugin is a C program which can call WeeChat functions defined in + an interface. + + + + This C program does not need WeeChat sources to compile and can be + dynamically loaded into WeeChat with command + /plugin. + + + + The plugin has to be a dynamic library, for dynamic loading by + operating system. + Under GNU/Linux, the file has ".so" extension, ".dll" under + Windows. + + +
+ +
+ Write a plugin + + + The plugin has to include "weechat-plugin.h" file (available in + WeeChat source code). + This file defines structures and types used to communicate with + WeeChat. + + + + The plugin must have some variables and functions (mandatory, + without them the plugin can't load): + + + + + Variable + Description + + + + + char plugin_name[] + plugin name + + + char plugin_version[] + plugin version + + + char plugin_description[] + short description of plugin + + + + + + + + + + Function + Description + + + + + int weechat_plugin_init (t_weechat_plugin *plugin) + + function called when plugin is loaded, must return + PLUGIN_RC_OK if successful, PLUGIN_RC_KO if error + (if error, plugin will NOT be loaded) + + + + void weechat_plugin_end (t_weechat_plugin *plugin) + function called when plugin is unloaded + + + + + + +
+ API functions + +
+ ascii_strcasecmp + + + Prototype: + + int ascii_strcasecmp (t_weechat_plugin *plugin, + char *string1, char *string2) + + + + Locale and case independent string comparison. + + + Arguments: + + + + : pointer to plugin structure + + + + + : first string for comparison + + + + + : second string for comparison + + + + + + Return value: difference between two strings: negative if + string1 < string2, zero if string1 == string2, positive if + string1 > string2 + + + Example: + if (plugin->ascii_strcasecmp (plugin, "abc", "def") != 0) ... + +
+ +
+ ascii_strncasecmp + + + Prototype: + + int ascii_strncasecmp (t_weechat_plugin *plugin, + char *string1, char *string2, int max) + + + + Locale and case independent string comparison, for "max" chars. + + + Arguments: + + + + : pointer to plugin struct + + + + + : first string for comparison + + + + + : second string for comparison + + + + + : max number of chars for comparison + + + + + + Return value: difference between two strings: negative if + string1 < string2, zero if string1 == string2, positive if + string1 > string2 + + + Example: + if (plugin->ascii_strncasecmp (plugin, "abc", "def", 2) != 0) ... + +
+ +
+ explode_string + + + Prototype: + + char **explode_string (t_weechat_plugin *plugin, char *string, + char *separators, int num_items_max, int *num_items) + + + + Explode a string according to one or more delimiter(s). + + + Arguments: + + + + : pointer to plugin struct + + + + + : string to explode + + + + + : delimiters used for explosion + + + + + : maximum number of items + created (0 = no limit) + + + + + : pointer to int which will + contain number of items created + + + + + + Return value: array of strings, NULL if problem. + + + Note: result has to be free by a call to "free_exloded_string" + after use. + + + Example: + +char **argv; +int argc; +argv = plugin->explode_string (plugin, string, " ", 0, &argc); +... +if (argv != NULL) + plugin->free_exploded_string (plugin, argv); + + +
+ +
+ free_exploded_string + + + Prototype: + + char **free_exploded_string (t_weechat_plugin *plugin, + char **string) + + + + Free memory used by a string explosion. + + + Arguments: + + + + : pointer to plugin structure + + + + + : string exploded by + "explode_string" function + + + + + + Return value: none. + + + Example: + +char *argv; +int argc; +argv = plugin->explode_string (plugin, string, " ", 0, &argc); +... +if (argv != NULL) + plugin->free_exploded_string (plugin, argv); + + +
+ +
+ exec_on_files + + + Prototype: + + void exec_on_files (t_weechat_plugin *plugin, char *repertoire, + int (*callback)(t_weechat_plugin *, char *)) + + + + Execute a function on all files of a directory. + + + Arguments: + + + + : pointer tu plugin structure + + + + + : directory for searching files + + + + + : function called for each file + found + + + + + + Return value: none. + + + Example: + +int callback (t_weechat_plugin *plugin, char *file) +{ + plugin->printf_server (plugin, "file: %s", file); + return 1; +} +... +plugin->exec_on_files (plugin, "/tmp", &callback); + + +
+ +
+ printf + + + Prototype: + + void printf (t_weechat_plugin *plugin, + char *server, char *channel, char *message, ...) + + + + Display a message on a WeeChat buffer, identified by server and + channel (both may be NULL for current buffer). + + + Arguments: + + + + : pointer to plugin structure + + + + + : internal name of server to find + buffer for message display (may be NULL) + + + + + : name of channel to find buffer + for message display (may be NULL) + + + + + : message + + + + + + Return value: none. + + + Examples: + +plugin->printf (plugin, NULL, NULL, "hello"); +plugin->printf (plugin, NULL, "#weechat", "hello"); +plugin->printf (plugin, "freenode", "#weechat", "hello"); + + +
+ +
+ printf_server + + + Prototype: + + void printf_server (t_weechat_plugin *plugin, + char *message, ...) + + + + Display a message on current server buffer. + + + Arguments: + + + + : pointer to plugin structure + + + + + : message + + + + + + Return value: none. + + + Example: plugin->printf_server (plugin, "hello"); + +
+ +
+ printf_infobar + + + Prototype: + + void printf_infobar (t_weechat_plugin *plugin, + int time, char *message, ...) + + + + Display a message in infobar for a specified time. + + + Arguments: + + + + : pointer to plugin structure + + + + + : time (in seconds) for displaying + message (0 = never erased) + + + + + + Return value: none. + + + Example: + +plugin->printf_infobar (plugin, 5, "hello"); + + +
+ +
+ msg_handler_add + + + Prototype: + + t_plugin_handler *msg_handler_add (t_weechat_plugin + *plugin, char *message, t_plugin_handler_func *function, + char *handler_args, void *handler_pointer) + + + + Add an IRC message handler, called when an IRC message is + received. + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of IRC message. + To know list of IRC messages, please consult + RFCs + 1459 and + 2812 + + + + + : function called when message + is received + + + + + : arguments given to function + when called + + + + + : pointer given to function + when called + + + + + + Return value: pointer to new message handler. + + + Note: function called when message is received has to return + one of following values: + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfully + completed + + + + + PLUGIN_RC_OK_IGNORE_WEECHAT: message + will not be sent to WeeChat + + + + + PLUGIN_RC_OK_IGNORE_PLUGINS: message + will not be sent to other plugins + + + + + PLUGIN_RC_OK_IGNORE_ALL: message + will not be sent to WeeChat neither other plugins + + + + + + Example: + +int msg_kick (t_weechat_plugin *plugin, char *server, char *command, + char *arguments, char *handler_args, void *handler_pointer) +{ + plugin->printf (plugin, serveur, NULL, "KICK received"); + return PLUGIN_RC_OK; +} +... +plugin->msg_handler_add (plugin, "KICK", &msg_kick, NULL, NULL); + + +
+ +
+ cmd_handler_add + + + Prototype: + + t_plugin_handler *cmd_handler_add (t_weechat_plugin + *plugin, char *command, char *description, char *arguments, + char *arguments_description, char *completion_template, + t_plugin_handler_func *fonction, char *handler_args, + void *handler_pointer) + + + + Add a WeeChat command handler, called when user uses command + (for example /command). + + + Arguments: + + + + : pointer to plugin structure + + + + + : the new command name, which + may be an existing command (be careful, replaced command + will not be available until plugin is unloaded) + + + + + : short command description + (displayed by /help command) + + + + + : short description of command + arguments (displayed by /help command) + + + + + : long description + of command arguments (displayed by /help command) + + + + + : template for + completion, like "abc|%w def|%i" + which means "abc" or a WeeChat command for first argument, + "def" or IRC command for second. + An empty string lets WeeChat complete any argument with + a nick from current channel, NULL disable completion for + all command arguments. + + + Following codes can be used: + + + + + Code + Description + + + + + %- + no completion for argument + + + %a + alias + + + %A + + alias and commandes (WeeChat, IRC and plugins) + + + + %c + current channel + + + %C + channels of current server + + + %f + filename + + + %h + plugins commands + + + %i + IRC commands (sent) + + + %I + IRC commands (received) + + + %k + key functions + + + %n + nicks of current channel + + + %o + setup options + + + %p + default "part" message + + + %q + default "quit" message + + + %s + current server name + + + %S + all servers names + + + %t + topic of current channel + + + %v + setup option value + + + %w + WeeChat commands + + + %y + default "away" message + + + + + + + + + : function called when command + is executed + + + + + : arguments given to function + when called + + + + + : pointer given to function + when called + + + + + + Return value: pointer to new command handler. + + + Note: function called when command is executed has to return + one of following values: + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfulle + completed + + + + + + Example: + +int cmd_test (t_weechat_plugin *plugin, char *server, + char *command, char *arguments, char *handler_args, + void *handler_pointer) +{ + plugin->printf (plugin, serveur, NULL, + "test command, nick: %s", + (arguments) ? arguments : "none"); + return PLUGIN_RC_OK; +} +... +plugin->cmd_handler_add (plugin, "test", "Test command", + "[nick]", "nick: nick of channel", + "%n", &cmd_test, NULL, NULL); + + +
+ +
+ handler_remove + + + Prototype: + + void handler_remove (t_weechat_plugin *plugin, + t_plugin_handler *handler) + + + + Remove a handler. + + + Arguments: + + + + : pointer to plugin structure + + + + + : handler to remove + + + + + + Return value: none. + + + Example: + plugin->handler_remove (plugin, my_handler); + +
+ +
+ handler_remove_all + + + Prototype: + + void handler_remove_all (t_weechat_plugin *plugin) + + + + Remove all handlers for a plugin. + + + Arguments: + + + + : pointer to plugin structure + + + + + + Return value: none. + + + Example: + plugin->handler_remove_all (plugin); + +
+ +
+ exec_command + + + Prototype: + + void exec_command (t_weechat_plugin + *plugin, char *server, char *channel, char *command) + + + + Execute a WeeChat command (or send a message to a channel). + + + Arguments: + + + + : pointer to plugin structure + + + + + : internal name of server for + executing command (may be NULL) + + + + + : name of channel for executing + command (may be NULL) + + + + + : command + + + + + + Return value: none. + + + Examples: + +plugin->exec_command (plugin, NULL, NULL, "/help nick"); +plugin->exec_command (plugin, "freenode", "#weechat", "hello"); + + +
+ +
+ get_info + + + Prototype: + + char *get_info (t_weechat_plugin *plugin, + char *info, char *server) + + + + Return an info about WeeChat or a channel. + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of info to read: + + + + + Info + Description + + + + + version + WeeChat's version + + + nick + nick + + + channel + + name of channel (NULL for a server or private) + + + + server + name of server + + + away + "away" flag + + + weechat_dir + + WeeChat home dir + (by default: ~/.weechat/) + + + + weechat_libdir + WeeChat system lib directory + + + weechat_sharedir + WeeChat system share directory + + + + + + + + + : internal name of server for + reading info (if needed) + + + + + + Return value: information asked, NULL if not found. + + + Note: result has to be free by a call to "free" function after + use. + + + Examples: + +char *version = plugin->get_info (plugin, "version", NULL); +char *nick = plugin->get_info (plugin, "nick", "freenode"); + + +
+ +
+ get_dcc_info + + + Prototype: + + t_plugin_info_dcc *get_dcc_info (t_weechat_plugin *plugin) + + + + Return list of DCC currently active or finished. + + + Arguments: + + + + : pointer to plugin structure + + + + + + Return value: linked list of DCC. + + + + + Field + Description + + + + + server + IRC server + + + channel + IRC channel + + + type + + DCC type: + 0 = chat received, + 1 = chat sent, + 2 = file received, + 3 = file sent + + + + status + + DCC status: + 0 = waiting, + 1 = connecting, + 2 = active, + 3 = finished, + 4 = failed, + 5 = interrupted by user + + + + start_time + date/time of DCC creation + + + start_transfer + date/time of DCC transfert start + + + addr + IP address of remote user + + + port + port used for DCC + + + nick + remote nick + + + filename + file name + + + local_filename + local file name + + + size + file size + + + pos + position in file + + + start_resume + start position after interruption + + + bytes_per_sec + + number of bytes per second since transfert start + + + + + + + + Note: result has to be free by a call to "free_dcc_info" function + after use. + + + Examples: + +t_plugin_dcc_info *dcc_info = plugin->get_dcc_info (plugin); +for (ptr_dcc = dcc_info; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc) +{ + plugin->printf_server (plugin, "DCC type=%d, with: %s", + ptr_dcc->type, ptr_dcc->nick); +} +if (dcc_info) + plugin->free_dcc_info (plugin, dcc_info); + + +
+ +
+ free_dcc_info + + + Prototype : + + void free_dcc_info (t_weechat_plugin *plugin, + t_plugin_dcc_info *dcc_info) + + + + Free memory used by a DCC list. + + + Arguments: + + + + : pointer to plugin structure + + + + + : pointer to DCC list returned by + "get_dcc_info" function + + + + + + Return value: none. + + + Example: + plugin->free_dcc_info (plugin, dcc_info); + +
+ +
+ get_config + + + Prototype : + + char *get_config (t_weechat_plugin *plugin, char *option) + + + + Return value of a WeeChat config option. + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of option to read + + + + + + Return value: option value, NULL if not found. + + + Note: result has to be free by a call to "free" function after + use. + + + Examples: + +char *value1 = plugin->get_config (plugin, "look_set_title"); +char *value2 = plugin->get_config (plugin, "freenode.server_autojoin"); + + +
+ +
+ set_config + + + Prototype: + + int set_config (t_weechat_plugin *plugin, + char *option, char *value) + + + + Update value of a WeeChat config option. + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of option to update + + + + + : new value for option + + + + + + Return value: 1 if option was successfully updated, 0 if an + error occured. + + + Example: + +plugin->set_config (plugin, "look_nicklist", "off"); + + +
+ +
+ get_plugin_config + + + Prototype: + + char *get_plugin_config (t_weechat_plugin *plugin, char *option) + + + + Return value of a plugin option. + Option is read from file "~/.weechat/plugins.rc" + and is like: "plugin.option=value" + (note: plugin name is automatically added). + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of option to read + + + + + + Return value: option value, NULL if not found. + + + Note: result has to be free by a call to "free" function after + use. + + + Example: + +char *value = plugin->get_plugin_config (plugin, "my_var"); + + +
+ +
+ set_plugin_config + + + Prototype: + + int set_plugin_config (t_weechat_plugin *plugin, + char *option, char *value) + + + + Update value of a plugin option. + Option is written in file "~/.weechat/plugins.rc" + and is like: "plugin.option=value" + (note: plugin name is automatically added). + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of option to update + + + + + : new value for option + + + + + + Return value: 1 if option was successfully updated, 0 if an + error occurred. + + + Example : + +plugin->set_plugin_config (plugin, "my_var", "value"); + + +
+ +
+ +
+ Compile plugin + + + Compile does not need WeeChat sources, only file + "weechat-plugin.h". + + + + To compile a plugin which has one file "toto.c" (sous GNU/Linux): + +$ gcc -fPIC -Wall -c toto.c +$ gcc -shared -fPIC -o libtoto.so toto.o + + + +
+ +
+ Load plugin into WeeChat + + + Copy "libtoto.so" file into system plugins dir (for example + "/usr/local/lib/weechat/plugins") or into + user's plugins dir (for example + "/home/xxxxx/.weechat/plugins"). + + + + Under WeeChat: + /plugin load toto + + +
+ +
+ Plugin example + + + Full example of plugin, which adds a /double command, which displays + two times arguments on current channel (ok that's not very useful, but + that's just an example!): + +#include <stdlib.h> + +#include "weechat-plugin.h" + +char plugin_name[] = "Double"; +char plugin_version[] = "0.1"; +char plugin_description[] = "Test plugin for WeeChat"; + +/* gestionnaire de commande "/double" */ + +int double_cmd (t_weechat_plugin *plugin, char *server, + char *command, char *arguments, + char *handler_args, void *handler_pointer) +{ + if (arguments && arguments[0] && (arguments[0] != '/')) + { + plugin->exec_command (plugin, NULL, NULL, arguments); + plugin->exec_command (plugin, NULL, NULL, arguments); + } + return PLUGIN_RC_OK; +} + +int weechat_plugin_init (t_weechat_plugin *plugin) +{ + plugin->cmd_handler_add (plugin, "double", + "Display two times a message", + "msg", + "msg: message to display two times", + NULL, + &double_cmd, + NULL, NULL); + return PLUGIN_RC_OK; +} + +void weechat_plugin_end (t_weechat_plugin *plugin) +{ + /* nothing done here */ +} + + + +
+ +
+ +
+ Scripts plugins + + + Three plugins are provided with WeeChat to use script languages: + Perl, Python and Ruby. + + +
+ Load / unload scripts + + + Scripts are loaded and unloaded with /perl, + /python and /ruby commands + (type /help in WeeChat for help about commands). + + + + Examples: + + + + Load a Perl script: + /perl load /tmp/test.pl + + + + + List all loaded Perl scripts: + /perl + + + + + Load a Python script: + /python load /tmp/test.py + + + + + List all loaded Python scripts: + /python + + + + + Load a Ruby script: + /ruby load /tmp/test.rb + + + + + List all loaded Ruby scripts: + /ruby + + + + + +
+ +
+ WeeChat / scripts API + +
+ register + + + Perl prototype: + + weechat::register ( name, version, end_function, description ); + + + + Python prototype: + + weechat.register ( name, version, end_function, description ) + + + + Ruby prototype: + + Weechat.register ( name, version, end_function, description ) + + + + This is first function to call in script. + All WeeChat scripts have to call this function. + + + Arguments: + + + + : unique name to identify script + (each script must have unique name) + + + + + : script version + + + + + : function called when script is + unloaded (optional parameter, empty string means nothing is + called at the end) + + + + + : short description of script + + + + + + Return value: 1 if script was registered, 0 if an error occured. + + + Examples: + +# perl +weechat::register ("test", "1.0", "end_test", "Test script!"); + +# python +weechat.register ("test", "1.0", "end_test", "Test script!") + +# ruby +Weechat.register ("test", "1.0", "end_test", "Test script!") + + +
+ +
+ print + + + Perl prototype: + + weechat::print ( message, [channel, [server]] ) + + + + Python prototype: + + weechat.prnt ( message, [channel, [server]] ) + + + + Ruby prototype: + + Weechat.print ( message, [channel, [server]] ) + + + + Display a message on a WeeChat buffer, identified by server + and channel. + + + Arguments: + + + + : message + + + + + : name of channel to find buffer + for message display + + + + + : internal name of server to find + buffer for message display + + + + + + Return value: 1 if success, 0 if an error occured. + + + Examples: + +# perl +weechat::print ("message"); +weechat::print ("message", "#weechat"); +weechat::print ("message", "#weechat", "freenode"); + +# python +weechat.prnt ("message") +weechat.prnt ("message", "#weechat") +weechat.prnt ("message", "#weechat", "freenode") + +# ruby +Weechat.print ("message") +Weechat.print ("message", "#weechat") +Weechat.print ("message", "#weechat", "freenode") + + +
+ +
+ print_infobar + + + Perl prototype: + + weechat::print_infobar ( time, message ); + + + + Python prototype: + + weechat.print_infobar ( time, message ) + + + + Ruby prototype: + + Weechat.print_infobar ( time, message ) + + + + Display a message in infobar for a specified time. + + + Arguments: + + + + : time (in seconds) for displaying + message (0 = never erased) + + + + + : message + + + + + + Return value: 1 if success, 0 if an error occured. + + + Examples: + +# perl +weechat::print_infobar (5, "message"); + +# python +weechat.print_infobar (5, "message") + +# ruby +Weechat.print_infobar (5, "message") + + +
+ +
+ add_message_handler + + + Perl prototype: + + weechat::add_message_handler ( message, function ); + + + + Python prototype: + + weechat.add_message_handler ( message, function ) + + + + Ruby prototype: + + Weechat.add_message_handler ( message, function ) + + + + Add an IRC message handler, called when an IRC message is + received. + + + Arguments: + + + + : name of IRC message. To know list + of IRC messages, please consult RFCs + 1459 and + 2812 + + + + + : function called when message is + received + + + + + + Return value: 1 if success, 0 if an error occured. + + + Examples: + +# perl +weechat::add_message_handler ("privmsg", my_function); +sub my_function +{ + weechat::print ("server=$_[0]\n"); + ($null, $channel, $message) = split ":",$_[1],3; + ($mask, $null, $channel) = split " ", $channel; + weechat::print ("mask=$mask, channel=$channel, msg=$message\n"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_message_handler ("privmsg", my_function) +def ma_fonction(server, args): + weechat.prnt("server="+serveur) + null, channel, message = string.split(args, ":", 2) + masque, null, channel = string.split(string.strip(channel), " ", 2) + weechat.prnt("mask="+mask+", canal="+channel+", message="+message) + return weechat.PLUGIN_RC_OK + + + + Note: function called when message is received has to return one + of following values (prefixed by weechat::" for Perl, "weechat." + for Python or "Weechat." for Ruby): + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfully + completed + + + + + PLUGIN_RC_OK_IGNORE_WEECHAT: message + will not be sent to WeeChat + + + + + PLUGIN_RC_OK_IGNORE_PLUGINS: message + will not be sent to other plugins + + + + + PLUGIN_RC_OK_IGNORE_ALL: message + will not be sent to WeeChat neither other plugins + + + + +
+ +
+ add_command_handler + + + Perl prototype: + + weechat::add_command_handler ( command, function, + [description, arguments, arguments_description, + completion_template] ); + + + + Python prototype: + + weechat.add_command_handler ( command, function, + [description, arguments, arguments_description, + completion_template] ) + + + + Ruby prototype: + + Weechat.add_command_handler ( command, function, + [description, arguments, arguments_description, + completion_template] ) + + + + Add a WeeChat command handler, called when user uses command + (for example /command). + + + Paramètres : + + + + : the new command name, which + may be an existing command (be careful, replaced command + will not be available until script is unloaded) + + + + + : fonction appelée lorsque la + commande est exécutée + + + + + : short description of command + arguments (displayed by /help command) + + + + + : long description + of command arguments (displayed by /help command) + + + + + : template for + completion, like "abc|%w def|%i" which + means "abc" or a WeeChat command for first argument, + "def" or IRC command for second. + (see ) + + + + + + Return value: 1 if success, 0 if an error occured. + + + Examples: + +# perl +weechat::add_command_handler ("command", my_command); +sub my_command +{ + weechat::print("Server: $_[0], arguments: $_[1]\n"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_command_handler ("command", my_command) +def ma_commande(server, args): + weechat.prnt("server:"+serveur+" arguments:"+args) + return weechat.PLUGIN_RC_OK + + + + Notes: function called when command is executed has to return one + of following values (prefixed by "weechat::" for Perl, "weechat." + for Python or "Weechat." for Ruby): + + + + PLUGIN_RC_KO : function failed + + + + + PLUGIN_RC_OK : function successfully + completed + + + + +
+ +
+ remove_handler + + + Perl prototype: + + weechat::remove_handler ( name, function ); + + + + Python prototype: + + weechat.remove_handler ( name, function ) + + + + Ruby prototype: + + Weechat.remove_handler ( name, function ) + + + + Remove a handler. + + + Arguments: + + + + : name of IRC message or command + + + + + : function + + + + + + Return value: 1 if success, 0 if an error occured. + + + Examples: + +# perl +weechat::remove_handler ("command", my_command); + +# python +weechat.remove_handler ("command", my_command) + +# ruby +Weechat.remove_handler ("command", my_command) + + +
+ +
+ command + + + Perl prototype: + + weechat::command ( command, [channel, [server]] ); + + + + Python prototype: + + weechat.command ( command, [channel, [server]] ) + + + + Ruby prototype: + + Weechat.command ( command, [channel, [server]] ) + + + + Execute a WeeChat command (or send a message to a channel). + + + Arguments: + + + + : command + + + + + : name of channel for executing + command + + + + + : internal name of server for + executing command + + + + + + Return value: 1 if success, 0 if an error occured. + + + Examples: + +# perl +weechat::command ("hello everybody!"); +weechat::command ("/kick toto please leave this channel", "#weechat"); +weechat::command ("/nick newnick", "", "freenode"); + +# python +weechat.command ("hello everybody!") +weechat.command ("/kick toto please leave this channel", "#weechat") +weechat.command ("/nick newnick", "", "freenode") + +# ruby +Weechat.command ("hello everybody!") +Weechat.command ("/kick toto please leave this channel", "#weechat") +Weechat.command ("/nick newnick", "", "freenode") + + +
+ +
+ get_info + + + Perl prototype: + + weechat::get_info ( name, [server] ); + + + + Python prototype: + + weechat.get_info ( name, [server] ) + + + + Ruby prototype: + + Weechat.get_info ( name, [server] ) + + + + Return an info about WeeChat or a channel. + + + Arguments: + + + + : name of info to read + (see ) + + + + + : internal name of server for + reading info (if needed) + + + + + + Return value: information asked, empty string if an error + occured + + + Examples: + +# perl +$version = get_info("version"); +$nick = get_info("nick", "freenode"); + +# python +version = weechat.get_info ("version") +nick = weechat.get_info ("nick", "freenode") + + +
+ +
+ get_dcc_info + + + Perl prototype: + + weechat::get_dcc_info ( ); + + + + Python prototype: + + weechat.get_dcc_info ( ) + + + + Ruby prototype : + + Weechat.get_dcc_info ( ) + + + + Return list of DCC currently active or finished. + + + Return value: list of DCC + (see ). + +
+ +
+ get_config + + + Perl prototype: + + weechat::get_config ( option ); + + + + Python prototype: + + weechat.get_config ( option ) + + + + Ruby prototype: + + Weechat.get_config ( option ) + + + + Return value of a WeeChat config option. + + + Arguments: + + + + : name of option to read + + + + + + Return value: option value, empty string if not found. + + + Examples: + +# perl +$value1 = weechat::get_config ("look_nicklist"); +$value2 = weechat::get_config ("freenode.server_autojoin"); + +# python +value1 = weechat.get_config ("look_nicklist") +value2 = weechat.get_config ("freenode.server_autojoin") + + +
+ +
+ set_config + + + Perl prototype: + + weechat::set_config ( option, value ); + + + + Python prototype: + + weechat.set_config ( option, value ) + + + + Ruby prototype: + + Weechat.set_config ( option, value ) + + + + Update value of a WeeChat config option. + + + Arguments: + + + + : name of option to update + + + + + : new value for option + + + + + + Return value: 1 if option was successfully updated, 0 if an error + occured. + + + Examples: + +# perl +weechat::set_config ("look_nicklist", "off"); +weechat::set_config ("freenode.server_autojoin, "#weechat"); + +# python +weechat.set_config ("look_nicklist", "off") +weechat.set_config ("freenode.server_autojoin, "#weechat") + +# ruby +Weechat.set_config ("look_nicklist", "off") +Weechat.set_config ("freenode.server_autojoin, "#weechat") + + +
+ +
+ get_plugin_config + + + Perl prototype: + + weechat::get_plugin_config ( option ); + + + + Python prototype: + + weechat.get_plugin_config ( option ) + + + + Ruby prototype: + + Weechat.get_plugin_config ( option ) + + + + Return value of a plugin option. Option is read from file + "~/.weechat/plugins.rc" and is like: + "plugin.option=value" (note: plugin name + is automatically added). + + + Arguments: + + + + : name of option to read + + + + + + Return value: value of option, empty string if not found. + + + Examples : + +# perl +$value = weechat::get_plugin_config ("my_var"); + +# python +value = weechat.get_plugin_config ("my_var") + + +
+ +
+ set_plugin_config + + + Perl prototype: + + weechat::set_plugin_config ( option, valeur ); + + + + Python prototype: + + weechat.set_plugin_config ( option, valeur ) + + + + Ruby prototype: + + Weechat.set_plugin_config ( option, valeur ) + + + + Update value of a plugin option. Option is written in file + "~/.weechat/plugins.rc" and is like: + "plugin.option=value" (note: plugin name + is automatically added). + + + Arguments: + + + + : name of option to update + + + + + : new value for option + + + + + + Return value: 1 if option was successfully updated, 0 if an error + occured. + + + Examples: + +# perl +weechat::set_plugin_config ("my_var", "value"); + +# python +weechat.set_plugin_config ("my_var", "value") + +# ruby +Weechat.set_plugin_config ("my_var", "value") + + +
+ +
+ +
+ +
+ + + + + Authors / Support + + + This chapter lists authors and contributors for WeeChat, and + shows ways to get support. + + +
+ Authors + + + WeeChat is developed by: + + + + FlashCode (Sébastien Helleu) + flashcode AT flashtux.org - + main developer + + + + + Kolter + kolter AT free.fr - + developer + + + + + Ptitlouis + ptitlouis AT sysif.net - + Debian packager + + + + + +
+ +
+ Contributors + + + Following people contributed to WeeChat: + + + + Jiri Golembiovsky - + czech translation + + + + + Rudolf Polzer - + patches + + + + + Jim Ramsay - + patches + + + + + Pistos - + patches + + + + + +
+ +
+ Get support + + + Before asking for support, be sure you've read documentation and FAQ + provided with WeeChat (documentation is this document, if you don't + read all lines until this sentence, you can start again!) + + + + + + + IRC: server "irc.freenode.net", + channel "#weechat" + + + + + WeeChat forum: + + http://forums.flashtux.org + + + + + + Mailing list: + + + + To subscribe: + + http://mail.nongnu.org/mailman/listinfo/weechat-support + + + + + + To send a mail on mailing list: + weechat-support@nongnu.org + + + + Mailing list archives are available here: + + http://mail.nongnu.org/archive/html/weechat-support + + + + + + +
+ +
+ +
diff --git a/weechat/doc/fr/Makefile.am b/weechat/doc/fr/Makefile.am new file mode 100644 index 000000000..52e9ad23b --- /dev/null +++ b/weechat/doc/fr/Makefile.am @@ -0,0 +1,59 @@ +# Copyright (c) 2003-2006 FlashCode +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +LANGCODE = fr +BOOK = weechat.$(LANGCODE) +BOOK_INCLUDE = weechat_commands.xml irc_commands.xml key_functions.xml config.xml + +EXTRA_DIST = $(BOOK).xml $(BOOK_INCLUDE) + +docdir = $(datadir)/doc/$(PACKAGE) + +all-local: html-stamp + +# HTML output with chunks (many pages) + +html: html-stamp + +html-stamp: $(BOOK).xml $(BOOK_INCLUDE) ../weechat-html.xsl ../weechat-doc.css + mkdir -p html/ + xsltproc -o html/ ../weechat-html.xsl $(BOOK).xml || true + cp ../weechat-doc.css html/ + touch html-stamp + +# HTML output, all in one page + +html1: html1-stamp + +html1-stamp: $(BOOK).xml $(BOOK_INCLUDE) ../weechat-html-one.xsl ../weechat-doc.css + mkdir -p html1/ + xsltproc -o html1/$(BOOK).html ../weechat-html-one.xsl $(BOOK).xml || true + cp ../weechat-doc.css html1/ + touch html1-stamp + +# install docs + +install-data-hook: + $(mkinstalldirs) $(DESTDIR)$(docdir)/html/$(LANGCODE)/ + $(INSTALL_DATA) html/* $(DESTDIR)$(docdir)/html/$(LANGCODE)/ + +# clean + +clean-local: + -rm -f *.html *.pdf *.txt + -rm -rf html/ html1/ + -rm -f html-stamp html1-stamp diff --git a/weechat/doc/fr/weechat.fr.xml b/weechat/doc/fr/weechat.fr.xml new file mode 100644 index 000000000..e809b9c04 --- /dev/null +++ b/weechat/doc/fr/weechat.fr.xml @@ -0,0 +1,3542 @@ + + + + + + + + +]> + + + + + + WeeChat 0.1.7-cvs - Guide utilisateur + Client IRC rapide, léger et extensible + + + Sébastien + Helleu + flashcode AT flashtux.org + + + + 2006 + Sébastien Helleu + + + + + This manual is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA + + + + + + Ce manuel documente le client IRC WeeChat, il fait partie de WeeChat. + + + La dernière version de ce document peut être téléchargée + sur cette page : + + http://weechat.flashtux.org/doc.php + + + + + + + + + + Introduction + + + Ce chapître décrit WeeChat et les pré-requis pour son installation. + + +
+ Description + + + WeeChat (Wee Enhanced Environment for Chat) est un client + IRC libre, rapide et léger, conçu pour + différents systèmes d'exploitation. + + + + Ses principales caractéristiques sont les suivantes : + + + + connexion multi-serveurs (avec SSL, IPv6, proxy) + + + + + plusieurs interfaces : Curses, wxWidgets, Gtk et Qt + + + + + petit, rapide et léger + + + + + paramétrable et extensible avec des extensions et des scripts + + + + + conforme aux RFCs + 1459, + 2810, + 2811, + 2812 et + 2813 + + + + + multi-plateformes (GNU/Linux, *BSD, MacOS X, Windows et + d'autres systèmes) + + + + + 100% GPL, logiciel libre + + + + + + + La page d'accueil de WeeChat est ici : + + http://weechat.flashtux.org + + + +
+ +
+ Pré-requis + + + Pour installer WeeChat, vous devez avoir : + + + + un système GNU/Linux (avec le compilateur et les outils + associés pour le paquet des sources) + + + + + droits "root" (pour installer WeeChat) + + + + + selon l'interface, une des bibliothèques + suivantes : + + + + Curses : la bibliothèque ncurses + + + + + Gtk : *** interface non développée *** + + + + + WxWidgets : *** interface non développée *** + + + + + Qt : *** interface non développée *** + + + + + + + + +
+
+ + + + + Installation + + + Ce chapître explique comment installer WeeChat. + + +
+ Paquets binaires + + + Les paquets binaires sont disponibles pour les distributions + suivantes : + + + + Debian (ou toute distribution compatible Debian) : + apt-get install weechat + + + + + Mandriva/RedHat (ou toute distribution compatible avec les RPM) : + + rpm -i /chemin/weechat-x.y.z-1.i386.rpm + + + + + + Gentoo : + emerge weechat + + + + + Pour les autres distributions supportées, merci de vous + référer au manuel de la distribution pour la méthode d'installation. + + +
+ +
+ Paquet source + + + Tapez simplement dans une console ou un terminal : +$ ./configure +$ make + + + Obtenez les droits root et installez WeeChat : +$ su +(entrez le mot de passe root) +# make install + + +
+ +
+ Sources CVS + + + Attention : les sources CVS sont réservées aux utilisateurs + avancés : il se peut que WeeChat ne compile pas et qu'il soit + très instable. Vous êtes prévenus ! + + + + Pour récupérer les sources CVS, tapez cette commande : +$ cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/weechat co weechat + + + + Exécutez ce script : + ./autogen.sh + + + + Suivez alors les instructions du paquet source + (voir ) + + +
+ +
+ + + + + Utilisation + + + Ce chapître explique comment lancer WeeChat, les touches utilisées par + défaut, les commandes internes et IRC, le fichier de configuration et + l'utilisation du tube FIFO. + + +
+ Lancer WeeChat + + + Paramètres de ligne de commande : + + + + + Paramètre + Description + + + + + -a, --no-connect + + Supprimer la connexion automatique aux serveurs lors du démarrage + + + + -c, --config + + Afficher l'aide sur le fichier de config (liste des options) + + + + -f, --key-functions + + Afficher la liste des fonctions internes WeeChat pour les touches + + + + -h, --help + + Afficher l'aide + + + + -i, --irc-commands + + Afficher la liste des commandes IRC + + + + -k, --keys + + Afficher les touches par défaut de WeeChat + + + + -l, --license + + Afficher la licence de WeeChat + + + + -p, --no-plugin + + Supprimer le chargement automatique des extensions au + démarrage + + + + -v, --version + + Afficher la version de WeeChat + + + + -w, --weechat-commands + + Afficher la liste des commandes WeeChat + + + + + + + + + Il est également possible de passer une URL pour un ou plusieurs + serveurs IRC, de la forme : + irc[6][s]://[pseudo[:mot_passe]@]irc.exemple.org[:port][/canal][,canal[...] + Exemple pour rejoindre #weechat et #toto sur le serveur + "irc.freenode.net", port par défaut (6667), sous + le pseudo "nono" : + $ weechat-curses irc://nono@irc.freenode.net/#weechat,#toto + + + + Pour lancer WeeChat, tapez cette commande : + + + + pour l'interface Curses : weechat-curses + + + + + pour l'interface Gtk : weechat-gtk + + + + + pour l'interface wxWidgets : weechat-wxwidgets + + + + + pour l'interface Qt : weechat-qt + + + + + + + Lorsque vous lancez WeeChat pour la première fois, un fichier de + configuration par défaut est créé, avec les options par défaut. + Le fichier de configuration par défaut est : + "~/.weechat/weechat.rc" + + + + Vous pouvez éditer ce fichier pour configurer WeeChat à votre + convenance (SEULEMENT si WeeChat ne tourne pas), ou vous pouvez + modifier les paramètres dans WeeChat avec la commande + "/set" + (voir ) + + +
+ +
+ Raccourcis clavier + + + + + + + Touche + Action + + + + + Flèche gauche + + Aller au caractère précédent sur la ligne de commande + + + + Flèche droite + + Aller au caractère suivant sur la ligne de commande + + + + Ctrl + flèche gauche + + Aller au mot précédent sur la ligne de commande + + + + Ctrl + flèche droite + + Aller au mot suivant sur la ligne de commande + + + + Home / Ctrl + A + + Aller au début de la ligne de commande + + + + End / Ctrl + E + + Aller à la fin de la ligne de commande + + + + Ctrl + K + + Effacer du curseur jusqu'à la fin de la ligne de commande + + + + Ctrl + L + + Réafficher toute la fenêtre + + + + Ctrl + U + + Effacer du curseur jusqu'au début de la ligne de commande + + + + Ctrl + W + + Effacer le mot précédent sur la ligne de commande + + + + Backspace + + Effacer le caractère précédent sur la ligne de commande + + + + Delete + + Effacer le caractère suivant sur la ligne de commande + + + + Tab + + Compléter la commande ou le pseudo + (Tab de nouveau: trouver la complétion suivante) + + + + Tout caractère + + Insérer le caractère à la position du curseur + sur la ligne de commande + + + + Entrée + + Exécuter la commande ou envoyer le message + + + + Flèche haut / flèche bas + + Rappeler les dernières commandes ou messages + + + + Ctrl + flèche haut / Ctrl + flèche bas + + Rappeler les dernières commandes ou messages dans + l'historique global (commun à tous les tampons) + + + + PageUp / PageDown + + Afficher l'historique du tampon + + + + F5 / Alt + flèche gauche + + Aller au tampon précédent + + + + F6 / Alt + flèche droite + + Aller au tampon suivant + + + + F7 + + Aller à la fenêtre précédente + + + + F8 + + Aller à la fenêtre suivante + + + + F10 + + Effacer le dernier message de la barre d'infos + + + + F11 / F12 + + Faire défiler la liste des pseudos + + + + Alt + Home / Alt + End + + Aller au début / à la fin de la liste des pseudos + + + + Alt + A + + Sauter au prochain tampon avec activité + (avec priorité : highlight, message, autre) + + + + Alt + B + + Aller au mot précédent + + + + Alt + D + + Effacer le mot suivant + + + + Alt + F + + Aller au mot suivant + + + + Alt + H + + Vider la hotlist + (notification d'actitivé sur les autres tampons) + + + + Alt + J puis Alt + D + + Afficher le tampon des DCC + + + + Alt + J puis Alt + L + + Sauter au dernier tampon + + + + Alt + J puis Alt + S + + Sauter au tampon du serveur + + + + Alt + J puis Alt + X + + Sauter au premier canal du serveur suivant + (ou tampon du serveur si aucun canal n'est ouvert) + + + + Alt + chiffre (0-9) + + Sauter au tampon qui porte ce numéro (0 = 10) + + + + Alt + J puis nombre (01-99) + + Sauter au tampon qui porte ce numéro + + + + Alt + K + + Capturer une touche et insérer son code sur la ligne + de commande + + + + Alt + N + + Se positionner sur le highlight suivant + + + + Alt + P + + Se positionner sur le highlight précédent + + + + Alt + R + + Effacer entièrement la ligne de commande + + + + Alt + S + + Changer de serveur sur le tampon des serveurs + (si l'option "look_one_server_buffer" est activée) + + + + Alt + U + + Se positionner sur la première ligne non lue du tampon + + + + Alt + W puis Alt + flèche + + Sauter à une fenêtre avec une direction + + + + + + + +
+ +
+ Commandes WeeChat / IRC + + + Ce chapître liste toutes les commandes WeeChat et IRC. + + +
+ Commandes WeeChat + + + &weechat_commands.xml; + + +
+ +
+ Fonctions pour les touches + + + + + + + Fonction + Description + + + + + &key_functions.xml; + + + + + + +
+ +
+ Commandes IRC + + + &irc_commands.xml; + + +
+ +
+ +
+ Fichier de configuration + + + Liste des options du fichier de configuration : + + + + + Option + Type + Valeurs + Défaut + Description + + + + + &config.xml; + + + + + + + + Les couleurs pour l'interface Curses sont : + + + + + Mot clé + Couleur + + + + + default + couleur par défaut (transparent pour le fond) + + + black + noir + + + red + rouge foncé + + + lightred + rouge clair + + + green + vert foncé + + + lightgreen + vert clair + + + brown + marron + + + yellow + jaune + + + blue + bleu foncé + + + lightblue + bleu clair + + + magenta + violet foncé + + + lightmagenta + violet clair + + + cyan + cyan foncé + + + lightcyan + cyan clair + + + white + blanc + + + + + + +
+ +
+ Tube FIFO + + + Vous pouvez contrôler WeeChat à distance, en envoyant des commandes + ou du texte dans un tube FIFO (l'option "irc_fifo_pipe" doit être + activée, elle est désactivée par défaut). + + + + Le tube FIFO est dans le répertoire "~/.weechat/" + et s'appelle "weechat_fifo_xxxxx" (où xxxxx est l'ID du processus + (PID) du WeeChat qui tourne). Donc si plusieurs WeeChat tournent, il + y a plusieurs tubes FIFO, un pour chaque session. + + + + La syntaxe pour envoyer des commandes ou du texte dans le tube FIFO + est la suivante : + serveur,canal *texte ou commande ici + où le serveur et le canal sont facultatifs, mais si le canal est là, + le serveur doit l'être aussi. + + + + Quelques exemples : + + + + changement du pseudo sur freenode en "pseudo|absent" : + $ echo "freenode */nick pseudo|absent" >~/.weechat/weechat_fifo_12345 + + + + + affichage de texte sur le canal #weechat : + $ echo "freenode,#weechat *bonjour tout le monde !" >~/.weechat/weechat_fifo_12345 + + + + + affichage de texte sur le canal courant (le tampon affiché + par WeeChat) : + $ echo "*bonjour !" >~/.weechat/weechat_fifo_12345 + Attention : ceci est dangereux et vous ne + devriez pas le faire sauf si vous savez ce que vous faites ! + + + + + envoyer deux commandes pour décharger/recharger les scripts Perl + (vous devez les séparer par "\n") : + $ echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345 + + + + + + + Vous pouvez écrire un script qui envoie les commandes à tous les + WeeChat qui tournent en même temps, par exemple : + +#!/bin/sh +if [ $# -eq 1 ]; then + for fifo in $(/bin/ls ~/.weechat/weechat_fifo_* 2>/dev/null); do + echo -e "$1" >$fifo + done +fi + + Si le script s'appelle "auto_weechat_command", vous pouvez le lancer + ainsi : + $ ./auto_weechat_command "freenode,#weechat *bonjour" + + +
+ +
+ + + + + Extensions + + + Ce chapître décrit l'interface des extensions (API) et les extensions + pour scripts (Perl, Python, Ruby), fournies avec WeeChat. + + +
+ Les extensions dans WeeChat + + + Une extension ("plugin" en anglais) est un programme écrit en C + qui peut appeler des fonctions de WeeChat définies dans une interface. + + + + Ce programme C n'a pas besoin des sources WeeChat pour être + compilé et peut être chargé/déchargé dynamiquement dans + WeeChat via la commande /plugin. + + + + L'extension doit être au format bibliothèque, chargeable + dynamiquement par le systême d'exploitation. + Sous GNU/Linux, il s'agit d'un fichier ayant pour extension ".so", + sous Windows ".dll". + + +
+ +
+ Ecrire une extension + + + L'extension doit inclure le fichier "weechat-plugin.h" + (disponible dans les sources de WeeChat). + Ce fichier définit les structures et types dont l'extension aura + besoin pour communiquer avec WeeChat. + + + + L'extension doit comporter certaines variables et fonctions + obligatoires (sans quoi l'extension ne peut être chargée) : + + + + + Variable + Description + + + + + char plugin_name[] + le nom de l'extension + + + char plugin_version[] + la version de l'extension + + + char plugin_description[] + une courte description de l'extension + + + + + + + + + + Fonction + Description + + + + + int weechat_plugin_init (t_weechat_plugin *plugin) + + fonction appelée au chargement de l'extension + qui doit renvoyer PLUGIN_RC_OK en cas de succès, + PLUGIN_RC_KO en cas d'erreur (si erreur, l'extension + ne sera PAS chargée) + + + + void weechat_plugin_end (t_weechat_plugin *plugin) + fonction appelée au déchargement de l'extension + + + + + + +
+ Fonctions de l'interface (API) + +
+ ascii_strcasecmp + + + Prototype : + + int ascii_strcasecmp (t_weechat_plugin *plugin, + char *chaine1, char *chaine2) + + + + Effectue une comparaison entre deux chaînes, sans tenir compte des + majuscules/minuscules ni de la locale. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : la première chaîne à comparer + + + + + : la deuxième chaîne à comparer + + + + + + Valeur renvoyée : la différence entre les deux chaînes : négatif + si chaine1 < chaine2, zéro si chaine1 == chaine2, positif si + chaine1 > chaine2 + + + Exemple : + if (plugin->ascii_strcasecmp (plugin, "abc", "def") != 0) ... + +
+ +
+ ascii_strncasecmp + + + Prototype : + + int ascii_strncasecmp (t_weechat_plugin *plugin, + char *chaine1, char *chaine2, int max) + + + + Effectue une comparaison entre deux chaînes, sans tenir compte des + majuscules/minuscules ni de la locale, en comparant au plus "max" + caractères. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : la première chaîne à comparer + + + + + : la deuxième chaîne à comparer + + + + + : nombre de caractères max à comparer + + + + + + Valeur renvoyée : la différence entre les deux chaînes : négatif + si chaine1 < chaine2, zéro si chaine1 == chaine 2, positif si + chaine1 > chaine2 + + + Exemple : + if (plugin->ascii_strncasecmp (plugin, "abc", "def", 2) != 0) ... + +
+ +
+ explode_string + + + Prototype : + + char **explode_string (t_weechat_plugin *plugin, char *chaine, + char *separateurs, int num_items_max, int *num_items) + + + + Explose une chaîne en plusieurs selon un/des délimiteur(s). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : la chaîne à exploser + + + + + : les délimiteurs utilisés + pour exploser la chaîne + + + + + : nombre maximum de + sous-chaînes créées (0 = pas de limite) + + + + + : pointeur vers un entier qui + contiendra le nombre de sous-chaînes créées en retour + + + + + + Valeur renvoyée : un tableau de chaînes, ou NULL si un problème + a été rencontré. + + + Note : le résultat doit être libéré par un appel à la fonction + "free_exploded_string" après utilisation. + + + Exemple : + +char **argv; +int argc; +argv = plugin->explode_string (plugin, chaine, " ", 0, &argc); +... +if (argv != NULL) + plugin->free_exploded_string (plugin, argv); + + +
+ +
+ free_exploded_string + + + Prototype : + + char **free_exploded_string (t_weechat_plugin *plugin, + char **chaine) + + + + Libère la mémoire utilisée pour une explosion de chaîne. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : la chaîne explosée par la fonction + "explode_string" + + + + + + Valeur renvoyée : aucune. + + + Exemple : + +char *argv; +int argc; +argv = plugin->explode_string (plugin, chaine, " ", 0, &argc); +... +if (argv != NULL) + plugin->free_exploded_string (plugin, argv); + + +
+ +
+ exec_on_files + + + Prototype : + + void exec_on_files (t_weechat_plugin *plugin, char *repertoire, + int (*callback)(t_weechat_plugin *, char *)) + + + + Exécute une fonction sur tous les fichiers d'un répertoire. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : le répertoire où les fichiers + sont recherchés + + + + + : une fonction appelée pour chaque + fichier trouvé + + + + + + Valeur renvoyée : aucune. + + + Exemple : + +int callback (t_weechat_plugin *plugin, char *fichier) +{ + plugin->printf_server (plugin, "fichier: %s", fichier); + return 1; +} +... +plugin->exec_on_files (plugin, "/tmp", &callback); + + +
+ +
+ printf + + + Prototype : + + void printf (t_weechat_plugin *plugin, + char *serveur, char *canal, char *message, ...) + + + + Affiche un message sur un tampon WeeChat, identifié par le serveur + et le canal (tous deux pouvant être NULL pour le tampon courant). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom interne du serveur pour + trouver le tampon dans lequel afficher (peut être NULL) + + + + + : nom du canal pour trouver le + tampon dans lequel afficher (peut être NULL) + + + + + : message à afficher + + + + + + Valeur renvoyée : aucune. + + + Exemples : + +plugin->printf (plugin, NULL, NULL, "hello"); +plugin->printf (plugin, NULL, "#weechat", "hello"); +plugin->printf (plugin, "freenode", "#weechat", "hello"); + + +
+ +
+ printf_server + + + Prototype : + + void printf_server (t_weechat_plugin *plugin, + char *message, ...) + + + + Affiche un message sur le tampon du serveur courant. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : message à afficher + + + + + + Valeur renvoyée : aucune. + + + Exemple : plugin->printf_server (plugin, "hello"); + +
+ +
+ printf_infobar + + + Prototype : + + void printf_infobar (t_weechat_plugin *plugin, + int temps, char *message, ...) + + + + Affiche un message sur la barre d'infos pour un temps déterminé. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : temps (en secondes) pendant lequel + le message est affiché (0 = jamais effacé) + + + + + + Valeur renvoyée : aucune. + + + Exemple : plugin->printf_infobar (plugin, 5, "hello"); + +
+ +
+ msg_handler_add + + + Prototype : + + t_plugin_handler *msg_handler_add (t_weechat_plugin + *plugin, char *message, t_plugin_handler_func *fonction, + char *handler_args, void *handler_pointer) + + + + Ajoute un gestionnaire de messages IRC, appelé dès qu'un message + IRC est reçu. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom du message IRC pour lequel la + fonction est appelée. + Pour connaître la liste des messages IRC disponibles, merci + de consulter les RFCs + 1459 et + 2812 + + + + + : fonction appelée lorsque le + message est reçu + + + + + : paramètres passés à la + fonction appelée + + + + + : pointeur passé à la + fonction appelée + + + + + + Valeur renvoyée : le pointeur vers le nouveau gestionnaire de + messages. + + + Note : la fonction appelée lorsque le message est reçu doit + renvoyer une des valeurs suivantes : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + + PLUGIN_RC_OK_IGNORE_WEECHAT : le message + ne sera pas transmis à WeeChat + + + + + PLUGIN_RC_OK_IGNORE_PLUGINS : le message + ne sera pas transmis à d'autres extensions + + + + + PLUGIN_RC_OK_IGNORE_ALL : le message + ne sera ni transmis à WeeChat ni à d'autres extensions + + + + + + Exemple : + +int msg_kick (t_weechat_plugin *plugin, char *serveur, char *commande, + char *arguments, char *handler_args, void *handler_pointer) +{ + plugin->printf (plugin, serveur, NULL, "KICK reçu"); + return PLUGIN_RC_OK; +} +... +plugin->msg_handler_add (plugin, "KICK", &msg_kick, NULL, NULL); + + +
+ +
+ cmd_handler_add + + + Prototype : + + t_plugin_handler *cmd_handler_add (t_weechat_plugin + *plugin, char *commande, char *description, char *arguments, + char *arguments_description, char *modele_completion, + t_plugin_handler_func *fonction, char *handler_args, + void *handler_pointer) + + + + Ajoute un gestionnaire de commande WeeChat, appelé dès que + l'utilisateur utilise la commande (par exemple /commande). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de la nouvelle commande, + qui peut être une commande déjà existante (attention la + commande remplacée ne sera plus disponible jusqu'à ce que + l'extension soit déchargée) + + + + + : brève description de la + commande (affichée par /help commande) + + + + + : brève description des + paramètres de la commande (affichée par /help commande) + + + + + : longue description + des paramètres de la commande (affichée par /help commande) + + + + + : modèle pour la + complétion sous la forme "abc|%w def|%i" + qui signigie "abc" ou une commande WeeChat pour le premier + paramètre, et "def" ou une commande IRC pour le deuxième. + Une chaîne vide indique à WeeChat de compléter tout + paramètre avec un pseudo du canal courant, une valeur NULL + désactive toute complétion pour tous les paramètres de la + commande. + + + Les codes suivants peuvent être utilisés : + + + + + Code + Description + + + + + %- + aucune complétion pour le paramètre + + + %a + alias + + + %A + + alias et commandes (WeeChat, IRC et extensions) + + + + %c + canal courant + + + %C + canaux du serveur courant + + + %f + nom de fichier + + + %h + commandes définies par des extensions + + + %i + commandes IRC (envoyées) + + + %I + commandes IRC (reçues) + + + %k + fonctions associées aux touches + + + %n + pseudos du canal courant + + + %o + options de configuration + + + %p + message de "part" par défaut + + + %q + message de "quit" par défaut + + + %s + nom du serveur courant + + + %S + tous les serveurs + + + %t + titre du canal courant + + + %v + valeur d'une option de configuration + + + %w + commandes WeeChat + + + %y + message d'absence ("away") par défaut + + + + + + + + + : fonction appelée lorsque la + commande est exécutée + + + + + : paramètres passés à la + fonction appelée + + + + + : pointeur passé à la + fonction appelée + + + + + + Valeur renvoyée : le pointeur vers le nouveau gestionnaire de + commande. + + + Note : la fonction appelée lorsque la commande est exécutée doit + renvoyer une des valeurs suivantes : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + + + Exemple : + +int cmd_test (t_weechat_plugin *plugin, char *serveur, + char *commande, char *arguments, char *handler_args, + void *handler_pointer) +{ + plugin->printf (plugin, serveur, NULL, + "commande test, pseudo: %s", + (arguments) ? arguments : "aucun"); + return PLUGIN_RC_OK; +} +... +plugin->cmd_handler_add (plugin, "test", "Commande test", + "[pesudo]", "pseudo: un pseudo du canal", + "%n", &cmd_test, NULL, NULL); + + + +
+ +
+ handler_remove + + + Prototype : + + void handler_remove (t_weechat_plugin *plugin, + t_plugin_handler *handler) + + + + Supprime un gestionnaire. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : le gestionnaire à supprimer + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->handler_remove (plugin, mon_handler); + +
+ +
+ handler_remove_all + + + Prototype : + + void handler_remove_all (t_weechat_plugin *plugin) + + + + Supprime tous les gestionnaires d'une extension. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->handler_remove_all (plugin); + +
+ +
+ exec_command + + + Prototype : + + void exec_command (t_weechat_plugin + *plugin, char *serveur, char *canal, char *commande) + + + + Execute une commande WeeChat ou envoie un message à un canal. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom interne du serveur où + exécuter la commande (peut être NULL) + + + + + : nom du canal où exécuter la + commande (peut être NULL) + + + + + : la commande à exécuter + + + + + + Valeur renvoyée : aucune. + + + Exemples : + +plugin->exec_command (plugin, NULL, NULL, "/help nick"); +plugin->exec_command (plugin, "freenode", "#weechat", "bonjour"); + + +
+ +
+ get_info + + + Prototype : + + char *get_info (t_weechat_plugin *plugin, + char *info, char *serveur) + + + + Renvoie une information sur WeeChat ou un canal. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de l'info à obtenir : + + + + + Info + Description + + + + + version + version de WeeChat + + + nick + pesudo + + + channel + + nom du canal (NULL pour un serveur ou un privé) + + + + server + nom du serveur + + + away + drapeau "away" + + + weechat_dir + + répertoire maison de WeeChat + (par défaut: ~/.weechat/) + + + + weechat_libdir + répertoire "lib" système de WeeChat + + + weechat_sharedir + répertoire "share" système de WeeChat + + + + + + + + + : nom interne du serveur où + récupérer l'information (si nécessaire) + + + + + + Valeur renvoyée : l'information recherchée, NULL si non trouvée. + + + Note : le résultat doit être libéré par un appel à la fonction + "free" après utilisation. + + + Exemples : + +char *version = plugin->get_info (plugin, "version", NULL); +char *nick = plugin->get_info (plugin, "nick", "freenode"); + + +
+ +
+ get_dcc_info + + + Prototype : + + t_plugin_info_dcc *get_dcc_info (t_weechat_plugin *plugin) + + + + Renvoie la liste des DCC en cours ou terminés. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + + Valeur renvoyée : la liste chaînée des DCC. + + + + + Champ + Description + + + + + server + le serveur IRC + + + channel + le canal IRC + + + type + + le type de DCC : + 0 = discussion reçue, + 1 = discussion envoyée, + 2 = fichier reçu, + 3 = fichier envoyé + + + + status + + le statut du DCC : + 0 = en attente, + 1 = en cours de connexion, + 2 = actif, + 3 = terminé, + 4 = échoué, + 5 = interrompu par l'utilisateur + + + + start_time + la date et heure de création du DCC + + + start_transfer + la date et heure de démarrage du transfert + + + addr + adresse IP de l'utilisateur distant + + + port + port utilisé pour le DCC + + + nick + pseudo de l'utilisateur distant + + + filename + nom de fichier + + + local_filename + nom de fichier local + + + size + taille du fichier + + + pos + position actuelle dans le fichier + + + start_resume + position de démarrage après une interruption + + + bytes_per_sec + + nombre d'octets transmis par seconde depuis le début + du transfert + + + + + + + + Note : le résultat doit être libéré par un appel à la fonction + "free_dcc_info" après utilisation. + + + Exemples : + +t_plugin_dcc_info *dcc_info = plugin->get_dcc_info (plugin); +for (ptr_dcc = dcc_info; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc) +{ + plugin->printf_server (plugin, "DCC type=%d, avec: %s", + ptr_dcc->type, ptr_dcc->nick); +} +if (dcc_info) + plugin->free_dcc_info (plugin, dcc_info); + + +
+ +
+ free_dcc_info + + + Prototype : + + void free_dcc_info (t_weechat_plugin *plugin, + t_plugin_dcc_info *dcc_info) + + + + Libère la mémoire utilisée par une liste de DCC. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : pointeur vers la liste DCC + renvoyée par la fonction "get_dcc_info" + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->free_dcc_info (plugin, dcc_info); + +
+ +
+ get_config + + + Prototype : + + char *get_config (t_weechat_plugin *plugin, char *option) + + + + Renvoie la valeur d'une option de configuration WeeChat. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de l'option à lire + + + + + + Valeur renvoyée : la valeur de l'option, NULL si non trouvée. + + + Note : le résultat doit être libéré par un appel à la fonction + "free" après utilisation. + + + Exemples : + +char *value1 = plugin->get_config (plugin, "look_set_title"); +char *value2 = plugin->get_config (plugin, "freenode.server_autojoin"); + + +
+ +
+ set_config + + + Prototype : + + int set_config (t_weechat_plugin *plugin, + char *option, char *valeur) + + + + Modifie la valeur d'une option de configuration WeeChat. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de l'option à mettre à jour + + + + + : nouvelle valeur pour l'option + + + + + + Valeur renvoyée : 1 si l'option a été modifiée avec succès, 0 si + une erreur s'est produite. + + + Exemple : + +plugin->set_config (plugin, "look_nicklist", "off"); + + +
+ +
+ get_plugin_config + + + Prototype : + + char *get_plugin_config (t_weechat_plugin *plugin, char *option) + + + + Renvoie la valeur d'une option de l'extension. + L'option est lue depuis le fichier + "~/.weechat/plugins.rc" et est + sous cette forme : "extension.option=valeur" + (NB : le nom de l'extension est ajouté automatiquement). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de l'option à lire + + + + + + Valeur renvoyée : la valeur de l'option, NULL si non trouvée. + + + Note : le résultat doit être libéré par un appel à la fonction + "free" après utilisation. + + + Exemple : + +char *value = plugin->get_plugin_config (plugin, "ma_variable"); + + +
+ +
+ set_plugin_config + + + Prototype : + + int set_plugin_config (t_weechat_plugin *plugin, + char *option, char *valeur) + + + + Modifie la valeur d'une option de l'extension. + L'option est écrite dans le fichier + "~/.weechat/plugins.rc" et est + sous cette forme : "extension.option=valeur" + (NB : le nom de l'extension est ajouté automatiquement). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de l'option à mettre à jour + + + + + : nouvelle valeur pour l'option + + + + + + Valeur renvoyée : 1 si l'option a été modifiée avec succès, 0 si + une erreur s'est produite. + + + Exemple : + +plugin->set_plugin_config (plugin, "ma_variable", "valeur"); + + +
+ +
+ +
+ Compiler l'extension + + + La compilation ne nécessite pas les sources WeeChat, mais seulement + le fichier "weechat-plugin.h". + + + + Pour compiler une extension composée d'un fichier "toto.c" (sous + GNU/Linux) : + +$ gcc -fPIC -Wall -c toto.c +$ gcc -shared -fPIC -o libtoto.so toto.o + + + +
+ +
+ Charger l'extension dans WeeChat + + + Copier le fichier "libtoto.so" dans le répertoire système des + extensions (par exemple + "/usr/local/lib/weechat/plugins)" ou bien dans + celui de l'utilisateur (par exemple + "/home/xxxxx/.weechat/plugins"). + + + + Sous WeeChat : + /plugin load toto + + +
+ +
+ Exemple d'extension + + + Un exemple complet d'extension, qui ajoute une commande /double + affichant deux fois les paramètres passés sur le canal courant + (d'accord ce n'est pas très utile mais ceci est un exemple !) : + +#include <stdlib.h> + +#include "weechat-plugin.h" + +char plugin_name[] = "Double"; +char plugin_version[] = "0.1"; +char plugin_description[] = "Plugin de test pour WeeChat"; + +/* gestionnaire de commande "/double" */ + +int double_cmd (t_weechat_plugin *plugin, char *serveur, + char *commande, char *arguments, + char *handler_args, void *handler_pointer) +{ + if (arguments && arguments[0] && (arguments[0] != '/')) + { + plugin->exec_command (plugin, NULL, NULL, arguments); + plugin->exec_command (plugin, NULL, NULL, arguments); + } + return PLUGIN_RC_OK; +} + +int weechat_plugin_init (t_weechat_plugin *plugin) +{ + plugin->cmd_handler_add (plugin, "double", + "Affiche deux fois un message", + "msg", + "msg: message a afficher deux fois", + NULL, + &double_cmd, + NULL, NULL); + return PLUGIN_RC_OK; +} + +void weechat_plugin_end (t_weechat_plugin *plugin) +{ + /* on ne fait rien ici */ +} + + + +
+ +
+ +
+ Extensions pour scripts + + + Trois extensions sont fournies en standard avec WeeChat pour utiliser + des langages de script : Perl, Python et Ruby. + + +
+ Charger / décharger des scripts + + + Les scripts sont chargés et déchargés avec les commandes + /perl, /python et + /ruby (tapez /help dans + WeeChat pour obtenir de l'aide sur les commandes). + + + + Exemples : + + + + Charger un script Perl : + /perl load /tmp/essai.pl + + + + + Lister les scripts Perl chargés : + /perl + + + + + Charger un script Python : + /python load /tmp/essai.py + + + + + Lister les scripts Python chargés : + /python + + + + + Charger un script Ruby : + /ruby load /tmp/essai.rb + + + + + Lister les scripts Ruby chargés : + /ruby + + + + + +
+ +
+ Interface WeeChat / scripts + +
+ register + + + Prototype Perl : + + weechat::register ( nom, version, fonction_de_fin, description ); + + + + Prototype Python : + + weechat.register ( nom, version, fonction_de_fin, description ) + + + + Prototype Ruby : + + Weechat.register ( nom, version, fonction_de_fin, description ) + + + + C'est la première fonction à appeler dans le script. + Tout script pour WeeChat doit appeler cette fonction. + + + Paramètres : + + + + : nom unique pour identifier le script + (chaque script doit avoir un nom différent) + + + + + : version du script + + + + + : fonction appelée quand + le script est déchargé (paramètre facultatif, une chaîne + vide signifiant qu'il n'y a pas de fonction à appeler) + + + + + : brève description du script + + + + + + Valeur renvoyée : 1 si le script a été enregistré, 0 si une erreur + s'est produite. + + + Exemples : + +# perl +weechat::register ("essai", "1.0", "fin_essai", "Script d'essai !"); + +# python +weechat.register ("essai", "1.0", "fin_essai", "Script d'essai !") + +# ruby +Weechat.register ("essai", "1.0", "fin_essai", "Script d'essai !") + + +
+ +
+ print + + + Prototype Perl : + + weechat::print ( message, [canal, [serveur]] ) + + + + Prototype Python : + + weechat.prnt ( message, [canal, [serveur]] ) + + + + Prototype Ruby : + + Weechat.print ( message, [canal, [serveur]] ) + + + + Affiche un message sur un tampon WeeChat, identifié par le + serveur et le canal. + + + Paramètres : + + + + : message à afficher + + + + + : nom du canal pour trouver le + tampon dans lequel afficher + + + + + : nom interne du serveur pour + trouver le tampon dans lequel afficher + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::print ("message"); +weechat::print ("message", "#weechat"); +weechat::print ("message", "#weechat", "freenode"); + +# python +weechat.prnt ("message") +weechat.prnt ("message", "#weechat") +weechat.prnt ("message", "#weechat", "freenode") + +# ruby +Weechat.print ("message") +Weechat.print ("message", "#weechat") +Weechat.print ("message", "#weechat", "freenode") + + +
+ +
+ print_infobar + + + Prototype Perl : + + weechat::print_infobar ( temps, message ); + + + + Prototype Python : + + weechat.print_infobar ( temps, message ) + + + + Prototype Ruby : + + Weechat.print_infobar ( temps, message ) + + + + Affiche un message sur la barre d'infos pour un temps déterminé. + + + Paramètres : + + + + : temps (en secondes) pendant + lequel le message est affiché (0 = jamais effacé) + + + + + : message à afficher + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::print_infobar (5, "message"); + +# python +weechat.print_infobar (5, "message") + +# ruby +Weechat.print_infobar (5, "message") + + +
+ +
+ add_message_handler + + + Prototype Perl : + + weechat::add_message_handler ( message, fonction ); + + + + Prototype Python : + + weechat.add_message_handler ( message, fonction ) + + + + Prototype Ruby : + + Weechat.add_message_handler ( message, fonction ) + + + + Ajoute un gestionnaire de messages IRC, appelé dès qu'un message + IRC est reçu. + + + Paramètres : + + + + : nom du message IRC pour lequel la + fonction est appelée. + Pour connaître la liste des messages IRC disponibles, merci + de consulter les RFCs + 1459 et + 2812 + + + + + : fonction appelée lorsque le message + est reçu + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::add_message_handler ("privmsg", ma_fonction); +sub ma_fonction +{ + weechat::print ("serveur=$_[0]\n"); + ($null, $canal, $message) = split ":",$_[1],3; + ($masque, $null, $canal) = split " ", $canal; + weechat::print ("masque=$masque, canal=$canal, msg=$message\n"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_message_handler ("privmsg", ma_fonction) +def ma_fonction(serveur, args): + weechat.prnt("serveur="+serveur) + null, canal, message = string.split(args, ":", 2) + masque, null, canal = string.split(string.strip(canal), " ", 2) + weechat.prnt("masque="+masque+", canal="+canal+", message="+message) + return weechat.PLUGIN_RC_OK + + + + Note : la fonction appelée lorsque le message est reçu doit + renvoyer une des valeurs suivantes (préfixée par "weechat::" pour + Perl, "weechat." pour Python ou "Weechat." pour Ruby) : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + + PLUGIN_RC_OK_IGNORE_WEECHAT : le message + ne sera pas transmis à WeeChat + + + + + PLUGIN_RC_OK_IGNORE_PLUGINS : le message + ne sera pas transmis à d'autres extensions + + + + + PLUGIN_RC_OK_IGNORE_ALL : le message + ne sera ni transmis à WeeChat ni à d'autres extensions + + + + +
+ +
+ add_command_handler + + + Prototype Perl : + + weechat::add_command_handler ( commande, fonction, + [description, arguments, arguments_description, + modele_completion] ); + + + + Prototype Python : + + weechat.add_command_handler ( commande, fonction, + [description, arguments, arguments_description, + modele_completion] ) + + + + Prototype Ruby : + + Weechat.add_command_handler ( commande, fonction, + [description, arguments, arguments_description, + modele_completion] ) + + + + Ajoute un gestionnaire de commande WeeChat, appelé dès que + l'utilisateur utilise la commande (par exemple /commande). + + + Paramètres : + + + + : nom de la nouvelle commande, + qui peut être une commande déjà existante (attention la + commande remplacée ne sera plus disponible jusqu'à ce que + le script soit déchargé) + + + + + : fonction appelée lorsque la + commande est exécutée + + + + + : brève description des + paramètres de la commande (affichée par /help commande) + + + + + : longue description + des paramètres de la commande (affichée par /help commande) + + + + + : modèle pour la + complétion sous la forme "abc|%w def|%i" + qui signigie "abc" ou une commande WeeChat pour le premier + paramètre, et "def" ou une commande IRC pour le deuxième. + (voir ) + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::add_command_handler ("commande", ma_commande); +sub ma_commande +{ + weechat::print("Serveur: $_[0], paramètres: $_[1]\n"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_command_handler ("commande", ma_commande) +def ma_commande(serveur, args): + weechat.prnt("serveur:"+serveur+" paramètres:"+args) + return weechat.PLUGIN_RC_OK + + + + Notes : la fonction appelée lorsque le message est exécutée doit + renvoyer une des valeurs suivantes (préfixée par "weechat::" pour + Perl, "weechat." pour Python ou "Weechat." pour Ruby) : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + +
+ +
+ remove_handler + + + Prototype Perl : + + weechat::remove_handler ( nom, fonction ); + + + + Prototype Python : + + weechat.remove_handler ( nom, fonction ) + + + + Prototype Ruby : + + Weechat.remove_handler ( nom, fonction ) + + + + Supprime un gestionnaire. + + + Paramètres : + + + + : nom du message IRC ou de la commande + + + + + : fonction associée + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::remove_handler ("commande", ma_commande); + +# python +weechat.remove_handler ("commande", ma_commande) + +# ruby +Weechat.remove_handler ("commande", ma_commande) + + +
+ +
+ command + + + Prototype Perl : + + weechat::command ( commande, [canal, [serveur]] ); + + + + Prototype Python : + + weechat.command ( commande, [canal, [serveur]] ) + + + + Prototype Ruby : + + Weechat.command ( commande, [canal, [serveur]] ) + + + + Exécute une commande ou envoie un message à un canal. + + + Paramètres : + + + + : la commande à exécuter + + + + + : nom du canal où exécuter la + commande + + + + + : nom interne du serveur où + exécuter la commande + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::command ("bonjour tout le monde !"); +weechat::command ("/kick toto merci de quitter ce canal", "#weechat"); +weechat::command ("/nick newnick", "", "freenode"); + +# python +weechat.command ("bonjour tout le monde !") +weechat.command ("/kick toto merci de quitter ce canal", "#weechat") +weechat.command ("/nick newnick", "", "freenode") + +# ruby +Weechat.command ("bonjour tout le monde !") +Weechat.command ("/kick toto merci de quitter ce canal", "#weechat") +Weechat.command ("/nick newnick", "", "freenode") + + +
+ +
+ get_info + + + Prototype Perl : + + weechat::get_info ( nom, [serveur] ); + + + + Prototype Python : + + weechat.get_info ( nom, [serveur] ) + + + + Prototype Ruby : + + Weechat.get_info ( nom, [serveur] ) + + + + Renvoie une information sur WeeChat ou un canal. + + + Paramètres : + + + + : nom de l'info à obtenir + (voir ) + + + + + : nom interne du serveur où + récupérer l'information (si nécessaire) + + + + + + Valeur renvoyée : l'information demandée, chaîne vide si une + erreur s'est produite ou que l'information n'a pas été trouvée. + + + Exemples : + +# perl +$version = get_info("version"); +$nick = get_info("nick", "freenode"); + +# python +version = weechat.get_info ("version") +nick = weechat.get_info ("nick", "freenode") + + +
+ +
+ get_dcc_info + + + Prototype Perl : + + weechat::get_dcc_info ( ); + + + + Prototype Python : + + weechat.get_dcc_info ( ) + + + + Prototype Ruby : + + Weechat.get_dcc_info ( ) + + + + Renvoie la liste des DCC en cours ou terminés. + + + Valeur renvoyée : la liste des DCC + (voir ). + +
+ +
+ get_config + + + Prototype Perl : + + weechat::get_config ( option ); + + + + Prototype Python : + + weechat.get_config ( option ) + + + + Prototype Ruby : + + Weechat.get_config ( option ) + + + + Renvoie la valeur d'une option de configuration WeeChat. + + + Paramètres : + + + + : nom de l'option + + + + + + Valeur renvoyée : la valeur de l'option, chaîne vide si l'option + n'a pas été trouvée. + + + Exemples : + +# perl +$value1 = weechat::get_config ("look_nicklist"); +$value2 = weechat::get_config ("freenode.server_autojoin"); + +# python +value1 = weechat.get_config ("look_nicklist") +value2 = weechat.get_config ("freenode.server_autojoin") + + +
+ +
+ set_config + + + Prototype Perl : + + weechat::set_config ( option, valeur ); + + + + Prototype Python : + + weechat.set_config ( option, valeur ) + + + + Prototype Ruby : + + Weechat.set_config ( option, valeur ) + + + + Modifie la valeur d'une option de configuration WeeChat. + + + Paramètres : + + + + : nom de l'option + + + + + : la nouvelle valeur pour + l'option + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est + produite. + + + Exemples : + +# perl +weechat::set_config ("look_nicklist", "off"); +weechat::set_config ("freenode.server_autojoin, "#weechat"); + +# python +weechat.set_config ("look_nicklist", "off") +weechat.set_config ("freenode.server_autojoin, "#weechat") + +# ruby +Weechat.set_config ("look_nicklist", "off") +Weechat.set_config ("freenode.server_autojoin, "#weechat") + + +
+ +
+ get_plugin_config + + + Prototype Perl : + + weechat::get_plugin_config ( option ); + + + + Prototype Python : + + weechat.get_plugin_config ( option ) + + + + Prototype Ruby : + + Weechat.get_plugin_config ( option ) + + + + Renvoie la valeur d'une option de l'extension. + L'option est lue depuis le fichier + "~/.weechat/plugins.rc" et est + sous cette forme : + "extension.script.option=valeur" + (NB : le nom de l'extension et du script sont ajoutés + automatiquement). + + + Paramètres : + + + + : nom de l'option + + + + + + Valeur renvoyée : la valeur de l'option, chaîne vide si l'option + n'a pas été trouvée. + + + Exemples : + +# perl +$value = weechat::get_plugin_config ("ma_variable"); + +# python +value = weechat.get_plugin_config ("ma_variable") + + +
+ +
+ set_plugin_config + + + Prototype Perl : + + weechat::set_plugin_config ( option, valeur ); + + + + Prototype Python : + + weechat.set_plugin_config ( option, valeur ) + + + + Prototype Ruby : + + Weechat.set_plugin_config ( option, valeur ) + + + + Modifie la valeur d'une option de l'extension. + L'option est écrite dans le fichier + "~/.weechat/plugins.rc" et est + sous cette forme : + "extension.script.option=valeur" + (NB : le nom de l'extension et du script sont rajoutés + automatiquement). + + + Paramètres : + + + + : nom de l'option + + + + + : la nouvelle valeur pour + l'option + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est + produite. + + + Exemples : + +# perl +weechat::set_plugin_config ("ma_variable", "valeur"); + +# python +weechat.set_plugin_config ("ma_variable", "valeur") + +# ruby +Weechat.set_plugin_config ("ma_variable", "valeur") + + +
+ +
+ +
+ +
+ + + + + Auteurs / Support + + + Ce chapître liste les auteurs et contributeurs pour WeeChat, et + indique les moyens d'obtenir du support. + + +
+ Auteurs + + + WeeChat est développé par : + + + + FlashCode (Sébastien Helleu) + flashcode AT flashtux.org - + développeur principal + + + + + Kolter + kolter AT free.fr - + développeur + + + + + Ptitlouis + ptitlouis AT sysif.net - + empaqueteur Debian + + + + + +
+ +
+ Contributeurs + + + Les personnes suivantes ont contribué à WeeChat : + + + + Jiri Golembiovsky - + traduction tchèque + + + + + Rudolf Polzer - + patchs + + + + + Jim Ramsay - + patchs + + + + + Pistos - + patchs + + + + + +
+ +
+ Obtenir du support + + + Avant de faire appel au support, merci de lire la documentation et + la FAQ de WeeChat (la documentation est le document que vous êtes + en train de lire, si vous n'avez pas tout lu jusqu'ici, il est encore + temps de recommencer !) + + + + + + + IRC : serveur "irc.freenode.net", + canal "#weechat" + + + + + Forum WeeChat : + + http://forums.flashtux.org + + + + + + Liste de diffusion : + + + + Pour souscrire : + + http://mail.nongnu.org/mailman/listinfo/weechat-support + + + + + + Pour envoyer un mail à la liste de diffusion : + weechat-support@nongnu.org + + + + Les archives de la liste de diffusion sont ici : + + http://mail.nongnu.org/archive/html/weechat-support + + + + + + +
+ +
+ +
diff --git a/weechat/doc/weechat-doc.css b/weechat/doc/weechat-doc.css new file mode 100644 index 000000000..6f8650351 --- /dev/null +++ b/weechat/doc/weechat-doc.css @@ -0,0 +1,49 @@ +/* + * WeeChat doc CSS + * (c) 2006 by FlashCode + */ + +body { + font-size: 12px; +} + +table { + font-size: 12px; +} + +.informaltable table { + font-size: 11px; + font-family: Verdana; + border-collapse: collapse; +} + +.informaltable table th { + padding: 2px 5px 2px 5px; + border: solid 1px #AAAAAA; + background-color: #DDDDFF; +} + +.informaltable table td { + padding: 2px 5px 2px 5px; + border: solid 1px #AAAAAA; +} + +.oddrow { + background-color: #F0F0F0; +} + +.synopsis { + font-size: 11px; +} + +.programlisting { + font-size: 11px; +} + +pre.screen { + font-size: 11px; + background-color: #F5F5F5; + border: solid 1px #CCCCCC; + padding: 4px; + margin: 0 40px 0 40px; +} diff --git a/weechat/doc/weechat-html-one.xsl b/weechat/doc/weechat-html-one.xsl new file mode 100644 index 000000000..5427dbb3a --- /dev/null +++ b/weechat/doc/weechat-html-one.xsl @@ -0,0 +1,27 @@ + + + + + + + + + + + + + +weechat-doc.css + + + + + + + + oddrow + + + + + diff --git a/weechat/doc/weechat-html.xsl b/weechat/doc/weechat-html.xsl new file mode 100644 index 000000000..56fb6f96d --- /dev/null +++ b/weechat/doc/weechat-html.xsl @@ -0,0 +1,27 @@ + + + + + + + + + + + + + +weechat-doc.css + + + + + + + + oddrow + + + + +