<?xml version="1.0" encoding="iso-8859-1"?> <!-- WeeChat documentation (french version) Copyright (c) 2003-2006 by FlashCode <flashcode@flashtux.org> 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 manual 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 --> <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "file:///usr/share/xml/docbook/schema/dtd/4.2/docbookx.dtd" [ <!ENTITY date.xml SYSTEM "date.xml"> <!ENTITY config.xml SYSTEM "config.xml"> <!ENTITY weechat_commands.xml SYSTEM "weechat_commands.xml"> <!ENTITY irc_commands.xml SYSTEM "irc_commands.xml"> <!ENTITY key_functions.xml SYSTEM "key_functions.xml"> ]> <book lang="fr"> <bookinfo> <title>WeeChat 0.2.1-cvs - Guide utilisateur</title> <subtitle>Client IRC rapide, l�ger et extensible</subtitle> <author> <firstname>S�bastien</firstname> <surname>Helleu</surname> <email>flashcode AT flashtux.org</email> </author> &date.xml; <copyright> <year>2006</year> <holder>S�bastien Helleu</holder> </copyright> <legalnotice> <para> 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. </para> <para> 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. </para> <para> 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 </para> </legalnotice> <abstract> <para> Ce manuel documente le client IRC WeeChat, il fait partie de WeeChat. </para> <para> La derni�re version de ce document peut �tre t�l�charg�e sur cette page : <ulink url="http://weechat.flashtux.org/doc.php"> http://weechat.flashtux.org/doc.php </ulink> </para> </abstract> </bookinfo> <!-- =========================== Introduction =========================== --> <chapter id="chapIntroduction"> <title>Introduction</title> <para> Ce chapitre d�crit WeeChat et les pr�-requis pour son installation. </para> <section id="secDescription"> <title>Description</title> <para> WeeChat (Wee Enhanced Environment for Chat) est un client <acronym>IRC</acronym> libre, rapide et l�ger, con�u pour diff�rents syst�mes d'exploitation. </para> <para> Ses principales caract�ristiques sont les suivantes : <itemizedlist> <listitem> <para> connexion multi-serveurs (avec SSL, IPv6, proxy) </para> </listitem> <listitem> <para> plusieurs interfaces : Curses, wxWidgets, Gtk et Qt </para> </listitem> <listitem> <para> petit, rapide et l�ger </para> </listitem> <listitem> <para> param�trable et extensible avec des extensions et des scripts </para> </listitem> <listitem> <para> conforme aux <acronym>RFC</acronym>s <ulink url="http://www.ietf.org/rfc/rfc1459.txt">1459</ulink>, <ulink url="http://www.ietf.org/rfc/rfc2810.txt">2810</ulink>, <ulink url="http://www.ietf.org/rfc/rfc2811.txt">2811</ulink>, <ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink> et <ulink url="http://www.ietf.org/rfc/rfc2813.txt">2813</ulink> </para> </listitem> <listitem> <para> multi plates-formes (GNU/L'index, *BSD, MacOS X, Windows et d'autres syst�mes) </para> </listitem> <listitem> <para> 100% GPL, logiciel libre </para> </listitem> </itemizedlist> </para> <para> La page d'accueil de WeeChat est ici : <ulink url="http://weechat.flashtux.org"> http://weechat.flashtux.org </ulink> </para> </section> <section id="secPreRequis"> <title>Pr�-requis</title> <para> Pour installer WeeChat, vous <emphasis>devez</emphasis> avoir : <itemizedlist> <listitem> <para> un syst�me GNU/Linux (avec le compilateur et les outils associ�s pour le paquet des sources) </para> </listitem> <listitem> <para> droits "root" (pour installer WeeChat) </para> </listitem> <listitem> <para> selon l'interface, une des biblioth�ques suivantes : <itemizedlist> <listitem> <para> Curses : la biblioth�que ncurses </para> </listitem> <listitem> <para> Gtk : <emphasis>*** interface non d�velopp�e ***</emphasis> </para> </listitem> <listitem> <para> WxWidgets : <emphasis>*** interface non d�velopp�e ***</emphasis> </para> </listitem> <listitem> <para> Qt : <emphasis>*** interface non d�velopp�e ***</emphasis> </para> </listitem> </itemizedlist> </para> </listitem> </itemizedlist> </para> </section> </chapter> <!-- =========================== Installation =========================== --> <chapter id="chapInstallation"> <title>Installation</title> <para> Ce chapitre explique comment installer WeeChat. </para> <section id="secPaquetsBinaires"> <title>Paquets binaires</title> <para> Les paquets binaires sont disponibles pour les distributions suivantes : <itemizedlist> <listitem> <para> Debian (ou toute distribution compatible Debian) : <userinput>apt-get install weechat</userinput> </para> </listitem> <listitem> <para> Mandriva/RedHat (ou toute distribution compatible avec les RPM) : <userinput> rpm -i /chemin/weechat-x.y.z-1.i386.rpm </userinput> </para> </listitem> <listitem> <para> Gentoo : <userinput>emerge weechat</userinput> </para> </listitem> </itemizedlist> Pour les autres distributions support�es, merci de vous r�f�rer au manuel de la distribution pour la m�thode d'installation. </para> </section> <section id="secPaquetSource"> <title>Paquet source</title> <para> Tapez simplement dans une console ou un terminal : <screen><prompt>$ </prompt><userinput>./configure</userinput> <prompt>$ </prompt><userinput>make</userinput></screen> </para> <para> Obtenez les droits root et installez WeeChat : <screen><prompt>$ </prompt><userinput>su</userinput> (entrez le mot de passe root) <prompt># </prompt><userinput>make install</userinput></screen> </para> </section> <section id="secSourcesCVS"> <title>Sources CVS</title> <para> Attention : les sources CVS sont r�serv�s aux utilisateurs avanc�s : il se peut que WeeChat ne compile pas et qu'il soit tr�s instable. Vous �tes pr�venus ! </para> <para> Pour r�cup�rer les sources CVS, tapez cette commande : <screen><prompt>$ </prompt><userinput>cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/weechat co weechat</userinput></screen> </para> <para> Ex�cutez ce script : <userinput>./autogen.sh</userinput> </para> <para> Suivez alors les instructions du paquet source (voir <xref linkend="secPaquetSource" />) </para> </section> </chapter> <!-- =========================== Utilisation ============================ --> <chapter id="chapUtilisation"> <title>Utilisation</title> <para> Ce chapitre 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. </para> <section id="secLancerWeeChat"> <title>Lancer WeeChat</title> <para> Param�tres de ligne de commande : <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Param�tre</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry><literal>-a, --no-connect</literal></entry> <entry> Supprimer la connexion automatique aux serveurs lors du d�marrage </entry> </row> <row> <entry><literal>-c, --config</literal></entry> <entry> Afficher l'aide sur le fichier de config (liste des options) </entry> </row> <row> <entry><literal>-d, --dir <r�pertoire></literal></entry> <entry> D�finir le r�pertoire comme �tant la base de WeeChat (utilis� pour les fichiers de configuration, logs, extensions et scripts de l'utilisateur). La valeur par d�faut est "<literal>~/.weechat</literal>". NB: le r�pertoire est cr�� s'il n'est pas trouv� par WeeChat. </entry> </row> <row> <entry><literal>-f, --key-functions</literal></entry> <entry> Afficher la liste des fonctions internes WeeChat pour les touches </entry> </row> <row> <entry><literal>-h, --help</literal></entry> <entry> Afficher l'aide </entry> </row> <row> <entry><literal>-i, --irc-commands</literal></entry> <entry> Afficher la liste des commandes IRC </entry> </row> <row> <entry><literal>-k, --keys</literal></entry> <entry> Afficher les touches par d�faut de WeeChat </entry> </row> <row> <entry><literal>-l, --license</literal></entry> <entry> Afficher la licence de WeeChat </entry> </row> <row> <entry><literal>-p, --no-plugin</literal></entry> <entry> Supprimer le chargement automatique des extensions au d�marrage </entry> </row> <row> <entry><literal>-v, --version</literal></entry> <entry> Afficher la version de WeeChat </entry> </row> <row> <entry><literal>-w, --weechat-commands</literal></entry> <entry> Afficher la liste des commandes WeeChat </entry> </row> </tbody> </tgroup> </informaltable> </para> <para> Il est �galement possible de passer une URL pour un ou plusieurs serveurs IRC, de la forme : <screen>irc[6][s]://[pseudo[:mot_passe]@]irc.exemple.org[:port][/canal][,canal[...]</screen> Exemple pour rejoindre #weechat et #toto sur le serveur "<literal>irc.freenode.net</literal>", port par d�faut (6667), sous le pseudo "nono" : <screen><prompt>$ </prompt><userinput>weechat-curses irc://nono@irc.freenode.net/#weechat,#toto</userinput></screen> </para> <para> Pour lancer WeeChat, tapez cette commande : <itemizedlist> <listitem> <para> pour l'interface Curses : <userinput>weechat-curses</userinput> </para> </listitem> <listitem> <para> pour l'interface Gtk : <userinput>weechat-gtk</userinput> </para> </listitem> <listitem> <para> pour l'interface wxWidgets : <userinput>weechat-wxwidgets</userinput> </para> </listitem> <listitem> <para> pour l'interface Qt : <userinput>weechat-qt</userinput> </para> </listitem> </itemizedlist> </para> <para> 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 : "<literal>~/.weechat/weechat.rc</literal>" </para> <para> 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 "<literal>/set</literal>" (voir <xref linkend="secCommandesWeeChat" />) </para> </section> <section id="secRaccourcisClavier"> <title>Raccourcis clavier</title> <para> <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Touche</entry> <entry>Action</entry> </row> </thead> <tbody> <row> <entry>Fl�che gauche</entry> <entry> Aller au caract�re pr�c�dent sur la ligne de commande </entry> </row> <row> <entry>Fl�che droite</entry> <entry> Aller au caract�re suivant sur la ligne de commande </entry> </row> <row> <entry>Ctrl + fl�che gauche</entry> <entry> Aller au mot pr�c�dent sur la ligne de commande </entry> </row> <row> <entry>Ctrl + fl�che droite</entry> <entry> Aller au mot suivant sur la ligne de commande </entry> </row> <row> <entry>Home / Ctrl + A</entry> <entry> Aller au d�but de la ligne de commande </entry> </row> <row> <entry>End / Ctrl + E</entry> <entry> Aller � la fin de la ligne de commande </entry> </row> <row> <entry>Ctrl + K</entry> <entry> Effacer du curseur jusqu'� la fin de la ligne de commande </entry> </row> <row> <entry>Ctrl + L</entry> <entry> R�afficher toute la fen�tre </entry> </row> <row> <entry>Ctrl + U</entry> <entry> Effacer du curseur jusqu'au d�but de la ligne de commande </entry> </row> <row> <entry>Ctrl + W</entry> <entry> Effacer le mot pr�c�dent sur la ligne de commande </entry> </row> <row> <entry>Backspace</entry> <entry> Effacer le caract�re pr�c�dent sur la ligne de commande </entry> </row> <row> <entry>Delete</entry> <entry> Effacer le caract�re suivant sur la ligne de commande </entry> </row> <row> <entry>Tab</entry> <entry> Compl�ter la commande ou le pseudo (Tab de nouveau: trouver la compl�tion suivante) </entry> </row> <row> <entry>Tout caract�re</entry> <entry> Ins�rer le caract�re � la position du curseur sur la ligne de commande </entry> </row> <row> <entry>Entr�e</entry> <entry> Ex�cuter la commande ou envoyer le message </entry> </row> <row> <entry>Fl�che haut / fl�che bas</entry> <entry> Rappeler les derni�res commandes ou messages </entry> </row> <row> <entry>Ctrl + fl�che haut / Ctrl + fl�che bas</entry> <entry> Rappeler les derni�res commandes ou messages dans l'historique global (commun � tous les tampons) </entry> </row> <row> <entry>PageUp / PageDown</entry> <entry> Monter / descendre d'une page dans l'historique du tampon </entry> </row> <row> <entry>Alt + PageUp / Alt + PageDown</entry> <entry> Monter / descendre de quelques lignes dans l'historique du tampon </entry> </row> <row> <entry>Alt + Home / Alt + End</entry> <entry> Aller au d�but / � la fin du tampon </entry> </row> <row> <entry>F5 / Alt + fl�che gauche</entry> <entry> Aller au tampon pr�c�dent </entry> </row> <row> <entry>F6 / Alt + fl�che droite</entry> <entry> Aller au tampon suivant </entry> </row> <row> <entry>F7</entry> <entry> Aller � la fen�tre pr�c�dente </entry> </row> <row> <entry>F8</entry> <entry> Aller � la fen�tre suivante </entry> </row> <row> <entry>F10</entry> <entry> Effacer le dernier message de la barre d'informations </entry> </row> <row> <entry>F11 / F12</entry> <entry> Faire d�filer la liste des pseudos </entry> </row> <row> <entry>Alt + F11 / Alt + F12</entry> <entry> Aller au d�but / � la fin de la liste des pseudos </entry> </row> <row> <entry>Alt + A</entry> <entry> Sauter au prochain tampon avec activit� (avec priorit� : highlight, message, autre) </entry> </row> <row> <entry>Alt + B</entry> <entry> Aller au mot pr�c�dent </entry> </row> <row> <entry>Alt + D</entry> <entry> Effacer le mot suivant </entry> </row> <row> <entry>Alt + F</entry> <entry> Aller au mot suivant </entry> </row> <row> <entry>Alt + H</entry> <entry> Vider la hotlist (notification d'activit� sur les autres tampons) </entry> </row> <row> <entry>Alt + J puis Alt + D</entry> <entry> Afficher le tampon des DCC </entry> </row> <row> <entry>Alt + J puis Alt + L</entry> <entry> Sauter au dernier tampon </entry> </row> <row> <entry>Alt + J puis Alt + R</entry> <entry> Sauter au tampon de donn�es brutes IRC </entry> </row> <row> <entry>Alt + J puis Alt + S</entry> <entry> Sauter au tampon du serveur </entry> </row> <row> <entry>Alt + J puis Alt + X</entry> <entry> Sauter au premier canal du serveur suivant (ou tampon du serveur si aucun canal n'est ouvert) </entry> </row> <row> <entry>Alt + chiffre (0-9)</entry> <entry> Sauter au tampon qui porte ce num�ro (0 = 10) </entry> </row> <row> <entry>Alt + J puis nombre (01-99)</entry> <entry> Sauter au tampon qui porte ce num�ro </entry> </row> <row> <entry>Alt + K</entry> <entry> Capturer une touche et ins�rer son code sur la ligne de commande </entry> </row> <row> <entry>Alt + N</entry> <entry> Se positionner sur le highlight suivant </entry> </row> <row> <entry>Alt + P</entry> <entry> Se positionner sur le highlight pr�c�dent </entry> </row> <row> <entry>Alt + R</entry> <entry> Effacer enti�rement la ligne de commande </entry> </row> <row> <entry>Alt + S</entry> <entry> Changer de serveur sur le tampon des serveurs (si l'option "look_one_server_buffer" est activ�e) </entry> </row> <row> <entry>Alt + U</entry> <entry> Se positionner sur la premi�re ligne non lue du tampon </entry> </row> <row> <entry>Alt + W puis Alt + fl�che</entry> <entry> Sauter � une fen�tre avec une direction </entry> </row> </tbody> </tgroup> </informaltable> </para> </section> <section id="secLigneDeCommande"> <title>La ligne de commande</title> <para> La ligne de commande WeeChat (situ�e en bas de la fen�tre) permet d'envoyer du texte sur les canaux et d'ex�cuter des commandes WeeChat ou IRC (voir <xref linkend="secCommandesWeeChatIRC" />). </para> <para> Les commandes d�butent par un caract�re "/", suivi du nom de la commande. Par exemple pour initier une conversation priv�e avec "<literal>toto</literal>" : <screen><userinput>/query toto</userinput></screen> </para> <para> Le texte envoy� � un canal est tout texte ne commen�ant pas par le caract�re "/", par exemple pour envoyer "<literal>bonjour</literal>" sur le canal courant : <screen><userinput>bonjour</userinput></screen> </para> <para> Il est cependant possible de faire d�buter un texte par "/" en le doublant. Par exemple pour envoyer le texte "<literal>/query toto</literal>" sur le canal courant : <screen><userinput>//query toto</userinput></screen> </para> <para> Si l'option d'envoi des couleurs IRC ("<literal>irc_colors_send</literal>") est activ�e, il est possible d'utiliser des codes couleur et attributs comme suit : <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Code</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry>%B</entry> <entry> texte gras </entry> </row> <row> <entry>%Cxx</entry> <entry> couleur du texte "<literal>xx</literal>" (voir le tableau des couleurs ci-dessous) </entry> </row> <row> <entry>%Cxx,yy</entry> <entry> couleur du texte "<literal>xx</literal>" et du fond "<literal>yy</literal>" (voir le tableau des couleurs ci-dessous) </entry> </row> <row> <entry>%O</entry> <entry> d�sactiver la couleur et tous les attributs </entry> </row> <row> <entry>%R</entry> <entry> vid�o inverse (inversion de la couleur d'�criture et du fond) </entry> </row> <row> <entry>%U</entry> <entry> texte soulign� </entry> </row> <row> <entry>%%</entry> <entry> afficher un seul "<literal>%</literal>" </entry> </row> </tbody> </tgroup> </informaltable> NB: le m�me code (sans le num�ro pour %C) peut �tre utilis� pour stopper l'attribut d�fini. </para> <para> Les codes couleur pour %C sont : <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Code</entry> <entry>Couleur</entry> </row> </thead> <tbody> <row> <entry>00</entry> <entry>blanc</entry> </row> <row> <entry>01</entry> <entry>noir</entry> </row> <row> <entry>02</entry> <entry>bleu fonc�</entry> </row> <row> <entry>03</entry> <entry>vert fonc�</entry> </row> <row> <entry>04</entry> <entry>rouge clair</entry> </row> <row> <entry>05</entry> <entry>rouge fonc�</entry> </row> <row> <entry>06</entry> <entry>magenta</entry> </row> <row> <entry>07</entry> <entry>orange</entry> </row> <row> <entry>08</entry> <entry>jaune</entry> </row> <row> <entry>09</entry> <entry>vert clair</entry> </row> <row> <entry>10</entry> <entry>cyan</entry> </row> <row> <entry>11</entry> <entry>cyan clair</entry> </row> <row> <entry>12</entry> <entry>bleu clair</entry> </row> <row> <entry>13</entry> <entry>magenta clair</entry> </row> <row> <entry>14</entry> <entry>gris</entry> </row> <row> <entry>15</entry> <entry>gris clair (blanc)</entry> </row> </tbody> </tgroup> </informaltable> </para> <para> Exemple : affichage de "<literal>bonjour tout le monde !</literal>" avec "<literal>bonjour</literal>" en bleu clair gras, et "<literal>tout le monde</literal>" en rouge clair soulign� : <screen><userinput>%C12%Bbonjour%B%C04%U tout le monde%U%C !</userinput></screen> </para> </section> <section id="secCommandesWeeChatIRC"> <title>Commandes WeeChat / IRC</title> <para> Ce chapitre liste toutes les commandes WeeChat et IRC. </para> <section id="secCommandesWeeChat"> <title>Commandes WeeChat</title> <para> &weechat_commands.xml; </para> </section> <section id="secFonctionsTouches"> <title>Fonctions pour les touches</title> <para> <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Fonction</entry> <entry>Description</entry> </row> </thead> <tbody> &key_functions.xml; </tbody> </tgroup> </informaltable> </para> </section> <section id="secCommandesIRC"> <title>Commandes IRC</title> <para> &irc_commands.xml; </para> </section> </section> <section id="secFichierConfiguration"> <title>Fichier de configuration</title> <para> Liste des options du fichier de configuration : <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Option</entry> <entry>Type</entry> <entry>Valeurs</entry> <entry>D�faut</entry> <entry>Description</entry> </row> </thead> <tbody> &config.xml; </tbody> </tgroup> </informaltable> </para> <para> Les couleurs pour l'interface Curses sont : <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Mot cl�</entry> <entry>Couleur</entry> </row> </thead> <tbody> <row> <entry><literal>default</literal></entry> <entry>couleur par d�faut (transparent pour le fond)</entry> </row> <row> <entry><literal>black</literal></entry> <entry>noir</entry> </row> <row> <entry><literal>red</literal></entry> <entry>rouge fonc�</entry> </row> <row> <entry><literal>lightred</literal></entry> <entry>rouge clair</entry> </row> <row> <entry><literal>green</literal></entry> <entry>vert fonc�</entry> </row> <row> <entry><literal>lightgreen</literal></entry> <entry>vert clair</entry> </row> <row> <entry><literal>brown</literal></entry> <entry>marron</entry> </row> <row> <entry><literal>yellow</literal></entry> <entry>jaune</entry> </row> <row> <entry><literal>blue</literal></entry> <entry>bleu fonc�</entry> </row> <row> <entry><literal>lightblue</literal></entry> <entry>bleu clair</entry> </row> <row> <entry><literal>magenta</literal></entry> <entry>violet fonc�</entry> </row> <row> <entry><literal>lightmagenta</literal></entry> <entry>violet clair</entry> </row> <row> <entry><literal>cyan</literal></entry> <entry>cyan fonc�</entry> </row> <row> <entry><literal>lightcyan</literal></entry> <entry>cyan clair</entry> </row> <row> <entry><literal>white</literal></entry> <entry>blanc</entry> </row> </tbody> </tgroup> </informaltable> </para> </section> <section id="secTubeFIFO"> <title>Tube FIFO</title> <para> 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). </para> <para> Le tube FIFO est dans le r�pertoire "<literal>~/.weechat/</literal>" 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. </para> <para> La syntaxe pour envoyer des commandes ou du texte dans le tube FIFO est la suivante : <screen>serveur,canal *texte ou commande ici</screen> o� le serveur et le canal sont facultatifs, mais si le canal est l�, le serveur doit l'�tre aussi. </para> <para> Quelques exemples : <itemizedlist> <listitem> <para> changement du pseudo sur freenode en "pseudo|absent" : <screen><prompt>$ </prompt><userinput>echo 'freenode */nick pseudo|absent' >~/.weechat/weechat_fifo_12345</userinput></screen> </para> </listitem> <listitem> <para> affichage de texte sur le canal #weechat : <screen><prompt>$ </prompt><userinput>echo 'freenode,#weechat *bonjour tout le monde !' >~/.weechat/weechat_fifo_12345</userinput></screen> </para> </listitem> <listitem> <para> affichage de texte sur le canal courant (le tampon affich� par WeeChat) : <screen><prompt>$ </prompt><userinput>echo '*bonjour !' >~/.weechat/weechat_fifo_12345</userinput></screen> <emphasis>Attention :</emphasis> ceci est dangereux et vous ne devriez pas le faire sauf si vous savez ce que vous faites ! </para> </listitem> <listitem> <para> envoyer deux commandes pour d�charger/recharger les scripts Perl (vous devez les s�parer par "\n") : <screen><prompt>$ </prompt><userinput>echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345</userinput></screen> </para> </listitem> </itemizedlist> </para> <para> Vous pouvez �crire un script qui envoie les commandes � tous les WeeChat qui tournent en m�me temps, par exemple : <screen> #!/bin/sh if [ $# -eq 1 ]; then for fifo in $(/bin/ls ~/.weechat/weechat_fifo_* 2>/dev/null); do echo -e "$1" >$fifo done fi </screen> Si le script s'appelle "auto_weechat_command", vous pouvez le lancer ainsi : <screen><prompt>$ </prompt><userinput>./auto_weechat_command "freenode,#weechat *bonjour"</userinput></screen> </para> </section> </chapter> <!-- ============================ Extensions ============================ --> <chapter id="chapExtensions"> <title>Extensions</title> <para> Ce chapitre d�crit l'interface des extensions (API) et les extensions pour scripts (Perl, Python, Ruby, Lua), fournies avec WeeChat. </para> <section id="secLesExtensionsDansWeeChat"> <title>Les extensions dans WeeChat</title> <para> Une extension ("plugin" en anglais) est un programme �crit en C qui peut appeler des fonctions de WeeChat d�finies dans une interface. </para> <para> 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 <command>/plugin</command>. </para> <para> 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". </para> </section> <section id="secEcrireUneExtension"> <title>Ecrire une extension</title> <para> 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. </para> <para> L'extension doit comporter certaines variables et fonctions obligatoires (sans quoi l'extension ne peut �tre charg�e) : <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Variable</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry><literal>char plugin_name[]</literal></entry> <entry>le nom de l'extension</entry> </row> <row> <entry><literal>char plugin_version[]</literal></entry> <entry>la version de l'extension</entry> </row> <row> <entry><literal>char plugin_description[]</literal></entry> <entry>une courte description de l'extension</entry> </row> </tbody> </tgroup> </informaltable> <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Fonction</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry><literal>int weechat_plugin_init (t_weechat_plugin *plugin)</literal></entry> <entry> 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) </entry> </row> <row> <entry><literal>void weechat_plugin_end (t_weechat_plugin *plugin)</literal></entry> <entry>fonction appel�e au d�chargement de l'extension</entry> </row> </tbody> </tgroup> </informaltable> </para> <section id="secFonctionsInterface"> <title>Fonctions de l'interface (API)</title> <section id="secAPI_ascii_strcasecmp"> <title>ascii_strcasecmp</title> <para> Prototype : <command> int ascii_strcasecmp (t_weechat_plugin *plugin, char *chaine1, char *chaine2) </command> </para> <para> Effectue une comparaison entre deux cha�nes, sans tenir compte des majuscules/minuscules ni de la locale. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>chaine1</option> : la premi�re cha�ne � comparer </para> </listitem> <listitem> <para> <option>chaine2</option> : la deuxi�me cha�ne � comparer </para> </listitem> </itemizedlist> </para> <para> 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 </para> <para> Exemple : <screen>if (plugin->ascii_strcasecmp (plugin, "abc", "def") != 0) ...</screen> </para> </section> <section id="secAPI_ascii_strncasecmp"> <title>ascii_strncasecmp</title> <para> Prototype : <command> int ascii_strncasecmp (t_weechat_plugin *plugin, char *chaine1, char *chaine2, int max) </command> </para> <para> Effectue une comparaison entre deux cha�nes, sans tenir compte des majuscules/minuscules ni de la locale, en comparant au plus "max" caract�res. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>chaine1</option> : la premi�re cha�ne � comparer </para> </listitem> <listitem> <para> <option>chaine2</option> : la deuxi�me cha�ne � comparer </para> </listitem> <listitem> <para> <option>max</option> : nombre de caract�res max � comparer </para> </listitem> </itemizedlist> </para> <para> 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 </para> <para> Exemple : <screen>if (plugin->ascii_strncasecmp (plugin, "abc", "def", 2) != 0) ...</screen> </para> </section> <section id="secAPI_explode_string"> <title>explode_string</title> <para> Prototype : <command> char **explode_string (t_weechat_plugin *plugin, char *chaine, char *separateurs, int num_items_max, int *num_items) </command> </para> <para> Explose une cha�ne en plusieurs selon un/des d�limiteur(s). </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>chaine</option> : la cha�ne � exploser </para> </listitem> <listitem> <para> <option>separateurs</option> : les d�limiteurs utilis�s pour exploser la cha�ne </para> </listitem> <listitem> <para> <option>num_items_max</option> : nombre maximum de sous-cha�nes cr��es (0 = pas de limite) </para> </listitem> <listitem> <para> <option>num_items</option> : pointeur vers un entier qui contiendra le nombre de sous-cha�nes cr��es en retour </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : un tableau de cha�nes, ou NULL si un probl�me a �t� rencontr�. </para> <para> Note : le r�sultat doit �tre lib�r� par un appel � la fonction "free_exploded_string" apr�s utilisation. </para> <para> Exemple : <screen> char **argv; int argc; argv = plugin->explode_string (plugin, chaine, " ", 0, &argc); ... if (argv != NULL) plugin->free_exploded_string (plugin, argv); </screen> </para> </section> <section id="secAPI_free_exploded_string"> <title>free_exploded_string</title> <para> Prototype : <command> char **free_exploded_string (t_weechat_plugin *plugin, char **chaine) </command> </para> <para> Lib�re la m�moire utilis�e pour une explosion de cha�ne. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>chaine</option> : la cha�ne explos�e par la fonction "explode_string" </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemple : <screen> char *argv; int argc; argv = plugin->explode_string (plugin, chaine, " ", 0, &argc); ... if (argv != NULL) plugin->free_exploded_string (plugin, argv); </screen> </para> </section> <section id="secAPI_mkdir_home"> <title>mkdir_home</title> <para> Prototype : <command> int mkdir_home (t_weechat_plugin *plugin, char *repertoire) </command> </para> <para> Cr�� un r�pertoire dans le r�pertoire de base de WeeChat. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>repertoire</option> : r�pertoire � cr�er </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si le r�pertoire a �t� cr�� avec succ�s, 0 si une erreur s'est produite. </para> <para> Example: <screen> if (!plugin->mkdir_home (plugin, "temp")) plugin->print_server(plugin, "Impossible de cr�er le r�pertoire 'temp' dans la base WeeChat."); </screen> </para> </section> <section id="secAPI_exec_on_files"> <title>exec_on_files</title> <para> Prototype : <command> void exec_on_files (t_weechat_plugin *plugin, char *repertoire, int (*callback)(t_weechat_plugin *, char *)) </command> </para> <para> Ex�cute une fonction sur tous les fichiers d'un r�pertoire. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>repertoire</option> : le r�pertoire o� les fichiers sont recherch�s </para> </listitem> <listitem> <para> <option>callback</option> : une fonction appel�e pour chaque fichier trouv� </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemple : <screen> int callback (t_weechat_plugin *plugin, char *fichier) { plugin->print_server (plugin, "fichier: %s", fichier); return 1; } ... plugin->exec_on_files (plugin, "/tmp", &callback); </screen> </para> </section> <section id="secAPI_print"> <title>print</title> <para> Prototype : <command> void print (t_weechat_plugin *plugin, char *serveur, char *canal, char *message, ...) </command> </para> <para> Affiche un message sur un tampon WeeChat, identifi� par le serveur et le canal (tous deux pouvant �tre NULL pour le tampon courant). </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>serveur</option> : nom interne du serveur pour trouver le tampon dans lequel afficher (peut �tre NULL) </para> </listitem> <listitem> <para> <option>canal</option> : nom du canal pour trouver le tampon dans lequel afficher (peut �tre NULL) </para> </listitem> <listitem> <para> <option>message</option> : message � afficher </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemples : <screen> plugin->print (plugin, NULL, NULL, "hello"); plugin->print (plugin, NULL, "#weechat", "hello"); plugin->print (plugin, "freenode", "#weechat", "hello"); </screen> </para> </section> <section id="secAPI_print_server"> <title>print_server</title> <para> Prototype : <command> void print_server (t_weechat_plugin *plugin, char *message, ...) </command> </para> <para> Affiche un message sur le tampon du serveur courant. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>message</option> : message � afficher </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemple : <screen>plugin->print_server (plugin, "hello");</screen> </para> </section> <section id="secAPI_print_infobar"> <title>print_infobar</title> <para> Prototype : <command> void print_infobar (t_weechat_plugin *plugin, int temps, char *message, ...) </command> </para> <para> Affiche un message sur la barre d'infos pour un temps d�termin�. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>temps</option> : temps (en secondes) pendant lequel le message est affich� (0 = jamais effac�) </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemple : <screen> plugin->print_infobar (plugin, 5, "hello"); </screen> </para> </section> <section id="secAPI_infobar_remove"> <title>infobar_remove</title> <para> Prototype : <command> void infobar_remove (t_weechat_plugin *plugin, int nombre) </command> </para> <para> Efface un ou plusieurs messages dans la pile de la barre d'infos. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>nombre</option> : nombre de messages � supprimer (si param�tre non pr�sent ou <= 0, alors tous les messages sont effac�s) </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemple : <screen>plugin->infobar_remove (1);</screen> </para> </section> <section id="secAPI_log"> <title>log</title> <para> Prototype : <command> void log (t_weechat_plugin *plugin, char *serveur, char *canal, char *message, ...) </command> </para> <para> Ecrit un message dans le fichier de log pour un serveur ou un canal. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>serveur</option> : nom interne du serveur pour trouver le log du tampon (peut �tre NULL) </para> </listitem> <listitem> <para> <option>canal</option> : nom du canal pour trouver le tampon le log du tampon (peut �tre NULL) </para> </listitem> <listitem> <para> <option>message</option> : message </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemple : <screen> plugin->log (plugin, "freenode", "#weechat", "test"); </screen> </para> </section> <section id="secAPI_msg_handler_add"> <title>msg_handler_add</title> <para> Prototype : <command> t_plugin_handler *msg_handler_add (t_weechat_plugin *plugin, char *message, t_plugin_handler_func *fonction, char *handler_args, void *handler_pointer) </command> </para> <para> Ajoute un gestionnaire de messages IRC, appel� d�s qu'un message IRC est re�u. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>message</option> : nom du message IRC pour lequel la fonction est appel�e. Pour conna�tre la liste des messages IRC disponibles, merci de consulter les <acronym>RFC</acronym>s <ulink url="http://www.ietf.org/rfc/rfc1459.txt">1459</ulink> et <ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>. De plus, vous pouvez utiliser un nom sp�cial, pr�fix� par "weechat_" pour capturer des �v�nements sp�ciaux, comme d�crit dans le tableau ci-dessous : <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Nom</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry><literal>weechat_pv</literal></entry> <entry>message priv� re�u</entry> </row> <row> <entry><literal>weechat_highlight</literal></entry> <entry> message avec highlight (sur un canal ou en priv�) </entry> </row> <row> <entry><literal>weechat_ctcp</literal></entry> <entry> message CTCP re�u (VERSION, PING, etc...) </entry> </row> <row> <entry><literal>weechat_dcc</literal></entry> <entry> message DCC re�u (discussion ou fichier) </entry> </row> </tbody> </tgroup> </informaltable> </para> </listitem> <listitem> <para> <option>fonction</option> : fonction appel�e lorsque le message est re�u </para> <para> Elle a le prototype suivant : <command> int ma_fonction (t_weechat_plugin *plugin, int argc, char **argv, char *handler_args, void *handler_pointer) </command> </para> <para> Le param�tre argc vaut 3 et les arguments suivants sont pass�s dans le tableau argv : <itemizedlist> <listitem> <para>argv[0] = nom du serveur</para> </listitem> <listitem> <para>argv[1] = message IRC</para> </listitem> <listitem> <para>argv[2] = arguments de la commande</para> </listitem> </itemizedlist> </para> </listitem> <listitem> <para> <option>handler_args</option> : param�tres pass�s � la fonction appel�e </para> </listitem> <listitem> <para> <option>handler_pointer</option> : pointeur pass� � la fonction appel�e </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : le pointeur vers le nouveau gestionnaire de messages. </para> <para> Note : la fonction appel�e lorsque le message est re�u doit renvoyer une des valeurs suivantes : <itemizedlist> <listitem> <para> <literal>PLUGIN_RC_KO</literal> : la fonction a �chou� </para> </listitem> <listitem> <para> <literal>PLUGIN_RC_OK</literal> : la fonction a r�ussi </para> </listitem> <listitem> <para> <literal>PLUGIN_RC_OK_IGNORE_WEECHAT</literal> : le message ne sera pas transmis � WeeChat </para> </listitem> <listitem> <para> <literal>PLUGIN_RC_OK_IGNORE_PLUGINS</literal> : le message ne sera pas transmis � d'autres extensions </para> </listitem> <listitem> <para> <literal>PLUGIN_RC_OK_IGNORE_ALL</literal> : le message ne sera ni transmis � WeeChat ni � d'autres extensions </para> </listitem> </itemizedlist> </para> <para> Exemple : <screen> int msg_kick (t_weechat_plugin *plugin, int argc, char **argv, char *handler_args, void *handler_pointer) { plugin->print (plugin, argv[0], NULL, "KICK re�u"); return PLUGIN_RC_OK; } ... plugin->msg_handler_add (plugin, "KICK", &msg_kick, NULL, NULL); </screen> </para> </section> <section id="secAPI_cmd_handler_add"> <title>cmd_handler_add</title> <para> Prototype : <command> 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) </command> </para> <para> Ajoute un gestionnaire de commande WeeChat, appel� d�s que l'utilisateur utilise la commande (par exemple /commande). </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>commande</option> : 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) </para> </listitem> <listitem> <para> <option>description</option> : br�ve description de la commande (affich�e par /help commande) </para> </listitem> <listitem> <para> <option>arguments</option> : br�ve description des param�tres de la commande (affich�e par /help commande) </para> </listitem> <listitem> <para> <option>arguments_description</option> : longue description des param�tres de la commande (affich�e par /help commande) </para> </listitem> <listitem> <para> <option>modele_completion</option> : mod�le pour la compl�tion sous la forme "<literal>abc|%w def|%i</literal>" qui signifie "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 ou �gale � "-" d�sactive toute compl�tion pour tous les param�tres de la commande. </para> <para> Les codes suivants peuvent �tre utilis�s : <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Code</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry><literal>%-</literal></entry> <entry>aucune compl�tion pour le param�tre</entry> </row> <row> <entry><literal>%a</literal></entry> <entry>alias</entry> </row> <row> <entry><literal>%A</literal></entry> <entry> alias et commandes (WeeChat, IRC et extensions) </entry> </row> <row> <entry><literal>%c</literal></entry> <entry>canal courant</entry> </row> <row> <entry><literal>%C</literal></entry> <entry>canaux du serveur courant</entry> </row> <!-- <row> <entry><literal>%f</literal></entry> <entry>nom de fichier</entry> </row> --> <row> <entry><literal>%h</literal></entry> <entry>commandes d�finies par des extensions</entry> </row> <row> <entry><literal>%i</literal></entry> <entry>commandes IRC (envoy�es)</entry> </row> <row> <entry><literal>%I</literal></entry> <entry>commandes IRC (re�ues)</entry> </row> <row> <entry><literal>%k</literal></entry> <entry>fonctions associ�es aux touches</entry> </row> <row> <entry><literal>%m</literal></entry> <entry>pseudo sur le serveur courant</entry> </row> <row> <entry><literal>%n</literal></entry> <entry>pseudos du canal courant</entry> </row> <row> <entry><literal>%N</literal></entry> <entry> pseudos et noms de machines du canal courant </entry> </row> <row> <entry><literal>%o</literal></entry> <entry>options de configuration</entry> </row> <row> <entry><literal>%O</literal></entry> <entry>options des extensions</entry> </row> <row> <entry><literal>%p</literal></entry> <entry>message de "part" par d�faut</entry> </row> <row> <entry><literal>%q</literal></entry> <entry>message de "quit" par d�faut</entry> </row> <row> <entry><literal>%s</literal></entry> <entry>nom du serveur courant</entry> </row> <row> <entry><literal>%S</literal></entry> <entry>tous les serveurs</entry> </row> <row> <entry><literal>%t</literal></entry> <entry>titre du canal courant</entry> </row> <row> <entry><literal>%v</literal></entry> <entry>valeur d'une option de configuration</entry> </row> <row> <entry><literal>%V</literal></entry> <entry>valeur d'une option d'extension</entry> </row> <row> <entry><literal>%w</literal></entry> <entry>commandes WeeChat</entry> </row> </tbody> </tgroup> </informaltable> </para> </listitem> <listitem> <para> <option>fonction</option> : fonction appel�e lorsque la commande est ex�cut�e. </para> <para> Elle a le prototype suivant : <command> int ma_fonction (t_weechat_plugin *plugin, int argc, char **argv, char *handler_args, void *handler_pointer) </command> </para> <para> Le param�tre argc vaut 3 et les arguments suivants sont pass�s dans le tableau argv : <itemizedlist> <listitem> <para>argv[0] = nom du serveur</para> </listitem> <listitem> <para>argv[1] = commande</para> </listitem> <listitem> <para>argv[2] = arguments de la commande</para> </listitem> </itemizedlist> </para> </listitem> <listitem> <para> <option>handler_args</option> : param�tres pass�s � la fonction appel�e </para> </listitem> <listitem> <para> <option>handler_pointer</option> : pointeur pass� � la fonction appel�e </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : le pointeur vers le nouveau gestionnaire de commande. </para> <para> Note : la fonction appel�e lorsque la commande est ex�cut�e doit renvoyer une des valeurs suivantes : <itemizedlist> <listitem> <para> <literal>PLUGIN_RC_KO</literal> : la fonction a �chou� </para> </listitem> <listitem> <para> <literal>PLUGIN_RC_OK</literal> : la fonction a r�ussi </para> </listitem> </itemizedlist> </para> <para> Exemple : <screen> int cmd_test (t_weechat_plugin *plugin, int argc, char **argv, char *handler_args, void *handler_pointer) { plugin->print (plugin, argv[0], NULL, "commande test, pseudo: %s", (argv[2]) ? argv[2] : "aucun"); return PLUGIN_RC_OK; } ... plugin->cmd_handler_add (plugin, "test", "Commande test", "[pesudo]", "pseudo: un pseudo du canal", "%n", &cmd_test, NULL, NULL); </screen> </para> </section> <section id="secAPI_timer_handler_add"> <title>timer_handler_add</title> <para> Prototype : <command> t_plugin_handler *timer_handler_add (t_weechat_plugin *plugin, int intervalle, t_plugin_handler_func *fonction, char *handler_args, void *handler_pointer) </command> </para> <para> Ajoute un gestionnaire de temps, qui appelle p�riodiquement une fonction. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>intervalle</option> : intervalle (en secondes) entre deux appels de la fonction. </para> </listitem> <listitem> <para> <option>fonction</option> : fonction appel�e </para> <para> Elle a le prototype suivant : <command> int ma_fonction (t_weechat_plugin *plugin, int argc, char **argv, char *handler_args, void *handler_pointer) </command> </para> <para> Le param�tre argc vaut 0 et argv vaut NULL. </para> </listitem> <listitem> <para> <option>handler_args</option> : param�tres pass�s � la fonction appel�e </para> </listitem> <listitem> <para> <option>handler_pointer</option> : pointeur pass� � la fonction appel�e </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : le pointeur vers le nouveau gestionnaire de temps. </para> <para> Note : la fonction appel�e doit renvoyer une des valeurs suivantes : <itemizedlist> <listitem> <para> <literal>PLUGIN_RC_KO</literal> : la fonction a �chou� </para> </listitem> <listitem> <para> <literal>PLUGIN_RC_OK</literal> : la fonction a r�ussi </para> </listitem> </itemizedlist> </para> <para> Exemple : <screen> int mon_timer (t_weechat_plugin *plugin, int argc, char **argv, char *handler_args, void *handler_pointer) { plugin->print (plugin, NULL, NULL, "mon timer"); return PLUGIN_RC_OK; } ... plugin->timer_handler_add (plugin, 60, &mon_timer); </screen> </para> </section> <section id="secAPI_keyboard_handler_add"> <title>keyboard_handler_add</title> <para> Prototype : <command> t_plugin_handler *keyboard_handler_add (t_weechat_plugin *plugin, t_plugin_handler_func *fonction, char *handler_args, void *handler_pointer) </command> </para> <para> Ajoute un gestionnaire de clavier, appel� d�s qu'une touche est press�e. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>fonction</option> : fonction appel�e </para> <para> Elle a le prototype suivant : <command> int ma_fonction (t_weechat_plugin *plugin, int argc, char **argv, char *handler_args, void *handler_pointer) </command> </para> <para> Le param�tre argc vaut 3 et les arguments suivants sont pass�s dans le tableau argv : <itemizedlist> <listitem> <para> argv[0] = touche appuy�e (nom d'une fonction interne ou bien '*' suivi du code d'une touche) </para> </listitem> <listitem> <para> argv[1] = la ligne de commande avant l'action de la touche </para> </listitem> <listitem> <para> argv[2] = la ligne de commande apr�s l'action de la touche </para> </listitem> </itemizedlist> </para> </listitem> <listitem> <para> <option>handler_args</option> : param�tres pass�s � la fonction appel�e </para> </listitem> <listitem> <para> <option>handler_pointer</option> : pointeur pass� � la fonction appel�e </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : le pointeur vers le nouveau gestionnaire de clavier. </para> <para> Note : la fonction appel�e doit renvoyer une des valeurs suivantes : <itemizedlist> <listitem> <para> <literal>PLUGIN_RC_KO</literal> : la fonction a �chou� </para> </listitem> <listitem> <para> <literal>PLUGIN_RC_OK</literal> : la fonction a r�ussi </para> </listitem> </itemizedlist> </para> <para> Exemple : <screen> int keyb_handler (t_weechat_plugin *plugin, int argc, char **argv, char *handler_args, void *handler_pointer) { if (argc == 2) { plugin->print (plugin, NULL, NULL, "touche appuy�e: %s", argv[0]); if (argv[1] && (argv[1][0] == '1')) plugin->print (plugin, NULL, NULL, "le texte d'entr�e a chang�"); else plugin->print (plugin, NULL, NULL, "le texte d'entr�e n'a pas chang�"); } return PLUGIN_RC_OK; } ... plugin->keyboard_handler_add (plugin, &keyb_handler); </screen> </para> </section> <section id="secAPI_handler_remove"> <title>handler_remove</title> <para> Prototype : <command> void handler_remove (t_weechat_plugin *plugin, t_plugin_handler *handler) </command> </para> <para> Supprime un gestionnaire de commande ou message. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>handler</option> : le gestionnaire � supprimer </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemple : <screen>plugin->handler_remove (plugin, mon_handler);</screen> </para> </section> <section id="secAPI_handler_remove_all"> <title>handler_remove_all</title> <para> Prototype : <command> void handler_remove_all (t_weechat_plugin *plugin) </command> </para> <para> Supprime tous les gestionnaires d'une extension. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemple : <screen>plugin->handler_remove_all (plugin);</screen> </para> </section> <section id="secAPI_exec_command"> <title>exec_command</title> <para> Prototype : <command> void exec_command (t_weechat_plugin *plugin, char *serveur, char *canal, char *commande) </command> </para> <para> Execute une commande WeeChat ou envoie un message � un canal. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>serveur</option> : nom interne du serveur o� ex�cuter la commande (peut �tre NULL) </para> </listitem> <listitem> <para> <option>canal</option> : nom du canal o� ex�cuter la commande (peut �tre NULL) </para> </listitem> <listitem> <para> <option>commande</option> : la commande � ex�cuter </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemples : <screen> plugin->exec_command (plugin, NULL, NULL, "/help nick"); plugin->exec_command (plugin, "freenode", "#weechat", "bonjour"); </screen> </para> </section> <section id="secAPI_get_info"> <title>get_info</title> <para> Prototype : <command> char *get_info (t_weechat_plugin *plugin, char *info, char *serveur) </command> </para> <para> Renvoie une information sur WeeChat ou un canal. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>info</option> : nom de l'info � obtenir : <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Info</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry><literal>version</literal></entry> <entry>version de WeeChat</entry> </row> <row> <entry><literal>nick</literal></entry> <entry>pesudo</entry> </row> <row> <entry><literal>channel</literal></entry> <entry> nom du canal (NULL pour un serveur ou un priv�) </entry> </row> <row> <entry><literal>server</literal></entry> <entry>nom du serveur</entry> </row> <row> <entry><literal>away</literal></entry> <entry>drapeau "away"</entry> </row> <row> <entry><literal>inactivity</literal></entry> <entry> nombre de secondes �coul�es depuis que la derni�re touche a �t� appuy�e </entry> </row> <row> <entry><literal>input</literal></entry> <entry> contenu de la ligne de commande de la fen�tre courante </entry> </row> <row> <entry><literal>input_mask</literal></entry> <entry> contenu du masque de couleur de la ligne de commande </entry> </row> <row> <entry><literal>input_pos</literal></entry> <entry> position du curseur dans la ligne de commande </entry> </row> <row> <entry><literal>weechat_dir</literal></entry> <entry> r�pertoire de base de WeeChat (par d�faut: ~/.weechat/) </entry> </row> <row> <entry><literal>weechat_libdir</literal></entry> <entry>r�pertoire "lib" syst�me de WeeChat</entry> </row> <row> <entry><literal>weechat_sharedir</literal></entry> <entry>r�pertoire "share" syst�me de WeeChat</entry> </row> </tbody> </tgroup> </informaltable> </para> </listitem> <listitem> <para> <option>serveur</option> : nom interne du serveur o� r�cup�rer l'information (si n�cessaire) </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : l'information recherch�e, NULL si non trouv�e. </para> <para> Note : le r�sultat doit �tre lib�r� par un appel � la fonction "free" apr�s utilisation. </para> <para> Exemples : <screen> char *version = plugin->get_info (plugin, "version", NULL); char *nick = plugin->get_info (plugin, "nick", "freenode"); char *inactivity = plugin->get_info (plugin, "inactivity", NULL); plugin->print (plugin, NULL, NULL, "WeeChat version %s, vous �tes %s sur freenode " "(inactif depuis %s secondes)", version, nick, inactivity); if (version) free (version); if (nick) free (nick); if (inactivity) free (inactivity); </screen> </para> </section> <section id="secAPI_get_dcc_info"> <title>get_dcc_info</title> <para> Prototype : <command> t_plugin_info_dcc *get_dcc_info (t_weechat_plugin *plugin) </command> </para> <para> Renvoie la liste des DCC en cours ou termin�s. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : la liste cha�n�e des DCC. <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Type</entry> <entry>Champ</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry>char *</entry> <entry><literal>server</literal></entry> <entry>le serveur IRC</entry> </row> <row> <entry>char *</entry> <entry><literal>channel</literal></entry> <entry>le canal IRC</entry> </row> <row> <entry>int</entry> <entry><literal>type</literal></entry> <entry> le type de DCC : 0 = discussion re�ue, 1 = discussion envoy�e, 2 = fichier re�u, 3 = fichier envoy� </entry> </row> <row> <entry>int</entry> <entry><literal>status</literal></entry> <entry> le statut du DCC : 0 = en attente, 1 = en cours de connexion, 2 = actif, 3 = termin�, 4 = �chou�, 5 = interrompu par l'utilisateur </entry> </row> <row> <entry>time_t</entry> <entry><literal>start_time</literal></entry> <entry>la date et heure de cr�ation du DCC</entry> </row> <row> <entry>time_t</entry> <entry><literal>start_transfer</literal></entry> <entry>la date et heure de d�marrage du transfert</entry> </row> <row> <entry>unsigned long</entry> <entry><literal>addr</literal></entry> <entry>adresse IP de l'utilisateur distant</entry> </row> <row> <entry>int</entry> <entry><literal>port</literal></entry> <entry>port utilis� pour le DCC</entry> </row> <row> <entry>char *</entry> <entry><literal>nick</literal></entry> <entry>pseudo de l'utilisateur distant</entry> </row> <row> <entry>char *</entry> <entry><literal>filename</literal></entry> <entry>nom de fichier</entry> </row> <row> <entry>char *</entry> <entry><literal>local_filename</literal></entry> <entry>nom de fichier local</entry> </row> <row> <entry>int</entry> <entry><literal>filename_suffix</literal></entry> <entry>suffixe si renommage de fichier</entry> </row> <row> <entry>unsigned long</entry> <entry><literal>size</literal></entry> <entry>taille du fichier</entry> </row> <row> <entry>unsigned long</entry> <entry><literal>pos</literal></entry> <entry>position actuelle dans le fichier</entry> </row> <row> <entry>unsigned long</entry> <entry><literal>start_resume</literal></entry> <entry>position de d�marrage apr�s une interruption</entry> </row> <row> <entry>unsigned long</entry> <entry><literal>bytes_per_sec</literal></entry> <entry> nombre d'octets transmis par seconde depuis le d�but du transfert </entry> </row> <row> <entry>t_plugin_dcc_info *</entry> <entry><literal>prev_dcc</literal></entry> <entry> pointeur vers l'info DCC pr�c�dente </entry> </row> <row> <entry>t_plugin_dcc_info *</entry> <entry><literal>next_dcc</literal></entry> <entry> pointeur vers l'info DCC suivante </entry> </row> </tbody> </tgroup> </informaltable> </para> <para> Note : le r�sultat doit �tre lib�r� par un appel � la fonction "free_dcc_info" apr�s utilisation. </para> <para> Exemples : <screen> 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->print_server (plugin, "DCC type=%d, avec: %s", ptr_dcc->type, ptr_dcc->nick); } if (dcc_info) plugin->free_dcc_info (plugin, dcc_info); </screen> </para> </section> <section id="secAPI_free_dcc_info"> <title>free_dcc_info</title> <para> Prototype : <command> void free_dcc_info (t_weechat_plugin *plugin, t_plugin_dcc_info *dcc_info) </command> </para> <para> Lib�re la m�moire utilis�e par une liste de DCC. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>dcc_info</option> : pointeur vers la liste DCC renvoy�e par la fonction "get_dcc_info" </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemple : <screen>plugin->free_dcc_info (plugin, dcc_info);</screen> </para> </section> <section id="secAPI_get_server_info"> <title>get_server_info</title> <para> Prototype : <command> t_plugin_server_info *get_server_info (t_weechat_plugin *plugin) </command> </para> <para> Renvoie la liste des serveurs IRC (connect�s ou non). </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> </itemizedlist> </para> <para> Valeur retourn�e : la liste cha�n�e des serveurs IRC. <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Type</entry> <entry>Champ</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry>char *</entry> <entry><literal>name</literal></entry> <entry>nom interne du serveur</entry> </row> <row> <entry>int</entry> <entry><literal>autoconnect</literal></entry> <entry>1 si auto-connexion au d�marrage, 0 sinon</entry> </row> <row> <entry>int</entry> <entry><literal>autoreconnect</literal></entry> <entry> 1 si auto-reconnexion quand d�connect�, 0 sinon </entry> </row> <row> <entry>int</entry> <entry><literal>autoreconnect_delay</literal></entry> <entry>d�lai avant de tenter une reconnexion</entry> </row> <row> <entry>int</entry> <entry><literal>command_line</literal></entry> <entry> 1 si le serveur vient de la ligne de commande (donc temporaire), 0 sinon </entry> </row> <row> <entry>char *</entry> <entry><literal>address</literal></entry> <entry>adresse du serveur (nom ou IP)</entry> </row> <row> <entry>int</entry> <entry><literal>port</literal></entry> <entry>port</entry> </row> <row> <entry>int</entry> <entry><literal>ipv6</literal></entry> <entry>connexion IPv6</entry> </row> <row> <entry>int</entry> <entry><literal>ssl</literal></entry> <entry>connexion SSL</entry> </row> <row> <entry>char *</entry> <entry><literal>password</literal></entry> <entry>mot de passe pour le serveur</entry> </row> <row> <entry>char *</entry> <entry><literal>nick1</literal></entry> <entry>premier pseudo</entry> </row> <row> <entry>char *</entry> <entry><literal>nick2</literal></entry> <entry>pseudo alternatif</entry> </row> <row> <entry>char *</entry> <entry><literal>nick3</literal></entry> <entry>second pseudo alternatif</entry> </row> <row> <entry>char *</entry> <entry><literal>username</literal></entry> <entry>nom d'utilisateur</entry> </row> <row> <entry>char *</entry> <entry><literal>real name</literal></entry> <entry>nom r�el</entry> </row> <row> <entry>char *</entry> <entry><literal>command</literal></entry> <entry>commande ex�cut�e une fois connect�</entry> </row> <row> <entry>int</entry> <entry><literal>command_delay</literal></entry> <entry>d�lai apr�s ex�cution de la commande</entry> </row> <row> <entry>char *</entry> <entry><literal>autojoin</literal></entry> <entry>canaux joints automatiquement</entry> </row> <row> <entry>int</entry> <entry><literal>autorejoin</literal></entry> <entry> 1 si les canaux sont rejoints apr�s un "kick", 0 sinon </entry> </row> <row> <entry>char *</entry> <entry><literal>notify_levels</literal></entry> <entry>niveaux de notification des canaux</entry> </row> <row> <entry>char *</entry> <entry><literal>charset_decode_iso</literal></entry> <entry> jeux de caract�res de d�codage ISO pour les canaux </entry> </row> <row> <entry>char *</entry> <entry><literal>charset_decode_utf</literal></entry> <entry> jeux de caract�res de d�codage UTF pour les canaux </entry> </row> <row> <entry>char *</entry> <entry><literal>charset_encode</literal></entry> <entry> jeux de caract�res d'encodage pour les canaux </entry> </row> <row> <entry>int</entry> <entry><literal>is_connected</literal></entry> <entry>1 si connect� au serveur, 0 sinon</entry> </row> <row> <entry>int</entry> <entry><literal>ssl_connected</literal></entry> <entry>1 si connect� via SSL, 0 sinon</entry> </row> <row> <entry>char *</entry> <entry><literal>nick</literal></entry> <entry>pseudo courant</entry> </row> <row> <entry>int</entry> <entry><literal>is_away</literal></entry> <entry>1 si absent, 0 sinon</entry> </row> <row> <entry>time_t</entry> <entry><literal>away_time</literal></entry> <entry> date/heure � laquelle l'utilisateur a �t� marqu� absent </entry> </row> <row> <entry>int</entry> <entry><literal>lag</literal></entry> <entry>lag (en millisecondes)</entry> </row> <row> <entry>t_plugin_server_info *</entry> <entry><literal>prev_server</literal></entry> <entry>pointeur vers les infos du serveur pr�c�dent</entry> </row> <row> <entry>t_plugin_server_info *</entry> <entry><literal>next_server</literal></entry> <entry>pointeur vers les infos du serveur suivant</entry> </row> </tbody> </tgroup> </informaltable> </para> <para> Note : le r�sultat doit �tre lib�r� par un appel � la fonction "free_server_info" apr�s utilisation. </para> <para> Exemple : <screen> t_plugin_server_info *server_info, *ptr_server_info; server_info = plugin->get_server_info (plugin); if (server_info) { for (ptr_server_info = server_info; ptr_server_info; ptr_server_info = ptr_server_info->next_server) { plugin->print (plugin, NULL, NULL, "serveur: %s, addresse: %s, port: %d %s", ptr_server_info->name, ptr_server_info->address, ptr_server_info->port, (ptr_server_info->is_connected) ? "(connect�)" : ""); } plugin->free_server_info (plugin, server_info); } </screen> </para> </section> <section id="secAPI_free_server_info"> <title>free_server_info</title> <para> Prototype : <command> void free_server_info (t_weechat_plugin *plugin, t_plugin_server_info *server_info) </command> </para> <para> Lib�re la m�moire utilis�e par une liste de serveurs. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>server_info</option> : pointeur vers la liste de serveurs retourn�e par la fonction "get_server_info" </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemple : <screen>plugin->free_server_info (plugin, server_info);</screen> </para> </section> <section id="secAPI_get_channel_info"> <title>get_channel_info</title> <para> Prototype : <command> t_plugin_channel_info *get_channel_info (t_weechat_plugin *plugin, char *serveur) </command> </para> <para> Renvoie la liste des canaux IRC pour un serveur. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>serveur</option> : nom interne du serveur </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : la liste cha�n�e des canaux IRC du serveur. <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Type</entry> <entry>Field</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry>int</entry> <entry><literal>type</literal></entry> <entry>0 pour un canal, 1 pour un priv�</entry> </row> <row> <entry>char *</entry> <entry><literal>name</literal></entry> <entry>nom du canal</entry> </row> <row> <entry>char *</entry> <entry><literal>topic</literal></entry> <entry>titre du canal</entry> </row> <row> <entry>char *</entry> <entry><literal>modes</literal></entry> <entry>modes du canal</entry> </row> <row> <entry>int</entry> <entry><literal>limit</literal></entry> <entry>limite d'utilisateurs</entry> </row> <row> <entry>char *</entry> <entry><literal>key</literal></entry> <entry>cl� du canal</entry> </row> <row> <entry>int</entry> <entry><literal>nicks_count</literal></entry> <entry>nombre de pseudos pr�sents sur le canal</entry> </row> <row> <entry>t_plugin_channel_info *</entry> <entry><literal>prev_channel</literal></entry> <entry>pointeur vers les infos du canal pr�c�dent</entry> </row> <row> <entry>t_plugin_channel_info *</entry> <entry><literal>next_channel</literal></entry> <entry>pointeur vers les infos du canal suivant</entry> </row> </tbody> </tgroup> </informaltable> </para> <para> Note : le r�sultat doit �tre lib�r� par un appel � la fonction "free_channel_info" apr�s utilisation. </para> <para> Exemple : <screen> t_plugin_channel_info *channel_info, *ptr_chan_info; channel_info = plugin->get_channel_info (plugin, "freenode"); if (channel_info) { for (ptr_chan_info = channel_info; ptr_chan_info; ptr_chan_info = ptr_chan_info->next_channel) { plugin->print (plugin, NULL, NULL, " %s (type %d)", ptr_chan_info->name, ptr_chan_info->type); } plugin->free_channel_info (plugin, channel_info); } </screen> </para> </section> <section id="secAPI_free_channel_info"> <title>free_channel_info</title> <para> Prototype : <command> void free_channel_info (t_weechat_plugin *plugin, t_plugin_channel_info *channel_info) </command> </para> <para> Lib�re la m�moire utilis�e par une liste de canaux. </para> <para> Arguments: <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>channel_info</option> : pointeur vers la liste de canaux retourn�e par la fonction "get_channel_info" </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemple : <screen>plugin->free_channel_info (plugin, channel_info);</screen> </para> </section> <section id="secAPI_get_nick_info"> <title>get_nick_info</title> <para> Prototype : <command> t_plugin_nick_info *get_nick_info (t_weechat_plugin *plugin, char *serveur, char *canal) </command> </para> <para> Renvoie la liste des pseudos pour un canal. </para> <para> Arguments: <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>serveur</option> : nom interne du serveur </para> </listitem> <listitem> <para> <option>canal</option> : nom du canal </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : la liste cha�n�e des pseudos pr�sents sur le canal. <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Type</entry> <entry>Champ</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry>char *</entry> <entry><literal>nick</literal></entry> <entry>pseudo</entry> </row> <row> <entry>char *</entry> <entry><literal>host</literal></entry> <entry>nom de machine</entry> </row> <row> <entry>int</entry> <entry><literal>flags</literal></entry> <entry> propri�t�s du pseudo, "ou" binaire entre plusieurs valeurs (1 =propri�taire du canal, 2 = administrateur du canal, 4 = op, 8 = demi-op, 16 = voix, 32 = absent) </entry> </row> <row> <entry>t_plugin_nick_info *</entry> <entry><literal>prev_nick</literal></entry> <entry>pointeur vers les infos du pseudo pr�c�dent</entry> </row> <row> <entry>t_plugin_nick_info *</entry> <entry><literal>next_nick</literal></entry> <entry>pointeur vers les infos du pseudo pr�c�dent</entry> </row> </tbody> </tgroup> </informaltable> </para> <para> Note : le r�sultat doit �tre lib�r� par un appel � la fonction "free_nick_info" apr�s utilisation. </para> <para> Exemple : <screen> t_plugin_nick_info *nick_info, *ptr_nick_info; nick_info = plugin->get_nick_info (plugin, "freenode", "#weechat"); if (nick_info) { for (ptr_nick_info = nick_info; ptr_nick_info; ptr_nick_info = ptr_nick_info->next_nick) { plugin->print (plugin, NULL, NULL, " %s (flags: %d)", ptr_nick_info->nick, ptr_nick_info->flags); } plugin->free_nick_info (plugin, nick_info); } </screen> </para> </section> <section id="secAPI_free_nick_info"> <title>free_nick_info</title> <para> Prototype : <command> void free_nick_info (t_weechat_plugin *plugin, t_plugin_nick_info *nick_info) </command> </para> <para> Lib�re la m�moire utilis�e par une liste de pseudos. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>nick_info</option> : pointeur vers la liste de pseudos retourn�e par la fonction "get_nick_info" </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemple : <screen>plugin->free_nick_info (plugin, nick_info);</screen> </para> </section> <section id="secAPI_get_config"> <title>get_config</title> <para> Prototype : <command> char *get_config (t_weechat_plugin *plugin, char *option) </command> </para> <para> Renvoie la valeur d'une option de configuration WeeChat. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>option</option> : nom de l'option � lire </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : la valeur de l'option, NULL si non trouv�e. </para> <para> Note : le r�sultat doit �tre lib�r� par un appel � la fonction "free" apr�s utilisation. </para> <para> Exemples : <screen> char *value1 = plugin->get_config (plugin, "look_set_title"); char *value2 = plugin->get_config (plugin, "freenode.server_autojoin"); </screen> </para> </section> <section id="secAPI_set_config"> <title>set_config</title> <para> Prototype : <command> int set_config (t_weechat_plugin *plugin, char *option, char *valeur) </command> </para> <para> Modifie la valeur d'une option de configuration WeeChat. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>option</option> : nom de l'option � mettre � jour </para> </listitem> <listitem> <para> <option>valeur</option> : nouvelle valeur pour l'option </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si l'option a �t� modifi�e avec succ�s, 0 si une erreur s'est produite. </para> <para> Exemple : <screen> plugin->set_config (plugin, "look_nicklist", "off"); </screen> </para> </section> <section id="secAPI_get_plugin_config"> <title>get_plugin_config</title> <para> Prototype : <command> char *get_plugin_config (t_weechat_plugin *plugin, char *option) </command> </para> <para> Renvoie la valeur d'une option de l'extension. L'option est lue depuis le fichier "<literal>~/.weechat/plugins.rc</literal>" et est sous cette forme : "<literal>extension.option=valeur</literal>" (NB : le nom de l'extension est ajout� automatiquement). </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>option</option> : nom de l'option � lire </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : la valeur de l'option, NULL si non trouv�e. </para> <para> Note : le r�sultat doit �tre lib�r� par un appel � la fonction "free" apr�s utilisation. </para> <para> Exemple : <screen> char *value = plugin->get_plugin_config (plugin, "ma_variable"); </screen> </para> </section> <section id="secAPI_set_plugin_config"> <title>set_plugin_config</title> <para> Prototype : <command> int set_plugin_config (t_weechat_plugin *plugin, char *option, char *valeur) </command> </para> <para> Modifie la valeur d'une option de l'extension. L'option est �crite dans le fichier "<literal>~/.weechat/plugins.rc</literal>" et est sous cette forme : "<literal>extension.option=valeur</literal>" (NB : le nom de l'extension est ajout� automatiquement). </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>option</option> : nom de l'option � mettre � jour </para> </listitem> <listitem> <para> <option>valeur</option> : nouvelle valeur pour l'option </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si l'option a �t� modifi�e avec succ�s, 0 si une erreur s'est produite. </para> <para> Exemple : <screen> plugin->set_plugin_config (plugin, "ma_variable", "valeur"); </screen> </para> </section> <section id="secAPI_get_irc_color"> <title>get_irc_color</title> <para> Prototype : <command> int get_irc_color (t_weechat_plugin *plugin, char *nom_couleur) </command> </para> <para> Renvoie le num�ro d'une couleur IRC avec son nom. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>nom_couleur</option> : nom de la couleur Les couleure autoris�es sont : <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Nom couleur</entry> <entry>Valeur</entry> </row> </thead> <tbody> <row> <entry>white</entry> <entry>0</entry> </row> <row> <entry>black</entry> <entry>1</entry> </row> <row> <entry>blue</entry> <entry>2</entry> </row> <row> <entry>green</entry> <entry>3</entry> </row> <row> <entry>lightred</entry> <entry>4</entry> </row> <row> <entry>red</entry> <entry>5</entry> </row> <row> <entry>magenta</entry> <entry>6</entry> </row> <row> <entry>brown</entry> <entry>7</entry> </row> <row> <entry>yellow</entry> <entry>8</entry> </row> <row> <entry>lightgreen</entry> <entry>9</entry> </row> <row> <entry>cyan</entry> <entry>10</entry> </row> <row> <entry>lightcyan</entry> <entry>11</entry> </row> <row> <entry>lightblue</entry> <entry>12</entry> </row> <row> <entry>lightmagenta</entry> <entry>13</entry> </row> <row> <entry>gray</entry> <entry>14</entry> </row> <row> <entry>lightgray</entry> <entry>15</entry> </row> </tbody> </tgroup> </informaltable> </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : num�ro de la couleur IRC, -1 si la couleur n'est pas trouv�e. </para> <para> Exemple : <screen> int color_blue = plugin->get_irc_color (plugin, "blue"); /* retourne 2 */ </screen> </para> </section> <section id="secAPI_input_color"> <title>input_color</title> <para> Prototype : <command> void input_color (t_weechat_plugin *plugin, int couleur, int debut, int longueur) </command> </para> <para> Ajoute de la couleur dans la zone de saisie. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>couleur</option> : couleur pour le texte (si < 0, alors la zone de saisie est rafraichie, et il n'y a aucun changement dans son contenu) </para> </listitem> <listitem> <para> <option>debut</option> : position de d�but pour la coloration (si < 0, alors le masque est r�initialis�) </para> </listitem> <listitem> <para> <option>longueur</option> : longueur pour la coloration (si <= 0, alors le masque est r�initialis�) </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemple : <screen> plugin->input_color (plugin, plugin->get_irc_color (plugin, "blue"), 10, 5); </screen> </para> </section> <section id="secAPI_get_window_info"> <title>get_window_info</title> <para> Prototype : <command> t_plugin_window_info *get_window_info (t_weechat_plugin *plugin) </command> </para> <para> Retourne la liste des fen�tres WeeChat. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : liste cha�n�e des fen�tres WeeChat. <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Type</entry> <entry>Champ</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry>int</entry> <entry><literal>win_x</literal></entry> <entry>position horizontale de la fen�tre</entry> </row> <row> <entry>int</entry> <entry><literal>win_y</literal></entry> <entry>position verticale de la fen�tre</entry> </row> <row> <entry>int</entry> <entry><literal>win_width</literal></entry> <entry>largeur de la fen�tre</entry> </row> <row> <entry>int</entry> <entry><literal>win_height</literal></entry> <entry>hauteur de la fen�tre</entry> </row> <row> <entry>int</entry> <entry><literal>win_width_pct</literal></entry> <entry>largeur en % (compar� � la fen�tre parent)</entry> </row> <row> <entry>int</entry> <entry><literal>win_height_pct</literal></entry> <entry>hauteur en % (compar� � la fen�tre parent)</entry> </row> <row> <entry>int</entry> <entry><literal>num_buffer</literal></entry> <entry>num�ro du tampon affich�</entry> </row> <row> <entry>t_plugin_window_info *</entry> <entry><literal>prev_window</literal></entry> <entry>pointeur vers les infos de la fen�tre pr�c�dente</entry> </row> <row> <entry>t_plugin_window_info *</entry> <entry><literal>next_window</literal></entry> <entry>pointeur vers les infos de la fen�tre suivante</entry> </row> </tbody> </tgroup> </informaltable> </para> <para> Note : le r�sultat doit �tre lib�r� par un appel � la fonction "free_window_info" apr�s utilisation. </para> <para> Exemple : <screen> t_plugin_window_info *window_info, *ptr_window; window_info = plugin->get_window_info (plugin); if (window_info) { for (ptr_window = window_info; ptr_window; ptr_window = ptr_window->next_window) { plugin->print (plugin, NULL, NULL, "--- info fen�tre ---"); plugin->print (plugin, NULL, NULL, "(%d,%d), size: %dx%d, %%size: %d%%x%d%%", ptr_window->win_x, ptr_window->win_y, ptr_window->win_width, ptr_window->win_height, ptr_window->win_width_pct, ptr_window->win_height_pct); plugin->print (plugin, NULL, NULL, "num_buffer: %d", ptr_window->num_buffer); } plugin->free_window_info (plugin, window_info); } else plugin->print (plugin, NULL, NULL, "pas d'info fen�tre !"); </screen> </para> </section> <section id="secAPI_free_window_info"> <title>free_window_info</title> <para> Prototype : <command> void free_window_info (t_weechat_plugin *plugin, t_plugin_window_info *window_info) </command> </para> <para> Lib�re la m�moire utilis�e par une liste de fen�tres. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>window_info</option> : pointeur vers la liste des infos fen�tres retourn�e par la fonction "get_window_info" </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemple : <screen>plugin->free_window_info (plugin, window_info);</screen> </para> </section> <section id="secAPI_get_buffer_info"> <title>get_buffer_info</title> <para> Prototype : <command> t_plugin_buffer_info *get_buffer_info (t_weechat_plugin *plugin) </command> </para> <para> Retourne la liste des tampons WeeChat. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : liste cha�n�e des tampons WeeChat. <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Type</entry> <entry>Champ</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry>int</entry> <entry><literal>type</literal></entry> <entry> type de tampon: 0=standard, 1=dcc, 2=donn�es IRC brutes </entry> </row> <row> <entry>int</entry> <entry><literal>number</literal></entry> <entry>num�ro de tampon</entry> </row> <row> <entry>int</entry> <entry><literal>num_displayed</literal></entry> <entry>nombre de fen�tres affichant ce tampon</entry> </row> <row> <entry>char *</entry> <entry><literal>server_name</literal></entry> <entry>nom du serveur pour le tampon (peut �tre NULL)</entry> </row> <row> <entry>char *</entry> <entry><literal>channel_name</literal></entry> <entry>nom du canal pout le tampon (peut �tre NULL)</entry> </row> <row> <entry>int</entry> <entry><literal>notify_level</literal></entry> <entry>niveau de notification du tampon</entry> </row> <row> <entry>char *</entry> <entry><literal>log_filename</literal></entry> <entry> nom du fichier de log (NULL signifie qu'il n'y a pas de log) </entry> </row> <row> <entry>t_plugin_buffer_info *</entry> <entry><literal>prev_buffer</literal></entry> <entry>pointeur vers les infos du tampon pr�c�dent</entry> </row> <row> <entry>t_plugin_buffer_info *</entry> <entry><literal>next_buffer</literal></entry> <entry>pointeur vers les infos du tampon suivant</entry> </row> </tbody> </tgroup> </informaltable> </para> <para> Note : le r�sultat doit �tre lib�r� par un appel � la fonction "free_buffer_info" apr�s utilisation. </para> <para> Exemple : <screen> t_plugin_buffer_info *buffer_info, *ptr_buffer; buffer_info = plugin->get_buffer_info (plugin); if (buffer_info) { for (ptr_buffer = buffer_info; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer) { plugin->print (plugin, NULL, NULL, "--- info tampon ---"); plugin->print (plugin, NULL, NULL, "type: %d", ptr_buffer->type); plugin->print (plugin, NULL, NULL, "number: %d", ptr_buffer->number); plugin->print (plugin, NULL, NULL, "num_displayed: %d", ptr_buffer->num_displayed); plugin->print (plugin, NULL, NULL, "server: %s", ptr_buffer->server_name); plugin->print (plugin, NULL, NULL, "channel: %s", ptr_buffer->channel_name); plugin->print (plugin, NULL, NULL, "notify level: %d", ptr_buffer->notify_level); plugin->print (plugin, NULL, NULL, "log filename: %s", ptr_buffer->log_filename); } plugin->free_buffer_info (plugin, buffer_info); } else plugin->print (plugin, NULL, NULL, "pas d'info tampon !"); </screen> </para> </section> <section id="secAPI_free_buffer_info"> <title>free_buffer_info</title> <para> Prototype: <command> void free_buffer_info (t_weechat_plugin *plugin, t_plugin_buffer_info *buffer_info) </command> </para> <para> Lib�re la m�moire utilis�e par une liste de tampons. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>buffer_info</option> : pointeur vers la liste des infos tampons retourn�e par la fonction "get_buffer_info" </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemple : <screen>plugin->free_buffer_info (plugin, buffer_info);</screen> </para> </section> <section id="secAPI_get_buffer_data"> <title>get_buffer_data</title> <para> Prototype: <command> t_plugin_buffer_data *get_buffer_info (t_weechat_plugin *plugin, char *serveur, char *canal) </command> </para> <para> Renvoie le contenu du tampon. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>serveur</option> : nom interne du serveur </para> </listitem> <listitem> <para> <option>canal</option> : nom du canal </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : contenu du tampon (liste cha�n�e de lignes). <informaltable colsep="0" frame="none"> <tgroup cols="2"> <thead> <row> <entry>Type</entry> <entry>Champ</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry>char *</entry> <entry><literal>nick</literal></entry> <entry>pseudo</entry> </row> <row> <entry>char *</entry> <entry><literal>data</literal></entry> <entry> contenu de la ligne (les codes couleur sont retir�s) </entry> </row> <row> <entry>t_plugin_buffer_line *</entry> <entry><literal>prev_line</literal></entry> <entry>pointeur vers la ligne pr�c�dente</entry> </row> <row> <entry>t_plugin_buffer_line *</entry> <entry><literal>next_line</literal></entry> <entry>pointeur vers la ligne suivante</entry> </row> </tbody> </tgroup> </informaltable> </para> <para> Note : le r�sultat doit �tre lib�r� par un appel � la fonction "free_buffer_data" apr�s utilisation. </para> <para> Exemple : <screen> t_plugin_buffer_line *buffer_line, *ptr_line; buffer_line = plugin->get_buffer_data (plugin); if (buffer_line) { for (ptr_line = buffer_line; ptr_line; ptr_line = ptr_line->next_line) { plugin->print (plugin, NULL, NULL, "pseudo: %s, donn�es: %s", ptr_line->nick, ptr_line->data); } plugin->free_buffer_data (plugin, buffer_line); } </screen> </para> </section> <section id="secAPI_free_buffer_data"> <title>free_buffer_data</title> <para> Prototype: <command> void free_buffer_data (t_weechat_plugin *plugin, t_plugin_buffer_line *buffer_line) </command> </para> <para> Lib�re la m�moire utilis�e par les lignes d'un tampon. </para> <para> Arguments: <itemizedlist> <listitem> <para> <option>plugin</option> : pointeur vers la structure de l'extension </para> </listitem> <listitem> <para> <option>buffer_line</option> : pointeur vers la liste des lignes du tampon retourn�e par la fonction "get_buffer_data" </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemple : <screen>plugin->free_buffer_data (plugin, buffer_line);</screen> </para> </section> </section> <section id="secCompilerExtension"> <title>Compiler l'extension</title> <para> La compilation ne n�cessite pas les sources WeeChat, mais seulement le fichier "<literal>weechat-plugin.h</literal>". </para> <para> Pour compiler une extension compos�e d'un fichier "toto.c" (sous GNU/Linux) : <screen> <prompt>$ </prompt><userinput>gcc -fPIC -Wall -c toto.c</userinput> <prompt>$ </prompt><userinput>gcc -shared -fPIC -o libtoto.so toto.o</userinput> </screen> </para> </section> <section id="secChargerExtension"> <title>Charger l'extension dans WeeChat</title> <para> Copier le fichier "libtoto.so" dans le r�pertoire syst�me des extensions (par exemple "<literal>/usr/local/lib/weechat/plugins)</literal>" ou bien dans celui de l'utilisateur (par exemple "<literal>/home/xxxxx/.weechat/plugins</literal>"). </para> <para> Sous WeeChat : <screen><userinput>/plugin load toto</userinput></screen> </para> </section> <section id="secExempleExtension"> <title>Exemple d'extension</title> <para> 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 !) : <screen> #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, int argc, char **argv, char *handler_args, void *handler_pointer) { if (argv[2] && (argv[2][0] != '/')) { plugin->exec_command (plugin, NULL, NULL, argv[2]); plugin->exec_command (plugin, NULL, NULL, argv[2]); } 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 */ } </screen> </para> </section> </section> <section id="secExtensionsScripts"> <title>Extensions pour scripts</title> <para> Quatre extensions sont fournies en standard avec WeeChat pour utiliser des langages de script : Perl, Python, Ruby et Lua. </para> <section id="secChargerDechargerScripts"> <title>Charger / d�charger des scripts</title> <para> Les scripts sont charg�s et d�charg�s avec les commandes <command>/perl</command>, <command>/python</command>, <command>/ruby</command> et <command>/lua</command> (tapez <command>/help</command> dans WeeChat pour obtenir de l'aide sur les commandes). </para> <para> Exemples : <itemizedlist> <listitem> <para> Charger un script Perl : <command><userinput>/perl load /tmp/essai.pl</userinput></command> </para> </listitem> <listitem> <para> Lister les scripts Perl charg�s : <command><userinput>/perl</userinput></command> </para> </listitem> <listitem> <para> Charger un script Python : <command><userinput>/python load /tmp/essai.py</userinput></command> </para> </listitem> <listitem> <para> Lister les scripts Python charg�s : <command><userinput>/python</userinput></command> </para> </listitem> <listitem> <para> Charger un script Ruby : <command><userinput>/ruby load /tmp/essai.rb</userinput></command> </para> </listitem> <listitem> <para> Lister les scripts Ruby charg�s : <command><userinput>/ruby</userinput></command> </para> </listitem> <listitem> <para> Charger un script Lua : <command><userinput>/lua load /tmp/essai.lua</userinput></command> </para> </listitem> <listitem> <para> Lister les scripts Lua charg�s : <command><userinput>/lua</userinput></command> </para> </listitem> </itemizedlist> </para> </section> <section id="secSyntaxeParLangage"> <title>Syntaxe par langage</title> <section id="secScriptPerl"> <title>Perl</title> <para> Dans un script Perl WeeChat, toutes les fonctions et variables de l'interface sont pr�fix�es par "<literal>weechat::</literal>". Exemple : <screen>weechat::register("test", "1.0", "end_test", "Script perl WeeChat");</screen> </para> </section> <section id="secScriptPython"> <title>Python</title> <para> Un script Python WeeChat doit commencer par importer weechat : <screen>import weechat</screen> </para> <para> Toutes les fonctions et variables de l'interface sont pr�fix�es par "<literal>weechat.</literal>". Exemple : <screen>weechat.register("test", "1.0", "end_test", "Script python WeeChat")</screen> </para> </section> <section id="secScriptRuby"> <title>Ruby</title> <para> Dans un script Ruby WeeChat, tout le code doit �tre dans des fonctions. Pour le code principal, vous devez d�finir une fonction "<literal>weechat_init</literal>", qui est appel�e automatiquement quand le script est charg� par WeeChat. Exemple : <screen> def weechat_init Weechat.register("test", "1.0", "end_test", "Script ruby WeeChat") Weechat.add_command_handler("commande", "ma_commande") return Weechat::PLUGIN_RC_OK end def ma_commande(server, args) Weechat.print("ma commande") return Weechat::PLUGIN_RC_OK end </screen> </para> <para> Toutes les fonctions de l'interface sont pr�fix�es par "<literal>Weechat.</literal>" et les variables par "<literal>Weechat::</literal>". </para> </section> <section id="secScriptLua"> <title>Lua</title> <para> Dans un script Lua WeeChat, toutes les fonctions de l'interface sont pr�fix�es par "<literal>weechat.</literal>". Les variables sont pr�fix�es par "<literal>weechat.</literal>" et suffix�es par "<literal>()</literal>". Exemple : <screen> function message_handler(server, args) weechat.print("Je suis un message handler") return weechat.PLUGIN_RC_OK() end </screen> </para> </section> </section> <section id="secInterfaceWeeChatScripts"> <title>Interface WeeChat / scripts</title> <section id="sec_script_register"> <title>register</title> <para> Prototype Perl : <command> weechat::register(nom, version, fonction_de_fin, description); </command> </para> <para> Prototype Python : <command> weechat.register(nom, version, fonction_de_fin, description) </command> </para> <para> Prototype Ruby : <command> Weechat.register(nom, version, fonction_de_fin, description) </command> </para> <para> Prototype Lua : <command> weechat.register(nom, version, fonction_de_fin, description) </command> </para> <para> C'est la premi�re fonction � appeler dans le script. Tout script pour WeeChat doit appeler cette fonction. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>nom</option> : nom unique pour identifier le script (chaque script doit avoir un nom diff�rent) </para> </listitem> <listitem> <para> <option>version</option> : version du script </para> </listitem> <listitem> <para> <option>fonction_de_fin</option> : 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) </para> </listitem> <listitem> <para> <option>description</option> : br�ve description du script </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si le script a �t� enregistr�, 0 si une erreur s'est produite. </para> <para> Exemples : <screen> # 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 !") -- lua weechat.register("essai", "1.0", "fin_essai", "Script d'essai !") </screen> </para> </section> <section id="secScript_print"> <title>print</title> <para> Prototype Perl : <command> weechat::print(message, [canal, [serveur]]) </command> </para> <para> Prototype Python : <command> weechat.prnt(message, [canal, [serveur]]) </command> </para> <para> Prototype Ruby : <command> Weechat.print(message, [canal, [serveur]]) </command> </para> <para> Prototype Lua : <command> weechat.print(message, [canal, [serveur]]) </command> </para> <para> Affiche un message sur un tampon WeeChat, identifi� par le serveur et le canal. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>message</option> : message � afficher </para> </listitem> <listitem> <para> <option>canal</option> : nom du canal pour trouver le tampon dans lequel afficher </para> </listitem> <listitem> <para> <option>serveur</option> : nom interne du serveur pour trouver le tampon dans lequel afficher </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si succ�s, 0 si une erreur s'est produite. </para> <para> Exemples : <screen> # 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") -- lua weechat.print("message") weechat.print("message", "#weechat") weechat.print("message", "#weechat", "freenode") </screen> </para> </section> <section id="secScript_print_infobar"> <title>print_infobar</title> <para> Prototype Perl : <command> weechat::print_infobar(temps, message); </command> </para> <para> Prototype Python : <command> weechat.print_infobar(temps, message) </command> </para> <para> Prototype Ruby : <command> Weechat.print_infobar(temps, message) </command> </para> <para> Prototype Lua : <command> weechat.print_infobar(temps, message) </command> </para> <para> Affiche un message sur la barre d'infos pour un temps d�termin�. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>temps</option> : temps (en secondes) pendant lequel le message est affich� (0 = jamais effac�) </para> </listitem> <listitem> <para> <option>message</option> : message � afficher </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si succ�s, 0 si une erreur s'est produite. </para> <para> Exemples : <screen> # perl weechat::print_infobar(5, "message"); # python weechat.print_infobar(5, "message") # ruby Weechat.print_infobar(5, "message") -- lua weechat.print_infobar(5, "message") </screen> </para> </section> <section id="secScript_remove_infobar"> <title>remove_infobar</title> <para> Prototype Perl : <command> weechat::remove_infobar([nombre]); </command> </para> <para> Prototype Python : <command> weechat.remove_infobar([nombre]) </command> </para> <para> Prototype Ruby : <command> Weechat.remove_infobar([nombre]) </command> </para> <para> Prototype Lua : <command> weechat.remove_infobar([nombre]) </command> </para> <para> Efface un ou plusieurs messages dans la pile de la barre d'infos. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>nombre</option> : nombre de messages � supprimer (si param�tre non pr�sent ou <= 0, alors tous les messages sont effac�s) </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si succ�s, 0 si une erreur s'est produite. </para> <para> Exemples : <screen> # perl weechat::remove_infobar(1); # python weechat.remove_infobar(1) # ruby Weechat.remove_infobar(1) -- lua weechat.remove_infobar(1) </screen> </para> </section> <section id="secScript_log"> <title>log</title> <para> Prototype Perl : <command> weechat::log(message, [canal, [serveur]]); </command> </para> <para> Prototype Python : <command> weechat.log(message, [canal, [serveur]]) </command> </para> <para> Prototype Ruby : <command> Weechat.log(message, [canal, [serveur]]) </command> </para> <para> Prototype Lua : <command> weechat.log(message, [canal, [serveur]]) </command> </para> <para> Ecrit un message dans le fichier de log pour un serveur ou un canal. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>message</option> : message </para> </listitem> <listitem> <para> <option>canal</option> : nom du canal pour trouver le log du tampon </para> </listitem> <listitem> <para> <option>serveur</option> : nom interne du serveur pour trouver le log du tampon </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si succ�s, 0 si une erreur s'est produite. </para> <para> Exemples : <screen> # perl weechat::log("message", "#weechat", "freenode"); # python weechat.log("message", "#weechat", "freenode") # ruby Weechat.log("message", "#weechat", "freenode") -- lua weechat.log("message", "#weechat", "freenode") </screen> </para> </section> <section id="secScript_add_message_handler"> <title>add_message_handler</title> <para> Prototype Perl : <command> weechat::add_message_handler(message, fonction); </command> </para> <para> Prototype Python : <command> weechat.add_message_handler(message, fonction) </command> </para> <para> Prototype Ruby : <command> Weechat.add_message_handler(message, fonction) </command> </para> <para> Prototype Lua : <command> weechat.add_message_handler(message, fonction) </command> </para> <para> Ajoute un gestionnaire de messages IRC, appel� d�s qu'un message IRC est re�u. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>message</option> : nom du message IRC pour lequel la fonction est appel�e. Pour conna�tre la liste des messages IRC disponibles, merci de consulter les <acronym>RFC</acronym>s <ulink url="http://www.ietf.org/rfc/rfc1459.txt">1459</ulink> et <ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>. De plus, vous pouvez utiliser un nom sp�cial, pr�fix� par "weechat_" pour capturer des �v�nements sp�ciaux (voir <xref linkend="secAPI_msg_handler_add" />). </para> </listitem> <listitem> <para> <option>fonction</option> : fonction appel�e lorsque le message est re�u </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si succ�s, 0 si une erreur s'est produite. </para> <para> Exemples : <screen> # perl weechat::add_message_handler("privmsg", "ma_fonction"); sub ma_fonction { weechat::print("serveur=$_[0]"); ($null, $canal, $message) = split ":",$_[1],3; ($masque, $null, $canal) = split " ", $canal; weechat::print("masque=$masque, canal=$canal, msg=$message"); 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 # ruby Weechat.add_message_handler("privmsg", "ma_fonction") def ma_fonction(server, args) Weechat.print("serveur=#{server}, args=#{args}") return Weechat::PLUGIN_RC_OK end -- lua weechat.add_message_handler ("privmsg", "ma_fonction") function ma_fonction(server, args) weechat.print("serveur=" .. server .. ", args=" .. args) return weechat.PLUGIN_RC_OK() end </screen> </para> <para> Note : la fonction appel�e lorsque le message est re�u doit renvoyer une des valeurs suivantes : <itemizedlist> <listitem> <para> <literal>PLUGIN_RC_KO</literal> : la fonction a �chou� </para> </listitem> <listitem> <para> <literal>PLUGIN_RC_OK</literal> : la fonction a r�ussi </para> </listitem> <listitem> <para> <literal>PLUGIN_RC_OK_IGNORE_WEECHAT</literal> : le message ne sera pas transmis � WeeChat </para> </listitem> <listitem> <para> <literal>PLUGIN_RC_OK_IGNORE_PLUGINS</literal> : le message ne sera pas transmis � d'autres extensions </para> </listitem> <listitem> <para> <literal>PLUGIN_RC_OK_IGNORE_ALL</literal> : le message ne sera ni transmis � WeeChat ni � d'autres extensions </para> </listitem> </itemizedlist> </para> </section> <section id="secScript_add_command_handler"> <title>add_command_handler</title> <para> Prototype Perl : <command> weechat::add_command_handler(commande, fonction, [description, arguments, arguments_description, modele_completion]); </command> </para> <para> Prototype Python : <command> weechat.add_command_handler(commande, fonction, [description, arguments, arguments_description, modele_completion]) </command> </para> <para> Prototype Ruby : <command> Weechat.add_command_handler(commande, fonction, [description, arguments, arguments_description, modele_completion]) </command> </para> <para> Prototype Lua : <command> weechat.add_command_handler(commande, fonction, [description, arguments, arguments_description, modele_completion]) </command> </para> <para> Ajoute un gestionnaire de commande WeeChat, appel� d�s que l'utilisateur utilise la commande (par exemple /commande). </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>commande</option> : 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�) </para> </listitem> <listitem> <para> <option>fonction</option> : fonction appel�e lorsque la commande est ex�cut�e </para> </listitem> <listitem> <para> <option>arguments</option> : br�ve description des param�tres de la commande (affich�e par /help commande) </para> </listitem> <listitem> <para> <option>arguments_description</option> : longue description des param�tres de la commande (affich�e par /help commande) </para> </listitem> <listitem> <para> <option>modele_completion</option> : mod�le pour la compl�tion sous la forme "<literal>abc|%w def|%i</literal>" qui signifie "abc" ou une commande WeeChat pour le premier param�tre, et "def" ou une commande IRC pour le deuxi�me. (voir <xref linkend="secAPI_cmd_handler_add" />) </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si succ�s, 0 si une erreur s'est produite. </para> <para> Exemples : <screen> # perl weechat::add_command_handler("commande", "ma_commande"); sub ma_commande { weechat::print("serveur=$_[0], args=$_[1]"); return weechat::PLUGIN_RC_OK; } # python weechat.add_command_handler("commande", "ma_commande") def ma_commande(serveur, args): weechat.prnt("serveur="+serveur+", args="+args) return weechat.PLUGIN_RC_OK # ruby Weechat.add_command_handler("commande", "ma_commande") def ma_commande(server, args) Weechat.print("serveur=#{server} args=#{args}") return Weechat::PLUGIN_RC_OK end -- lua weechat.add_command_handler ("commande", "ma_commande") def my_command(server, args) weechat.print("serveur="..server..", args="..args) return weechat.PLUGIN_RC_OK() end </screen> </para> <para> Notes : la fonction appel�e lorsque la commande est ex�cut�e doit renvoyer une des valeurs suivantes : <itemizedlist> <listitem> <para> <literal>PLUGIN_RC_KO</literal> : la fonction a �chou� </para> </listitem> <listitem> <para> <literal>PLUGIN_RC_OK</literal> : la fonction a r�ussi </para> </listitem> </itemizedlist> </para> </section> <section id="secScript_add_timer_handler"> <title>add_timer_handler</title> <para> Prototype Perl : <command> weechat::add_timer_handler(intervalle, fonction); </command> </para> <para> Prototype Python : <command> weechat.add_timer_handler(intervalle, fonction) </command> </para> <para> Prototype Ruby : <command> Weechat.add_timer_handler(intervalle, fonction) </command> </para> <para> Prototype Lua : <command> weechat.add_timer_handler(intervalle, fonction) </command> </para> <para> Ajoute un gestionnaire de temps, qui appelle p�riodiquement une fonction. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>intervalle</option> : intervalle (en secondes) entre deux appels de la fonction. </para> </listitem> <listitem> <para> <option>fonction</option> : fonction appel�e </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si succ�s, 0 si une erreur s'est produite. </para> <para> Exemples : <screen> # perl weechat::add_timer_handler(60, "mon_timer"); sub mon_timer { weechat::print("ceci est le timer handler"); return weechat::PLUGIN_RC_OK; } # python weechat.add_timer_handler(60, "mon_timer") def mon_timer(): weechat.prnt("ceci est le timer handler") return weechat.PLUGIN_RC_OK # ruby Weechat.add_timer_handler(60, "mon_timer") def mon_timer() Weechat.print("ceci est le timer handler") return Weechat::PLUGIN_RC_OK end -- lua weechat.add_timer_handler(60, "mon_timer") function mon_timer() weechat.print("ceci est le timer handler") return weechat.PLUGIN_RC_OK() end </screen> </para> <para> Note : la fonction appel�e doit renvoyer une des valeurs suivantes : <itemizedlist> <listitem> <para> <literal>PLUGIN_RC_KO</literal> : la fonction a �chou� </para> </listitem> <listitem> <para> <literal>PLUGIN_RC_OK</literal> : la fonction a r�ussi </para> </listitem> </itemizedlist> </para> </section> <section id="secScript_add_keyboard_handler"> <title>add_keyboard_handler</title> <para> Prototype Perl : <command> weechat::add_keyboard_handler(fonction); </command> </para> <para> Prototype Python : <command> weechat.add_keyboard_handler(fonction) </command> </para> <para> Prototype Ruby : <command> Weechat.add_keyboard_handler(fonction) </command> </para> <para> Prototype Lua : <command> weechat.add_keyboard_handler(fonction) </command> </para> <para> Ajoute un gestionnaire de clavier, appel� d�s qu'une touche est press�e. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>fonction</option> : fonction appel�e </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si succ�s, 0 si une erreur s'est produite. </para> <para> Exemples : <screen> # perl weechat::add_keyboard_handler("mon_clavier"); sub mon_clavier { my $key = shift; my $input_before = shift; my $input_after = shift; weechat::print("gestionnaire clavier: key = '$key', " ."entr�e avant = '$input_before' " ."apr�s = '$input_after'"); return weechat::PLUGIN_RC_OK; } # python weechat.add_keyboard_handler("mon_clavier") def mon_clavier(key, input_before, input_after): weechat.prnt("gestionnaire clavier: touche = '%s', " \ "entr�e avant = '%s' apr�s = '%s'" %(key, input_before, input_after)) return weechat.PLUGIN_RC_OK # ruby Weechat.add_clavier_handler("mon_clavier") def mon_clavier(server, input_before, input_after) Weechat.print("gestionnaire clavier: touche = '#{key}', " \ "entr�e avant = '#{input_before}' " \ "apr�s = '#{input_after}'") return Weechat::PLUGIN_RC_OK end -- lua weechat.add_clavier_handler("mon_clavier") function mon_clavier(server, input_before, input_after) weechat.print("gestionnaire clavier: touche = '"..key.. "', entr�e avant = '"..input_before.. "' apr�s = '"..input_after.."'") return weechat.PLUGIN_RC_OK() end </screen> </para> <para> Note : la fonction appel�e doit renvoyer une des valeurs suivantes : <itemizedlist> <listitem> <para> <literal>PLUGIN_RC_KO</literal> : la fonction a �chou� </para> </listitem> <listitem> <para> <literal>PLUGIN_RC_OK</literal> : la fonction a r�ussi </para> </listitem> </itemizedlist> </para> </section> <section id="secScript_remove_handler"> <title>remove_handler</title> <para> Prototype Perl : <command> weechat::remove_handler(nom, fonction); </command> </para> <para> Prototype Python : <command> weechat.remove_handler(nom, fonction) </command> </para> <para> Prototype Ruby : <command> Weechat.remove_handler(nom, fonction) </command> </para> <para> Prototype Lua : <command> weechat.remove_handler(nom, fonction) </command> </para> <para> Supprime un gestionnaire de message ou de commande. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>nom</option> : nom du message IRC ou de la commande </para> </listitem> <listitem> <para> <option>fonction</option> : fonction associ�e </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si succ�s, 0 si une erreur s'est produite. </para> <para> Exemples : <screen> # perl weechat::remove_handler("commande", "ma_commande"); # python weechat.remove_handler("commande", "ma_commande") # ruby Weechat.remove_handler("commande", "ma_commande") -- lua weechat.remove_handler("commande", "ma_commande") </screen> </para> </section> <section id="secScript_remove_timer_handler"> <title>remove_timer_handler</title> <para> Prototype Perl : <command> weechat::remove_timer_handler(fonction); </command> </para> <para> Prototype Python : <command> weechat.remove_timer_handler(fonction) </command> </para> <para> Prototype Ruby : <command> Weechat.remove_timer_handler(fonction) </command> </para> <para> Prototype Lua : <command> weechat.remove_timer_handler(fonction) </command> </para> <para> Supprime un gestionnaire de temps. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>fonction</option> : fonction </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si succ�s, 0 si une erreur s'est produite. </para> <para> Exemples : <screen> # perl weechat::remove_timer_handler("mon_timer"); # python weechat.remove_timer_handler("mon_timer") # ruby Weechat.remove_timer_handler("mon_timer") -- lua weechat.remove_timer_handler("mon_timer") </screen> </para> </section> <section id="secScript_remove_keyboard_handler"> <title>remove_keyboard_handler</title> <para> Prototype Perl : <command> weechat::remove_keyboard_handler(fonction); </command> </para> <para> Prototype Python : <command> weechat.remove_keyboard_handler(fonction) </command> </para> <para> Prototype Ruby : <command> Weechat.remove_keyboard_handler(fonction) </command> </para> <para> Prototype Lua : <command> weechat.remove_keyboard_handler(fonction) </command> </para> <para> Supprime un gestionnaire de clavier. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>fonction</option> : fonction </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si succ�s, 0 si une erreur s'est produite. </para> <para> Exemples : <screen> # perl weechat::remove_keyboard_handler("mon_clavier"); # python weechat.remove_keyboard_handler("mon_clavier") # ruby Weechat.remove_keyboard_handler("mon_clavier") -- lua weechat.remove_keyboard_handler("mon_clavier") </screen> </para> </section> <section id="secScript_command"> <title>command</title> <para> Prototype Perl : <command> weechat::command(commande, [canal, [serveur]]); </command> </para> <para> Prototype Python : <command> weechat.command(commande, [canal, [serveur]]) </command> </para> <para> Prototype Ruby : <command> Weechat.command(commande, [canal, [serveur]]) </command> </para> <para> Prototype Lua : <command> weechat.command(commande, [canal, [serveur]]) </command> </para> <para> Ex�cute une commande ou envoie un message � un canal. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>commande</option> : la commande � ex�cuter </para> </listitem> <listitem> <para> <option>canal</option> : nom du canal o� ex�cuter la commande </para> </listitem> <listitem> <para> <option>serveur</option> : nom interne du serveur o� ex�cuter la commande </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si succ�s, 0 si une erreur s'est produite. </para> <para> Exemples : <screen> # 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") -- lua weechat.command("bonjour tout le monde !") weechat.command("/kick toto merci de quitter ce canal", "#weechat") weechat.command("/nick newnick", "", "freenode") </screen> </para> </section> <section id="secScript_get_info"> <title>get_info</title> <para> Prototype Perl : <command> weechat::get_info(nom, [serveur]); </command> </para> <para> Prototype Python : <command> weechat.get_info(nom, [serveur]) </command> </para> <para> Prototype Ruby : <command> Weechat.get_info(nom, [serveur]) </command> </para> <para> Prototype Lua : <command> weechat.get_info(nom, [serveur]) </command> </para> <para> Renvoie une information sur WeeChat ou un canal. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>nom</option> : nom de l'info � obtenir (voir <xref linkend="secAPI_get_info" />) </para> </listitem> <listitem> <para> <option>serveur</option> : nom interne du serveur o� r�cup�rer l'information (si n�cessaire) </para> </listitem> </itemizedlist> </para> <para> 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. </para> <para> Exemples : <screen> # perl $version = get_info("version"); $nick = get_info("nick", "freenode"); # python version = weechat.get_info("version") nick = weechat.get_info("nick", "freenode") # ruby version = Weechat.get_info("version") nick = Weechat.get_info("nick", "freenode") -- lua version = weechat.get_info("version") nick = weechat.get_info("nick", "freenode") </screen> </para> </section> <section id="secScript_get_dcc_info"> <title>get_dcc_info</title> <para> Prototype Perl : <command> weechat::get_dcc_info(); </command> </para> <para> Prototype Python : <command> weechat.get_dcc_info() </command> </para> <para> Prototype Ruby : <command> Weechat.get_dcc_info() </command> </para> <para> Prototype Lua : <command> weechat.get_dcc_info() </command> </para> <para> Renvoie la liste des DCC en cours ou termin�s. </para> <para> Valeur renvoy�e : la liste des DCC (voir <xref linkend="secAPI_get_dcc_info" />). </para> <para> Exemples : <screen> # perl my @dccs = weechat::get_dcc_info(); if (@dccs) { foreach my $dcc (@dccs) { while (my ($key, $value) = each %$dcc) { weechat::print("$key = '$value'"); } } } else { weechat::print("pas de DCC"); } # python dccs = weechat.get_dcc_info() if dccs != None: if dccs == []: weechat.prnt("pas de DCC") else: for d in dccs: for b in d.keys(): weechat.prnt("%s = '%s'" %(b, d[b])) else: weechat.prnt("erreur de lecture des DCC") # ruby dccs = Weechat.get_dcc_info() if dccs != nil if dccs == [] Weechat.print("pas de DCC") else dccs.each do |m| m.each do |key, value| Weechat.print("#{key} = '#{value}'") end end end else Weechat.print("erreur de lecture des DCC") end -- lua dccs = weechat.get_dcc_info() if dccs ~= nil then if dccs then dcc, dccinfos = next (dccs, nil) while (dcc) do key, value = next (dccinfos, nil) while (key) do weechat.print(key.." = '"..value.."'") key, value = next (dccinfos, key) end dcc, dccinfos = next (dccs, dcc) end else weechat.print("pas de DCC") end else weechat.print("erreur de lecture des DCC") end </screen> </para> </section> <section id="secScript_get_server_info"> <title>get_server_info</title> <para> Prototype Perl : <command> weechat::get_server_info(); </command> </para> <para> Prototype Python : <command> weechat.get_server_info() </command> </para> <para> Prototype Ruby : <command> Weechat.get_server_info() </command> </para> <para> Prototype Lua : <command> weechat.get_server_info() </command> </para> <para> Renvoie la liste des serveurs IRC (connect�s ou non). </para> <para> Valeur renvoy�e : la liste des serveurs IRC (connect�s ou non) (voir <xref linkend="secAPI_get_server_info" />). </para> <para> Exemples : <screen> # perl my $servers = weechat::get_server_info(); if ($servers) { while (my ($srvname, $srvinfos) = each %$servers) { while (my ($key, $value) = each %$srvinfos) { weechat::print("$srvname -> $key = '$value'"); } } } else { weechat::print("pas de serveur"); } # python servers = weechat.get_server_info() if servers != None: if servers == {}: weechat.prnt("pas de serveur") else: for s in servers: for i in servers[s]: weechat.prnt("%s -> %s = '%s'" % (s, i, str(servers[s][i]))) else: weechat.prnt("erreur de lecture des serveurs") # ruby servers = Weechat.get_server_info() if servers != nil if servers == [] Weechat.print("pas de serveur") else servers.each do |n, s| s.each do |key, value| Weechat.print("#{n} -> #{key} = '#{value}'") end end end else Weechat.print("erreur de lecture des serveurs") end -- lua servers = weechat.get_server_info() if servers ~= nil then if servers then srv, srvinfos = next (servers, nil) while (srv) do key, value = next (srvinfos, nil) while (key) do weechat.print(srv.." -> "..key.." = '"..value.."'") key, value = next (srvinfos, key) end srv, srvinfos = next (servers, srv) end else weechat.print("pas de serveur") end else weechat.print("erreur de lecture des serveurs") end </screen> </para> </section> <section id="secScript_get_channel_info"> <title>get_channel_info</title> <para> Prototype Perl : <command> weechat::get_channel_info(serveur); </command> </para> <para> Prototype Python : <command> weechat.get_channel_info(serveur) </command> </para> <para> Prototype Ruby : <command> Weechat.get_channel_info(serveur) </command> </para> <para> Prototype Lua : <command> weechat.get_channel_info(serveur) </command> </para> <para> Renvoie la liste des canaux IRC pour un serveur. </para> <para> Valeur renvoy�e : la liste des canaux IRC du serveur (voir <xref linkend="secAPI_get_channel_info" />). </para> <para> Exemples : <screen> # perl my $channels = weechat::get_channel_info(weechat::get_info("server")); if ($channels) { while (my ($channame, $chaninfos) = each %$channels) { while (my ($key, $value) = each %$chaninfos) { weechat::print("$channame -> $key = '$value'"); } } } else { weechat::print("pas de canal"); } # python chans = weechat.get_channel_info(weechat.get_info("server")) if chans != None: if chans == {}: weechat.prnt("pas de canal") else: for s in chans: for i in chans[s]: weechat.prnt("%s -> %s = '%s'" % (s, i, str(chans[s][i]))) else: weechat.prnt("erreur de lecture des canaux") # ruby channels = Weechat.get_channel_info(Weechat.get_info("server")) if channels != nil if channels == {} Weechat.print("pas de canal") else channels.each do |n, c| c.each do |key, value| Weechat.print("#{n} -> #{key} = '#{value}'") end end end else Weechat.print("erreur de lecture des canaux") end -- lua chans = weechat.get_channel_info(weechat.get_info("server")) if chans ~= nil then if chans then chan, chaninfos = next (chans, nil) while (chan) do key, value = next (chaninfos, nil) while (key) do weechat.print(chan.." -> "..key.." = '"..value.."'") key, value = next (chaninfos, key) end chan, chaninfos = next (chans, chan) end else weechat.print("pas de canal") end else weechat.print("erreur de lecture des canaux") end </screen> </para> </section> <section id="secScript_get_nick_info"> <title>get_nick_info</title> <para> Prototype Perl : <command> weechat::get_nick_info(serveur, canal); </command> </para> <para> Prototype Python : <command> weechat.get_nick_info(serveur, canal) </command> </para> <para> Prototype Ruby : <command> Weechat.get_nick_info(serveur, canal) </command> </para> <para> Prototype Lua : <command> weechat.get_nick_info(serveur, canal) </command> </para> <para> Renvoie la liste des pseudos pour un canal. </para> <para> Valeur renvoy�e : la liste des pseudos pr�sents sur le canal (voir <xref linkend="secAPI_get_nick_info" />). </para> <para> Exemples : <screen> # perl my $nicks = weechat::get_nick_info("freenode", "#weechat"); if ($nicks) { while (my ($nickname, $nickinfos) = each %$nicks) { while ( my ($key, $value) = each %$nickinfos) { weechat::print("$nickname -> $key = '$value'"); } } } else { weechat::print("pas de pseudo"); } # python nicks = weechat.get_nick_info("freenode", "#weechat") if nicks != None: if nicks == {}: weechat.prnt("pas de pseudo") else: for n in nicks: for f in nicks[n]: weechat.prnt("%s -> %s = '%s'" % (n, f, str(nicks[n][f]))) else: weechat.prnt("erreur de lecture des pseudos") # ruby nicks = Weechat.get_nick_info("freenode", "#weechat") if nicks != nil if nicks == {} Weechat.print("pas de pseudo") else nicks.each do |nk, nattr| nattr.each do |key, value| Weechat.print("#{nk} -> #{key} = '#{value}'") end end end else Weechat.print("erreur de lecture des pseudos") end -- lua nicks = weechat.get_nick_info("freenode", "#weechat") if nicks ~= nil then if nicks then nick, nickinfos = next (nicks, nil) while (nick) do key, value = next (nickinfos, nil) while (key) do weechat.print(nick.." -> "..key.." = '"..value.."'") key, value = next (nickinfos, key) end nick, nickinfos = next (nicks, nick) end else weechat.print("pas de pseudo") end else weechat.print("erreur de lecture des pseudos") end </screen> </para> </section> <section id="secScript_get_config"> <title>get_config</title> <para> Prototype Perl : <command> weechat::get_config(option); </command> </para> <para> Prototype Python : <command> weechat.get_config(option) </command> </para> <para> Prototype Ruby : <command> Weechat.get_config(option) </command> </para> <para> Prototype Lua : <command> weechat.get_config(option) </command> </para> <para> Renvoie la valeur d'une option de configuration WeeChat. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>option</option> : nom de l'option </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : la valeur de l'option, cha�ne vide si l'option n'a pas �t� trouv�e. </para> <para> Exemples : <screen> # perl $valeur1 = weechat::get_config("look_nicklist"); $valeur2 = weechat::get_config("freenode.server_autojoin"); # python valeur1 = weechat.get_config("look_nicklist") valeur2 = weechat.get_config("freenode.server_autojoin") # ruby valeur1 = Weechat.get_config("look_nicklist") valeur2 = Weechat.get_config("freenode.server_autojoin") -- lua valeur1 = weechat.get_config("look_nicklist") valeur2 = weechat.get_config("freenode.server_autojoin") </screen> </para> </section> <section id="secScript_set_config"> <title>set_config</title> <para> Prototype Perl : <command> weechat::set_config(option, valeur); </command> </para> <para> Prototype Python : <command> weechat.set_config(option, valeur) </command> </para> <para> Prototype Ruby : <command> Weechat.set_config(option, valeur) </command> </para> <para> Prototype Lua : <command> weechat.set_config(option, valeur) </command> </para> <para> Modifie la valeur d'une option de configuration WeeChat. </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>option</option> : nom de l'option </para> </listitem> <listitem> <para> <option>valeur</option> : la nouvelle valeur pour l'option </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si succ�s, 0 si une erreur s'est produite. </para> <para> Exemples : <screen> # 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") -- lua weechat.set_config("look_nicklist", "off") weechat.set_config("freenode.server_autojoin, "#weechat") </screen> </para> </section> <section id="secScript_get_plugin_config"> <title>get_plugin_config</title> <para> Prototype Perl : <command> weechat::get_plugin_config(option); </command> </para> <para> Prototype Python : <command> weechat.get_plugin_config(option) </command> </para> <para> Prototype Ruby : <command> Weechat.get_plugin_config(option) </command> </para> <para> Prototype Lua : <command> weechat.get_plugin_config(option) </command> </para> <para> Renvoie la valeur d'une option de l'extension. L'option est lue depuis le fichier "<literal>~/.weechat/plugins.rc</literal>" et est sous cette forme : "<literal>extension.script.option=valeur</literal>" (NB : le nom de l'extension et du script sont ajout�s automatiquement). </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>option</option> : nom de l'option </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : la valeur de l'option, cha�ne vide si l'option n'a pas �t� trouv�e. </para> <para> Exemples : <screen> # perl $valeur = weechat::get_plugin_config("ma_variable"); # python valeur = weechat.get_plugin_config("ma_variable") # ruby valeur = Weechat.get_plugin_config("ma_variable") -- lua valeur = weechat.get_plugin_config("ma_variable") </screen> </para> </section> <section id="secScript_set_plugin_config"> <title>set_plugin_config</title> <para> Prototype Perl : <command> weechat::set_plugin_config(option, valeur); </command> </para> <para> Prototype Python : <command> weechat.set_plugin_config(option, valeur) </command> </para> <para> Prototype Ruby : <command> Weechat.set_plugin_config(option, valeur) </command> </para> <para> Prototype Lua : <command> weechat.set_plugin_config(option, valeur) </command> </para> <para> Modifie la valeur d'une option de l'extension. L'option est �crite dans le fichier "<literal>~/.weechat/plugins.rc</literal>" et est sous cette forme : "<literal>extension.script.option=valeur</literal>" (NB : le nom de l'extension et du script sont rajout�s automatiquement). </para> <para> Param�tres : <itemizedlist> <listitem> <para> <option>option</option> : nom de l'option </para> </listitem> <listitem> <para> <option>valeur</option> : la nouvelle valeur pour l'option </para> </listitem> </itemizedlist> </para> <para> Valeur renvoy�e : 1 si succ�s, 0 si une erreur s'est produite. </para> <para> Exemples : <screen> # perl weechat::set_plugin_config("ma_variable", "valeur"); # python weechat.set_plugin_config("ma_variable", "valeur") # ruby Weechat.set_plugin_config("ma_variable", "valeur") -- lua weechat.set_plugin_config("ma_variable", "valeur") </screen> </para> </section> <section id="secScript_get_irc_color"> <title>get_irc_color</title> <para> Prototype Perl : <command> weechat::get_irc_color(color); </command> </para> <para> Prototype Python : <command> weechat.get_irc_color(color) </command> </para> <para> Prototype Ruby : <command> Weechat.get_irc_color(color) </command> </para> <para> Prototype Lua : <command> weechat.get_irc_color(color) </command> </para> <para> Renvoie le num�ro d'une couleur IRC avec son nom. </para> <para> Valeur renvoy�e : num�ro de la couleur IRC, -1 si la couleur n'est pas trouv�e (voir <xref linkend="secAPI_get_irc_color" />). </para> <para> Exemples : <screen> # perl my $color_blue = weechat::get_irc_color("blue"); # python color_blue = weechat.get_irc_color("blue") # ruby color_blue = Weechat.get_irc_color("blue") -- lua color_blue = weechat.get_irc_color("blue") </screen> </para> </section> <section id="secScript_input_color"> <title>input_color</title> <para> Prototype Perl : <command> weechat::input_color(color); </command> </para> <para> Prototype Python : <command> weechat.input_color(color) </command> </para> <para> Prototype Ruby : <command> Weechat.input_color(color) </command> </para> <para> Prototype Lua : <command> weechat.input_color(color) </command> </para> <para> Ajoute de la couleur dans la zone de saisie. </para> <para> Valeur renvoy�e : aucune. </para> <para> Exemples : <screen> # perl weechat::input_color(weechat::get_irc_color("blue"), 10, 5); # python weechat.input_color(weechat.get_irc_color("blue"), 10, 5) # ruby Weechat.input_color(Weechat.get_irc_color("blue"), 10, 5) -- lua weechat.input_color(weechat.get_irc_color("blue"), 10, 5) </screen> </para> </section> <section id="secScript_get_window_info"> <title>get_window_info</title> <para> Prototype Perl : <command> weechat::get_window_info(); </command> </para> <para> Prototype Python : <command> weechat.get_window_info() </command> </para> <para> Prototype Ruby : <command> Weechat.get_window_info() </command> </para> <para> Prototype Lua : <command> weechat.get_window_info() </command> </para> <para> Renvoie la liste des fen�tres WeeChat. </para> <para> Valeur renvoy�e : liste des fen�tres WeeChat (voir <xref linkend="secAPI_get_window_info" />). </para> <para> Exemples : <screen> # perl my @wf = weechat::get_window_info(); if (@wf) { weechat::print("**** infos fen�tres ****"); foreach my $w (@wf) { while ( my ($key, $value) = each %$w) { weechat::print(" > $key => $value"); } weechat::print("----------------------"); } } else { weechat::print("**** pas d'info fen�tre ****"); } # python wf = weechat.get_window_info() if wf != None and wf != []: weechat.prnt ("**** infos fen�tres ****") for w in wf: for i in w: weechat.prnt (" > %s => %s" % (i, w[i])) weechat.prnt ("----------------------") else: weechat.prnt ("**** pas d'info sur les fen�tres ****") # ruby wf = Weechat.get_window_info() if wf != nil and wf != [] Weechat.print("**** infos fen�tres ****") wf.each do |w| w.each do |key, value| Weechat.print(" > #{key} => #{value}") end Weechat.print("----------------------") end else Weechat.print("**** pas d'info sur les fen�tres ****") end -- lua wf = weechat.get_window_info() if wf then weechat.print ("**** infos fen�tres ****") w, winfos = next (wf, nil) while (w) do key, value = next (winfos, nil) while (key) do weechat.print(" > " .. key .. " => " .. value) key, value = next (winfos, key) end weechat.print ("----------------------") w, winfos = next (wf, w) end else weechat.print("**** pas d'info sur les fen�tres ****") end </screen> </para> </section> <section id="secScript_get_buffer_info"> <title>get_buffer_info</title> <para> Prototype Perl : <command> weechat::get_buffer_info(); </command> </para> <para> Prototype Python : <command> weechat.get_buffer_info() </command> </para> <para> Prototype Ruby : <command> Weechat.get_buffer_info() </command> </para> <para> Prototype Lua : <command> weechat.get_buffer_info() </command> </para> <para> Renvoie la liste des tampons WeeChat. </para> <para> Valeur renvoy�e : liste des tampons WeeChat (voir <xref linkend="secAPI_get_buffer_info" />). </para> <para> Exemples : <screen> # perl my $bf = weechat::get_buffer_info(); if ($bf) { while ( my ($nobuf, $binfos) = each %$bf) { while ( my ($key, $value) = each %$binfos) { weechat::print(" > $key => $value"); } } } else { weechat::print("**** pas d'info sur les tampons ****"); } # python bf = weechat.get_buffer_info() if bf != None and bf != {}: for b in bf: weechat.prnt ("**** info pour tampon buffer no %d ****" % b) for c in bf[b]: weechat.prnt (" > %s => %s" % (c, bf[b][c])) else: weechat.prnt ("**** pas d'info sur les tampons ****") # ruby bf = Weechat.get_buffer_info() if bf != nil and bf != {} bf.each do |n, c| Weechat.print("**** info pour tampon no #{n} ****") c.each do |key, value| Weechat.print(" > #{key} => #{value}") end end else Weechat.print("**** pas d'info sur les tampons ****") end -- lua bf = weechat.get_buffer_info() if bf then b, binfos = next (bf, nil) while (b) do weechat.print("**** info pour tampon no " .. b .. " ****") key, value = next (binfos, nil) while (key) do weechat.print(" > " .. key .. " => " .. value) key, value = next (binfos, key) end b, infos = next (bf, b) end else weechat.print("**** pas d'info sur les tampons ****") end </screen> </para> </section> <section id="secScript_get_buffer_data"> <title>get_buffer_data</title> <para> Perl prototype: <command> weechat::get_buffer_data(server, channel); </command> </para> <para> Python prototype: <command> weechat.get_buffer_data(server, channel) </command> </para> <para> Ruby prototype: <command> Weechat.get_buffer_data(server, channel) </command> </para> <para> Lua prototype: <command> weechat.get_buffer_data(server, channel) </command> </para> <para> Return content of buffer. </para> <para> Return value: list of lines for buffer (see <xref linkend="secAPI_get_buffer_data" />). </para> <para> Examples: <screen> # perl my $server = "freenode"; my $channel = "#weechat"; my @bc = weechat::get_buffer_data($server, $channel); if (@bc) { weechat::print("**** buffer data for $channel@$server ****"); foreach my $l (@bc) { while ( my ($key, $value) = each %$l) { weechat::print(" > $key => $value"); } weechat::print("----------------------"); } } else { weechat::print("**** no buffer data ****"); } # python server = "freenode" channel = "#weechat" bc = weechat.get_buffer_data(server, channel) if bc != None and bc != []: weechat.prnt ("**** buffer data for %s@%s ****" % (channel, server)) for l in bc: for i in l: weechat.prnt (" > %s => %s" % (i, l[i])) weechat.prnt ("----------------------") else: weechat.prnt ("**** no buffer data ****") # ruby server = "freenode" channel = "#weechat" bc = Weechat.get_buffer_data(server, channel) if bc != nil and bc != [] Weechat.print("**** buffer data for #{channel}@#{server} ****") bc.each do |l| l.each do |key, value| Weechat.print(" > #{key} => #{value}") end Weechat.print("----------------------") end else Weechat.print("**** no buffer data ****") end -- lua server = "freenode" channel = "#weechat" bc = weechat.get_buffer_data(server, channel) if bc then b, bdatas = next (bc, nil) weechat.print("**** buffer data for " .. channel .. "@" .. server .. " ****") while (b) do key, value = next (chaninfos, nil) while (key) do weechat.print(" > " .. key .. " => " .. value) key, value = next (bdatas, key) end weechat.print ("----------------------") b, bdatas = next (bc, b) end else weechat.print("**** no buffer data ****") end </screen> </para> </section> </section> </section> </chapter> <!-- ======================== Auteurs / Support ========================= --> <chapter id="chapAuteursSupport"> <title>Auteurs / Support</title> <para> Ce chapitre liste les auteurs et contributeurs pour WeeChat, et indique les moyens d'obtenir du support. </para> <section id="secAuteurs"> <title>Auteurs</title> <para> WeeChat est d�velopp� par : <itemizedlist> <listitem> <para> <emphasis>FlashCode (S�bastien Helleu)</emphasis> <email>flashcode AT flashtux.org</email> - d�veloppeur principal </para> </listitem> <listitem> <para> <emphasis>Kolter</emphasis> <email>kolter AT free.fr</email> - d�veloppeur </para> </listitem> <listitem> <para> <emphasis>Ptitlouis</emphasis> <email>ptitlouis AT sysif.net</email> - empaqueteur Debian </para> </listitem> </itemizedlist> </para> </section> <section id="secContributeurs"> <title>Contributeurs</title> <para> Les personnes suivantes ont contribu� � WeeChat : <itemizedlist> <listitem> <para> <emphasis>Jiri Golembiovsky</emphasis> - traduction en tch�que, patchs </para> </listitem> <listitem> <para> <emphasis>Rudolf Polzer</emphasis> - patchs </para> </listitem> <listitem> <para> <emphasis>Jim Ramsay</emphasis> - patchs </para> </listitem> <listitem> <para> <emphasis>Odin</emphasis> - RPM pour SuSE </para> </listitem> <listitem> <para> <emphasis>Pistos</emphasis> - patchs </para> </listitem> <listitem> <para> <emphasis>Gwenn</emphasis> - patchs </para> </listitem> <listitem> <para> <emphasis>voroskoi</emphasis> - traduction en hongrois </para> </listitem> <listitem> <para> <emphasis>Frank Zacharias</emphasis> - traduction en allemand </para> </listitem> <listitem> <para> <emphasis>Pavel Shevchuk</emphasis> - traduction en russe </para> </listitem> </itemizedlist> </para> </section> <section id="secSupport"> <title>Obtenir du support</title> <para> 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 !) </para> <para> <itemizedlist> <listitem> <para> IRC : serveur "<literal>irc.freenode.net</literal>", canal "<literal>#weechat</literal>" </para> </listitem> <listitem> <para> Forum WeeChat : <ulink url="http://forums.flashtux.org"> http://forums.flashtux.org </ulink> </para> </listitem> <listitem> <para> Liste de diffusion : <itemizedlist> <listitem> <para> Pour souscrire : <ulink url="http://mail.nongnu.org/mailman/listinfo/weechat-support"> http://mail.nongnu.org/mailman/listinfo/weechat-support </ulink> </para> </listitem> <listitem> <para> Pour envoyer un mail � la liste de diffusion : <email>weechat-support@nongnu.org</email> </para> </listitem> </itemizedlist> Les archives de la liste de diffusion sont ici : <ulink url="http://mail.nongnu.org/archive/html/weechat-support"> http://mail.nongnu.org/archive/html/weechat-support </ulink> </para> </listitem> </itemizedlist> </para> </section> </chapter> </book>