From af12f3e99cf9b05f6eb31e326f1a569bf8b8b002 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sun, 24 Feb 2008 10:45:55 +0100 Subject: [PATCH] XML doc files (weechat.XX.xml) splitted in many XML files --- doc/CMakeLists.txt | 8 + doc/de/Makefile.am | 7 +- doc/de/authors.de.xml | 185 + doc/de/install.de.xml | 108 + doc/de/intro.de.xml | 146 + doc/de/plugin_api.de.xml | 3601 +++++++++++++++ doc/de/plugin_charset.de.xml | 136 + doc/de/plugin_scripts.de.xml | 3014 +++++++++++++ doc/de/plugins.de.xml | 214 + doc/de/usage.de.xml | 961 ++++ doc/de/weechat.de.xml | 11 + doc/en/Makefile.am | 7 +- doc/en/authors.en.xml | 184 + doc/en/install.en.xml | 107 + doc/en/intro.en.xml | 142 + doc/en/plugin_api.en.xml | 3528 +++++++++++++++ doc/en/plugin_charset.en.xml | 130 + doc/en/plugin_scripts.en.xml | 2979 ++++++++++++ doc/en/plugins.en.xml | 213 + doc/en/usage.en.xml | 947 ++++ doc/en/weechat.en.xml | 8069 +-------------------------------- doc/fr/Makefile.am | 7 +- doc/fr/authors.fr.xml | 185 + doc/fr/install.fr.xml | 109 + doc/fr/intro.fr.xml | 148 + doc/fr/plugin_api.fr.xml | 3640 +++++++++++++++ doc/fr/plugin_charset.fr.xml | 140 + doc/fr/plugin_scripts.fr.xml | 3005 +++++++++++++ doc/fr/plugins.fr.xml | 215 + doc/fr/usage.fr.xml | 966 ++++ doc/fr/weechat.fr.xml | 8247 +--------------------------------- 31 files changed, 25072 insertions(+), 16287 deletions(-) create mode 100644 doc/de/authors.de.xml create mode 100644 doc/de/install.de.xml create mode 100644 doc/de/intro.de.xml create mode 100644 doc/de/plugin_api.de.xml create mode 100644 doc/de/plugin_charset.de.xml create mode 100644 doc/de/plugin_scripts.de.xml create mode 100644 doc/de/plugins.de.xml create mode 100644 doc/de/usage.de.xml create mode 100644 doc/en/authors.en.xml create mode 100644 doc/en/install.en.xml create mode 100644 doc/en/intro.en.xml create mode 100644 doc/en/plugin_api.en.xml create mode 100644 doc/en/plugin_charset.en.xml create mode 100644 doc/en/plugin_scripts.en.xml create mode 100644 doc/en/plugins.en.xml create mode 100644 doc/en/usage.en.xml create mode 100644 doc/fr/authors.fr.xml create mode 100644 doc/fr/install.fr.xml create mode 100644 doc/fr/intro.fr.xml create mode 100644 doc/fr/plugin_api.fr.xml create mode 100644 doc/fr/plugin_charset.fr.xml create mode 100644 doc/fr/plugin_scripts.fr.xml create mode 100644 doc/fr/plugins.fr.xml create mode 100644 doc/fr/usage.fr.xml diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index be4839e57..5475ff701 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -95,6 +95,14 @@ IF(BUILD_HTML OR BUILD_PDF) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}/index.html ${CMAKE_CURRENT_BINARY_DIR}/html-one/${dlang}/weechat.${dlang}.html COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/weechat.${dlang}.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build" + COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/intro.${dlang}.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build" + COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/install.${dlang}.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build" + COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/usage.${dlang}.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build" + COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/plugins.${dlang}.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build" + COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/plugin_api.${dlang}.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build" + COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/plugin_charset.${dlang}.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build" + COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/plugin_scripts.${dlang}.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build" + COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/authors.${dlang}.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build" COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/config.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build" COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/irc_commands.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build" COMMAND ${COPY} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${dlang}/key_functions.xml" "${CMAKE_CURRENT_BINARY_DIR}/html/${dlang}-build" diff --git a/doc/de/Makefile.am b/doc/de/Makefile.am index 32ebd941f..060e21424 100644 --- a/doc/de/Makefile.am +++ b/doc/de/Makefile.am @@ -16,7 +16,12 @@ LANGCODE = de BOOK = weechat.$(LANGCODE) -BOOK_INCLUDE = weechat_commands.xml irc_commands.xml key_functions.xml config.xml +BOOK_INCLUDE = intro.$(LANGCODE).xml install.$(LANGCODE).xml \ + usage.$(LANGCODE).xml plugins.$(LANGCODE).xml \ + plugin_api.$(LANGCODE).xml plugin_charset.$(LANGCODE).xml \ + plugin_scripts.$(LANGCODE).xml \ + weechat_commands.xml irc_commands.xml key_functions.xml \ + config.xml QUICKSTART = weechat_quickstart.$(LANGCODE).txt EXTRA_DIST = $(BOOK).xml $(BOOK_INCLUDE) $(QUICKSTART) diff --git a/doc/de/authors.de.xml b/doc/de/authors.de.xml new file mode 100644 index 000000000..a355053d6 --- /dev/null +++ b/doc/de/authors.de.xml @@ -0,0 +1,185 @@ + + + + + + Autoren / Support + + + Dieses Kapitel listet Autoren und Beitragende für WeeChat auf, und + zeigt die Möglichkeiten um Support zu bekommen. + + +
+ Autoren + + + WeeChat wird entwickelt von: + + + + FlashCode (Sébastien Helleu) + flashcode AT flashtux.org - + Hauptentwickler + + + + + kolter (Emmanuel Bouthenot) + kolter AT openics.org - + Entwickler + + + + + Ptitlouis + ptitlouis AT sysif.net - + erzeugt Debian-Pakete + + + + + +
+ +
+ Beitragende + + + Die folgenden Personen trugen zur Entwicklung von WeeChat bei: + + + + Jiri Golembiovsky - + Tschechische Übersetzung, Patches + + + + + Rudolf Polzer - + Patches + + + + + Jim Ramsay - + Patches + + + + + Odin - + SuSE RPM + + + + + Pistos - + Patches + + + + + Gwenn - + Patches + + + + + voroskoi - + Ungarische Übersetzung + + + + + Frank Zacharias - + Deutsche Übersetzung + + + + + Pavel Shevchuk - + Russisch Übersetzung + + + + + +
+ +
+ Support bekommen + + + Bevor Sie nach Support fragen, sollten Sie die Dokumentation und die FAQ + gelesen haben, die bei WeeChat angeboten wird. (Die Dokumentation + ist dieses Dokument, wenn Sie sie nicht bis zu dieser Zeile gelesen + haben, sollten Sie sie noch Mal lesen!) + + + + + + + IRC: Server "irc.freenode.net", + Channel "#weechat" + + + + + WeeChat Forum: + + http://forums.flashtux.org + + + + + + Mailingliste: + + + + Zum abonnieren: + + http://mail.nongnu.org/mailman/listinfo/weechat-support + + + + + + Um eine Mail an die Liste zu senden: + weechat-support@nongnu.org + + + + Das Archiv der Mailingliste ist hier: + + http://mail.nongnu.org/archive/html/weechat-support + + + + + + +
+ +
diff --git a/doc/de/install.de.xml b/doc/de/install.de.xml new file mode 100644 index 000000000..692d58024 --- /dev/null +++ b/doc/de/install.de.xml @@ -0,0 +1,108 @@ + + + + + + Installation + + + Dieses Kapitel erklärt die Installation von WeeChat. + + +
+ Binäre Pakete + + + Binäre Pakete sind für die folgenden Distributionen verfügbar: + + + + Debian (oder Debian-kompatible): + apt-get install weechat + + + + + Mandriva/RedHat (oder jede RPM-kompatible Distribution): + + rpm -i /chemin/weechat-x.y.z-1.i386.rpm + + + + + + Gentoo: + emerge weechat + + + + FÜr andere Distributionen: sehen sie in die Dokumentation + für Installationsanweisungen. + + +
+ +
+ Quellcode-Pakete + + + Alles was sie tun müssen, ist in einer Konsole oder einem Terminal + aufzurufen: +$ ./configure +$ make + + + Dann root werden und WeeChat installieren: +$ su +(root-Passwort eingeben) +# make install + + +
+ +
+ GIT Quellen + + + Warnung: GIT Quellen sind für fortgeschrittene Anwender, das + Übersetzen könnte fehlschlagen oder das Ergebnis nicht stabil sein. + Sie wurden gewarnt! + + + + Um die GIT Quellen zu bekommen, sind folgende Kommandos nötig: +$ git-clone git://git.sv.gnu.org/weechat.git + + + + Ausführen des folgenden Skripts: + ./autogen.sh + + + + Dann folgen sie den Anweisungen zu den Quellpaketen + (siehe ) + + +
+ +
diff --git a/doc/de/intro.de.xml b/doc/de/intro.de.xml new file mode 100644 index 000000000..75f2b012b --- /dev/null +++ b/doc/de/intro.de.xml @@ -0,0 +1,146 @@ + + + + + + Einführung + + + Dieses Kapitel beschreibt WeeChat und die Vorraussetzungen für die + Installation. + + +
+ Beschreibung + + + WeeChat (Wee Enhanced Environment for Chat) ist ein freier Chat Client, + schnell und klein, entwickelt für viele Betriebssysteme. + + + + Hauptmerkmale: + + + + Mehrere Server gleichzeitig nutzbar (mit SSL, IPv6, Proxy) + + + + + viele unterschiedliche User-Interfaces: Curses, wxWidgets, Gtk + und Qt + + + + + klein, schnell and leichtgewichtig + + + + + änderbar und erweiterbar mit Plugins und Skripten + + + + + entsprechend den folgenden RFCs + 1459, + 2810, + 2811, + 2812 und + 2813 + + + + + Viele Plattformen (GNU/Linux, *BSD, MacOS X, Windows and other) + + + + + 100% GPL, freie Software + + + + + + + WeeChat Homepage: + + http://weechat.flashtux.org + + + +
+ +
+ Vorraussetzungen + + + Um WeeChat zu installieren, werden gebraucht: + + + + ein laufendes GNU/Linux (Compiler für Quellcode-Pakete) + + + + + root-Rechte für die Installation + + + + + dem User-Interface entsprechend, eine der folgenden Bibliotheken: + + + + Curses: ncurses Bibliothek + + + + + Gtk: + *** noch nicht implementiert *** + + + + + WxWidgets: + *** noch nicht implementiert *** + + + + + Qt: + *** noch nicht implementiert *** + + + + + + + + +
+
diff --git a/doc/de/plugin_api.de.xml b/doc/de/plugin_api.de.xml new file mode 100644 index 000000000..3ae4b412e --- /dev/null +++ b/doc/de/plugin_api.de.xml @@ -0,0 +1,3601 @@ + + + + +
+ API Funktionen + +
+ set_charset + + + Prototyp: + + void set_charset (t_weechat_plugin *plugin, char *charset) + + + + Legt neuen Zeichensatz für ein Plugin fest. + + + Argumente: + + + + : Zeiger auf Plugin-Struktur + + + + + : neuer Zeichensatz, der benutzt + werden soll + + + + + + Beispiel: + plugin->set_charset (plugin, "ISO-8859-1"); + +
+ +
+ iconv_to_internal + + + Prototyp: + + void iconv_to_internal (t_weechat_plugin *plugin, char *charset, + char *string) + + + + Konvertiert eine Zeichenkette in das interne Format von WeeChat + (UTF-8). + + + Argumente: + + + + : Zeiger auf Plugin-Struktur + + + + + : ursprünglicher Zeichensatz, von + dem konvertiert werden soll + + + + + : zu konvertierende Zeichenkette + + + + + + Rückgabewert: konvertierte Zeichenkette + + + Anmerkung: der Speicher, der durch das Ergebnis belegt wird, muss + mit free() wieder freigegeben werden. + + + Beispiel: + char *str = plugin->iconv_to_internal (plugin, "ISO-8859-1", "iso string: é à"); + +
+ +
+ iconv_from_internal + + + Prototyp: + + void iconv_from_internal (t_weechat_plugin *plugin, char *charset, + char *string) + + + + Konvertiert eine Zeichenkette von dem internen WeeChat-Zeichensatz + (UTF-8) in einen anderen. + + + Argumente: + + + + : Zeiger auf Plugin-Struktur + + + + + : Ziel-Zeichensatz + + + + + : zu konvertierende Zeichenkette + + + + + + Rückgabewert: konvertierte Zeichenkette + + + Anmerkung: der Speicher, der durch das Ergebnis belegt wird, muss + mit free() wieder freigegeben werden. + + + Beispiel: + char *str = plugin->iconv_from_internal (plugin, "ISO-8859-1", "utf-8 string: é à"); + +
+ +
+ ascii_strcasecmp + + + Prototyp: + + int ascii_strcasecmp (t_weechat_plugin *plugin, + char *string1, char *string2) + + + + Vergleich von Zeichenketten unabhängig von Sprache und + Schreibweise (gross/klein). + + + Argumente: + + + + : Zeiger auf Plugin-Struktur + + + + + : erste Zeichenkette des Vergleichs + + + + + : zweite Zeichenkette des Vergleichs + + + + + + Rückgabewert: Unterschied zwischen den zwei Zeichenketten: kleiner + Null wenn + string1 < string2, Null wenn string1 == string2, grösser Null + wenn string1 > string2 + + + Beispiel: + if (plugin->ascii_strcasecmp (plugin, "abc", "def") != 0) ... + +
+ +
+ ascii_strncasecmp + + + Prototyp: + + int ascii_strncasecmp (t_weechat_plugin *plugin, + char *string1, char *string2, int max) + + + + Vergleich von Zeichenketten unabhängig von Sprache und Schreibweise + (gross/klein) für höchstens "max" Zeichen. + + + Argumente: + + + + : Zeiger auf Plugin-Struktur + + + + + : erste Zeichenkette des Vergleichs + + + + + : zweite Zeichenkette des Vergleichs + + + + + : maximale Zahl an Zeichen für den + Vergleich + + + + + + Rückgabewert: Unterschied zwischen den zwei Zeichenketten: kleiner + Null wenn string1 < string2, Null wenn string1 == string2, + grösser Null wenn string1 > string2 + + + Beispiel: + if (plugin->ascii_strncasecmp (plugin, "abc", "def", 2) != 0) ... + +
+ +
+ explode_string + + + Prototyp: + + char **explode_string (t_weechat_plugin *plugin, char *string, + char *separators, int num_items_max, int *num_items) + + + + Zerlege eine Zeichenkette entsprechend eines oder mehrerer + Trennzeichen(s). + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : zu zerlegende Zeichenkette + + + + + : zu verwendende(s) Trennzeichen + + + + + : maximale Anzahl an zu + erzeugenden Teilen (0 = keine Grenze) + + + + + : Zeiger auf eine int-Variable, + die die Anzahl der erzeugten + Teile enthält + + + + + + Rückgabewert: ein Array von Zeichenketten, NULL bei Fehlern. + + + Hinweis: Das zurückgegebene Array muss nach der Benutzung mittels + "free_exloded_string" explizit freigegeben werden. + + + Beispiel: + +char **argv; +int argc; +argv = plugin->explode_string (plugin, string, " ", 0, &argc); +... +if (argv != NULL) + plugin->free_exploded_string (plugin, argv); + + +
+ +
+ free_exploded_string + + + Prototyp: + + char **free_exploded_string (t_weechat_plugin *plugin, + char **string) + + + + Gib ein Array frei, dass infolge der Zerlegung eines Strings + reserviert wurde. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : ein Array von Strings + + + + + + Rückgabewert: keiner (?). + + + Beispiel: + +char *argv; +int argc; +argv = plugin->explode_string (plugin, string, " ", 0, &argc); +... +if (argv != NULL) + plugin->free_exploded_string (plugin, argv); + + +
+ +
+ mkdir_home + + + Prototyp: + + int mkdir_home (t_weechat_plugin *plugin, char *directory) + + + + Erzeugt ein Verzeichnis im WeeChat-Verzeichnis. + + + Argumente: + + + + : Zeiger auf Pluginstrukur + + + + + : Verzeichnis, das erzeugt werden + soll + + + + + + Rückgabewert: 1 wenn das Verzeichnis erfolgreich erstellt wurde, 0 + wenn ein Fehler aufgetreten ist. + + + Beispiel: + +if (!plugin->mkdir_home (plugin, "temp")) + plugin->print_server(plugin, "Konnte 'temp'-Verzeichnis im WeeChat-Verzeichnis nicht erstellen."); + + +
+ +
+ exec_on_files + + + Prototyp: + + void exec_on_files (t_weechat_plugin *plugin, char *repertoire, + int (*callback)(t_weechat_plugin *, char *)) + + + + Führe eine Funktion auf allen Dateien eines Verzeichnisses aus. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Verzeichnis der zu verwendenden + Dateien + + + + + : die anzuwendende Funktion + + + + + + Rückgabewert: keiner. + + + Beispiel: + +int callback (t_weechat_plugin *plugin, char *file) +{ + plugin->print_server (plugin, "file: %s", file); + return 1; +} +... +plugin->exec_on_files (plugin, "/tmp", &callback); + + +
+ +
+ print + + + Prototyp: + + void print (t_weechat_plugin *plugin, + char *server, char *channel, char *message, ...) + + + + Sende eine Nachricht an einen WeeChat-Puffer, bezeichnet durch + server und channel (beide können NULL sein, dann wird der aktuelle + Puffer verwendet). + + + Argumente: + + + + : Zeiger auf Plugin-Struktur + + + + + : interner Name des Servers, zu + welchem der Puffer gehört, in dem die Nachricht angezeigt + werden soll (kann NULL sein) + + + + + : Name des Channels, in dem die + Nachricht angezeigt werden soll (kann NULL sein) + + + + + : Nachricht + + + + + + + To display colored text, there are following codes: + + + + + Code + Description + + + + + 0x02 + + bold text + + + + 0x03 + "xx" + + text color "xx" + (see for colors) + + + + 0x03 + "xx,yy" + + text color "xx" + and background "yy" + (see for colors) + + + + 0x0F + + disable color and attributes + + + + 0x12 + + reverse video (revert text color with background) + + + + 0x1F + + underlined text + + + + + + Note: the same code (without number for 0x03) may be used to stop + the attribute. + + + Rückgabewert: keiner. + + + Beispiele: + +plugin->print (plugin, NULL, NULL, "hello"); +plugin->print (plugin, NULL, "#weechat", "hello"); +plugin->print (plugin, "freenode", "#weechat", "hello"); +plugin->print (plugin, NULL, NULL, + "Test: \x02 Fett \x0F\x03%02d Blau \x03%02d Grün", + plugin->get_irc_color (plugin, "blue"), + plugin->get_irc_color (plugin, "green")); + + +
+ +
+ print_server + + + Prototyp: + + void print_server (t_weechat_plugin *plugin, + char *message, ...) + + + + Zeige eine Nachricht im aktuellen Server-Puffer. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Nachricht + + + + + + + To display colored text, see . + + + Rückgabewert: keiner. + + + Beispiel: plugin->print_server (plugin, "hello"); + +
+ +
+ print_infobar + + + Prototyp: + + void print_infobar (t_weechat_plugin *plugin, + int time, char *message, ...) + + + + Zeige eine Nachricht in der Infobar für eine bestimmte Zeit + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Zeitspanne für die Anzeige (in + Sekunden, 0 = ständige Anzeige) + + + + + + Rückgabewert: keiner. + + + Beispiel: + +plugin->print_infobar (plugin, 5, "hello"); + + +
+ +
+ infobar_remove + + + Prototyp: + + void infobar_remove (t_weechat_plugin *plugin, int count) + + + + Entferne eine oder mehr Nachrichten aus der Infobar. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Anzahl der Nachrichten (wenn das + Argument kleiner als Null ist, werden alle Nachrichten + entfernt) + + + + + + Rückgabewert: keiner. + + + Beispiel: plugin->infobar_remove (1); + +
+ +
+ log + + + Prototyp: + + void log (t_weechat_plugin *plugin, + char *server, char *channel, char *message, ...) + + + + Schreibe eine Nachricht in die Log-Datei (für den entsprechenden + Server/Channel). + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : interner Name des Servers, zu + welchem der Log-Puffer gehört (kann NULL sein) + + + + + : Name des Channels, zu welchem der + Log-Puffer gehört (kann NULL sein) + + + + + : Nachricht + + + + + + Rückgabewert: keiner. + + + Beispiel: + +plugin->log (plugin, "freenode", "#weechat", "test"); + + +
+ +
+ msg_handler_add + + + Prototyp: + + t_plugin_handler *msg_handler_add (t_weechat_plugin + *plugin, char *message, t_plugin_handler_func *function, + char *handler_args, void *handler_pointer) + + + + Erzeuge einen IRC-Message-Handler, der aufgerufen wird, wenn + eine Nachricht empfangen wird. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Name (Typ) der IRC-Nachricht ("*" + für alle Nachrichten). + Eine Liste der bekannten IRC-Nachrichten ist in den + RFCs + 1459 + und + 2812 + zu finden. + Weiterhin können sie einen speziellen Namen verwenden, der + mit "weechat_" beginnt, um spezielle Ereignisse zu + bearbeiten, wie in der folgenden Tabelle aufgeführt: + + + + + Name + Beschreibung + + + + + weechat_pv + private Nachricht empfangen + + + weechat_highlight + + hervorgehobene Nachricht (in einem Channel oder privatem Chat) + + + + weechat_ctcp + + CTCP-Nachricht empfangen (VERSION, PING, ...) + + + + weechat_dcc + + DCC-Nachricht empfangen (Chat oder Datei) + + + + + + + + + + : Funktion, die aufgerufen wird, + wenn eine Nachricht empfangen wurde + + + Sie verwendet den folgenden Prototyp: + + int my_function (t_weechat_plugin *plugin, + int argc, char **argv, + char *handler_args, void *handler_pointer) + + + + Argument argc ist auf 3 gesetzt, die folgenden Werte sind + im argv-Array: + + + argv[0] = Server Name + + + argv[1] = IRC Nachricht + + + argv[2] = Kommando Argumente + + + + + + + : Argumente, die beim Aufruf + an die Funktion übergeben werden + + + + + : pointer given to function + when called + : Zeiger, der an die Funktion + übergeben wird + + + + + + Rückgabewert: Zeiger auf den neuen Handler + + + Hinweis: die Funktion, die aufgerufen wird wenn eine Nachricht + empfangen wurde, muss einen der folgenden Werte zurückgeben: + + + + PLUGIN_RC_KO: Funktion ist fehlgschlagen + + + + + PLUGIN_RC_OK: Funktion war erfolgreich + + + + + PLUGIN_RC_OK_IGNORE_WEECHAT: Die Nachricht + wird nicht an WeeChat übergeben + + + + + PLUGIN_RC_OK_IGNORE_PLUGINS: Die Nachricht + wird nicht an andere Plugins weitergegeben + + + + + PLUGIN_RC_OK_IGNORE_ALL: Die Nachricht + wird weder an WeeChat noch an andere + Plugins weitergegeben + + + + + PLUGIN_RC_OK_WITH_HIGHLIGHT: Funktion + erfolgreich vervollständigt und eine Hervorhebung bei den + empfangenen Nachrichten eingebaut + + + + + + Beispiel: + +int msg_kick (t_weechat_plugin *plugin, int argc, char **argv, + char *handler_args, void *handler_pointer) +{ + plugin->print (plugin, argv[0], NULL, "KICK received"); + return PLUGIN_RC_OK; +} +... +t_plugin_handler *msg_handler; +msg_handler = plugin->msg_handler_add (plugin, "KICK", + &msg_kick, NULL, NULL); + + +
+ +
+ cmd_handler_add + + + Prototyp: + + t_plugin_handler *cmd_handler_add (t_weechat_plugin + *plugin, char *command, char *description, char *arguments, + char *arguments_description, char *completion_template, + t_plugin_handler_func *fonction, char *handler_args, + void *handler_pointer) + + + + Erzeugt einen Handler für ein WeeChat-Kommando, der aufgerufen + wird, wenn der Anwender das Kommando ausführt (Beispiel: /command). + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Name des neuen Kommandos, der auch + Name eines bereits existierenden Kommandos sein kann (mit + Bedacht zu verwenden, das ersetzte Kommando ist nicht + verfügbar, bis das Plugin entfernt wurde) + + + + + : kurze Beschreibung des + Kommandos (angezeigt beim Ausführen von /help command) + + + + + : kurze Beschreibung der Argumente + des Kommandos (angezeigt beim Ausführen von /help command) + + + + + : lange Beschreibung + der Argumente des Kommandos (angezeigt beim Ausführen von + /help command) + + + + + : Vorlage für die + Vervollständigung; zum Beispiel bedeutet + "abc|%w def|%i", dass das erste Argument + "abc" oder ein WeeChat-Kommando sein kann und das zweite + Argument "def" oder ein IRC-Kommando. Eine leere + Zeichenkette bedeutet, dass WeeChat für jedes Argument + einen Nicknamen des gegenwärtigen Channels einsetzt, ein + NULL oder "-" schaltet die Vervollständigung für alle + Argumente ab. + + + Die folgenden Ersetzungen können verwendet werden: + + + + + Code + Beschreibung + + + + + %- + keine Vervollständigung für das Argument + + + %* + + + repeat last completion for all following arguments + (this code has to be at the end of completion + template, preceded by "|") + + + + %a + Alias + + + %A + + Aliase und Kommandos (WeeChat, IRC und Plugins) + + + + %c + gegenwärtiger Channel + + + %C + alle channels (inklusive Queries) + + + %f + Dateiname + + + %h + Plugin Kommandos + + + %i + IRC Kommandos (senden) + + + %I + IRC Kommandos (empfangen) + + + %k + Grundfunktionen + + + %m + Nicknamen des gegenwärtigen Servers + + + %M + + Nicks auf dem gegenwärtigen Server (in allen + offenen Channeln) + + + + %n + Nicknamen des gegenwärtigen Channels + + + %N + + Nicknamen und Hostnamen des gegenwärtigen + Channels + + + + %o + Konfigurationseinstellungen + + + %O + Plugin Optionen + + + %p + Standard "part" Nachricht + + + %q + Standard "quit" Nachricht + + + %s + Name des gegenwärtigen Servers + + + %S + Namen aller definierten Server + + + %t + Topic des gegenwärtigen Channels + + + %v + Wert einer Konfigurationseinstellung + + + %V + Wert einer Plugin-Option + + + %w + WeeChat Kommandos + + + + + + + + + : Funktion, die aufgerufen wird, + wenn das Kommando ausgeführt wird + + + Sie verwendet den folgenden Prototypen: + + int my_function (t_weechat_plugin *plugin, + int argc, char **argv, + char *handler_args, void *handler_pointer) + + + + Das Argument argc ist auf 3 gesetzt, das Array argv enthält + die folgenden Werte: + + + argv[0] = Server Name + + + argv[1] = Kommando + + + argv[2] = Kommando-Argumente + + + + + + + : Argumente, die an die Funktion + übergeben werden + + + + + : Zeiger, der an die Funktion + übergeben wird + + + + + + Rückgabewert: Zeiger auf den neuen Kommando-Handler. + + + Hinweis: die Funktion, die aufgerufen wird, wenn das Kommando + ausgeführt wird, muss einen der folgende Werte zurückgeben: + + + + PLUGIN_RC_KO: Funktion ist fehlgeschlagen + + + + + PLUGIN_RC_OK: Funktion war erfolgreich + + + + + + Beispiel: + +int cmd_test (t_weechat_plugin *plugin, int argc, char **argv, + char *handler_args, void *handler_pointer) +{ + plugin->print (plugin, argv[0], NULL, + "test command, nick: %s", + (argv[2]) ? argv[2] : "none"); + return PLUGIN_RC_OK; +} +... +t_plugin_handler *cmd_handler; +cmd_handler = plugin->cmd_handler_add (plugin, "test", "Test command", + "[nick]", "nick: nick of channel", + "%n", &cmd_test, NULL, NULL); + + +
+ +
+ timer_handler_add + + + Prototyp: + + t_plugin_handler *timer_handler_add (t_weechat_plugin + *plugin, int interval, t_plugin_handler_func *function, + char *handler_args, void *handler_pointer) + + + + Erzeuge einen zeitgesteuerten Handler, der periodisch + eine Funktion aufruft. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Intervall (in Secunden) zwischen + zwei Aufrufen der Funktion + + + + + : Funktion, die aufgerufen wird + + + Sie verwendet den folgenden Prototypen: + + int my_function (t_weechat_plugin *plugin, + int argc, char **argv, + char *handler_args, void *handler_pointer) + + + + Das Argument argc ist auf 0 gesetzt und argv ist auf NULL + gesetzt. + + + + + : Argumente der aufgerufenen + Funktion + + + + + : Zeiger, der an die Funktion + übergeben wird + + + + + + Rückgabewert: Zeiger auf den neuen timer-Handler. + + + Hinweis: die Funktion, die aufgerufen wird, muss einen der folgende + Werte zurückgeben: + + + + PLUGIN_RC_KO: Funktion ist fehlgeschlagen + + + + + PLUGIN_RC_OK: Funktion war erfolgreich + + + + + + Beispiel: + +int my_timer (t_weechat_plugin *plugin, int argc, char **argv, + char *handler_args, void *handler_pointer) +{ + plugin->print (plugin, NULL, NULL, "my timer"); + return PLUGIN_RC_OK; +} +... +t_plugin_handler *timer_handler; +timer_handler = plugin->timer_handler_add (plugin, 60, &my_timer); + + +
+ +
+ keyboard_handler_add + + + Prototyp: + + t_plugin_handler *keyboard_handler_add (t_weechat_plugin + *plugin, t_plugin_handler_func *function, + char *handler_args, void *handler_pointer) + + + + Erzeugt einen Keyboard-Handler, der nach dem Drücken einer Taste + aufgerufen wird. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Die Funktion, die aufgerufen wird + + + Sie verwendet den folgenden Prototypen: + + int my_function (t_weechat_plugin *plugin, + int argc, char **argv, + char *handler_args, void *handler_pointer) + + + + Das Argument argc ist auf 3 gesetzt, argv enthält die + folgenden Werte: + + + + argv[0] = Taste, die gedrückt wurde + (Name der internen Funktion oder '*' gefolgt von einem + Tastaturcode) + + + + + argv[1] = Kommandozeile vor dem Tastendruck + + + + + argv[2] = Kommandozeile nach dem Tastendruck + + + + + + + + : Argumente, die bei Aufruf der + Funktion übergeben + werden + + + + + : Zeiger auf die Funktion, + der bei Aufruf übergeben + wird + + + + + + Rückgabewert: Zeiger auf den Handler. + + + Hinweis: Die aufgerufene Funktion muss einen der folgenden Werte + zurückgeben: + + + + PLUGIN_RC_KO: Funktion ist fehlgeschlagen + + + + + PLUGIN_RC_OK: Funktion war erfolgreich + + + + + + Beispiel: + +int my_keyb (t_weechat_plugin *plugin, int argc, char **argv, + char *handler_args, void *handler_pointer) +{ + if (argc == 2) + { + plugin->print (plugin, NULL, NULL, "key pressed: %s", argv[0]); + if (argv[1] && (argv[1][0] == '1')) + plugin->print (plugin, NULL, NULL, "input text changed"); + else + plugin->print (plugin, NULL, NULL, "input text not changed"); + } + return PLUGIN_RC_OK; +} +... +t_plugin_handler *keyb_handler; +keyb_handler = plugin->keyboard_handler_add (plugin, &my_keyb); + + +
+ +
+ event_handler_add + + + Prototyp: + + t_plugin_handler *event_handler_add (t_weechat_plugin + *plugin, char *event, t_plugin_handler_func *function, + char *handler_args, void *handler_pointer) + + + + Fügt einen Ereignishandler hinzu, der aufgerufen wird, wenn ein + Ereignis eintritt. + + + Argumente: + + + + : Zeiger auf Plugin-Strukture + + + + + : Ereignis (siehe folgende Tabelle) + + + + + : aufgerufene Funktion + + + Es wird folgender Prototyp verwendet: + + int my_function (t_weechat_plugin *plugin, + int argc, char **argv, + char *handler_args, void *handler_pointer) + + + + + Arguments depend on event (see table below). + + + + + : Argument, die an die aufgerufene + Funktion übergeben werden + + + + + : Pointer, der an die + aufgerufene Funktion übergeben werden + + + + + + + List of events: + + + + + Ereignis + Beschreibung + Arguments + + + + + buffer_open + ein Puffer wurde geöffnet + + argc = 1, argv = { buffer number } + + + + buffer_close + ein Puffer wurde geschlossen + + argc = 1, argv = { buffer number } + + + + buffer_move + a buffer was moved + + argc = 2, argv = { new buffer number, old number } + + + + + + + + Rückgabewert: Pointer auf den neuen Ereignishandler. + + + Anmerkung: die aufgerufene Function muss einen der folgenden Werte + zurückgeben: + + + + PLUGIN_RC_KO: Funktion fehlgeschlagen + + + + + PLUGIN_RC_OK: Funktion erfolgreich beendet + + + + + + Beispiel: + +int my_event (t_weechat_plugin *plugin, int argc, char **argv, + char *handler_args, void *handler_pointer) +{ + plugin->print (plugin, NULL, NULL, "my_event"); + return PLUGIN_RC_OK; +} +... +t_plugin_handler *event_handler; +event_handler = plugin->event_handler_add (plugin, "buffer_open", + &my_event); + + +
+ +
+ handler_remove + + + Prototyp: + + void handler_remove (t_weechat_plugin *plugin, + t_plugin_handler *handler) + + + + Entfernt einen Nachrichten- oder Kommando-Handler. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Handler, der entfernt werden soll + + + + + + Rückgabewert: keiner + + + Beispiel: + plugin->handler_remove (plugin, my_handler); + +
+ +
+ handler_remove_all + + + Prototyp: + + void handler_remove_all (t_weechat_plugin *plugin) + + + + Entfernt alle Handler eines Plugins. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + + Rückgabewert: keiner + + + Beispiel: + plugin->handler_remove_all (plugin); + +
+ +
+ modifier_add + + + Prototyp: + + t_plugin_modifier *modifier_add (t_weechat_plugin *plugin, + char *type, char *message, t_plugin_modifier_func *function, + char *modifier_args, void *modifier_pointer) + + + + Füge einen Nachrichtenmodifikator hinzu. + + + Argumente: + + + + : Zeiger auf Plugin-Struktur + + + + + : Modifikatorart: + + + + + Art + Beschreibung + + + + + irc_in + wird bei eingehenden IRC-Nachrichten aufgerufen + + + irc_user + + wird bei jeder Benutzernachricht (oder Befehl) + aufgerufen (bevor WeeChat die Nachricht parst) + + + + irc_out + + wird unmittelbar vor dem Abschicken einer ausgehenden + Nachricht an den IRC-Server aufgerufen (auch bei + Nachrichten, die WeeChat automatisch an den Server + sendet) + + + + + + + + + + : Name der IRC-Nachricht (wird nur + bei den Arten "irc_in" and "irc_out" benutzt) + Um eine Liste der IRC-Nachrichten zu erhalten, lies bitte + folgende Dokumente:RFCs + 1459 + and + 2812. + Außerdem gibt es den Wert "*", der alle Nachrichten + anspricht (ohne Filter). + + + + + : aufgerufene Funktion + + + Folgender Prototyp wird dafür benutzt: + + int my_function (t_weechat_plugin *plugin, + int argc, char **argv, + char *modifier_args, void *modifier_pointer) + + + + Argument argc hat den Wert 2, folgende Werte sind in dem + argv-Array: + + + argv[0] = Servername + + + argv[1] = Nachricht + + + + + + + : an die Funktion übergebene + Werte + + + + + : an die Funktion + übergebener Zeiger + + + + + + Rückgabewert: Zeiger auf den neuen Nachrichtenmodifikator + + + Anmerkung: Die Funktion muss die veränderte Zeichenkette oder NULL + (wenn keine Änderungen erfolgten) zurückgeben. + Wenn die Funktion eine leere Zeichenkette zurückgibt, wird die + Nachricht komplett verworfen und nicht weiter von WeeChat + verarbeitet. (Seien Sie vorsichtig mit dem Verwerfen von + Nachrichten!) Die zurückgegebene Zeichenkette muss mit malloc() + zugewiesen worden sein und wird von WeeChat nach Gebrauch + automatisch mit free() wieder freigegeben. + + + Beispiel: + +char *adder (t_weechat_plugin *plugin, int argc, char **argv, + char *modifier_args, void *modifier_pointer) +{ + char *string; + string = (char *)malloc (strlen (argv[1]) + 16); + strcpy (string, argv[1]); + strcat (string, "test"); + return string; +} +... +t_plugin_modifier *modifier; +modifier = plugin->modifier_add (plugin, "irc_in", "privmsg", + &adder, NULL, NULL); + + +
+ +
+ modifier_remove + + + Prototyp: + + void modifier_remove (t_weechat_plugin *plugin, + t_plugin_modifier *modifier) + + + + Entfernt einen Nachrichtenmodifikator. + + + Arguments: + + + + : Zeiger auf Plugin-Struktur + + + + + : zu entfernender Modifikator + + + + + + Rückgabewert: keiner + + + Beispiel: + plugin->modifier_remove (plugin, my_modifier); + +
+ +
+ modifier_remove_all + + + Prototyp: + + void modifier_remove_all (t_weechat_plugin *plugin) + + + + Entfernt alle Modifikatoren für ein Plugin. + + + Argumente: + + + + : Zeiger auf Plugin-Struktur + + + + + + Rückgabewert: keiner + + + Beispiel: + plugin->modifier_remove_all (plugin); + +
+ +
+ exec_command + + + Prototyp: + + void exec_command (t_weechat_plugin + *plugin, char *server, char *channel, char *command) + + + + Führe ein WeeChat-Kommando aus (oder sende eine Nachricht an + einen Channel). + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : interner Name des Servers, auf den + das Kommando angewendet werden soll (kann NULL sein) + + + + + : Name des Channels, auf den das + Kommando angewendet werden soll (kann NULL sein) + + + + + : Kommando + + + + + + Rückgabewert: keiner + + + Beispiel: + +plugin->exec_command (plugin, NULL, NULL, "/help nick"); +plugin->exec_command (plugin, "freenode", "#weechat", "hello"); + + +
+ +
+ get_info + + + Prototyp: + + char *get_info (t_weechat_plugin *plugin, + char *info, char *server) + + + + Gib eine Information über WeeChat oder einen Channel zurück. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Name (Typ) der Information: + + + + + Info + Beschreibung + + + + + version + WeeChats Version + + + nick + Nickname + + + channel + + Name des Channels (NULL bei einem Server oder + Privatchat) + + + + server + Name des Servers + + + type + + Puffertyp: 0=standard, 1=DCC, 2=raw IRC data + + + + away + Status des "away"-Flags + + + inactivity + + Anzahl der Sekunden seit der letzten + Tastenbetätigung + + + + input + + Inhalt der Kommandozeile im gegenwärtigen Fenster + + + + input_mask + + Inhalt der Farbmaske für die Kommandozeile + + + + input_pos + + Position des Cursors in der Kommandozeile + + + + weechat_dir + + WeeChat-Verzeichnis (Standard: ~/.weechat/) + + + + weechat_libdir + WeeChat-Systemverzeichnis (Bibliotheken) + + + weechat_sharedir + WeeChat-Systemverzeichnis (gemeinsame Dateien) + + + + + + + + + : interner Name des Servers um + Informationen zu lesen (wenn benötigt) + + + + + + Rückgabewert: angeforderte Information oder NULL + + + Hinweis: das Ergebnis muss nach Nutzung mit "free" wieder + freigegeben werden. + + + Beispiele: + +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, you are %s on freenode " + "(inactive for %s seconds)", + version, nick, inactivity); + +if (version) + free (version); +if (nick) + free (nick); +if (inactivity) + free (inactivity); + + +
+ +
+ get_dcc_info + + + Prototyp: + + t_plugin_info_dcc *get_dcc_info (t_weechat_plugin *plugin) + + + + Gib eine Liste der aktiven oder beendeten DCCs zurück. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + + Rückgabewert: verkettete Liste von DCCs. + + + + + Typ + Feld + Beschreibung + + + + + char * + server + IRC Server + + + char * + channel + IRC Channel + + + int + type + + DCC Typ: + 0 = Chatanfrage empfangen, + 1 = Chatanfrage gesendet, + 2 = Datei empfangen, + 3 = Datei gesendet + + + + int* + status + + DCC Status: + 0 = wartend, + 1 = verbindend, + 2 = aktiv, + 3 = beendet, + 4 = fehlgeschlagen, + 5 = unterbrochen durch Anwender + + + + time_t + start_time + Datum/Zeit der Erzeugung der DCC + + + time_t + start_transfer + Datum/Zeit des Beginns der Übertragung der DCC + + + unsigned long + addr + IP-Adresse des Partners + + + int + port + Port der DCC + + + char * + nick + Nickname des Partners + + + char * + filename + Dateiname + + + char * + local_filename + lokaler Dateiname + + + int + filename_suffix + Suffix wenn die Datei umbenannt wird + + + unsigned long + size + Dateigrösse + + + unsigned long + pos + Position in Datei + + + unsigned long + start_resume + Startposition nach einer Unterbrechung + + + unsigned long + bytes_per_sec + + Übertragungsrate (Bytes/s) seit Beginn der Übertragung + + + + t_plugin_dcc_info * + prev_dcc + + Zeiger auf voheriges DCC-Info + + + + t_plugin_dcc_info * + next_dcc + + Zeiger auf nächstes DCC-Info + + + + + + + + + Hinweis: Das Ergebnis muss nach der Benutzung mittels + "free_dcc_info" wieder freigegeben werden. + + + Beispiele: + +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, with: %s", + ptr_dcc->type, ptr_dcc->nick); +} +if (dcc_info) + plugin->free_dcc_info (plugin, dcc_info); + + +
+ +
+ free_dcc_info + + + Prototyp: + + void free_dcc_info (t_weechat_plugin *plugin, + t_plugin_dcc_info *dcc_info) + + + + Gibt den Speicher einer Liste von DCC-Infos wieder frei. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Zeiger auf eine Liste mit + DCC-Infos, die mit "get_dcc_info" angelegt wurde + + + + + + Rückgabewert: keiner. + + + Beispiel: + plugin->free_dcc_info (plugin, dcc_info); + +
+ +
+ get_server_info + + + Prototyp: + + t_plugin_server_info *get_server_info (t_weechat_plugin *plugin) + + + + Gibt die Liste von IRC-Servern zurück (verbunden oder nicht) + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + + Rückgabewert: Liste von IRC-Servern. + + + + + Typ + Feld + Beschreibung + + + + + char * + name + interner Servername + + + int + autoconnect + 1 wenn Autoconnect gesetzt ist, 0 sonst + + + int + autoreconnect + + 1 wenn autoreconnect gesetzt ist, + 0 sonst + + + + int + autoreconnect_delay + Wartezeit vor erneutem Verbindungsversuch + + + int + command_line + + 1 wenn der Servername auf der Kommandozeile angegeben + wurde (ist somit temporär) 0 sonst + + + + char * + address + Serveradresse (Name oder IP) + + + int + port + Port + + + int + ipv6 + IPv6-Verbindung + + + int + ssl + SSL-Verbindung + + + char * + password + Passwort + + + char * + nick1 + primärer Nickname + + + char * + nick2 + alternativer Nickname + + + char * + nick3 + zweiter, alternativer Nickname + + + char * + username + Username + + + char * + real name + tatsächlicher Name + + + char * + command + + Kommando, dass bei erfolgreicher Verbindung + ausgeführt wurde + + + + int + command_delay + Verzögerung nach Ausführung des Kommandos + + + char * + autojoin + Channels, die automatisch betreten werden sollen + + + int + autorejoin + + 1 wenn Channels wieder betreten werden sollen, nachdem + man gekickt wurde 0 sonst + + + + char * + notify_levels + Benachrichtigungs-Level von Channels + + + char * + charset_decode_iso + Zeichensatz zum Dekodieren von ISO + + + char * + charset_decode_utf + Zeichensatz zum Dekodieren von UTF + + + char * + charset_encode + + Zeichensatz der Channels zum Kodieren von + Nachrichten + + + + int + is_connected + 1 wenn verbunden mit einem Server, 0 otherwise + + + int + ssl_connected + 1 wenn verbunden über SSL, 0 sonst + + + char * + nick + gegenwärtiger Nickname + + + int + is_away + 1 wenn away-flag gesetzt ist, 0 sonst + + + time_t + away_time + Zeitspanne seit away-flag gesetzt ist + + + int + lag + Lag (in Millisekunden) + + + t_plugin_server_info * + prev_server + Zeiger auf vorherigen Knoten der Liste + + + t_plugin_server_info * + next_server + Zeiger auf nächsten Knoten der Liste + + + + + + + Hinweis: das Ergebnis muss nach der Benutzung mit + "free_server_info" wieder freigegeben werden. + + + Beispiel: + +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, + "server: %s, address: %s, port: %d %s", + ptr_server_info->name, + ptr_server_info->address, + ptr_server_info->port, + (ptr_server_info->is_connected) ? "(connected)" : ""); + } + plugin->free_server_info (plugin, server_info); +} + + +
+ +
+ free_server_info + + + Prototyp: + + void free_server_info (t_weechat_plugin *plugin, + t_plugin_server_info *server_info) + + + + Gib den Speicher einer Liste "server info" frei + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Zeiger auf eine Server-Liste, + der von der Funktion "get_server_info" zurückgegeben wurde. + + + + + + Rückgabewert: keiner. + + + Beispiel: + plugin->free_server_info (plugin, server_info); + +
+ +
+ get_channel_info + + + Prototyp: + + t_plugin_channel_info *get_channel_info (t_weechat_plugin *plugin, + char *server) + + + + Gib eine Liste der Channels für einen Server zurück. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : interner Name des Server + + + + + + Rückgabewert: verkettete Liste von Channels für einen Server. + + + + + Typ + Feld + Beschreibung + + + + + int + type + + 0 für einen normalen Channel, 1 für einen Privaten + + + + char * + name + Name des Channels + + + char * + topic + Topic des Channels + + + char * + modes + Channelmodus (Flags) + + + int + limit + Anzahl der erlaubten User + + + char * + key + Schlüssel des Channels + + + int + nicks_count + Anzahl der Nicknamen des Channels + + + t_plugin_channel_info * + prev_channel + Zeiger auf vorherigem Knoten der Liste + + + t_plugin_channel_info * + next_channel + Zeiger auf nächsten Knoten der Liste + + + + + + + Hinweis: Das Ergebnis muss nach der Benutzung mit + "free_channel_info" wieder freigegeben werden. + + + Beispiel: + +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); +} + + +
+ +
+ free_channel_info + + + Prototyp: + + void free_channel_info (t_weechat_plugin *plugin, + t_plugin_channel_info *channel_info) + + + + Gibt den Speicher einer Liste "channel info" wieder frei. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Zeiger auf eine Liste + "channel info", der von "get_channel_info" zurückgegeben + wurde + + + + + + Rückgabewert: keiner. + + + Beispiel: + plugin->free_channel_info (plugin, channel_info); + +
+ +
+ get_nick_info + + + Prototyp: + + t_plugin_nick_info *get_nick_info (t_weechat_plugin *plugin, + char *server, char *channel) + + + + Gib eine Liste der Nicknamen für einen Channel zurück. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : interner Name des Servers + + + + + : Name des Channels + + + + + + Rückgabewert: verkettete Liste von Nicknamen eines Channels. + + + + + Typ + Feld + Beschreibung + + + + + char * + nick + Nickname + + + char * + host + Hostname + + + int + Flags + + Flags, die für einen Nicknamen gesetzt sind: + Zweierpotenzen "oder" Zwischenwerte + (1 = channel owner, + 2 = channel admin, + 4 = op, + 8 = halfop, + 16 = voice, + 32 = away) + + + + t_plugin_nick_info * + prev_nick + Zeiger auf vorherigen Knoten der Liste + + + t_plugin_nick_info * + next_nick + Zeiger auf nächsten Knoten der Liste + + + + + + + Hinweis: Das Ergebnis muss nach der Benutzung mit "free_nick_info" wieder freigegeben werden. + + + Beispiel: + +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); +} + + +
+ +
+ free_nick_info + + + Prototyp: + + void free_nick_info (t_weechat_plugin *plugin, + t_plugin_nick_info *nick_info) + + + + Gibt den Speicher einer Liste "nick info" frei. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Zeiger auf eine Liste + "nick info", der von "get_nick_info" zurückgegeben wurde + + + + + + Rückgabewert: keiner. + + + Beispiel: + plugin->free_nick_info (plugin, nick_info); + +
+ +
+ get_config + + + Prototyp: + + char *get_config (t_weechat_plugin *plugin, char *option) + + + + Gibt den Wert einer Option der WeeChat-Konfiguration zurück. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Name der Option + + + + + + Rückgabewert: Wert der Option, oder NULL, wenn nichts gefunden wurde. + + + Hinweis: Das Ergebnis muss nach der Benutzung mit "free" wieder + freigegeben werden. + + + Beispiel: + +char *value1 = plugin->get_config (plugin, "look_set_title"); +char *value2 = plugin->get_config (plugin, "freenode.server_autojoin"); + + +
+ +
+ set_config + + + Prototyp: + + int set_config (t_weechat_plugin *plugin, + char *option, char *value) + + + + Setze den Wert einer Option der WeeChat-Konfiguration. + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Name der Option + + + + + : der neue Wert der Option + + + + + + Rückgabewert: 1 wenn der Wert der Option gesetzt werden konnte, + 0 bei Auftreten eines Fehlers. + + + Beispiel: + +plugin->set_config (plugin, "look_nicklist", "off"); + + +
+ +
+ get_plugin_config + + + Prototyp: + + char *get_plugin_config (t_weechat_plugin *plugin, char *option) + + + + Gibt den Wert einer Option eines Plugins zurück. + Die Option wird aus "~/.weechat/plugins.rc" + gelesen und sieht so aus: "plugin.option=value" + (Hinweis: der Name des Plugins wird automatisch gesetzt). + + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Name der Option + + + + + + Rückgabewert: Wert der Option, NULL wenn nichts gefunden wurde. + + + Hinweis: Das Ergebnis muss nach der Benutzung mit "free" wieder + freigegeben werden. + + + Beispiel: + +char *value = plugin->get_plugin_config (plugin, "my_var"); + + +
+ +
+ set_plugin_config + + + Prototyp: + + int set_plugin_config (t_weechat_plugin *plugin, + char *option, char *value) + + + + Setzt den Wert einer Option eines Plugins. + Die Option wird in die Datei + "~/.weechat/plugins.rc" geschrieben + und sieht so aus: "plugin.option=value" + (Hinweis: der Name des Plugins wird automatisch gesetzt) + + + Argumente: + + + + : Zeiger auf eine Plugin-Struktur + + + + + : Name der Option, die gesetzt werden soll + + + + + : Wert der zu setzenden Option + + + + + + Rückgabewert: 1 wenn die Option gesetzt werden konnte, 0 wenn ein + Fehler aufgetreten ist. + + + Beispiel: + +plugin->set_plugin_config (plugin, "my_var", "value"); + + +
+ +
+ get_irc_color + + + Prototype: + + int get_irc_color (t_weechat_plugin *plugin, + char *color_name) + + + + Hole IRC-Farbindex mit dem Farbnamen. + + + Argumente: + + + + : Zeiger auf die Pluginstruktur + + + + + : Farbname + Folgende Farben sind erlaubt: + + + + + Farbname + Wert + + + + + white + 0 + + + black + 1 + + + blue + 2 + + + green + 3 + + + lightred + 4 + + + red + 5 + + + magenta + 6 + + + brown + 7 + + + yellow + 8 + + + lightgreen + 9 + + + cyan + 10 + + + lightcyan + 11 + + + lightblue + 12 + + + lightmagenta + 13 + + + gray + 14 + + + lightgray + 15 + + + + + + + + + + Rückgabewert: IRC-Farbindex, -1 wenn die Farbe nicht gefunden wurde. + + + Beispiel: + +int color_blue = plugin->get_irc_color (plugin, "blue"); /* return 2 */ + + +
+ +
+ input_color + + + Prototyp: + + void input_color (t_weechat_plugin *plugin, + int color, int start, int length) + + + + Erzeugt einen Farbcode im Eingabepuffer. + + + Argumente: + + + + : Zeiger auf die Pluginstruktur + + + + + : Textfarbe (wenn der Wert < 0 ist, + dann wird der Eingabepuffer aufgefrischt und nicht verändert) + + + + + : Startposition für Einfärbung (wenn + der Wert < 0 ist, wird die Maske neu initialisiert) + + + + + : Länge der Einfärbung (wenn der Wert + <= 0 ist, wird die Maske neu initialisiert) + + + + + + Rückgabewert: keiner. + + + Beispiele: + +plugin->input_color (plugin, plugin->get_irc_color (plugin, "blue"), 10, 5); + + +
+ +
+ get_window_info + + + Prototype: + + t_plugin_window_info *get_window_info (t_weechat_plugin *plugin) + + + + Gibt die Liste der WeeChat-Fenster zurück. + + + Argumente: + + + + : Zeiger auf Pluginstruktur + + + + + + Rückgabewert: verkettete Liste der WeeChat-Fenster. + + + + + Typ + Feld + Beschreibung + + + + + int + win_x + horizontale Fensterposition + + + int + win_y + vertikale Fensterposition + + + int + win_width + Fensterbreite + + + int + win_height + Fensterhöhe + + + int + win_width_pct + + Breite in % (im Vergleich zum übergeordneten Fenster) + + + + int + win_height_pct + + Höhe % (im Vergleich zum übergeordneten Fenster) + + + + int + num_buffer + Anzahl der angezeigten Puffer + + + t_plugin_window_info * + prev_window + + Zeiger auf die Informationen des vorhergehenden Fensters + + + + t_plugin_window_info * + next_window + + Zeiger auf die Informationen des nächsten Fensters + + + + + + + + Anmerkung: Das Ergebnis muss nach Benutzung durch einen Aufruf der + "free_window_info"-Funktion gelöscht werden. + + + Example: + +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, "--- window info ---"); + 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, "no window info!"); + + +
+ +
+ free_window_info + + + Prototyp: + + void free_window_info (t_weechat_plugin *plugin, + t_plugin_window_info *window_info) + + + + Gibt den Speicher wieder frei, der von der + Fenster-Informationsliste belegt wird. + + + Argumente: + + + + : Zeiger auf Pluginstruktur + + + + + : Zeiger auf + Fenster-Informationsliste, der von der + "get_window_info"-Funktion zurückgegeben wurde + + + + + + Rückgabewert: keiner. + + + Beispiel: + plugin->free_window_info (plugin, window_info); + +
+ +
+ get_buffer_info + + + Prototyp: + + t_plugin_buffer_info *get_buffer_info (t_weechat_plugin *plugin) + + + + Gibt eine Liste der WeeChat-Puffer zurück. + + + Argumente: + + + + : Zeiger auf Pluginstruktur + + + + + + Rückgabewert: verkettete Liste der WeeChat-Puffer. + + + + + Typ + Feld + Beschreibung + + + + + int + type + Puffertyp: 0=standard, 1=DCC, 2=raw IRC data + + + int + number + Puffer-Nummer + + + int + num_displayed + Anzahl der Fenster im Puffer + + + char * + server_name + Servername für den Puffer (kann NULL sein) + + + char * + channel_name + Channelname für den Puffer (kann NULL sein) + + + int + notify_level + Benachrichtigungslevel für den Puffer + + + char * + log_filename + + Name der Logdatei (NULL bedeutet, dass nichts geloggt + wird) + + + + t_plugin_buffer_info * + prev_buffer + Zeiger auf die vorhergehenden Pufferinformationen + + + t_plugin_buffer_info * + next_buffer + Zeiger auf die nächsten Pufferinformationen + + + + + + + Bemerkung: Das Ergebnis muss nach der Auswertung mit der + "free_buffer_info"-Funktion wieder gelöscht werden. + + + Beispiel: + +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, "--- buffer info ---"); + 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, "no buffer info!"); + + +
+ +
+ free_buffer_info + + + Prototyp: + + void free_buffer_info (t_weechat_plugin *plugin, + t_plugin_buffer_info *buffer_info) + + + + Gibt den Speicher frei, der von der Puffer-Informationsliste + belegt wird. + + + Argumente: + + + + : Zeiger auf Pluginstruktur + + + + + : pointer to buffer info list + returned by "get_buffer_info" function + + + + + + Rückgabewert: keiner. + + + Beispiel: + plugin->free_buffer_info (plugin, buffer_info); + +
+ +
+ get_buffer_data + + + Prototype: + + t_plugin_buffer_data *get_buffer_info (t_weechat_plugin *plugin, + char *server, char *channel) + + + + Gibt den Inhalt des Puffers zurück. + + + Argumente: + + + + : Zeiger auf Pluginstruktur + + + + + : interner Name des Servers + + + + + : Channelname + + + + + + Rückgabewert: Pufferinhalt (verkettete Liste mit den Zeilen). + + + + + Typ + Feld + Beschreibung + + + + + time_t + date + Datum/Zeit + + + char * + nick + Nick + + + char * + data + Zeileninhalt (Farbcodes wurden entfernt) + + + t_plugin_buffer_line * + prev_line + Zeiger auf die vorherige Zeile + + + t_plugin_buffer_line * + next_line + Zeiger auf die nächste Zeile + + + + + + + Bemerkung: Das Ergebnis muss nach der Auswertung mit der + "free_buffer_data"-Funktion wieder gelöscht werden. + + + Example: + +t_plugin_buffer_line *buffer_line, *ptr_line; +char text_time[256]; + +buffer_line = plugin->get_buffer_data (plugin); +if (buffer_line) +{ + for (ptr_line = buffer_line; ptr_line; ptr_line = ptr_line->next_line) + { + strftime (text_time, sizeof (text_time), "%x %X", localtime (&(ptr_line->date))); + plugin->print (plugin, NULL, NULL, "date: %s, nick: %s, data: %s", + text_time, ptr_line->nick, ptr_line->data); + } + plugin->free_buffer_data (plugin, buffer_line); +} + + +
+ +
+ free_buffer_data + + + Prototype: + + void free_buffer_data (t_weechat_plugin *plugin, + t_plugin_buffer_line *buffer_line) + + + + Gibt den Speicher frei, der von den Pufferzeilen belegt wurde. + + + Arguments: + + + + : Zeiger auf Pluginstruktur + + + + + : Zeiger auf Pufferzeilen, der + von der "get_buffer_data"-Funktion zurückgegeben wurde + + + + + + Rückgabewert: keiner. + + + Beispiele: + plugin->free_buffer_data (plugin, buffer_line); + +
+ +
diff --git a/doc/de/plugin_charset.de.xml b/doc/de/plugin_charset.de.xml new file mode 100644 index 000000000..ecc77f3af --- /dev/null +++ b/doc/de/plugin_charset.de.xml @@ -0,0 +1,136 @@ + + + + +
+ Zeichensatz Plugin + + + Das Zeichensatz-Plugin ermöglicht das Ver- und Entschlüsseln von Daten + auf 3 Ebenen: Global, pro Server oder pro Channel. + Das Plugin ist optional, wird jedoch empfohlen: wenn es nicht geladen + ist, kann WeeChat nur UTF-8-Daten lesen und schreiben. + + + + Das Zeichensatz-Plugin sollte beim Start von WeeChat automatisch geladen + werden. + Um sicherzustellen, dass das Plugin geladen wurde, versuchen Sie: + "/charset". + Wenn der Befehl nicht gefunden wird, laden Sie das Plugin manuell mit + dem Befehl: /plugin load charset + Wenn das Plugin nicht gefunden wird, kompilieren Sie WeeChat erneut + mit Plugin- und Zeichensatz-Support + + + + Wenn das Zeichensatz-Plugin startet, zeigt es den Terminalzeichensatz + und den internen Zeichensatz an. Der Terminalzeichensatz hängt von + den LOCALE-Einstellungen ab, der interne ist UTF-8. + Zum Beispiel: + +-P- Charset plugin starting, terminal charset: ISO-8859-15 (WeeChat internal: UTF-8) + + + +
+ Einstellungen + + + + + Um den globalen Zeichensatz zum Kodieren und Dekodieren + festzulegen, benutzen Sie den "/setp" Befehl. + Zum Beispiel: + +/setp charset.global.decode = ISO-8859-15 +/setp charset.global.encode = ISO-8859-15 + + Wenn der Zeichensatz zum Dekodieren nicht gesetzt ist (z.B. beim + ersten Start des Plugins), wird es automatisch auf den + Terminalzeichensatz eingestellt (wenn es nicht UTF-8 ist) oder + als Voreinstellung auf "ISO-8859-1" gesetzt. + Der voreingestellte Enkodierungszeichensatz ist leer, so dass in + der Voreinstellung mit dem internen Zeichensatz (UTF-8) enkodiert + wird. + + + + + Um den Serverzeichensatz festzulegen, benutzen Sie den + "/charset"-Befehl im Server-Puffer. + Wenn Sie nur einen Zeichensatz vorgeben, wird dieser automatisch + zum Enkodieren und Dekodieren verwendet. + Zum Beispiel: + /charset ISO-8859-15 + Das ist gleichbedeutend mit: + +/charset decode ISO-8859-15 +/charset encode ISO-8859-15 + + + + + + Um den zeichensatz im Channel (oder einem privatem Chat) + festzulegen, müssen Sie den gleichen Befehl wie für den Server + benutzen, jedoch in dem Channel-Puffer (oder Query-Puffer) + + + + +
+ +
+ FAQ + + + Wenn Sie Probleme mit den Zeichen oder dem Zeichensatz-Plugin haben: + + + + überprüfen Sie, ob weechat-curses zu libcursesw gelinkt ist + (Achtung: Wird bei den meisten, jedoch nicht bei allen + Distributionen benötigt): + ldd /pfad/zu/weechat-curses + + + + + überprüfen Sie die Zeichensatz-Zeile im Server-Puffer, dort + sollten ISO-XXXXXX oder UTF-8 für den Terminal-Zeichensatz + stehen. Wenn Sie dort ANSI_X3.4-1968 oder andere Werte sehen, + sind Ihre LOCALES eventuell falsch eingestellt. + + + + + Setze die globalen Dekodier-Einstellungen, z.B.: + /setp charset.global.decode = ISO-8859-15 + + + + + +
+ +
diff --git a/doc/de/plugin_scripts.de.xml b/doc/de/plugin_scripts.de.xml new file mode 100644 index 000000000..789f50032 --- /dev/null +++ b/doc/de/plugin_scripts.de.xml @@ -0,0 +1,3014 @@ + + + + +
+ Skript-Plugins + + + Vier Plugins werden von WeeChat angeboten um Skriptsprachen zu nutzen: + Perl, Python, Ruby und Lua. + + +
+ Laden / Entfernen von Skripten + + + Scripts are loaded and unloaded with /perl, + /python, /ruby and + /lua commands + (type /help in WeeChat for help about commands). + + Skripte werden mit den Kommandos /perl, /python, + /ruby und /lua geladen oder + entfernt. (Benutze /help in WeeChat für Hilfe zu + den Kommandos). + + + + Beispiele: + + + + Laden eines Perl-Skripts: + /perl load /tmp/test.pl + + + + + Liste alle geladenen Perl-Skripte auf: + /perl + + + + + Laden eines Python-Skripts: + /python load /tmp/test.py + + + + + Liste alle geladenen Python-Skripte auf: + /python + + + + + Laden eines Ruby-Skripts: + /ruby load /tmp/test.rb + + + + + Liste alle geladenen Ruby-Skripte auf: + /ruby + + + + + Laden eines Lua-Skripts: + /lua load /tmp/test.lua + + + + + Liste alle geladenen Lua-Skripte auf: + /lua + + + + + +
+ +
+ Syntax in den Skriptsprachen + +
+ Perl + + + In einem WeeChat-PerlSkript ist allen API-Funktionen und Variablen + ein "weechat::" vorangestellt. + Beispiel: +weechat::register("test", "1.0", "end_test", "WeeChat perl script"); + + +
+ +
+ Python + + + Ein WeeChat-Pythonskript muss mit einer Importdirektive für WeeChat + beginnen: + import weechat + + + + Allen API-Funktionen und Variablen ist ein + "weechat." vorangestellt. + Beispiel: +weechat.register("test", "1.0", "end_test", "WeeChat python script") + + +
+ +
+ Ruby + + + In einem WeeChat-Rubyskript muss der gesamte Code innerhalb von + Funktionen stehen. Für den Hauptteil ist die Funktion + "weechat_init" zu definieren, die automatisch + aufgerufen wird, wenn das Skript in WeeChat geladen wird. + Beispiel: + +def weechat_init + Weechat.register("test", "1.0", "end_test", "WeeChat ruby script") + Weechat.add_command_handler("command", "my_command") + return Weechat::PLUGIN_RC_OK +end + +def my_command(server, args) + Weechat.print("my command") + return Weechat::PLUGIN_RC_OK +end + + + + + Allen API-Funktionen ist "Weechat." + und Variablen "Weechat::" vorangestellt. + + +
+ +
+ Lua + + + In einem WeeChat-Luaskript ist allen Funktionen ein + "weechat." vorangestellt. Variablen beginnen + mit "weechat." und enden mit + "()". + Beispiel: + +function message_handler(server, args) + weechat.print("I am a message handler") + return weechat.PLUGIN_RC_OK() +end + + + +
+ +
+ +
+ WeeChat / Skript-API + +
+ register + + + Perl-Prototyp: + + weechat::register(name, version, end_function, description, + [charset]); + + + + Python-Prototyp: + + weechat.register(name, version, end_function, description, + [charset]) + + + + Ruby-Prototyp: + + Weechat.register(name, version, end_function, description, + [charset]) + + + + Lua-Prototyp: + + weechat.register(name, version, end_function, description, + [charset]) + + + + Das ist die erste Funktion, die in einem Skript aufgerufen wird. + Alle WeeChat-Skripte müssen diese Funktion aufrufen. + + + Argumente: + + + + : eindeutiger Name des Skripts + (jedes Skript muss einen eindeutigen Namen besitzen) + + + + + : Version des Skripts + + + + + : Funktion, die aufgerufen + wird, wenn das Skript entfernt werden soll (optional; ein + leerer String bedeutet, dass nichts aufgerufen wird) + + + + + : eine kurze Beschreibung des + Skripts + + + + + : Zeichensatz, der von dem Script + benutzt wird, sollten Sie setzen, wenn das Script nicht in + UTF-8 geschrieben ist + + + + + + Rückgabewert: 1 wenn das Skript registriert werden konnte, 0 wenn + ein Fehler aufgetaucht ist. + + + Beispiele: + +# perl +weechat::register("test", "1.0", "end_test", "Test script!", "ISO-8859-1"); + +# python +weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1") + +# ruby +Weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1") + +-- lua +weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1") + + +
+ +
+ set_charset + + + Perl-Prototyp: + + weechat::set_charset(charset); + + + + Python-Prototyp: + + weechat.set_charset(charset) + + + + Ruby-Prototyp: + + Weechat.set_charset(charset) + + + + Lua-Prototyp: + + weechat.set_charset(charset) + + + + Legt einen neuen Script-Zeichensatz fest. + + + Argumente: + + + + : neuer Script-Zeichensatz + + + + + + Rückgabewert: 1, wenn der Zeichensatz erfolgreich gesetzt wurd, 0, + wenn ein Fehler aufgetreten ist + + + Beispiele: + +# perl +weechat::set_charset("ISO-8859-1"); + +# python +weechat.set_charset("ISO-8859-1") + +# ruby +Weechat.set_charset("ISO-8859-1") + +-- lua +weechat.set_charset("ISO-8859-1") + + +
+ +
+ print + + + Perl-Prototyp: + + weechat::print(message, [channel, [server]]) + + + + Python-Prototyp: + + weechat.prnt(message, [channel, [server]]) + + + + Ruby-Prototyp: + + Weechat.print(message, [channel, [server]]) + + + + Lua-Prototyp: + + weechat.print(message, [channel, [server]]) + + + + Sende eine Nachricht an einen WeeChat-Puffer, identifiziert durch + Server und Channel. + + + Argumente: + + + + : Nachricht + + + + + : Name des Channels, zu welchem der + Puffer gehört, in dem die + Nachricht angezeigt werden soll + + + + + : interner Name des Servers, zu + welchem der Puffer gehört, in dem die Nachricht angezeigt + werden soll + + + + + + + To display colored text, see . + + + Rückgabewert: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist + + + Beispiele: + +# perl +weechat::print("message"); +weechat::print("message", "#weechat"); +weechat::print("message", "#weechat", "freenode"); +weechat::print("test: \x0305 rot \x0F normal"); + +# 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") + + +
+ + +
+ print_server + + + Perl prototype: + + weechat::print_server(message) + + + + Python prototype: + + weechat.print_server(message) + + + + Ruby prototype: + + Weechat.print_server(message) + + + + Lua prototype: + + weechat.print_server(message) + + + + Display a message on server buffer. + + + Arguments: + + + + : message + + + + + + To display colored text, see . + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::print_server("message"); +weechat::print_server("test: \x0305 rot \x0F normal"); + +# python +weechat.print_server("message") + +# ruby +Weechat.print_server("message") + +-- lua +weechat.print_server("message") + + +
+ +
+ print_infobar + + + Perl-Prototyp: + + weechat::print_infobar(time, message); + + + + Python-Prototyp: + + weechat.print_infobar(time, message) + + + + Ruby-Prototyp: + + Weechat.print_infobar(time, message) + + + + Lua-Prototyp: + + weechat.print_infobar(time, message) + + + + Zeige eine Nachricht für einen festen Zeitraum in der Infobar. + + + Argumente: + + + + : Zeit (in sekunden) der Anzeige + (0 = permanent) + + + + + : Nachricht + + + + + + Rückgabewert: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist + + + Beispiele: + +# perl +weechat::print_infobar(5, "message"); + +# python +weechat.print_infobar(5, "message") + +# ruby +Weechat.print_infobar(5, "message") + +-- lua +weechat.print_infobar(5, "message") + + +
+ +
+ remove_infobar + + + Perl-Prototyp: + + weechat::remove_infobar([count]); + + + + Python-Prototyp: + + weechat.remove_infobar([count]) + + + + Ruby-Prototyp: + + Weechat.remove_infobar([count]) + + + + Lua-Prototyp: + + weechat.remove_infobar([count]) + + + + Entfernt eine oder mehrere Nachrichten aus dem Infobar-Speicher. + + + Argumente: + + + + : Anzahl der Nachrichten, die entfernt + werden sollen (Ist kein Argument angegeben oder <= 0 + werden alle Nachrichten entfernt) + + + + + + Rückgabewert: 1 bei Erfolg, 0 bei Auftreten eines Fehlers + + + Beispiele: + +# perl +weechat::remove_infobar(1); + +# python +weechat.remove_infobar(1) + +# ruby +Weechat.remove_infobar(1) + +-- lua +weechat.remove_infobar(1) + + +
+ +
+ log + + + Perl-Prototyp: + + weechat::log(message, [channel, [server]]); + + + + Python-Prototyp: + + weechat.log(message, [channel, [server]]) + + + + Ruby-Prototyp: + + Weechat.log(message, [channel, [server]]) + + + + Lua-Prototyp: + + weechat.log(message, [channel, [server]]) + + + + Schreibe eine Nachricht in die Logdatei eines Servers oder Channels. + + + Argumente: + + + + : Nachricht + + + + + : Name des Channels, zu welchem der + Puffer der Logdatei gehört + + + + + : interner Name des Servers, zu + welchem der Puffer der Logdatei gehört + + + + + + Rückgabewert: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist. + + + Beispiel: + +# perl +weechat::log("message", "#weechat", "freenode"); + +# python +weechat.log("message", "#weechat", "freenode") + +# ruby +Weechat.log("message", "#weechat", "freenode") + +-- lua +weechat.log("message", "#weechat", "freenode") + + +
+ +
+ add_message_handler + + + Perl-Prototyp: + + weechat::add_message_handler(message, function); + + + + Python-Prototyp: + + weechat.add_message_handler(message, function) + + + + Ruby-Prototyp: + + Weechat.add_message_handler(message, function) + + + + Lua-Prototyp: + + weechat.add_message_handler(message, function) + + + + Erzeuge einen Nachrichten-Handler, der bei Empfang einer + IRC-Nachricht aufgerufen wird. + + + Argumente: + + + + : Name (Typ) der IRC-Nachricht. Für + eine Liste + der bekannten Typen von IRC-Nachrichten konsultieren sie + bitte die + RFCs + 1459 + und + 2812. + Mehr noch, sie können spezielle Ereignisse abfangen, indem + sie einen speziellen Namen verwenden, der mit + "weechat_" beginnt (siehe + ). + + + + + : Funktion, die bei Empfang einer + Nachricht aufgerufen werden soll + + + + + + Rückgabewert: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist. + + + Beispiele: + +# perl +weechat::add_message_handler ("privmsg", "my_function"); +sub my_function +{ + weechat::print("server=$_[0]"); + ($null, $channel, $message) = split ":",$_[1],3; + ($mask, $null, $channel) = split " ", $channel; + weechat::print("mask=$mask, channel=$channel, msg=$message"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_message_handler ("privmsg", "my_function") +def my_function(server, args): + weechat.prnt("server="+server) + null, channel, message = string.split(args, ":", 2) + mask, null, channel = string.split(string.strip(channel), " ", 2) + weechat.prnt("mask="+mask+", canal="+channel+", message="+message) + return weechat.PLUGIN_RC_OK + +# ruby +Weechat.add_message_handler("privmsg", "my_function") +def my_function(server, args) + Weechat.print("server=#{server}, args=#{args}") + return Weechat::PLUGIN_RC_OK +end + +-- lua +weechat.add_message_handler ("privmsg", "my_function") +function my_function(server, args) + weechat.print("server=" .. server .. ", args=" .. args) + return weechat.PLUGIN_RC_OK() +end + + + + Hinweis: die Funktion, die aufgerufen wird wenn eine Nachricht + empfangen wurde, muss einen der folgenden Werte zurückgeben: + + + + PLUGIN_RC_KO: Funktion fehlgeschlagen + + + + + PLUGIN_RC_OK: Funktion war erfolgreich + + + + + PLUGIN_RC_OK_IGNORE_WEECHAT: Die Nachricht + wird nicht an WeeChat übergeben + + + + + PLUGIN_RC_OK_IGNORE_PLUGINS: Die Nachricht + wird nicht an andere Plugins + weitergegeben + + + + + PLUGIN_RC_OK_IGNORE_ALL: Die Nachricht + wird weder an WeeChat noch an andere Plugins übergeben + + + + + PLUGIN_RC_OK_WITH_HIGHLIGHT: Funktion + erfolgreich vervollständigt und eine Hervorhebung bei den + empfangenen Nachrichten eingebaut + + + + +
+ +
+ add_command_handler + + + Perl-Prototyp: + + weechat::add_command_handler(command, function, + [description, arguments, arguments_description, + completion_template]); + + + + Python-Prototyp: + + weechat.add_command_handler(command, function, + [description, arguments, arguments_description, + completion_template]) + + + + Ruby-Prototyp: + + Weechat.add_command_handler(command, function, + [description, arguments, arguments_description, + completion_template]) + + + + Lua-Prototyp: + + weechat.add_command_handler(command, function, + [description, arguments, arguments_description, + completion_template]) + + + + Erzeugt einen Kommando-Handler, der aufgerufen wird, wenn der + Anwender das Kommando benutzt (Beispiel: /command). + + + Argumente: + + + + : + Name des neuen Kommandos, der auch Name eines bereits + existierenden Kommandos sein kann (mit Bedacht zu verwenden, + das ersetzte Kommando ist nicht verfügbar, bis das Plugin + entfernt wurde) + + + + + : Funktion, die aufgerufen wird, + wenn das Kommando ausgeführt wird + + + + + : eine kurze Beschreibung der + Argumente des Kommandos (werden angezeigt bei /help command) + + + + + : eine ausführliche + Beschreibung der Argumente des Kommandos (werden angezeigt + bei /help command) + + + + + : + Vorlage für die Vervollständigung; zum Beispiel bedeutet + "abc|%w def|%i", dass das + erste Argument "abc" oder ein WeeChat-Kommando sein kann + und das zweite Argument "def" oder ein IRC-Kommando. + (siehe ) + + + + + + Rückgabewert: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist + + + Beispiele: + +# perl +weechat::add_command_handler("command", "my_command"); +sub my_command +{ + weechat::print("server= $_[0], args: $_[1]"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_command_handler("command", "my_command") +def my_command(server, args): + weechat.prnt("server="+server+", args="+args) + return weechat.PLUGIN_RC_OK + +# ruby +Weechat.add_command_handler("command", "my_command") +def my_command(server, args) + Weechat.print("server=#{server}, args=#{args}") + return Weechat::PLUGIN_RC_OK +end + +-- lua +weechat.add_command_handler("command", "my_command") +def my_command(server, args) + weechat.print("server="..server..", args="..args) + return weechat.PLUGIN_RC_OK() +end + + + + Hinweis: die Funktion, die aufgerufen wird wenn eine Nachricht + empfangen wurde, muss einen der folgenden Werte zurückgeben: + + + + + PLUGIN_RC_KO : Funktion ist fehlgeschlagen + + + + + PLUGIN_RC_OK : Funktion war erfolgreich + + + + +
+ +
+ add_timer_handler + + + Perl-Prototyp: + + weechat::add_timer_handler(interval, function); + + + + Python-Prototyp: + + weechat.add_timer_handler(interval, function) + + + + Ruby-Prototyp: + + Weechat.add_timer_handler(interval, function) + + + + Lua-Prototyp: + + weechat.add_timer_handler(interval, function) + + + + Erzeugt einen zeitgesteuerten Handler, der periodisch eine Funktion + aufruft. + + + Argumente: + + + + : Interval (in Sekunden) zwischen + zwei Aufrufen der Funktion. + + + + + : Funktion, die aufgerufen wird + + + + + + Rückgabewert: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist + + + Beispiele: + +# perl +weechat::add_timer_handler(60, "my_timer"); +sub my_timer +{ + weechat::print("this is timer handler"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_timer_handler(60, "my_timer") +def my_timer(): + weechat.prnt("this is timer handler") + return weechat.PLUGIN_RC_OK + +# ruby +Weechat.add_timer_handler(60, "my_timer") +def my_timer() + Weechat.print("this is timer handler") + return Weechat::PLUGIN_RC_OK +end + +-- lua +weechat.add_timer_handler(60, "my_timer") +function my_timer() + weechat.print("this is timer handler") + return weechat.PLUGIN_RC_OK() +end + + + + Note: function called has to return one of following values: + Hinweis: die Funktion, die aufgerufen wird, muss + einen der folgenden Werte zurückgeben: + + + + + PLUGIN_RC_KO: Funktion ist fehlgeschlagen + + + + + PLUGIN_RC_OK: Funktion war erfolgreich + completed + + + + +
+ +
+ add_keyboard_handler + + + Perl-Prototyp: + + weechat::add_keyboard_handler(function); + + + + Python-Prototyp: + + weechat.add_keyboard_handler(function) + + + + Ruby-Prototyp: + + Weechat.add_keyboard_handler(function) + + + + Lua-Prototyp: + + weechat.add_keyboard_handler(function) + + + + Erzeugt einen Keyboard-Handler, der für jeden Tastendruck + aufgerufen wird. + + + Argumente: + + + + : Funktion, die aufgerufen wird + + + + + + Rückgabewert: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist + + + Beispiele: + +# perl +weechat::add_keyboard_handler("my_keyboard"); +sub my_keyboard +{ + my $key = shift; + my $input_before = shift; + my $input_after = shift; + weechat::print("keyboard handler: key = '$key', " + ."input before = '$input_before' " + ."after = '$input_after'"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_keyboard_handler("my_keyboard") +def my_keyboard(key, input_before, input_after): + weechat.prnt("keyboard handler: key = '%s', " \ + "input before = '%s' after = '%s'" + %(key, input_before, input_after)) + return weechat.PLUGIN_RC_OK + +# ruby +Weechat.add_keyboard_handler("my_keyboard") +def my_keyboard(key, input_before, input_after) + Weechat.print("keyboard handler: key = '#{key}', " \ + "input before = '#{input_before}' " \ + "after = '#{input_after}'") + return Weechat::PLUGIN_RC_OK +end + +-- lua +weechat.add_keyboard_handler("my_keyboard") +function my_keyboard(key, input_before, input_after) + weechat.print("keyboard handler: key = '"..key.. + "', input before = '"..input_before.. + "' after = '"..input_after.."'") + return weechat.PLUGIN_RC_OK() +end + + + + Hinweis: Die aufgerufene Funktion muss einen der folgenden Werte + zurückgeben: + + + + PLUGIN_RC_KO: Funktion ist fehlgeschlagen + + + + + PLUGIN_RC_OK: Funktion war erfolgreich + + + + +
+ +
+ add_event_handler + + + Perl-Prototyp: + + weechat::add_event_handler(event, function); + + + + Python-Prototyp: + + weechat.add_event_handler(event, function) + + + + Ruby-Prototyp: + + Weechat.add_event_handler(event, function) + + + + Lua-Prototyp: + + weechat.add_event_handler(event, function) + + + + Fügt einen Ereignis-Handler hinzu, der beim Auftreten eines + Ereignisses aufgerufen wird. + + + Argumente: + + + + : Ereignis + (see ) + + + + + : aufgerufene Funktion + + + + + + Rückgabewerte: 1 bei Erfolg, 0 bei aufgetretenen Fehlern + + + Beispiele: + +# perl +weechat::add_event_handler("buffer_open", "my_event"); +sub my_event +{ + weechat::print("buffer open"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_event_handler("buffer_open", "my_event") +def my_event(): + weechat.prnt("buffer open") + return weechat.PLUGIN_RC_OK + +# ruby +Weechat.add_event_handler("buffer_open", "my_event") +def my_event() + Weechat.print("buffer open") + return Weechat::PLUGIN_RC_OK +end + +-- lua +weechat.add_event_handler("buffer_open", "my_event") +function my_event() + weechat.print("buffer open") + return weechat.PLUGIN_RC_OK() +end + + + + Bemerkung: aufgerufene Funktion muss einen der folgenden Werte + zurückgeben: + + + + PLUGIN_RC_KO: Funktion fehlgeschlagen + + + + + PLUGIN_RC_OK: Funktion erfolgreich beendet + + + + +
+ +
+ remove_handler + + + Perl-Prototyp: + + weechat::remove_handler(name, function); + + + + Python-Prototyp: + + weechat.remove_handler(name, function) + + + + Ruby-Prototyp: + + Weechat.remove_handler(name, function) + + + + Lua-Prototyp: + + weechat.remove_handler(name, function) + + + + Entfernt einen Nachrichten- oder Kommando-Handler. + + + Argumente: + + + + : Name der IRC-Message oder Kommando + + + + + : Funktion + + + + + + Rückgabewert: 1 bei Erfolg, 0 bei Auftreten eines Fehlers + + + Beispiele: + +# perl +weechat::remove_handler("command", "my_command"); + +# python +weechat.remove_handler("command", "my_command") + +# ruby +Weechat.remove_handler("command", "my_command") + +-- lua +weechat.remove_handler("command", "my_command") + + +
+ +
+ remove_timer_handler + + + Perl-Prototyp: + + weechat::remove_timer_handler(function); + + + + Python-Prototyp: + + weechat.remove_timer_handler(function) + + + + Ruby-Prototyp: + + Weechat.remove_timer_handler(function) + + + + Lua-Prototyp: + + weechat.remove_timer_handler(function) + + + + Entfernt einen zeitgesteuerten Handler. + + + Argumente: + + + + : Funktion + + + + + + Rückgabewert: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist + + + Beispiele: + +# perl +weechat::remove_timer_handler("my_timer"); + +# python +weechat.remove_timer_handler("my_timer") + +# ruby +Weechat.remove_timer_handler("my_timer") + +-- lua +weechat.remove_timer_handler("my_timer") + + +
+ +
+ remove_keyboard_handler + + + Perl-Prototyp: + + weechat::remove_keyboard_handler(function); + + + + Python-Prototyp: + + weechat.remove_keyboard_handler(function) + + + + Ruby-Prototyp: + + Weechat.remove_keyboard_handler(function) + + + + Lua-Prototyp: + + weechat.remove_keyboard_handler(function) + + + + Entfernt einen Keyboard-Handler. + + + Argumente: + + + + : Funktion + + + + + + Rückgabewerte: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist. + + + Beispiele: + +# perl +weechat::remove_keyboard_handler("my_keyboard"); + +# python +weechat.remove_keyboard_handler("my_keyboard") + +# ruby +Weechat.remove_keyboard_handler("my_keyboard") + +-- lua +weechat.remove_keyboard_handler("my_keyboard") + + +
+ +
+ remove_event_handler + + + Perl-Prototyp: + + weechat::remove_event_handler(function); + + + + Python-Prototyp: + + weechat.remove_event_handler(function) + + + + Ruby-Prototyp: + + Weechat.remove_event_handler(function) + + + + Lua-Prototyp: + + weechat.remove_event_handler(function) + + + + Entfernt einen Ereignis-Handler. + + + Argumente: + + + + : Funktion + + + + + + Rückgabewerte: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist. + + + Beispiele: + +# perl +weechat::remove_event_handler("my_event"); + +# python +weechat.remove_event_handler("my_event") + +# ruby +Weechat.remove_event_handler("my_event") + +-- lua +weechat.remove_event_handler("my_event") + + +
+ +
+ add_modifier + + + Perl-Prototyp: + + weechat::add_modifier(type, message, function); + + + + Python-Prototyp: + + weechat.add_modifier(type, message, function) + + + + Ruby-Prototyp: + + Weechat.add_modifier(type, message, function) + + + + Lua-Prototyp: + + weechat.add_modifier(type, message, function) + + + + Fügt einen Nachrichtenmodifikator hinzu. + + + Argumente: + + + + : Modifikatorart: + + + + + Art + Beschreibung + + + + + irc_in + wird bei eingehenden IRC-Nachrichten aufgerufen + + + irc_user + + wird bei jeder Benutzernachricht (oder Befehl) + aufgerufen (bevor WeeChat die Nachricht parst) + + + + irc_out + + wird unmittelbar vor dem Abschicken einer ausgehenden + Nachricht an den IRC-Server aufgerufen (auch bei + Nachrichten, die WeeChat automatisch an den Server + sendet) + + + + + + + + + + :Name der IRC-Nachricht (wird nur bei + den Arten "irc_in" and "irc_out" benutzt) Um eine Liste der + IRC-Nachrichten zu erhalten, lies bitte folgende Dokumente: + RFCs + 1459 + and + 2812. + Außerdem gibt es den Wert "*", der alle Nachrichten + anspricht (ohne Filter). + + + + + : aufgerufene Funktion + + + + + + Rückgabewert: 1 bei Erfolg, 0 bei einem aufgetretenem Fehler + + + Beispiele: + +# perl +weechat::add_modifier("irc_in", "privmsg", "mod_in"); +weechat::add_modifier("irc_out", "privmsg", "mod_out"); +sub mod_in +{ + return "$_[1] [modifier IN]"; +} +sub mod_out +{ + return "$_[1] [modifier OUT]"; +} + +# python +weechat.add_modifier("irc_in", "privmsg", "mod_in") +weechat.add_modifier("irc_out", "privmsg", "mod_out") +def mod_in(server, args): + return args + " [modifier IN]" +def mod_out(server, args): + return args + " [modifier OUT]" + +# ruby +Weechat.add_modifier("irc_in", "privmsg", "mod_in") +Weechat.add_modifier("irc_out", "privmsg", "mod_out") +def mod_in(server, args) + return args + " [modifier IN]" +end +def mod_out(server, args) + return args + " [modifier OUT]" +end + +-- lua +weechat.add_modifier("irc_in", "privmsg", "mod_in") +weechat.add_modifier("irc_out", "privmsg", "mod_out") +function mod_in(server, args) + return args .. " [modifier IN]" +end +function mod_out(server, args) + return args .. " [modifier OUT]" +end + + +
+ +
+ remove_modifier + + + Perl-Prototyp: + + weechat::remove_modifier(type, message, function); + + + + Python-Prototyp: + + weechat.remove_modifier(type, message, function) + + + + Ruby-Prototyp: + + Weechat.remove_modifier(type, message, function) + + + + Lua-Prototyp: + + weechat.remove_modifier(type, message, function) + + + + Entfernt einen Nachrichtenmodifikator. + + + Argumente: + + + + : Modifikatorart + + + + + : Nachrichtenart, die der Modifikator + verwaltet + + + + + : Funktion + + + + + + Rückgabewert: 1 bei Erfolg, 0 bei einem aufgetretenem Fehler + + + Beispiele: + +# perl +weechat::remove_modifier("irc_in", "privmsg", "mod_in"); + +# python +weechat.remove_modifier("irc_in", "privmsg", "mod_in") + +# ruby +Weechat.remove_modifier("irc_in", "privmsg", "mod_in") + +-- lua +weechat.remove_modifier("irc_in", "privmsg", "mod_in") + + +
+ +
+ command + + + Perl-Prototyp: + + weechat::command(command, [channel, [server]]); + + + + Python-Prototyp: + + weechat.command(command, [channel, [server]]) + + + + Ruby-Prototyp: + + Weechat.command(command, [channel, [server]]) + + + + Lua-Prototyp: + + weechat.command(command, [channel, [server]]) + + + + Führt ein WeeChat-Kommando aus (oder sendet eine Nachricht an einen + Channel). + + + Argumente: + + + + : Kommando + + + + + : Name des Channels, für den das + Kommando ausgeführt werden soll + + + + + : interner Name des Servers, für den + das Kommando ausgeführt werden soll + + + + + + Rückgabewert: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist + + + Beispiele: + +# perl +weechat::command("hello everybody!"); +weechat::command("/kick toto please leave this channel", "#weechat"); +weechat::command("/nick newnick", "", "freenode"); + +# python +weechat.command("hello everybody!") +weechat.command("/kick toto please leave this channel", "#weechat") +weechat.command("/nick newnick", "", "freenode") + +# ruby +Weechat.command("hello everybody!") +Weechat.command("/kick toto please leave this channel", "#weechat") +Weechat.command("/nick newnick", "", "freenode") + +-- lua +weechat.command("hello everybody!") +weechat.command("/kick toto please leave this channel", "#weechat") +weechat.command("/nick newnick", "", "freenode") + + +
+ +
+ get_info + + + Perl-Prototyp: + + weechat::get_info(name, [server]); + + + + Python-Prototyp: + + weechat.get_info(name, [server]) + + + + Ruby-Prototyp: + + Weechat.get_info(name, [server]) + + + + Lua-Prototyp: + + weechat.get_info(name, [server]) + + + + Gibt ein Info über WweeChat oder einen Channel zurück. + + + Argumente: + + + + : Name (Typ) des Infos, das gelesen + werden soll (siehe ) + + + + + : interner Name des Servers + + + + + + Rückgabewert: angefragte Infos, oder leerer String, wenn ein + Fehler aufgetreten ist. + + + Beispiele: + +# 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") + + +
+ +
+ get_dcc_info + + + Perl-Prototyp: + + weechat::get_dcc_info(); + + + + Python-Prototyp: + + weechat.get_dcc_info() + + + + Ruby-Prototyp: + + Weechat.get_dcc_info() + + + + Lua-Prototyp: + + weechat.get_dcc_info() + + + + Gibt eine Liste der gegenwärtig aktiven oder beendeten DCCs zurück. + + + Rückgabewert: Liste der DCCS + (siehe ). + + + Beispiele: + +# 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("no DCC"); +} + +# python +dccs = weechat.get_dcc_info() +if dccs != None: + if dccs == []: + weechat.prnt("no DCC") + else: + for d in dccs: + for b in d.keys(): + weechat.prnt("%s = '%s'" %(b, d[b])) +else: + weechat.prnt("error while getting DCC") + +# ruby +dccs = Weechat.get_dcc_info() +if dccs != nil + if dccs == [] + Weechat.print("no DCC") + else + dccs.each do |m| + m.each do |key, value| + Weechat.print("#{key} = '#{value}'") + end + end + end +else + Weechat.print("error while getting 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("no DCC") + end +else + weechat.print("error while getting DCC") +end + + +
+ +
+ get_server_info + + + Perl-Prototyp: + + weechat::get_server_info(); + + + + Python-Prototyp: + + weechat.get_server_info() + + + + Ruby-Prototyp: + + Weechat.get_server_info() + + + + Lua-Prototyp: + + weechat.get_server_info() + + + + Gibt eine Liste der IRC-Server zurück (verbunden oder nicht). + + + Rückgabewert: Liste der Server + (siehe ). + + + Beispiele: + +# 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("no server"); +} + +# python +servers = weechat.get_server_info() +if servers != None: + if servers == {}: + weechat.prnt("no server") + else: + for s in servers: + for i in servers[s]: + weechat.prnt("%s -> %s = '%s'" % (s, i, str(servers[s][i]))) +else: + weechat.prnt("error while getting servers") + +# ruby +servers = Weechat.get_server_info() +if servers != nil + if servers == [] + Weechat.print("no server") + else + servers.each do |n, s| + s.each do |key, value| + Weechat.print("#{n} -> #{key} = '#{value}'") + end + end + end +else + Weechat.print("error while getting servers") +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("no server") + end +else + weechat.print("error while getting servers") +end + + +
+ +
+ get_channel_info + + + Perl-Prototyp: + + weechat::get_channel_info(server); + + + + Python-Prototyp: + + weechat.get_channel_info(server) + + + + Ruby-Prototyp: + + Weechat.get_channel_info(server) + + + + Lua-Prototyp: + + weechat.get_channel_info(server) + + + + Gibt eine Liste der Channels für einen Server zurück. + + + Rückgabewert: Liste der Channel für einen Server + (siehe ). + + + Beispiele: + +# 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("no channel"); +} + +# python +chans = weechat.get_channel_info(weechat.get_info("server")) +if chans != None: + if chans == {}: + weechat.prnt("no channel") + else: + for s in chans: + for i in chans[s]: + weechat.prnt("%s -> %s = '%s'" % (s, i, str(chans[s][i]))) +else: + weechat.prnt("error while getting channels") + +# ruby +channels = Weechat.get_channel_info(Weechat.get_info("server")) +if channels != nil + if channels == {} + Weechat.print("no channel") + else + channels.each do |n, c| + c.each do |key, value| + Weechat.print("#{n} -> #{key} = '#{value}'") + end + end + end +else + Weechat.print("error while getting channels") +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("no channel") + end +else + weechat.print("error while getting channels") +end + + +
+ +
+ get_nick_info + + + Perl-Prototyp: + + weechat::get_nick_info(server, channel); + + + + Python-Prototyp: + + weechat.get_nick_info(server, channel) + + + + Ruby-Prototyp: + + Weechat.get_nick_info(server, channel) + + + + Lua-Prototyp: + + weechat.get_nick_info(server, channel) + + + + Gibt eine Liste der Nicknamen für einen Channel zurück. + + + Rückgabewert: Liste der Nicknamen eines Channels + (siehe ). + + + Beispiele: + +# 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("no nick"); +} + +# python +nicks = weechat.get_nick_info("freenode", "#weechat") +if nicks != None: + if nicks == {}: + weechat.prnt("no nick") + else: + for n in nicks: + for f in nicks[n]: + weechat.prnt("%s -> %s = '%s'" % (n, f, str(nicks[n][f]))) +else: + weechat.prnt("error while getting nicks") + +# ruby +nicks = Weechat.get_nick_info("freenode", "#weechat") +if nicks != nil + if nicks == {} + Weechat.print("no nick") + else + nicks.each do |nk, nattr| + nattr.each do |key, value| + Weechat.print("#{nk} -> #{key} = '#{value}'") + end + end + end +else + Weechat.print("error while getting nicks") +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("no nick") + end +else + weechat.print("error while getting nicks") +end + + +
+ +
+ get_config + + + Perl-Prototyp: + + weechat::get_config(option); + + + + Python-Prototyp: + + weechat.get_config(option) + + + + Ruby-Prototyp: + + Weechat.get_config(option) + + + + Lua-Prototyp: + + weechat.get_config(option) + + + + Gibt den Wert einer Option der WeeChat-Konfiguration zurück. + + + Argumente: + + + + : Name der Option + + + + + + Rückgabewert: Wert der Option, leerer String wenn nichts gefunden + wurde. + + + Beispiele: + +# perl +$value1 = weechat::get_config("look_nicklist"); +$value2 = weechat::get_config("freenode.server_autojoin"); + +# python +value1 = weechat.get_config("look_nicklist") +value2 = weechat.get_config("freenode.server_autojoin") + +# ruby +value1 = Weechat.get_config("look_nicklist") +value2 = Weechat.get_config("freenode.server_autojoin") + +-- lua +value1 = weechat.get_config("look_nicklist") +value2 = weechat.get_config("freenode.server_autojoin") + + +
+ +
+ set_config + + + Perl-Prototyp: + + weechat::set_config(option, value); + + + + Python-Prototyp: + + weechat.set_config(option, value) + + + + Ruby-Prototyp: + + Weechat.set_config(option, value) + + + + Lua-Prototyp: + + weechat.set_config(option, value) + + + + Setze den Wert einer Option der WeeChat-Konfiguration. + + + Argumente: + + + + : Name der Option, die gesetzt werden + soll + + + + + : neuer Wert der Option + + + + + + Rückgabewert: 1 wenn der Wert gesetzt wurde, 0 wenn ein Fehler + aufgetreten ist. + + + Beispiele: + +# 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") + + +
+ +
+ get_plugin_config + + + Perl-Prototyp: + + weechat::get_plugin_config(option); + + + + Python-Prototyp: + + weechat.get_plugin_config(option) + + + + Ruby-Prototyp: + + Weechat.get_plugin_config(option) + + + + Lua-Prototyp: + + weechat.get_plugin_config(option) + + + + Gibt den Wert einer Option eines Plugins zurück. Die Option wird + aus der Datei "~/.weechat/plugins.rc" gelesen + und sieht so aus: "plugin.option=value" + (Hinweis: Der Name des Plugins wird automatisch gesetzt). + + + Argumente: + + + + : Name der zu lesenden Option + + + + + + Rückgabewert: Wert der Option, leerer String wenn die Option nicht + gefunden wurde. + + + Beispiele: + +# perl +$value = weechat::get_plugin_config("my_var"); + +# python +value = weechat.get_plugin_config("my_var") + +# ruby +value = Weechat.get_plugin_config("my_var") + +-- lua +value = weechat.get_plugin_config("my_var") + + +
+ +
+ set_plugin_config + + + Perl-Prototyp: + + weechat::set_plugin_config(option, value); + + + + Python-Prototyp: + + weechat.set_plugin_config(option, value) + + + + Ruby-Prototyp: + + Weechat.set_plugin_config(option, value) + + + + Lua-Prototyp: + + weechat.set_plugin_config(option, value) + + + + Setzt den Wert einer Option eines Plugins. Die Option bzw. ihr Wert + wird in "~/.weechat/plugins.rc" geschrieben und + sieht so aus: "plugin.option=value" + (Hinweis: der Name des Plugins wird automatisch gesetzt). + + + Argumente: + + + + : Name der Option, die gesetzt werden + soll + + + + + : Der neue Wert der Option + + + + + + Rückgabewert: 1 wenn die Option gesetzt wurde, 0 wenn ein Fehler + aufgetreten ist. + + + Beispiele: + +# perl +weechat::set_plugin_config("my_var", "value"); + +# python +weechat.set_plugin_config("my_var", "value") + +# ruby +Weechat.set_plugin_config("my_var", "value") + +-- lua +weechat.set_plugin_config("my_var", "value") + + +
+ +
+ get_irc_color + + + Perl-Prototyp: + + weechat::get_irc_color(color); + + + + Python-Prototyp: + + weechat.get_irc_color(color) + + + + Ruby-Prototyp: + + Weechat.get_irc_color(color) + + + + Lua-Prototyp: + + weechat.get_irc_color(color) + + + + Hole IRC-Farbindex mit dem Farbnamen. + + + Rückgabewert: IRC-Farbindex, -1 wenn die Farbe nicht gefunden wurde + (siehe ). + + + Beispiele: + +# 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") + + +
+ +
+ input_color + + + Perl-Prototyp: + + weechat::input_color(color); + + + + Python-Prototyp: + + weechat.input_color(color) + + + + Ruby-Prototyp: + + Weechat.input_color(color) + + + + Lua-Prototyp: + + weechat.input_color(color) + + + + Erzeugt einen Farbcode im Eingabepuffer.Add color in input buffer. + + + Rückgabewert: keiner. + + + Bespiele: + +# 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) + + +
+ +
+ get_window_info + + + Perl-Prototyp: + + weechat::get_window_info(); + + + + Python-Prototyp: + + weechat.get_window_info() + + + + Ruby-Prototyp: + + Weechat.get_window_info() + + + + Lua-Prototyp: + + weechat.get_window_info() + + + + Gibt die Liste der WeeChat-Fenster zurück. + + + Rückgabewert: List der WeeChat-Fenster + (see ). + + + Besipiele: + +# perl +my @wf = weechat::get_window_info(); +if (@wf) +{ + weechat::print("**** Fenster-Informationen ****"); + foreach my $w (@wf) + { + while ( my ($key, $value) = each %$w) + { + weechat::print(" > $key => $value"); + } + weechat::print("----------------------"); + } +} +else +{ + weechat::print("**** Keine Fenster-Informationen ****"); +} + +# python +wf = weechat.get_window_info() +if wf != None and wf != []: + weechat.prnt ("**** Fenster-Informationen ****") + for w in wf: + for i in w: + weechat.prnt (" > %s => %s" % (i, w[i])) + weechat.prnt ("----------------------") +else: + weechat.prnt ("**** Keine Fenster-Informationen ****") + +# ruby +wf = Weechat.get_window_info() +if wf != nil and wf != [] + Weechat.print("**** Fenster-Informationen ****") + wf.each do |w| + w.each do |key, value| + Weechat.print(" > #{key} => #{value}") + end + Weechat.print("----------------------") + end +else + Weechat.print("**** Keine Fenster-Informationen ****") +end + +-- lua +wf = weechat.get_window_info() +if wf then + weechat.print ("**** Fenster-Informationen ****") + 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("**** Keine Fenster-Informationen ****") +end + + +
+ +
+ get_buffer_info + + + Perl-Prototyp: + + weechat::get_buffer_info(); + + + + Python-Prototyp: + + weechat.get_buffer_info() + + + + Ruby-Prototyp: + + Weechat.get_buffer_info() + + + + Lua-Prototyp: + + weechat.get_buffer_info() + + + + Gibt eine Liste der WeeChat-Puffer. + + + Rückgabewert: Liste der WeeChat-Puffer + (siehe ). + + + Beispiele: + +# 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"); + } + weechat::print("----------------------"); + } +} +else +{ + weechat::print("**** keine Pufferinformationen ****"); +} + +# python +bf = weechat.get_buffer_info() +if bf != None and bf != {}: + for b in bf: + weechat.prnt ("**** Informationen für Puffer Nr. %d ****" % b) + for c in bf[b]: + weechat.prnt (" > %s => %s" % (c, bf[b][c])) + weechat.prnt ("----------------------") +else: + weechat.prnt ("**** keine Pufferinformationen ****") + +# ruby +bf = Weechat.get_buffer_info() +if bf != nil and bf != {} + bf.each do |n, c| + Weechat.print("**** Informationen für Puffer Nr. #{n} ****") + c.each do |key, value| + Weechat.print(" > #{key} => #{value}") + end + Weechat.print("----------------------") + end +else + Weechat.print("**** keine Pufferinformationen ****") +end + +-- lua +bf = weechat.get_buffer_info() +if bf then + b, binfos = next (bf, nil) + while (b) do + weechat.print("**** Informationen für Puffer Nr. " .. b .. " ****") + key, value = next (binfos, nil) + while (key) do + weechat.print(" > " .. key .. " => " .. value) + key, value = next (binfos, key) + end + weechat.print ("----------------------") + b, infos = next (bf, b) + end +else + weechat.print("**** keine Pufferinformationen ****") +end + + +
+ +
+ get_buffer_data + + + Perl-Prototyp: + + weechat::get_buffer_data(server, channel); + + + + Python-Prototyp: + + weechat.get_buffer_data(server, channel) + + + + Ruby-Prototyp: + + Weechat.get_buffer_data(server, channel) + + + + Lua-Prototyp: + + weechat.get_buffer_data(server, channel) + + + + Gibt den Inhalt eines Puffers zurück. + + + Rückgabewert: Liste der Pufferzeilen + (see ). + + + Beispiele: + +# perl +my $server = weechat::get_info("server"); +my $channel = weechat::get_info("channel"); +my @bc = weechat::get_buffer_data($server, $channel); +if (@bc) +{ + weechat::print("**** Pufferdaten für '$channel'\@'$server' ****"); + foreach my $l (@bc) { + while ( my ($key, $value) = each %$l) { + weechat::print(" > $key => $value"); + } + weechat::print("----------------------"); + } +} +else +{ + weechat::print("**** keine Pufferdaten ****"); +} + +# python +server = weechat.get_info("server") +channel = weechat.get_info("channel") +bc = weechat.get_buffer_data(server, channel) +if bc != None and bc != []: + weechat.prnt ("**** Pufferdaten für '%s'@'%s' ****" % (channel, server)) + for l in bc: + for i in l: + weechat.prnt (" > %s => %s" % (i, l[i])) + weechat.prnt ("----------------------") +else: + weechat.prnt ("**** keine Pufferdaten ****") + +# ruby +server = Weechat.get_info("server") +channel = Weechat.get_info("channel") +bc = Weechat.get_buffer_data(server, channel) +if bc != nil and bc != [] + Weechat.print("**** Pufferdaten für '#{channel}'@'#{server}' ****") + bc.each do |l| + l.each do |key, value| + Weechat.print(" > #{key} => #{value}") + end + Weechat.print("----------------------") + end +else + Weechat.print("**** keine Pufferdaten ****") +end + +-- lua +server = weechat.get_info("server") +channel = weechat.get_info("channel") +bc = weechat.get_buffer_data(server, channel) +if bc then + b, bdatas = next (bc, nil) + weechat.print("**** Pufferdaten für '" .. channel .. "'@'" .. server .. "' ****") + while (b) do + key, value = next (bdatas, 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("**** keine Pufferdaten ****") +end + + +
+ +
+ +
diff --git a/doc/de/plugins.de.xml b/doc/de/plugins.de.xml new file mode 100644 index 000000000..56f39eb20 --- /dev/null +++ b/doc/de/plugins.de.xml @@ -0,0 +1,214 @@ + + + + + + Plugins + + + Dieses Kapitel beschreibt das Plugin-Interface (API) in WeeChat und die + Standard-Skriptplugins (Perl, Python, Ruby, Lua), die zu WeeChat gehören. + + +
+ Plugins in WeeChat + + + Ein Plugin ist ein C-Programm, dass WeeChat-Funktionen aufrufen kann, + die in einem Interface definiert sind. + + + + Dieses C-Programm braucht nicht den Quellcode von WeeChat (aber die + API-Beschreibung) und kann dynamisch mit dem folgenden Kommando in + WeeChat geladen werden + /plugin. + + + + Das Plugin muss in Form einer dynamischen Bibliothek vorliegen, + damit es das Betriebssystem dynamisch laden kann. + Unter GNU/Linux besitzt die Datei die Endung ".so", unter + Windows ".dll". + + +
+ +
+ Ein Plugin schreiben + + + Das Plugin muss die Datei "weechat-plugin.h" einbinden (verfügbar + im WeeChat-Quellcode). + Diese Datei definiert die Strukturen und Typen um mit WeeChat + zu kommunizieren. + + + + Das Plugin muss einige Variablen und Funktionen besitzen + (nötig, sonst kann das Plugin nicht geladen werden): + + + + + Variable + Beschreibung + + + + + char plugin_name[] + Plugin Name + + + char plugin_version[] + Plugin Version + + + char plugin_description[] + kurze Beschreibung des Plugins + + + + + + + + + + Funktion + Beschreibung + + + + + int weechat_plugin_init (t_weechat_plugin *plugin) + + Die Funktion wird aufgerufen, wenn das Plugin geladen wird. + Sie muss bei Erfolg PLUGIN_RC_OK, bei Fehlschlag PLUGIN_RC_KO + zurückgeben. (Bei einem Fehler wird das Plugin nicht geladen) + + + + void weechat_plugin_end (t_weechat_plugin *plugin) + Funktion wird beim Abschalten aufgerufen + + + + + + + &plugin_api.de.xml; + +
+ Übersetzen eines Plugins + + + Das Übersetzen braucht keine WeeChat-Quellen, aber die Datei "weechat-plugin.h". + + + + Um ein Plugin zu übersetzen, das aus einer Datei "toto.c" besteht + (unter GNU/Linux): + +$ gcc -fPIC -Wall -c toto.c +$ gcc -shared -fPIC -o libtoto.so toto.o + + + +
+ +
+ Laden des Plugins in WeeChat + + + Kopiere die Datei "libtoto.so" in das Plugin-Verzeichnis der + systemweiten Dateien WeeChats (zum Beispiel: + "/usr/local/lib/weechat/plugins") oder in das + Plugin-Verzeichnis des Users (zum Beispiel: + "/home/xxxxx/.weechat/plugins"). + + + + In WeeChat: + /plugin load toto + + +
+ +
+ Plugin Beispiel + + + Vollständiges Beispiel eines Plugins, welches das Kommando /double + implementiert, dass seine Argumente im gegenwärtigen Channel doppelt + ausgibt (ok, das ist weniger nützlich, aber auch nur ein Beispiel!): + +#include <stdlib.h> + +#include "weechat-plugin.h" + +char plugin_name[] = "Double"; +char plugin_version[] = "0.1"; +char plugin_description[] = "Test plugin for WeeChat"; + +/* "/double" command manager */ + +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", + "Display two times a message", + "msg", + "msg: message to display two times", + NULL, + &double_cmd, + NULL, NULL); + return PLUGIN_RC_OK; +} + +void weechat_plugin_end (t_weechat_plugin *plugin) +{ + /* nothing done here */ +} + + + +
+ +
+ + &plugin_charset.de.xml; + + &plugin_scripts.de.xml; + +
diff --git a/doc/de/usage.de.xml b/doc/de/usage.de.xml new file mode 100644 index 000000000..cd7b65732 --- /dev/null +++ b/doc/de/usage.de.xml @@ -0,0 +1,961 @@ + + + + + + Nutzung + + + Dieses Kapitel erklärt, wie Weechat zu starten ist, die zu verwendenden + Tastenkombinationen, interne und IRC-Kommandos, die Konfigurationsdatei + und die FIFO für die remote-Bedienung. + + +
+ Starten von WeeChat + + + Argumente der Kommandozeile: + + + + + Parameter + Beschreibung + + + + + -a, --no-connect + + Schaltet das auto-connect ab + + + + -c, --config + + Zeigt eine Hilfe zu den Konfigurationsmöglichkeiten (Liste + der Optionen) + + + + -d, --dir <path> + + Setzt den Pfad für das Verzeichnis, dass Weechat benutzen + soll (relevant für die Konfigurationsdateien, Logs, Plugins + und Skripte). Der Standardwert + "~/.weechat". Bitte beachten Sie: dieses + Verzeichnis wird automatisch erzeugt, wenn es noch nicht + exitiert. + + + + -f, --key-functions + + Zeigt die intern verwendeten Funktionen von WeeChat für + bestimmte Tastenkombinationen an + + + + -h, --help + + Zeigt eine zusammenfassende Hilfe an. + + + + -i, --irc-commands + + Zeigt die IRC-Kommandos an + + + + -k, --keys + + Zeigt die Standard-Tastenkombinationen an + + + + -l, --license + + Zeigt die Lizenz an + + + + -p, --no-plugin + + Schaltet das automatische Laden der Plugins ab + + + + -v, --version + + Zeigt die Programmversion an + + + + -w, --weechat-commands + + Zeigt die Weechat-eigenen Kommandos an + + + + + + + + + Es ist auch möglich URLs für einen oder mehrere IRC-Server anzugeben, + so wie: + irc[6][s]://[nick[:passwort]@]irc.example.org[:port][/channel][,channel[...] + Beispiel um die Channels #weechat and #toto zu betreten + "irc.freenode.net" server, default port (6667), + mit dem Nicknamen "nono": + $ weechat-curses irc://nono@irc.freenode.net/#weechat,#toto + + + + Um WeeChat zu starten, ist eins der folgenden Kommandos abzusetzen: + + + + für Curses GUI: weechat-curses + + + + + für Gtk GUI: weechat-gtk + + + + + für wxWidgets GUI: weechat-wxwidgets + + + + + für Qt GUI: weechat-qt + + + + + + + Wenn Sie Weechat zum ersten Mal starten, wird eine Konfigurationsdatei + erzeugt, deren Optionen besitzen Standardwerte. Diese Datei ist: + "~/.weechat/weechat.rc" + + + + Sie können diese Datei entsprechend ihren Bedürfnissen editieren, + um Weechat anzupassen (NUR wenn Weechat nicht läuft) oder Parameter + zu beeinflussen mit + "/set" Kommando in WeeChat + (siehe ) + + +
+ +
+ Tastenkombinationen + + + + + + + Tastenkombination + Wirkung + + + + + Links / Strg + B + + Gehe zum vorherigen Zeichen in der Kommandozeile + + + + Rechts / Strg + F + + Gehe zum nächsten Zeichen in der Kommandozeile + + + + Strg + Links + + Gehe zum vorherigen Wort in der Kommandozeile + + + + Strg + Rechts + + Gehe zum nächsten Wort in der Kommandozeile + + + + Pos1 / Strg + A + + Gehe zum Anfang der Kommandozeile + + + + + Strg + C dann B + + Insert code for bold text. + + + + Strg + C dann C + + Insert code for colored text. + + + + Strg + C dann O + + Insert code for color reset. + + + + Strg + C dann R + + Insert code for reverse color. + + + + Strg + C dann U + + Insert code for underlined text. + + + + Ende / Strg + E + + Gehe zum Ende der Kommandozeile + + + + Strg + K + + Lösche vom Cursor bis zum Ende der Kommandozeile + + + + Strg + L + + Fenster neu aufbauen + + + + Strg + R + + Suche nach Text im Pufferverlauf + (zwei Mal: suche nach dem genauen Text) + + + + Strg + S dann Strg + U + + + Set unread marker on all buffers + + + + Strg + T + + Zeichen transponieren + + + + Strg + U + + Lösche vom Cursor bis zum Aanfang der Kommandozeile + + + + Strg + W + + Lösche das vorhergehende Wort in der Kommandozeile + + + + Strg + Y + + Inhalt der Zwischenablage einfügen + + + + Rückschritt / Strg + H + + Lösche das vorhergehende Zeichen in der Kommandozeile + + + + Entfernen / Strg + D + + Lösche das nächste Zeichen in der Kommandozeile + + + + Tabulator / Shift + Tabulator + + Vervollständige ein Kommando oder Nick + (wiederhole: finde nächste Vervollständigung) + + + + Jedes Zeichen + + Setze das Zeichen beim Cursor in die Kommandozeile ein + + + + Eingabe / Strg + J / Strg + M + + Führe ein Kommando aus oder sende eine Nachricht + (im Suchmodus: Suche anhalten) + + + + Hoch / Runter + + Rufe das letzte Kommando/die letzte Nachricht wieder auf + (im Suchmodus: suche rückwärts/vorwärts) + + + + Strg + Hoch / Strg + Runter + + Rufe das letzte Kommando/die letzte Nachricht des globalen + Buffers wieder auf (für alle Buffer) + + + + Seite hoch / Seite runter + + Eine Seite hoch / runter im Verlauf des Buffers + + + + Alt + Seite hoch / Alt + Seite runter + + Ein paar Zeilen hoch / runter im Verlauf des Buffers + + + + Alt + Pos1 / Alt + Ende + + Gehe zum Anfang / Ende des Puffers + + + + F5 / Alt + Links + + Gehe zum vorherigen Puffer + + + + F6 / Alt + Rechts + + Gehe zum nächsten Puffer + + + + F7 + + Schalte in das vorherige Fenster + + + + F8 + + Schalte in das nächste Fenster + + + + F9 / F10 + + Blättere in der Topic + + + + F11 / F12 + + Blättere in der Nicklist + + + + Alt + F11 / Alt + F12 + + Gehe zum Anfang / Ende der Nicklist + + + + Alt + A + + Schalte in den nächsten Puffer mit Aktivität + (mit der Priorität: highlight, message, other) + + + + Alt + B + + Gehe zum vorherigen Wort in der Kommandozeile + + + + Alt + D + + Lösche das nächste Wort in der Kommandozeile + + + + Alt + F + + Gehe zum nächsten Wort in der Kommandozeile + + + + Alt + H + + Lösche den Inhalt der Hotlist + (Aktivitätsanzeige für andere Puffer) + + + + Alt + I + + Entferne den letzten Hinweis in der Infobar + + + + Alt + J dann Alt + D + + Zeige den DCC-Puffer + + + + Alt + J dann Alt + L + + Schalte zum letzten Puffer + + + + Alt + J then Alt + P + + + Switch to buffer previously displayed + + + + Alt + J dann Alt + R + + Schalte in den reinen IRC-Daten Puffer + + + + Alt + J dann Alt + S + + Schalte in den Server-Puffer + + + + Alt + J dann Alt + X + + Schalte in den ersten Channel des nächsten Servers + (oder in den Server-Puffer wenn keine Channel offen ist) + + + + Alt + Zahl (0-9) + + Schalte in den Puffer mit der Nummer (0 = 10) + + + + Alt + J dann eine Zahl (01-99) + + Schalte in den Puffer mit der Nummer + + + + Alt + K + + Setze den Keycode der nächsten Taste in der Kommandozeile + ein + + + + Alt + N + + Blättere zum nächsten Highlight + + + + Alt + P + + Blättere zum vorigen Highlight + + + + Alt + R + + Lösche die komplette Kommandozeile + + + + Alt + S + + Schalte zwischen den Servern im Server-Puffer hin und her + (wenn "look_one_server_buffer" angeschaltet ist) + + + + Alt + U + + Blättere zur ersten ungelesenen Zeile im Puffer + + + + Alt + W dann Alt + Pfeil + + Schalte zum Fenster in der entsprechenden Richtung + + + + + + + +
+ +
+ Kommandozeile + + + Die WeeChat Kommandozeile (am Ende des Fensters) lässt sie Nachrichten + an einen Channel senden oder WeeChat- bzw. IRC-Kommandos ausführen + (siehe ). + + + + Kommandos beginnen mit einem "/", gefolgt vom Namen des Kommandos. + Um zum Beispiel einen privaten Chat mit "toto" zu + beginnen: /query toto + + + + Nachrichten an einen Channel sind jeder Text, der nicht mit einem "/" + begint. Um zum Beispiel den Text "hello" an den + gegenwärtigen Channel zu senden: + hello + + + + Dennoch ist es möglich, eine Nachricht auch mit einem "/" zu beginnen, + einfach ein weiteres "/" voranstellen. Um zum Beispiel den Text + "/query toto" an den gegenwärtigen Channel zu + senden: + //query toto + + + + Wenn die Option IRC-Farben ("irc_colors_send") + senden angeschaltet ist, können sie Farbcodierung und Attribute + wiefolgt verwenden + + (press Ctrl-C then following letter, with optional value): + + + + + Code + Beschreibung + + + + + ^Cb + + Fett (bold) + + + + ^Ccxx + + Textfarbe "xx" (color) + (siehe Farbtabelle) + + + + ^Ccxx,yy + + Textfarbe "xx" + und Hintergrund "yy" + (siehe Farbtabelle) + + + + ^Co + + Schalte Farben und Attribute ab + + + + ^Cr + + umgedrehte Farben (tausche Textfarbe mit Hintergrundfarbe) + + + + ^Cu + + Unterstreiche Text + + + + + + Hinweis: Der gleiche Farbcode (ohne die Nummer) kann zum Ausschalten + des Attributes verwendet werden. + + + + Farbcodes für ^Cc: + + + + + Code + Farbe + + + + + 00 + weiss + + + 01 + schwarz + + + 02 + dunkles Blau + + + 03 + dunkles Grün + + + 04 + helles Rot + + + 05 + dunkles Rot + + + 06 + Magenta + + + 07 + Orange + + + 08 + Gelb + + + 09 + helles Grün + + + 10 + Cyan + + + 11 + helles Cyan + + + 12 + helles Blau + + + 13 + helles Magenta + + + 14 + Grau + + + 15 + helles Grau (Weiss) + + + + + + + + Beispiel: Anzeige von "hello everybody!" mit + "hello" fett in hellem Blau, und + "everybody" unterstrichen in hellem Rot: +^Cc12^Cbhello^Cb^Cc04^Cu everybody^Cu^Cc! + + +
+ +
+ WeeChat / IRC Kommandos + + + Dieses Kapitel listet alle WeeChat- und IRC-Kommandos auf. + + +
+ WeeChat Kommandos + + + &weechat_commands.xml; + + +
+ +
+ Funktionen + + + + + + + Funktion + Beschreibung + + + + + &key_functions.xml; + + + + + + +
+ +
+ IRC Kommandos + + + &irc_commands.xml; + + +
+ +
+ +
+ Konfigurationsdatei + + + Liste der Optionen für die Konfigurationsdatei: + + + + + Option + Typ + Wert + Default + Beschreibung + + + + + &config.xml; + + + + + + + + Farben für die Curses GUI: + + + + + Schlüsselwort + Farbe + + + + + default + default Farbe (Transparent für den Hintergrund) + + + black + Schwarz + + + red + dunkles Rot + + + lightred + helles Rot + + + green + dunkles Grün + + + lightgreen + helles Grün + + + brown + Braun + + + yellow + Gelb + + + blue + dunkles Blau + + + lightblue + helles Blau + + + magenta + dunkles Magenta + + + lightmagenta + helles Magenta + + + cyan + dunkles Cyan + + + lightcyan + helles Cyan + + + white + Weiss + + + + + + +
+ +
+ Remote-Schnittstelle (FIFO pipe) + + + Sie können WeeChat auch extern steuern, indem sie Kommandos oder Text + an eine sogen. pipe übergeben (sie müssen die Option "irc_fifo_pipe" + anschalten, die normalerweise abgeschaltet ist). + + + + Diese pipe liegt in "~/.weechat/" und hat den Namen + "weechat_fifo_xxxxx" (das xxxxx ist die Prozess-ID (PID) eines + laufenden WeeChat). Wenn mehrere Instanzen von WeeChat laufen, sind + mehrere pipes vorhanden, eine für jede Instanz. + + + + Der Syntax für ein pipe-Kommando ist: + server,channel *Text oder Kommando + wobei Server und Channel optional sind, aber wenn der Channel + angegeben ist, muss der Server auch angegeben werden. + + + + Einige Beispiele: + + + + Ändern des Nicks auf freenode in "mynick|out" : + $ echo 'freenode */nick mynick|out' >~/.weechat/weechat_fifo_12345 + + + + + Senden einer Nachricht an #weechat: + $ echo 'freenode,#weechat *hello everybody!' >~/.weechat/weechat_fifo_12345 + + + + + Senden einer Nachricht an den gegenwärtigen Channel (Puffer, der + in WeeChat angezeigt wird): + $ echo '*hello!' >~/.weechat/weechat_fifo_12345 + Warnung: Das ist gefährlich und sie sollten + das nicht tun, ausgenommen sie wissen was sie tun! + + + + + Sende zwei Kommandos um (alle) Perl-Skripte abzuschalten/neu zu + laden (getrennt durch ein "\n"): + $ echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345 + + + + + + + Sie können ein Skript schreiben, um ein Kommando an alle laufenden WeeChat-Instanzen zu senden, + zum Beispiel: + +#!/bin/sh +if [ $# -eq 1 ]; then + for fifo in ~/.weechat/weechat_fifo_* + do + echo -e "$1" >$fifo + done +fi + + Wenn das Skript "auto_weechat_command" heisst, können sie es + folgendermassen aufrufen: + $ ./auto_weechat_command "freenode,#weechat *hello" + + +
+ +
diff --git a/doc/de/weechat.de.xml b/doc/de/weechat.de.xml index b8167f241..11e84b23e 100644 --- a/doc/de/weechat.de.xml +++ b/doc/de/weechat.de.xml @@ -24,11 +24,22 @@ along with this program. If not, see . + + + + + + + + + + ]> diff --git a/doc/en/Makefile.am b/doc/en/Makefile.am index 9ba7e54e2..7e781921f 100644 --- a/doc/en/Makefile.am +++ b/doc/en/Makefile.am @@ -16,7 +16,12 @@ LANGCODE = en BOOK = weechat.$(LANGCODE) -BOOK_INCLUDE = weechat_commands.xml irc_commands.xml key_functions.xml config.xml +BOOK_INCLUDE = intro.$(LANGCODE).xml install.$(LANGCODE).xml \ + usage.$(LANGCODE).xml plugins.$(LANGCODE).xml \ + plugin_api.$(LANGCODE).xml plugin_charset.$(LANGCODE).xml \ + plugin_scripts.$(LANGCODE).xml \ + weechat_commands.xml irc_commands.xml key_functions.xml \ + config.xml QUICKSTART = weechat_quickstart.$(LANGCODE).txt EXTRA_DIST = $(BOOK).xml $(BOOK_INCLUDE) $(QUICKSTART) diff --git a/doc/en/authors.en.xml b/doc/en/authors.en.xml new file mode 100644 index 000000000..64957aa1a --- /dev/null +++ b/doc/en/authors.en.xml @@ -0,0 +1,184 @@ + + + + + + Authors / Support + + + This chapter lists authors and contributors for WeeChat, and + shows ways to get support. + + +
+ Authors + + + WeeChat is developed by: + + + + FlashCode (Sébastien Helleu) + flashcode AT flashtux.org - + main developer + + + + + kolter (Emmanuel Bouthenot) + kolter AT openics.org - + developer + + + + + Ptitlouis + ptitlouis AT sysif.net - + Debian packager + + + + + +
+ +
+ Contributors + + + Following people contributed to WeeChat: + + + + Jiri Golembiovsky - + czech translation, patches + + + + + Rudolf Polzer - + patches + + + + + Jim Ramsay - + patches + + + + + Odin - + SuSE RPM + + + + + Pistos - + patches + + + + + Gwenn - + patches + + + + + voroskoi - + hungarian translation + + + + + Frank Zacharias - + german translation + + + + + Pavel Shevchuk - + russian translation + + + + + +
+ +
+ Get support + + + Before asking for support, be sure you've read documentation and FAQ + provided with WeeChat (documentation is this document, if you don't + read all lines until this sentence, you can start again!) + + + + + + + IRC: server "irc.freenode.net", + channel "#weechat" + + + + + WeeChat forum: + + http://forums.flashtux.org + + + + + + Mailing list: + + + + To subscribe: + + http://mail.nongnu.org/mailman/listinfo/weechat-support + + + + + + To send a mail on mailing list: + weechat-support@nongnu.org + + + + Mailing list archives are available here: + + http://mail.nongnu.org/archive/html/weechat-support + + + + + + +
+ +
diff --git a/doc/en/install.en.xml b/doc/en/install.en.xml new file mode 100644 index 000000000..71d566e27 --- /dev/null +++ b/doc/en/install.en.xml @@ -0,0 +1,107 @@ + + + + + + Installation + + + This chapter explains how to install WeeChat. + + +
+ Binary packages + + + Binary packages are available for these distributions: + + + + Debian (or any Debian compatible distribution): + apt-get install weechat + + + + + Mandriva/RedHat (or any RPM compatible distribution): + + rpm -i /chemin/weechat-x.y.z-1.i386.rpm + + + + + + Gentoo : + emerge weechat + + + + + For other distributions, please look at your manual for + installation instructions. + + +
+ +
+ Source package + + + All you have to do is to run in a console or a terminal: +$ ./configure +$ make + + + Then get root privileges and install WeeChat: +$ su +(enter root password) +# make install + + +
+ +
+ GIT sources + + + Warning: GIT sources are for advanced users: it may not compile + or not be stable. You're warned! + + + + To get GIT sources, issue this command: +$ git-clone git://git.sv.gnu.org/weechat.git + + + + Execute this script: + ./autogen.sh + + + + Then follow instructions for source package + (see ) + + +
+ +
diff --git a/doc/en/intro.en.xml b/doc/en/intro.en.xml new file mode 100644 index 000000000..0e85bd743 --- /dev/null +++ b/doc/en/intro.en.xml @@ -0,0 +1,142 @@ + + + + + + Introduction + + + This chapter describes WeeChat and pre-requisites for its installation. + + +
+ Description + + + WeeChat (Wee Enhanced Environment for Chat) is a free chat client, + fast and light, designed for many operating systems. + + + + Main features are: + + + + multi-servers connection (with SSL, IPv6, proxy) + + + + + many GUI: Curses, wxWidgets, Gtk and Qt + + + + + small, fast and light + + + + + customizable and extensible with plugins and scripts + + + + + compliant with RFCs + 1459, + 2810, + 2811, + 2812 and + 2813 + + + + + multi-platform (GNU/Linux, *BSD, MacOS X, Windows and other) + + + + + 100% GPL, free software + + + + + + + WeeChat homepage is here: + + http://weechat.flashtux.org + + + +
+ +
+ Pre-requisites + + + In order to install WeeChat, you need: + + + + a running GNU/Linux system (with compiler tools for source + package) + + + + + "root" privileges (to install WeeChat) + + + + + according to GUI, one of the following libraries: + + + + Curses: ncurses library + + + + + Gtk: *** GUI not developed *** + + + + + WxWidgets: *** GUI not developed *** + + + + + Qt: *** GUI not developed *** + + + + + + + + +
+
diff --git a/doc/en/plugin_api.en.xml b/doc/en/plugin_api.en.xml new file mode 100644 index 000000000..3fb993bc7 --- /dev/null +++ b/doc/en/plugin_api.en.xml @@ -0,0 +1,3528 @@ + + + + +
+ API functions + +
+ set_charset + + + Prototype: + + void set_charset (t_weechat_plugin *plugin, char *charset) + + + + Set new plugin charset. + + + Arguments: + + + + : pointer to plugin structure + + + + + : new charset to use + + + + + + Example: + plugin->set_charset (plugin, "ISO-8859-1"); + +
+ +
+ iconv_to_internal + + + Prototype: + + void iconv_to_internal (t_weechat_plugin *plugin, char *charset, + char *string) + + + + Convert string to WeeChat internal charset (UTF-8). + + + Arguments: + + + + : pointer to plugin structure + + + + + : charset to convert + + + + + : string to convert + + + + + + Return value: converted string. + + + Note: result has to be free by a call to "free" after use. + + + Example: + char *str = plugin->iconv_to_internal (plugin, "ISO-8859-1", "iso string: é à"); + +
+ +
+ iconv_from_internal + + + Prototype: + + void iconv_from_internal (t_weechat_plugin *plugin, char *charset, + char *string) + + + + Convert string from internal WeeChat charset (UTF-8) to another. + + + Arguments: + + + + : pointer to plugin structure + + + + + : target charset + + + + + : string to convert + + + + + + Return value: converted string. + + + Note: result has to be free by a call to "free" after use. + + + Example: + char *str = plugin->iconv_from_internal (plugin, "ISO-8859-1", "utf-8 string: é à"); + +
+ +
+ ascii_strcasecmp + + + Prototype: + + int ascii_strcasecmp (t_weechat_plugin *plugin, + char *string1, char *string2) + + + + Locale and case independent string comparison. + + + Arguments: + + + + : pointer to plugin structure + + + + + : first string for comparison + + + + + : second string for comparison + + + + + + Return value: difference between two strings: negative if + string1 < string2, zero if string1 == string2, positive if + string1 > string2 + + + Example: + if (plugin->ascii_strcasecmp (plugin, "abc", "def") != 0) ... + +
+ +
+ ascii_strncasecmp + + + Prototype: + + int ascii_strncasecmp (t_weechat_plugin *plugin, + char *string1, char *string2, int max) + + + + Locale and case independent string comparison, for "max" chars. + + + Arguments: + + + + : pointer to plugin struct + + + + + : first string for comparison + + + + + : second string for comparison + + + + + : max number of chars for comparison + + + + + + Return value: difference between two strings: negative if + string1 < string2, zero if string1 == string2, positive if + string1 > string2 + + + Example: + if (plugin->ascii_strncasecmp (plugin, "abc", "def", 2) != 0) ... + +
+ +
+ explode_string + + + Prototype: + + char **explode_string (t_weechat_plugin *plugin, char *string, + char *separators, int num_items_max, int *num_items) + + + + Explode a string according to one or more delimiter(s). + + + Arguments: + + + + : pointer to plugin struct + + + + + : string to explode + + + + + : delimiters used for explosion + + + + + : maximum number of items + created (0 = no limit) + + + + + : pointer to int which will + contain number of items created + + + + + + Return value: array of strings, NULL if problem. + + + Note: result has to be free by a call to "free_exloded_string" + after use. + + + Example: + +char **argv; +int argc; +argv = plugin->explode_string (plugin, string, " ", 0, &argc); +... +if (argv != NULL) + plugin->free_exploded_string (plugin, argv); + + +
+ +
+ free_exploded_string + + + Prototype: + + char **free_exploded_string (t_weechat_plugin *plugin, + char **string) + + + + Free memory used by a string explosion. + + + Arguments: + + + + : pointer to plugin structure + + + + + : string exploded by + "explode_string" function + + + + + + Return value: none. + + + Example: + +char *argv; +int argc; +argv = plugin->explode_string (plugin, string, " ", 0, &argc); +... +if (argv != NULL) + plugin->free_exploded_string (plugin, argv); + + +
+ +
+ mkdir_home + + + Prototype: + + int mkdir_home (t_weechat_plugin *plugin, char *directory) + + + + Create a directory in WeeChat home. + + + Arguments: + + + + : pointer to plugin structure + + + + + : directory to create + + + + + + Return value: 1 if directory was successfully created, 0 if an + error occurred. + + + Example: + +if (!plugin->mkdir_home (plugin, "temp")) + plugin->print_server(plugin, "Failed to create 'temp' directory in WeeChat home."); + + +
+ +
+ exec_on_files + + + Prototype: + + void exec_on_files (t_weechat_plugin *plugin, char *directory, + int (*callback)(t_weechat_plugin *, char *)) + + + + Execute a function on all files of a directory. + + + Arguments: + + + + : pointer to plugin structure + + + + + : directory for searching files + + + + + : function called for each file + found + + + + + + Return value: none. + + + Example: + +int callback (t_weechat_plugin *plugin, char *file) +{ + plugin->print_server (plugin, "file: %s", file); + return 1; +} +... +plugin->exec_on_files (plugin, "/tmp", &callback); + + +
+ +
+ print + + + Prototype: + + void print (t_weechat_plugin *plugin, + char *server, char *channel, char *message, ...) + + + + Display a message on a WeeChat buffer, identified by server and + channel (both may be NULL for current buffer). + + + Arguments: + + + + : pointer to plugin structure + + + + + : internal name of server to find + buffer for message display (may be NULL) + + + + + : name of channel to find buffer + for message display (may be NULL) + + + + + : message + + + + + + To display colored text, there are following codes: + + + + + Code + Description + + + + + 0x02 + + bold text + + + + 0x03 + "xx" + + text color "xx" + (see for colors) + + + + 0x03 + "xx,yy" + + text color "xx" + and background "yy" + (see for colors) + + + + 0x0F + + disable color and attributes + + + + 0x12 + + reverse video (revert text color with background) + + + + 0x1F + + underlined text + + + + + + Note: the same code (without number for 0x03) may be used to stop + the attribute. + + + Return value: none. + + + Examples: + +plugin->print (plugin, NULL, NULL, "hello"); +plugin->print (plugin, NULL, "#weechat", "hello"); +plugin->print (plugin, "freenode", "#weechat", "hello"); +plugin->print (plugin, NULL, NULL, + "test: \x02 bold \x0F\x03%02d blue \x03%02d green", + plugin->get_irc_color (plugin, "blue"), + plugin->get_irc_color (plugin, "green")); + + +
+ +
+ print_server + + + Prototype: + + void print_server (t_weechat_plugin *plugin, + char *message, ...) + + + + Display a message on current server buffer. + + + Arguments: + + + + : pointer to plugin structure + + + + + : message + + + + + + To display colored text, see . + + + Return value: none. + + + Example: plugin->print_server (plugin, "hello"); + +
+ +
+ print_infobar + + + Prototype: + + void print_infobar (t_weechat_plugin *plugin, + int time, char *message, ...) + + + + Display a message in infobar for a specified time. + + + Arguments: + + + + : pointer to plugin structure + + + + + : time (in seconds) for displaying + message (0 = never erased) + + + + + + Return value: none. + + + Example: + +plugin->print_infobar (plugin, 5, "hello"); + + +
+ +
+ infobar_remove + + + Prototype: + + void infobar_remove (t_weechat_plugin *plugin, int count) + + + + Remove one or more messages in infobar stack. + + + Arguments: + + + + : pointer to plugin structure + + + + + : number of messages to remove + (if argument is <= 0, then all messages are removed) + + + + + + Return value: none. + + + Example: plugin->infobar_remove (1); + +
+ +
+ log + + + Prototype: + + void log (t_weechat_plugin *plugin, + char *server, char *channel, char *message, ...) + + + + Write a message in log file for a server or a channel. + + + Arguments: + + + + : pointer to plugin structure + + + + + : internal name of server to find + buffer for log (may be NULL) + + + + + : name of channel to find buffer + for log (may be NULL) + + + + + : message + + + + + + Return value: none. + + + Example: + +plugin->log (plugin, "freenode", "#weechat", "test"); + + +
+ +
+ msg_handler_add + + + Prototype: + + t_plugin_handler *msg_handler_add (t_weechat_plugin + *plugin, char *message, t_plugin_handler_func *function, + char *handler_args, void *handler_pointer) + + + + Add an IRC message handler, called when an IRC message is + received. + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of IRC message ("*" for all + messages). + To know list of IRC messages, please consult + RFCs + 1459 + and + 2812. + Moreover you can use a special name, prefixed by "weechat_" + to catch special events, as written in table below: + + + + + Name + Description + + + + + weechat_pv + private message received + + + weechat_highlight + + message with highlight (on a channel or pv) + + + + weechat_ctcp + + CTCP message received (VERSION, PING, ..) + + + + weechat_dcc + + DCC message received (chat or file) + + + + + + + + + + : function called when message + is received + + + It uses following prototype: + + int my_function (t_weechat_plugin *plugin, + int argc, char **argv, + char *handler_args, void *handler_pointer) + + + + Argument argc is set to 3, following values are set in + argv array: + + + argv[0] = server name + + + argv[1] = IRC message + + + argv[2] = command arguments + + + + + + + : arguments given to function + when called + + + + + : pointer given to function + when called + + + + + + Return value: pointer to new message handler. + + + Note: function called when message is received has to return + one of following values: + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfully + completed + + + + + PLUGIN_RC_OK_IGNORE_WEECHAT: message + will not be sent to WeeChat + + + + + PLUGIN_RC_OK_IGNORE_PLUGINS: message + will not be sent to other plugins + + + + + PLUGIN_RC_OK_IGNORE_ALL: message + will not be sent to WeeChat neither other plugins + + + + + PLUGIN_RC_OK_WITH_HIGHLIGHT: function + successfully completed and make "highlight" on received + message + + + + + + Example: + +int msg_kick (t_weechat_plugin *plugin, int argc, char **argv, + char *handler_args, void *handler_pointer) +{ + plugin->print (plugin, argv[0], NULL, "KICK received"); + return PLUGIN_RC_OK; +} +... +t_plugin_handler *msg_handler; +msg_handler = plugin->msg_handler_add (plugin, "KICK", + &msg_kick, NULL, NULL); + + +
+ +
+ cmd_handler_add + + + Prototype: + + t_plugin_handler *cmd_handler_add (t_weechat_plugin + *plugin, char *command, char *description, char *arguments, + char *arguments_description, char *completion_template, + t_plugin_handler_func *fonction, char *handler_args, + void *handler_pointer) + + + + Add a WeeChat command handler, called when user uses command + (for example /command). + + + Arguments: + + + + : pointer to plugin structure + + + + + : the new command name, which + may be an existing command (be careful, replaced command + will not be available until plugin is unloaded) + + + + + : short command description + (displayed by /help command) + + + + + : short description of command + arguments (displayed by /help command) + + + + + : long description + of command arguments (displayed by /help command) + + + + + : template for + completion, like "abc|%w def|%i" + which means "abc" or a WeeChat command for first argument, + "def" or IRC command for second. + An empty string lets WeeChat complete any argument with + a nick from current channel, NULL or "-" disable completion + for all command arguments. + + + Following codes can be used: + + + + + Code + Description + + + + + %- + no completion for argument + + + %* + + repeat last completion for all following arguments + (this code has to be at the end of completion + template, preceded by "|") + + + + %a + alias + + + %A + + alias and commands (WeeChat, IRC and plugins) + + + + %c + current channel + + + %C + all channels (including queries) + + + %f + file name + + + %h + plugins commands + + + %i + IRC commands (sent) + + + %I + IRC commands (received) + + + %k + key functions + + + %m + nick on current server + + + %M + + nicks on current server (on all open channels) + + + + %n + nicks of current channel + + + %N + nicks and hostnames of current channel + + + %o + setup options + + + %O + plugin options + + + %p + default "part" message + + + %q + default "quit" message + + + %s + current server name + + + %S + all servers names + + + %t + topic of current channel + + + %v + setup option value + + + %V + plugin option value + + + %w + WeeChat commands + + + + + + + + + : function called when command + is executed + + + It uses following prototype: + + int my_function (t_weechat_plugin *plugin, + int argc, char **argv, + char *handler_args, void *handler_pointer) + + + + Argument argc is set to 3, following values are set in + argc array: + + + argv[0] = server name + + + argv[1] = command + + + argv[2] = command arguments + + + + + + + : arguments given to function + when called + + + + + : pointer given to function + when called + + + + + + Return value: pointer to new command handler. + + + Note: function called when command is executed has to return + one of following values: + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfully + completed + + + + + + Example: + +int cmd_test (t_weechat_plugin *plugin, int argc, char **argv, + char *handler_args, void *handler_pointer) +{ + plugin->print (plugin, argv[0], NULL, + "test command, nick: %s", + (argv[2]) ? argv[2] : "none"); + return PLUGIN_RC_OK; +} +... +t_plugin_handler *cmd_handler; +cmd_handler = plugin->cmd_handler_add (plugin, "test", "Test command", + "[nick]", "nick: nick of channel", + "%n", &cmd_test, NULL, NULL); + + +
+ +
+ timer_handler_add + + + Prototype: + + t_plugin_handler *timer_handler_add (t_weechat_plugin + *plugin, int interval, t_plugin_handler_func *function, + char *handler_args, void *handler_pointer) + + + + Add a timer handler which periodically calls a function. + + + Arguments: + + + + : pointer to plugin structure + + + + + : interval (in seconds) between + two calls of function. + + + + + : function called + + + It uses following prototype: + + int my_function (t_weechat_plugin *plugin, + int argc, char **argv, + char *handler_args, void *handler_pointer) + + + + Argument argc is set to 0, and argv is set to NULL. + + + + + : arguments given to function + when called + + + + + : pointer given to function + when called + + + + + + Return value: pointer to new timer handler. + + + Note: function called has to return one of following values: + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfully + completed + + + + + + Example: + +int my_timer (t_weechat_plugin *plugin, int argc, char **argv, + char *handler_args, void *handler_pointer) +{ + plugin->print (plugin, NULL, NULL, "my timer"); + return PLUGIN_RC_OK; +} +... +t_plugin_handler *timer_handler; +timer_handler = plugin->timer_handler_add (plugin, 60, &my_timer); + + +
+ +
+ keyboard_handler_add + + + Prototype: + + t_plugin_handler *keyboard_handler_add (t_weechat_plugin + *plugin, t_plugin_handler_func *function, + char *handler_args, void *handler_pointer) + + + + Add a keyboard handler, called for any key pressed. + + + Arguments: + + + + : pointer to plugin structure + + + + + : function called + + + It uses following prototype: + + int my_function (t_weechat_plugin *plugin, + int argc, char **argv, + char *handler_args, void *handler_pointer) + + + + Argument argc is set to 3, following values are set in + argc array: + + + + argv[0] = key pressed (name of internal function or + '*' followed by a key code) + + + + + argv[1] = command line before key action + + + + + argv[2] = command line after key action + + + + + + + + : arguments given to function + when called + + + + + : pointer given to function + when called + + + + + + Return value: pointer to new message handler. + + + Note: function called has to return one of following values: + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfully + completed + + + + + + Example: + +int my_keyb (t_weechat_plugin *plugin, int argc, char **argv, + char *handler_args, void *handler_pointer) +{ + if (argc == 2) + { + plugin->print (plugin, NULL, NULL, "key pressed: %s", argv[0]); + if (argv[1] && (argv[1][0] == '1')) + plugin->print (plugin, NULL, NULL, "input text changed"); + else + plugin->print (plugin, NULL, NULL, "input text not changed"); + } + return PLUGIN_RC_OK; +} +... +t_plugin_handler *keyb_handler; +keyb_handler = plugin->keyboard_handler_add (plugin, &my_keyb); + + +
+ +
+ event_handler_add + + + Prototype: + + t_plugin_handler *event_handler_add (t_weechat_plugin + *plugin, char *event, t_plugin_handler_func *function, + char *handler_args, void *handler_pointer) + + + + Add an event handler, called when an event happens. + + + Arguments: + + + + : pointer to plugin structure + + + + + : event (see table below) + + + + + : function called + + + It uses following prototype: + + int my_function (t_weechat_plugin *plugin, + int argc, char **argv, + char *handler_args, void *handler_pointer) + + + + Arguments depend on event (see table below). + + + + + : arguments given to function + when called + + + + + : pointer given to function + when called + + + + + + List of events: + + + + + Event + Description + Arguments + + + + + buffer_open + a buffer was open + + argc = 1, argv = { buffer number } + + + + buffer_close + a buffer was closed + + argc = 1, argv = { buffer number } + + + + buffer_move + a buffer was moved + + argc = 2, argv = { new buffer number, old number } + + + + + + + + Return value: pointer to new event handler. + + + Note: function called has to return one of following values: + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfully + completed + + + + + + Example: + +int my_event (t_weechat_plugin *plugin, int argc, char **argv, + char *handler_args, void *handler_pointer) +{ + plugin->print (plugin, NULL, NULL, "my_event"); + return PLUGIN_RC_OK; +} +... +t_plugin_handler *event_handler; +event_handler = plugin->event_handler_add (plugin, "buffer_open", + &my_event); + + +
+ +
+ handler_remove + + + Prototype: + + void handler_remove (t_weechat_plugin *plugin, + t_plugin_handler *handler) + + + + Remove a command or message handler. + + + Arguments: + + + + : pointer to plugin structure + + + + + : handler to remove + + + + + + Return value: none. + + + Example: + plugin->handler_remove (plugin, my_handler); + +
+ +
+ handler_remove_all + + + Prototype: + + void handler_remove_all (t_weechat_plugin *plugin) + + + + Remove all handlers for a plugin. + + + Arguments: + + + + : pointer to plugin structure + + + + + + Return value: none. + + + Example: + plugin->handler_remove_all (plugin); + +
+ +
+ modifier_add + + + Prototype: + + t_plugin_modifier *modifier_add (t_weechat_plugin *plugin, + char *type, char *message, t_plugin_modifier_func *function, + char *modifier_args, void *modifier_pointer) + + + + Add a message modifier. + + + Arguments: + + + + : pointer to plugin structure + + + + + : modifier type: + + + + + Type + Description + + + + + irc_in + called for incoming IRC messages + + + irc_user + + called for each user message (or command) (before + WeeChat parses message) + + + + irc_out + + called for outgoing messages, immediately before + sending it to IRC server (this includes messages + sent automatically by WeeChat to server) + + + + + + + + + + : name of IRC message (used only for + types "irc_in" and "irc_out"). + To know list of IRC messages, please consult + RFCs + 1459 + and + 2812. + Moreover, special value "*" means all messages (no filter). + + + + + : function called + + + It uses following prototype: + + int my_function (t_weechat_plugin *plugin, + int argc, char **argv, + char *modifier_args, void *modifier_pointer) + + + + Argument argc is set to 2, following values are set in + argv array: + + + argv[0] = server name + + + argv[1] = message + + + + + + + : arguments given to function + when called + + + + + : pointer given to function + when called + + + + + + Return value: pointer to new message modifier. + + + Note: function has to return modified string, or NULL if no + changes are made to message. + If function returns empty string, then message is dropped and + will not be read at all by WeeChat (be careful when dropping + messages!). + Returned string must have been allocated by malloc() and will + be freed (with call to free()) automatically by WeeChat after use. + + + Example: + +char *adder (t_weechat_plugin *plugin, int argc, char **argv, + char *modifier_args, void *modifier_pointer) +{ + char *string; + string = (char *)malloc (strlen (argv[1]) + 16); + strcpy (string, argv[1]); + strcat (string, "test"); + return string; +} +... +t_plugin_modifier *modifier; +modifier = plugin->modifier_add (plugin, "irc_in", "privmsg", + &adder, NULL, NULL); + + +
+ +
+ modifier_remove + + + Prototype: + + void modifier_remove (t_weechat_plugin *plugin, + t_plugin_modifier *modifier) + + + + Remove a message modifier. + + + Arguments: + + + + : pointer to plugin structure + + + + + : modifier to remove + + + + + + Return value: none. + + + Example: + plugin->modifier_remove (plugin, my_modifier); + +
+ +
+ modifier_remove_all + + + Prototype: + + void modifier_remove_all (t_weechat_plugin *plugin) + + + + Remove all modifiers for a plugin. + + + Arguments: + + + + : pointer to plugin structure + + + + + + Return value: none. + + + Example: + plugin->modifier_remove_all (plugin); + +
+ +
+ exec_command + + + Prototype: + + void exec_command (t_weechat_plugin + *plugin, char *server, char *channel, char *command) + + + + Execute a WeeChat command (or send a message to a channel). + + + Arguments: + + + + : pointer to plugin structure + + + + + : internal name of server for + executing command (may be NULL) + + + + + : name of channel for executing + command (may be NULL) + + + + + : command + + + + + + Return value: none. + + + Examples: + +plugin->exec_command (plugin, NULL, NULL, "/help nick"); +plugin->exec_command (plugin, "freenode", "#weechat", "hello"); + + +
+ +
+ get_info + + + Prototype: + + char *get_info (t_weechat_plugin *plugin, + char *info, char *server) + + + + Return an info about WeeChat or a channel. + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of info to read: + + + + + Info + Description + + + + + version + WeeChat's version + + + nick + nick + + + channel + + name of channel (NULL for a server or private) + + + + server + name of server + + + type + + buffer type: 0=standard, 1=DCC, 2=raw IRC data + + + + away + "away" flag + + + inactivity + + number of seconds since last key was pressed + + + + input + + content of command line for current window + + + + input_mask + + content of color mask for command line + + + + input_pos + + cursor position in command line + + + + weechat_dir + + WeeChat home directory + (by default: ~/.weechat/) + + + + weechat_libdir + WeeChat system lib directory + + + weechat_sharedir + WeeChat system share directory + + + + + + + + + : internal name of server for + reading info (if needed) + + + + + + Return value: information asked, NULL if not found. + + + Note: result has to be free by a call to "free" function after + use. + + + Examples: + +char *version = plugin->get_info (plugin, "version", NULL); +char *nick = plugin->get_info (plugin, "nick", "freenode"); +char *inactivity = plugin->get_info (plugin, "inactivity", NULL); + +plugin->print (plugin, NULL, NULL, + "WeeChat version %s, you are %s on freenode " + "(inactive for %s seconds)", + version, nick, inactivity); + +if (version) + free (version); +if (nick) + free (nick); +if (inactivity) + free (inactivity); + + +
+ +
+ get_dcc_info + + + Prototype: + + t_plugin_info_dcc *get_dcc_info (t_weechat_plugin *plugin) + + + + Return list of DCC currently active or finished. + + + Arguments: + + + + : pointer to plugin structure + + + + + + Return value: linked list of DCC. + + + + + Type + Field + Description + + + + + char * + server + IRC server + + + char * + channel + IRC channel + + + int + type + + DCC type: + 0 = chat received, + 1 = chat sent, + 2 = file received, + 3 = file sent + + + + int* + status + + DCC status: + 0 = waiting, + 1 = connecting, + 2 = active, + 3 = finished, + 4 = failed, + 5 = interrupted by user + + + + time_t + start_time + date/time of DCC creation + + + time_t + start_transfer + date/time of DCC transfer start + + + unsigned long + addr + IP address of remote user + + + int + port + port used for DCC + + + char * + nick + remote nick + + + char * + filename + file name + + + char * + local_filename + local file name + + + int + filename_suffix + suffix if renaming file + + + unsigned long + size + file size + + + unsigned long + pos + position in file + + + unsigned long + start_resume + start position after interruption + + + unsigned long + bytes_per_sec + + number of bytes per second since transfer start + + + + t_plugin_dcc_info * + prev_dcc + + pointer to previous DCC info + + + + t_plugin_dcc_info * + next_dcc + + pointer to next DCC info + + + + + + + + + Note: result has to be free by a call to "free_dcc_info" function + after use. + + + Examples: + +t_plugin_dcc_info *dcc_info = plugin->get_dcc_info (plugin); +for (ptr_dcc = dcc_info; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc) +{ + plugin->print_server (plugin, "DCC type=%d, with: %s", + ptr_dcc->type, ptr_dcc->nick); +} +if (dcc_info) + plugin->free_dcc_info (plugin, dcc_info); + + +
+ +
+ free_dcc_info + + + Prototype: + + void free_dcc_info (t_weechat_plugin *plugin, + t_plugin_dcc_info *dcc_info) + + + + Free memory used by a DCC list. + + + Arguments: + + + + : pointer to plugin structure + + + + + : pointer to DCC list returned by + "get_dcc_info" function + + + + + + Return value: none. + + + Example: + plugin->free_dcc_info (plugin, dcc_info); + +
+ +
+ get_server_info + + + Prototype: + + t_plugin_server_info *get_server_info (t_weechat_plugin *plugin) + + + + Return list of IRC servers (connected or not). + + + Arguments: + + + + : pointer to plugin structure + + + + + + Return value: linked list of IRC servers. + + + + + Type + Field + Description + + + + + char * + name + server internal name + + + int + autoconnect + 1 if autoconnect at start-up, 0 otherwise + + + int + autoreconnect + + 1 if autoreconnect when disconnected, + 0 otherwise + + + + int + autoreconnect_delay + delay before trying again connection + + + int + command_line + + 1 if server was on command line (so it is temporary), + 0 otherwise + + + + char * + address + server address (host or IP) + + + int + port + port + + + int + ipv6 + IPv6 connection + + + int + ssl + SSL connection + + + char * + password + server password + + + char * + nick1 + first nickname + + + char * + nick2 + alternate nickname + + + char * + nick3 + second alternate nickname + + + char * + username + user name + + + char * + real name + real name + + + char * + command + command run once connected + + + int + command_delay + delay after execution of command + + + char * + autojoin + channels joined automatically + + + int + autorejoin + + 1 if channels are rejoined when kicked, + 0 otherwise + + + + char * + notify_levels + channels notify levels + + + char * + charset_decode_iso + channels charsets for decoding ISO + + + char * + charset_decode_utf + channels charsets for decoding UTF + + + char * + charset_encode + channels charsets for encoding messages + + + int + is_connected + 1 if connected to server, 0 otherwise + + + int + ssl_connected + 1 if connected with SSL, 0 otherwise + + + char * + nick + current nickname + + + int + is_away + 1 if away, 0 otherwise + + + time_t + away_time + time when user is marking as away + + + int + lag + lag (in milliseconds) + + + t_plugin_server_info * + prev_server + pointer to previous server info + + + t_plugin_server_info * + next_server + pointer to next server info + + + + + + + Note: result has to be free by a call to "free_server_info" + function after use. + + + Example: + +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, + "server: %s, address: %s, port: %d %s", + ptr_server_info->name, + ptr_server_info->address, + ptr_server_info->port, + (ptr_server_info->is_connected) ? "(connected)" : ""); + } + plugin->free_server_info (plugin, server_info); +} + + +
+ +
+ free_server_info + + + Prototype: + + void free_server_info (t_weechat_plugin *plugin, + t_plugin_server_info *server_info) + + + + Free memory used by server info list. + + + Arguments: + + + + : pointer to plugin structure + + + + + : pointer to server list + returned by "get_server_info" function + + + + + + Return value: none. + + + Example: + plugin->free_server_info (plugin, server_info); + +
+ +
+ get_channel_info + + + Prototype: + + t_plugin_channel_info *get_channel_info (t_weechat_plugin *plugin, + char *server) + + + + Return list of IRC channels for a server. + + + Arguments: + + + + : pointer to plugin structure + + + + + : internal server name + + + + + + Return value: linked list of IRC channels for server. + + + + + Type + Field + Description + + + + + int + type + 0 for a channel, 1 for a private + + + char * + name + name of channel + + + char * + topic + topic of channel + + + char * + modes + channel modes + + + int + limit + user limit + + + char * + key + channel key + + + int + nicks_count + number of nicks on channel + + + t_plugin_channel_info * + prev_channel + pointer to previous channel info + + + t_plugin_channel_info * + next_channel + pointer to next channel info + + + + + + + Note: result has to be free by a call to "free_channel_info" + function after use. + + + Example: + +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); +} + + +
+ +
+ free_channel_info + + + Prototype: + + void free_channel_info (t_weechat_plugin *plugin, + t_plugin_channel_info *channel_info) + + + + Free memory used by channel info list. + + + Arguments: + + + + : pointer to plugin structure + + + + + : pointer to channel info list + returned by "get_channel_info" function + + + + + + Return value: none. + + + Example: + plugin->free_channel_info (plugin, channel_info); + +
+ +
+ get_nick_info + + + Prototype: + + t_plugin_nick_info *get_nick_info (t_weechat_plugin *plugin, + char *server, char *channel) + + + + Return list of nicks for a channel. + + + Arguments: + + + + : pointer to plugin structure + + + + + : internal server name + + + + + : channel name + + + + + + Return value: linked list of nicks on channel. + + + + + Type + Field + Description + + + + + char * + nick + nick name + + + char * + host + hostname + + + int + flags + + nick flags, binary "or" between values (1 = channel + owner, 2 = channel admin, 4 = op, 8 = halfop, + 16 = voice, 32 = away) + + + + t_plugin_nick_info * + prev_nick + pointer to previous nick info + + + t_plugin_nick_info * + next_nick + pointer to next nick info + + + + + + + Note: result has to be free by a call to "free_nick_info" + function after use. + + + Example: + +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); +} + + +
+ +
+ free_nick_info + + + Prototype: + + void free_nick_info (t_weechat_plugin *plugin, + t_plugin_nick_info *nick_info) + + + + Free memory used by nick info list. + + + Arguments: + + + + : pointer to plugin structure + + + + + : pointer to nick info list + returned by "get_nick_info" function + + + + + + Return value: none. + + + Example: + plugin->free_nick_info (plugin, nick_info); + +
+ +
+ get_config + + + Prototype: + + char *get_config (t_weechat_plugin *plugin, char *option) + + + + Return value of a WeeChat config option. + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of option to read + + + + + + Return value: option value, NULL if not found. + + + Note: result has to be free by a call to "free" function after + use. + + + Examples: + +char *value1 = plugin->get_config (plugin, "look_set_title"); +char *value2 = plugin->get_config (plugin, "freenode.server_autojoin"); + + +
+ +
+ set_config + + + Prototype: + + int set_config (t_weechat_plugin *plugin, + char *option, char *value) + + + + Update value of a WeeChat config option. + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of option to update + + + + + : new value for option + + + + + + Return value: 1 if option was successfully updated, 0 if an + error occurred. + + + Example: + +plugin->set_config (plugin, "look_nicklist", "off"); + + +
+ +
+ get_plugin_config + + + Prototype: + + char *get_plugin_config (t_weechat_plugin *plugin, char *option) + + + + Return value of a plugin option. + Option is read from file "~/.weechat/plugins.rc" + and is like: "plugin.option=value" + (note: plugin name is automatically added). + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of option to read + + + + + + Return value: option value, NULL if not found. + + + Note: result has to be free by a call to "free" function after + use. + + + Example: + +char *value = plugin->get_plugin_config (plugin, "my_var"); + + +
+ +
+ set_plugin_config + + + Prototype: + + int set_plugin_config (t_weechat_plugin *plugin, + char *option, char *value) + + + + Update value of a plugin option. + Option is written in file "~/.weechat/plugins.rc" + and is like: "plugin.option=value" + (note: plugin name is automatically added). + + + Arguments: + + + + : pointer to plugin structure + + + + + : name of option to update + + + + + : new value for option + + + + + + Return value: 1 if option was successfully updated, 0 if an + error occurred. + + + Example: + +plugin->set_plugin_config (plugin, "my_var", "value"); + + +
+ +
+ get_irc_color + + + Prototype: + + int get_irc_color (t_weechat_plugin *plugin, + char *color_name) + + + + Get IRC color index with name. + + + Arguments: + + + + : pointer to plugin structure + + + + + : color name + Allowed colors are: + + + + + Color name + Value + + + + + white + 0 + + + black + 1 + + + blue + 2 + + + green + 3 + + + lightred + 4 + + + red + 5 + + + magenta + 6 + + + brown + 7 + + + yellow + 8 + + + lightgreen + 9 + + + cyan + 10 + + + lightcyan + 11 + + + lightblue + 12 + + + lightmagenta + 13 + + + gray + 14 + + + lightgray + 15 + + + + + + + + + + Return value: IRC color index, -1 if color is not found. + + + Example: + +int color_blue = plugin->get_irc_color (plugin, "blue"); /* return 2 */ + + +
+ +
+ input_color + + + Prototype: + + void input_color (t_weechat_plugin *plugin, + int color, int start, int length) + + + + Add color in input buffer. + + + Arguments: + + + + : pointer to plugin structure + + + + + : color for text (if < 0, then input + buffer is refresh, and there's no change in input buffer + content) + + + + + : start position for color (if < 0, + then mask is reinitialized) + + + + + : length for color (if <= 0, + then mask is reinitialized) + + + + + + Return value: none. + + + Example: + +plugin->input_color (plugin, plugin->get_irc_color (plugin, "blue"), 10, 5); + + +
+ +
+ get_window_info + + + Prototype: + + t_plugin_window_info *get_window_info (t_weechat_plugin *plugin) + + + + Return list of WeeChat windows. + + + Arguments: + + + + : pointer to plugin structure + + + + + + Return value: linked list of WeeChat windows. + + + + + Type + Field + Description + + + + + int + win_x + horizontal position of window + + + int + win_y + vertical position of window + + + int + win_width + width of window + + + int + win_height + height of window + + + int + win_width_pct + width % (compared to parent window) + + + int + win_height_pct + height % (compared to parent window) + + + int + num_buffer + number of displayed buffer + + + t_plugin_window_info * + prev_window + pointer to previous window info + + + t_plugin_window_info * + next_window + pointer to next window info + + + + + + + Note: result has to be free by a call to "free_window_info" + function after use. + + + Example: + +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, "--- window info ---"); + 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, "no window info!"); + + +
+ +
+ free_window_info + + + Prototype: + + void free_window_info (t_weechat_plugin *plugin, + t_plugin_window_info *window_info) + + + + Free memory used by window info list. + + + Arguments: + + + + : pointer to plugin structure + + + + + : pointer to window info list + returned by "get_window_info" function + + + + + + Return value: none. + + + Example: + plugin->free_window_info (plugin, window_info); + +
+ +
+ get_buffer_info + + + Prototype: + + t_plugin_buffer_info *get_buffer_info (t_weechat_plugin *plugin) + + + + Return list of WeeChat buffers. + + + Arguments: + + + + : pointer to plugin structure + + + + + + Return value: linked list of WeeChat buffers. + + + + + Type + Field + Description + + + + + int + type + buffer type: 0=standard, 1=DCC, 2=raw IRC data + + + int + number + buffer number + + + int + num_displayed + number of windows displaying buffer + + + char * + server_name + server name for buffer (may be NULL) + + + char * + channel_name + channel name for buffer (may be NULL) + + + int + notify_level + notify level for buffer + + + char * + log_filename + log filename (NULL means not logging) + + + t_plugin_buffer_info * + prev_buffer + pointer to previous buffer info + + + t_plugin_buffer_info * + next_buffer + pointer to next buffer info + + + + + + + Note: result has to be free by a call to "free_buffer_info" + function after use. + + + Example: + +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, "--- buffer info ---"); + 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, "no buffer info!"); + + +
+ +
+ free_buffer_info + + + Prototype: + + void free_buffer_info (t_weechat_plugin *plugin, + t_plugin_buffer_info *buffer_info) + + + + Free memory used by buffer info list. + + + Arguments: + + + + : pointer to plugin structure + + + + + : pointer to buffer info list + returned by "get_buffer_info" function + + + + + + Return value: none. + + + Example: + plugin->free_buffer_info (plugin, buffer_info); + +
+ +
+ get_buffer_data + + + Prototype: + + t_plugin_buffer_data *get_buffer_info (t_weechat_plugin *plugin, + char *server, char *channel) + + + + Return content of buffer. + + + Arguments: + + + + : pointer to plugin structure + + + + + : internal name of server + + + + + : channel name + + + + + + Return value: buffer content (linked list of lines). + + + + + Type + Field + Description + + + + + time_t + date + date and time + + + char * + nick + nick + + + char * + data + line content (color codes are removed) + + + t_plugin_buffer_line * + prev_line + pointer to previous line + + + t_plugin_buffer_line * + next_line + pointer to next line + + + + + + + Note: result has to be free by a call to "free_buffer_data" + function after use. + + + Example: + +t_plugin_buffer_line *buffer_line, *ptr_line; +char text_time[256]; + +buffer_line = plugin->get_buffer_data (plugin); +if (buffer_line) +{ + for (ptr_line = buffer_line; ptr_line; ptr_line = ptr_line->next_line) + { + strftime (text_time, sizeof (text_time), "%x %X", localtime (&(ptr_line->date))); + plugin->print (plugin, NULL, NULL, "date: %s, nick: %s, data: %s", + text_time, ptr_line->nick, ptr_line->data); + } + plugin->free_buffer_data (plugin, buffer_line); +} + + +
+ +
+ free_buffer_data + + + Prototype: + + void free_buffer_data (t_weechat_plugin *plugin, + t_plugin_buffer_line *buffer_line) + + + + Free memory used by buffer line list. + + + Arguments: + + + + : pointer to plugin structure + + + + + : pointer to buffer line list + returned by "get_buffer_data" function + + + + + + Return value: none. + + + Example: + plugin->free_buffer_data (plugin, buffer_line); + +
+ +
diff --git a/doc/en/plugin_charset.en.xml b/doc/en/plugin_charset.en.xml new file mode 100644 index 000000000..0c1c2b922 --- /dev/null +++ b/doc/en/plugin_charset.en.xml @@ -0,0 +1,130 @@ + + + + +
+ Charset plugin + + + Charset plugin lets you encode or decode data using charsets, with 3 + levels: global, by server, or by channel. + This plugin is optional, but recommended: if it's not loaded, WeeChat + can only read/write UTF-8 data. + + + + Charset plugin should be autoloaded by WeeChat at startup. + To be sure plugin is loaded, try: + "/charset". + If command is not found, then load plugin with command: + /plugin load charset + If plugin is not found, then you should compile again WeeChat with + plugins and Charset support. + + + + When Charset plugin starts, it displays terminal and internal charsets. + Terminal charset depends on your locale, and internal is UTF-8. + For example : + +-P- Charset plugin starting, terminal charset: ISO-8859-15 (WeeChat internal: UTF-8) + + + +
+ Settings + + + + + To set global decode and encode charsets, use + "/setp" command. + For example: + +/setp charset.global.decode = ISO-8859-15 +/setp charset.global.encode = ISO-8859-15 + + If global decode charset is not set (for example during first + load of Charset plugin), it will be automatically set to terminal + charset (if it's different from UTF-8), or by default to + "ISO-8859-1". + Default encode value is empty, so it sends by default with + internal charset (UTF-8). + + + + + To set server charset, use "/charset" command + on server buffer. + If you give only charset, then it will set "decode" and "encode" + values. + For example: + /charset ISO-8859-15 + It's equivalent to: + +/charset decode ISO-8859-15 +/charset encode ISO-8859-15 + + + + + + To set channel (or private) charset, use same commands as server, + but on channel (or private) buffer. + + + + +
+ +
+ FAQ + + + If you have problems with chars or accents using Charset plugin: + + + + check that weechat-curses is linked to libncursesw (warning: + needed on most distributions but not all) : + ldd /path/to/weechat-curses + + + + + check charset line (on server buffer), you should see + ISO-XXXXXX or UTF-8 for terminal charset. If you see + ANSI_X3.4-1968 or other values, probably your locale is wrong. + + + + + setup global decode value, for example: + /setp charset.global.decode = ISO-8859-15 + + + + + +
+ +
diff --git a/doc/en/plugin_scripts.en.xml b/doc/en/plugin_scripts.en.xml new file mode 100644 index 000000000..787e8c1c9 --- /dev/null +++ b/doc/en/plugin_scripts.en.xml @@ -0,0 +1,2979 @@ + + + + +
+ Scripts plugins + + + Four plugins are provided with WeeChat to use script languages: + Perl, Python, Ruby and Lua. + + +
+ Load / unload scripts + + + Scripts are loaded and unloaded with /perl, + /python, /ruby and + /lua commands + (type /help in WeeChat for help about commands). + + + + Examples: + + + + Load a Perl script: + /perl load /tmp/test.pl + + + + + List all loaded Perl scripts: + /perl + + + + + Load a Python script: + /python load /tmp/test.py + + + + + List all loaded Python scripts: + /python + + + + + Load a Ruby script: + /ruby load /tmp/test.rb + + + + + List all loaded Ruby scripts: + /ruby + + + + + Load a Lua script: + /lua load /tmp/test.lua + + + + + List all loaded Lua scripts: + /lua + + + + + +
+ +
+ Syntax by language + +
+ Perl + + + In a WeeChat Perl script, all API functions and variables are + prefixed by "weechat::". + Example: +weechat::register("test", "1.0", "end_test", "WeeChat perl script"); + + +
+ +
+ Python + + + A WeeChat Python script has to start by importing weechat: + import weechat + + + + All API functions and variables are prefixed by + "weechat.". + Example: +weechat.register("test", "1.0", "end_test", "WeeChat python script") + + +
+ +
+ Ruby + + + In a WeeChat Ruby script, all code has to be in functions. + So for main code, you have to define a + "weechat_init" function, which is automatically + called when script is loaded by WeeChat. Example: + +def weechat_init + Weechat.register("test", "1.0", "end_test", "WeeChat ruby script") + Weechat.add_command_handler("command", "my_command") + return Weechat::PLUGIN_RC_OK +end + +def my_command(server, args) + Weechat.print("my command") + return Weechat::PLUGIN_RC_OK +end + + + + + All API functions are prefixed by + "Weechat." and variables by + "Weechat::". + + +
+ +
+ Lua + + + In a WeeChat Lua script, all API functions are prefixed by + "weechat.". + Variables are prefixed by "weechat." and + suffixed by "()". + Example: + +function message_handler(server, args) + weechat.print("I am a message handler") + return weechat.PLUGIN_RC_OK() +end + + + +
+ +
+ +
+ WeeChat / scripts API + +
+ register + + + Perl prototype: + + weechat::register(name, version, end_function, description, + [charset]); + + + + Python prototype: + + weechat.register(name, version, end_function, description, + [charset]) + + + + Ruby prototype: + + Weechat.register(name, version, end_function, description, + [charset]) + + + + Lua prototype: + + weechat.register(name, version, end_function, description, + [charset]) + + + + This is first function to call in script. + All WeeChat scripts have to call this function. + + + Arguments: + + + + : unique name to identify script + (each script must have unique name) + + + + + : script version + + + + + : function called when script is + unloaded (optional parameter, empty string means nothing is + called at the end) + + + + + : short description of script + + + + + : charset used by script, you should + set this if script is not written with UTF-8 + + + + + + Return value: 1 if script was registered, 0 if an error occured. + + + Examples: + +# perl +weechat::register("test", "1.0", "end_test", "Test script!", "ISO-8859-1"); + +# python +weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1") + +# ruby +Weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1") + +-- lua +weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1") + + +
+ +
+ set_charset + + + Perl prototype: + + weechat::set_charset(charset); + + + + Python prototype: + + weechat.set_charset(charset) + + + + Ruby prototype: + + Weechat.set_charset(charset) + + + + Lua prototype: + + weechat.set_charset(charset) + + + + Set new script charset. + + + Arguments: + + + + : new script charset + + + + + + Return value: 1 if new charset was set, 0 if an error occured. + + + Examples: + +# perl +weechat::set_charset("ISO-8859-1"); + +# python +weechat.set_charset("ISO-8859-1") + +# ruby +Weechat.set_charset("ISO-8859-1") + +-- lua +weechat.set_charset("ISO-8859-1") + + +
+ +
+ print + + + Perl prototype: + + weechat::print(message, [channel, [server]]) + + + + Python prototype: + + weechat.prnt(message, [channel, [server]]) + + + + Ruby prototype: + + Weechat.print(message, [channel, [server]]) + + + + Lua prototype: + + weechat.print(message, [channel, [server]]) + + + + Display a message on a WeeChat buffer, identified by server + and channel. + + + Arguments: + + + + : message + + + + + : name of channel to find buffer + for message display + + + + + : internal name of server to find + buffer for message display + + + + + + To display colored text, see . + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::print("message"); +weechat::print("message", "#weechat"); +weechat::print("message", "#weechat", "freenode"); +weechat::print("test: \x0305 red \x0F normal"); + +# 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") + + +
+ +
+ print_server + + + Perl prototype: + + weechat::print_server(message) + + + + Python prototype: + + weechat.print_server(message) + + + + Ruby prototype: + + Weechat.print_server(message) + + + + Lua prototype: + + weechat.print_server(message) + + + + Display a message on server buffer. + + + Arguments: + + + + : message + + + + + + To display colored text, see . + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::print_server("message"); +weechat::print_server("test: \x0305 red \x0F normal"); + +# python +weechat.print_server("message") + +# ruby +Weechat.print_server("message") + +-- lua +weechat.print_server("message") + + +
+ +
+ print_infobar + + + Perl prototype: + + weechat::print_infobar(time, message); + + + + Python prototype: + + weechat.print_infobar(time, message) + + + + Ruby prototype: + + Weechat.print_infobar(time, message) + + + + Lua prototype: + + weechat.print_infobar(time, message) + + + + Display a message in infobar for a specified time. + + + Arguments: + + + + : time (in seconds) for displaying + message (0 = never erased) + + + + + : message + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::print_infobar(5, "message"); + +# python +weechat.print_infobar(5, "message") + +# ruby +Weechat.print_infobar(5, "message") + +-- lua +weechat.print_infobar(5, "message") + + +
+ +
+ remove_infobar + + + Perl prototype: + + weechat::remove_infobar([count]); + + + + Python prototype: + + weechat.remove_infobar([count]) + + + + Ruby prototype: + + Weechat.remove_infobar([count]) + + + + Lua prototype: + + weechat.remove_infobar([count]) + + + + Remove one or more messages in infobar stack. + + + Arguments: + + + + : number of messages to remove + (if argument not given or <= 0, then all messages are + removed) + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::remove_infobar(1); + +# python +weechat.remove_infobar(1) + +# ruby +Weechat.remove_infobar(1) + +-- lua +weechat.remove_infobar(1) + + +
+ +
+ log + + + Perl prototype: + + weechat::log(message, [channel, [server]]); + + + + Python prototype: + + weechat.log(message, [channel, [server]]) + + + + Ruby prototype: + + Weechat.log(message, [channel, [server]]) + + + + Lua prototype: + + weechat.log(message, [channel, [server]]) + + + + Write a message in log file for a server or a channel. + + + Arguments: + + + + : message + + + + + : name of channel to find buffer + for log + + + + + : internal name of server to find + buffer for log + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::log("message", "#weechat", "freenode"); + +# python +weechat.log("message", "#weechat", "freenode") + +# ruby +Weechat.log("message", "#weechat", "freenode") + +-- lua +weechat.log("message", "#weechat", "freenode") + + +
+ +
+ add_message_handler + + + Perl prototype: + + weechat::add_message_handler(message, function); + + + + Python prototype: + + weechat.add_message_handler(message, function) + + + + Ruby prototype: + + Weechat.add_message_handler(message, function) + + + + Lua prototype: + + weechat.add_message_handler(message, function) + + + + Add an IRC message handler, called when an IRC message is + received. + + + Arguments: + + + + : name of IRC message. To know list + of IRC messages, please consult RFCs + 1459 + and + 2812. + Moreover you can use a special name, prefixed by "weechat_" + to catch special events (see + ). + + + + + : function called when message is + received + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::add_message_handler ("privmsg", "my_function"); +sub my_function +{ + weechat::print("server=$_[0]"); + ($null, $channel, $message) = split ":",$_[1],3; + ($mask, $null, $channel) = split " ", $channel; + weechat::print("mask=$mask, channel=$channel, msg=$message"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_message_handler ("privmsg", "my_function") +def my_function(server, args): + weechat.prnt("server="+server) + null, channel, message = string.split(args, ":", 2) + mask, null, channel = string.split(string.strip(channel), " ", 2) + weechat.prnt("mask="+mask+", canal="+channel+", message="+message) + return weechat.PLUGIN_RC_OK + +# ruby +Weechat.add_message_handler("privmsg", "my_function") +def my_function(server, args) + Weechat.print("server=#{server}, args=#{args}") + return Weechat::PLUGIN_RC_OK +end + +-- lua +weechat.add_message_handler ("privmsg", "my_function") +function my_function(server, args) + weechat.print("server=" .. server .. ", args=" .. args) + return weechat.PLUGIN_RC_OK() +end + + + + Note: function called when message is received has to return + one of following values: + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfully + completed + + + + + PLUGIN_RC_OK_IGNORE_WEECHAT: message + will not be sent to WeeChat + + + + + PLUGIN_RC_OK_IGNORE_PLUGINS: message + will not be sent to other plugins + + + + + PLUGIN_RC_OK_IGNORE_ALL: message + will not be sent to WeeChat neither other plugins + + + + + PLUGIN_RC_OK_WITH_HIGHLIGHT: function + successfully completed and make "highlight" on received + message + + + + +
+ +
+ add_command_handler + + + Perl prototype: + + weechat::add_command_handler(command, function, + [description, arguments, arguments_description, + completion_template]); + + + + Python prototype: + + weechat.add_command_handler(command, function, + [description, arguments, arguments_description, + completion_template]) + + + + Ruby prototype: + + Weechat.add_command_handler(command, function, + [description, arguments, arguments_description, + completion_template]) + + + + Lua prototype: + + weechat.add_command_handler(command, function, + [description, arguments, arguments_description, + completion_template]) + + + + Add a WeeChat command handler, called when user uses command + (for example /command). + + + Arguments: + + + + : the new command name, which + may be an existing command (be careful, replaced command + will not be available until script is unloaded) + + + + + : function called when command + is executed + + + + + : short description of command + arguments (displayed by /help command) + + + + + : long description + of command arguments (displayed by /help command) + + + + + : template for + completion, like "abc|%w def|%i" which + means "abc" or a WeeChat command for first argument, + "def" or IRC command for second. + (see ) + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::add_command_handler("command", "my_command"); +sub my_command +{ + weechat::print("server= $_[0], args: $_[1]"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_command_handler("command", "my_command") +def my_command(server, args): + weechat.prnt("server="+server+", args="+args) + return weechat.PLUGIN_RC_OK + +# ruby +Weechat.add_command_handler("command", "my_command") +def my_command(server, args) + Weechat.print("server=#{server}, args=#{args}") + return Weechat::PLUGIN_RC_OK +end + +-- lua +weechat.add_command_handler("command", "my_command") +def my_command(server, args) + weechat.print("server="..server..", args="..args) + return weechat.PLUGIN_RC_OK() +end + + + + Notes: function called when command is executed has to return + one of following values: + + + + PLUGIN_RC_KO : function failed + + + + + PLUGIN_RC_OK : function successfully + completed + + + + +
+ +
+ add_timer_handler + + + Perl prototype: + + weechat::add_timer_handler(interval, function); + + + + Python prototype: + + weechat.add_timer_handler(interval, function) + + + + Ruby prototype: + + Weechat.add_timer_handler(interval, function) + + + + Lua prototype: + + weechat.add_timer_handler(interval, function) + + + + Add a timer handler which periodically calls a function. + + + Arguments: + + + + : interval (in seconds) between + two calls of function. + + + + + : function called + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::add_timer_handler(60, "my_timer"); +sub my_timer +{ + weechat::print("this is timer handler"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_timer_handler(60, "my_timer") +def my_timer(): + weechat.prnt("this is timer handler") + return weechat.PLUGIN_RC_OK + +# ruby +Weechat.add_timer_handler(60, "my_timer") +def my_timer() + Weechat.print("this is timer handler") + return Weechat::PLUGIN_RC_OK +end + +-- lua +weechat.add_timer_handler(60, "my_timer") +function my_timer() + weechat.print("this is timer handler") + return weechat.PLUGIN_RC_OK() +end + + + + Note: function called has to return one of following values: + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfully + completed + + + + +
+ +
+ add_keyboard_handler + + + Perl prototype: + + weechat::add_keyboard_handler(function); + + + + Python prototype: + + weechat.add_keyboard_handler(function) + + + + Ruby prototype: + + Weechat.add_keyboard_handler(function) + + + + Lua prototype: + + weechat.add_keyboard_handler(function) + + + + Add a keyboard handler, called for any key pressed. + + + Arguments: + + + + : function called + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::add_keyboard_handler("my_keyboard"); +sub my_keyboard +{ + my $key = shift; + my $input_before = shift; + my $input_after = shift; + weechat::print("keyboard handler: key = '$key', " + ."input before = '$input_before' " + ."after = '$input_after'"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_keyboard_handler("my_keyboard") +def my_keyboard(key, input_before, input_after): + weechat.prnt("keyboard handler: key = '%s', " \ + "input before = '%s' after = '%s'" + %(key, input_before, input_after)) + return weechat.PLUGIN_RC_OK + +# ruby +Weechat.add_keyboard_handler("my_keyboard") +def my_keyboard(key, input_before, input_after) + Weechat.print("keyboard handler: key = '#{key}', " \ + "input before = '#{input_before}' " \ + "after = '#{input_after}'") + return Weechat::PLUGIN_RC_OK +end + +-- lua +weechat.add_keyboard_handler("my_keyboard") +function my_keyboard(key, input_before, input_after) + weechat.print("keyboard handler: key = '"..key.. + "', input before = '"..input_before.. + "' after = '"..input_after.."'") + return weechat.PLUGIN_RC_OK() +end + + + + Note: function called has to return one of following values: + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfully + completed + + + + +
+ +
+ add_event_handler + + + Perl prototype: + + weechat::add_event_handler(event, function); + + + + Python prototype: + + weechat.add_event_handler(event, function) + + + + Ruby prototype: + + Weechat.add_event_handler(event, function) + + + + Lua prototype: + + weechat.add_event_handler(event, function) + + + + Add an event handler, called when an event happens. + + + Arguments: + + + + : event + (see ) + + + + + : function called + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::add_event_handler("buffer_open", "my_event"); +sub my_event +{ + weechat::print("buffer open"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_event_handler("buffer_open", "my_event") +def my_event(): + weechat.prnt("buffer open") + return weechat.PLUGIN_RC_OK + +# ruby +Weechat.add_event_handler("buffer_open", "my_event") +def my_event() + Weechat.print("buffer open") + return Weechat::PLUGIN_RC_OK +end + +-- lua +weechat.add_event_handler("buffer_open", "my_event") +function my_event() + weechat.print("buffer open") + return weechat.PLUGIN_RC_OK() +end + + + + Note: function called has to return one of following values: + + + + PLUGIN_RC_KO: function failed + + + + + PLUGIN_RC_OK: function successfully + completed + + + + +
+ +
+ remove_handler + + + Perl prototype: + + weechat::remove_handler(name, function); + + + + Python prototype: + + weechat.remove_handler(name, function) + + + + Ruby prototype: + + Weechat.remove_handler(name, function) + + + + Lua prototype: + + weechat.remove_handler(name, function) + + + + Remove a message or command handler. + + + Arguments: + + + + : name of IRC message or command + + + + + : function + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::remove_handler("command", "my_command"); + +# python +weechat.remove_handler("command", "my_command") + +# ruby +Weechat.remove_handler("command", "my_command") + +-- lua +weechat.remove_handler("command", "my_command") + + +
+ +
+ remove_timer_handler + + + Perl prototype: + + weechat::remove_timer_handler(function); + + + + Python prototype: + + weechat.remove_timer_handler(function) + + + + Ruby prototype: + + Weechat.remove_timer_handler(function) + + + + Lua prototype: + + weechat.remove_timer_handler(function) + + + + Remove a timer handler. + + + Arguments: + + + + : function + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::remove_timer_handler("my_timer"); + +# python +weechat.remove_timer_handler("my_timer") + +# ruby +Weechat.remove_timer_handler("my_timer") + +-- lua +weechat.remove_timer_handler("my_timer") + + +
+ +
+ remove_keyboard_handler + + + Perl prototype: + + weechat::remove_keyboard_handler(function); + + + + Python prototype: + + weechat.remove_keyboard_handler(function) + + + + Ruby prototype: + + Weechat.remove_keyboard_handler(function) + + + + Lua prototype: + + weechat.remove_keyboard_handler(function) + + + + Remove a keyboard handler. + + + Arguments: + + + + : function + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::remove_keyboard_handler("my_keyboard"); + +# python +weechat.remove_keyboard_handler("my_keyboard") + +# ruby +Weechat.remove_keyboard_handler("my_keyboard") + +-- lua +weechat.remove_keyboard_handler("my_keyboard") + + +
+ +
+ remove_event_handler + + + Perl prototype: + + weechat::remove_event_handler(function); + + + + Python prototype: + + weechat.remove_event_handler(function) + + + + Ruby prototype: + + Weechat.remove_event_handler(function) + + + + Lua prototype: + + weechat.remove_event_handler(function) + + + + Remove an event handler. + + + Arguments: + + + + : function + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::remove_event_handler("my_event"); + +# python +weechat.remove_event_handler("my_event") + +# ruby +Weechat.remove_event_handler("my_event") + +-- lua +weechat.remove_event_handler("my_event") + + +
+ +
+ add_modifier + + + Perl prototype: + + weechat::add_modifier(type, message, function); + + + + Python prototype: + + weechat.add_modifier(type, message, function) + + + + Ruby prototype: + + Weechat.add_modifier(type, message, function) + + + + Lua prototype: + + weechat.add_modifier(type, message, function) + + + + Add a message modifier. + + + Arguments: + + + + : modifier type: + + + + + Type + Description + + + + + irc_in + called for incoming IRC messages + + + irc_user + + called for each user message (or command) (before + WeeChat parses message) + + + + irc_out + + called for outgoing messages, immediately before + sending it to IRC server (this includes messages + sent automatically by WeeChat to server) + + + + + + + + + + : name of IRC message (used only for + types "irc_in" and "irc_out"). + To know list of IRC messages, please consult + RFCs + 1459 + and + 2812. + Moreover, special value "*" means all messages (no filter). + + + + + : function called + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::add_modifier("irc_in", "privmsg", "mod_in"); +weechat::add_modifier("irc_out", "privmsg", "mod_out"); +sub mod_in +{ + return "$_[1] [modifier IN]"; +} +sub mod_out +{ + return "$_[1] [modifier OUT]"; +} + +# python +weechat.add_modifier("irc_in", "privmsg", "mod_in") +weechat.add_modifier("irc_out", "privmsg", "mod_out") +def mod_in(serveur, args): + return args + " [modifier IN]" +def mod_out(serveur, args): + return args + " [modifier OUT]" + +# ruby +Weechat.add_modifier("irc_in", "privmsg", "mod_in") +Weechat.add_modifier("irc_out", "privmsg", "mod_out") +def mod_in(server, args) + return args + " [modifier IN]" +end +def mod_out(server, args) + return args + " [modifier OUT]" +end + +-- lua +weechat.add_modifier("irc_in", "privmsg", "mod_in") +weechat.add_modifier("irc_out", "privmsg", "mod_out") +function mod_in(server, args) + return args .. " [modifier IN]" +end +function mod_out(server, args) + return args .. " [modifier OUT]" +end + + +
+ +
+ remove_modifier + + + Perl prototype: + + weechat::remove_modifier(type, message, function); + + + + Python prototype: + + weechat.remove_modifier(type, message, function) + + + + Ruby prototype: + + Weechat.remove_modifier(type, message, function) + + + + Lua prototype: + + weechat.remove_modifier(type, message, function) + + + + Remove a message modifier. + + + Arguments: + + + + : modifier type + + + + + : message managed by modifier + + + + + : function + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::remove_modifier("irc_in", "privmsg", "mod_in"); + +# python +weechat.remove_modifier("irc_in", "privmsg", "mod_in") + +# ruby +Weechat.remove_modifier("irc_in", "privmsg", "mod_in") + +-- lua +weechat.remove_modifier("irc_in", "privmsg", "mod_in") + + +
+ +
+ command + + + Perl prototype: + + weechat::command(command, [channel, [server]]); + + + + Python prototype: + + weechat.command(command, [channel, [server]]) + + + + Ruby prototype: + + Weechat.command(command, [channel, [server]]) + + + + Lua prototype: + + weechat.command(command, [channel, [server]]) + + + + Execute a WeeChat command (or send a message to a channel). + + + Arguments: + + + + : command + + + + + : name of channel for executing + command + + + + + : internal name of server for + executing command + + + + + + Return value: 1 if success, 0 if an error occurred. + + + Examples: + +# perl +weechat::command("hello everybody!"); +weechat::command("/kick toto please leave this channel", "#weechat"); +weechat::command("/nick newnick", "", "freenode"); + +# python +weechat.command("hello everybody!") +weechat.command("/kick toto please leave this channel", "#weechat") +weechat.command("/nick newnick", "", "freenode") + +# ruby +Weechat.command("hello everybody!") +Weechat.command("/kick toto please leave this channel", "#weechat") +Weechat.command("/nick newnick", "", "freenode") + +-- lua +weechat.command("hello everybody!") +weechat.command("/kick toto please leave this channel", "#weechat") +weechat.command("/nick newnick", "", "freenode") + + +
+ +
+ get_info + + + Perl prototype: + + weechat::get_info(name, [server]); + + + + Python prototype: + + weechat.get_info(name, [server]) + + + + Ruby prototype: + + Weechat.get_info(name, [server]) + + + + Lua prototype: + + weechat.get_info(name, [server]) + + + + Return an info about WeeChat or a channel. + + + Arguments: + + + + : name of info to read + (see ) + + + + + : internal name of server for + reading info (if needed) + + + + + + Return value: information asked, empty string if an error + occurred. + + + Examples: + +# 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") + + +
+ +
+ get_dcc_info + + + Perl prototype: + + weechat::get_dcc_info(); + + + + Python prototype: + + weechat.get_dcc_info() + + + + Ruby prototype: + + Weechat.get_dcc_info() + + + + Lua prototype: + + weechat.get_dcc_info() + + + + Return list of DCC currently active or finished. + + + Return value: list of DCC + (see ). + + + Examples: + +# 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("no DCC"); +} + +# python +dccs = weechat.get_dcc_info() +if dccs != None: + if dccs == []: + weechat.prnt("no DCC") + else: + for d in dccs: + for b in d.keys(): + weechat.prnt("%s = '%s'" %(b, d[b])) +else: + weechat.prnt("error while getting DCC") + +# ruby +dccs = Weechat.get_dcc_info() +if dccs != nil + if dccs == [] + Weechat.print("no DCC") + else + dccs.each do |m| + m.each do |key, value| + Weechat.print("#{key} = '#{value}'") + end + end + end +else + Weechat.print("error while getting 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("no DCC") + end +else + weechat.print("error while getting DCC") +end + + +
+ +
+ get_server_info + + + Perl prototype: + + weechat::get_server_info(); + + + + Python prototype: + + weechat.get_server_info() + + + + Ruby prototype: + + Weechat.get_server_info() + + + + Lua prototype: + + weechat.get_server_info() + + + + Return list of IRC servers (connected or not). + + + Return value: list of servers + (see ). + + + Examples: + +# 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("no server"); +} + +# python +servers = weechat.get_server_info() +if servers != None: + if servers == {}: + weechat.prnt("no server") + else: + for s in servers: + for i in servers[s]: + weechat.prnt("%s -> %s = '%s'" % (s, i, str(servers[s][i]))) +else: + weechat.prnt("error while getting servers") + +# ruby +servers = Weechat.get_server_info() +if servers != nil + if servers == [] + Weechat.print("no server") + else + servers.each do |n, s| + s.each do |key, value| + Weechat.print("#{n} -> #{key} = '#{value}'") + end + end + end +else + Weechat.print("error while getting servers") +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("no server") + end +else + weechat.print("error while getting servers") +end + + +
+ +
+ get_channel_info + + + Perl prototype: + + weechat::get_channel_info(server); + + + + Python prototype: + + weechat.get_channel_info(server) + + + + Ruby prototype: + + Weechat.get_channel_info(server) + + + + Lua prototype: + + weechat.get_channel_info(server) + + + + Return list of IRC channels for a server. + + + Return value: list of IRC channels for server + (see ). + + + Examples: + +# 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("no channel"); +} + +# python +chans = weechat.get_channel_info(weechat.get_info("server")) +if chans != None: + if chans == {}: + weechat.prnt("no channel") + else: + for s in chans: + for i in chans[s]: + weechat.prnt("%s -> %s = '%s'" % (s, i, str(chans[s][i]))) +else: + weechat.prnt("error while getting channels") + +# ruby +channels = Weechat.get_channel_info(Weechat.get_info("server")) +if channels != nil + if channels == {} + Weechat.print("no channel") + else + channels.each do |n, c| + c.each do |key, value| + Weechat.print("#{n} -> #{key} = '#{value}'") + end + end + end +else + Weechat.print("error while getting channels") +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("no channel") + end +else + weechat.print("error while getting channels") +end + + +
+ +
+ get_nick_info + + + Perl prototype: + + weechat::get_nick_info(server, channel); + + + + Python prototype: + + weechat.get_nick_info(server, channel) + + + + Ruby prototype: + + Weechat.get_nick_info(server, channel) + + + + Lua prototype: + + weechat.get_nick_info(server, channel) + + + + Return list of nicks for a channel. + + + Return value: list of nicks on channel + (see ). + + + Examples: + +# 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("no nick"); +} + +# python +nicks = weechat.get_nick_info("freenode", "#weechat") +if nicks != None: + if nicks == {}: + weechat.prnt("no nick") + else: + for n in nicks: + for f in nicks[n]: + weechat.prnt("%s -> %s = '%s'" % (n, f, str(nicks[n][f]))) +else: + weechat.prnt("error while getting nicks") + +# ruby +nicks = Weechat.get_nick_info("freenode", "#weechat") +if nicks != nil + if nicks == {} + Weechat.print("no nick") + else + nicks.each do |nk, nattr| + nattr.each do |key, value| + Weechat.print("#{nk} -> #{key} = '#{value}'") + end + end + end +else + Weechat.print("error while getting nicks") +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("no nick") + end +else + weechat.print("error while getting nicks") +end + + +
+ +
+ get_config + + + Perl prototype: + + weechat::get_config(option); + + + + Python prototype: + + weechat.get_config(option) + + + + Ruby prototype: + + Weechat.get_config(option) + + + + Lua prototype: + + weechat.get_config(option) + + + + Return value of a WeeChat config option. + + + Arguments: + + + + : name of option to read + + + + + + Return value: option value, empty string if not found. + + + Examples: + +# perl +$value1 = weechat::get_config("look_nicklist"); +$value2 = weechat::get_config("freenode.server_autojoin"); + +# python +value1 = weechat.get_config("look_nicklist") +value2 = weechat.get_config("freenode.server_autojoin") + +# ruby +value1 = Weechat.get_config("look_nicklist") +value2 = Weechat.get_config("freenode.server_autojoin") + +-- lua +value1 = weechat.get_config("look_nicklist") +value2 = weechat.get_config("freenode.server_autojoin") + + +
+ +
+ set_config + + + Perl prototype: + + weechat::set_config(option, value); + + + + Python prototype: + + weechat.set_config(option, value) + + + + Ruby prototype: + + Weechat.set_config(option, value) + + + + Lua prototype: + + weechat.set_config(option, value) + + + + Update value of a WeeChat config option. + + + Arguments: + + + + : name of option to update + + + + + : new value for option + + + + + + Return value: 1 if option was successfully updated, 0 if an error + occurred. + + + Examples: + +# perl +weechat::set_config("look_nicklist", "off"); +weechat::set_config("freenode.server_autojoin", "#weechat"); + +# python +weechat.set_config("look_nicklist", "off") +weechat.set_config("freenode.server_autojoin", "#weechat") + +# ruby +Weechat.set_config("look_nicklist", "off") +Weechat.set_config("freenode.server_autojoin", "#weechat") + +-- lua +weechat.set_config("look_nicklist", "off") +weechat.set_config("freenode.server_autojoin", "#weechat") + + +
+ +
+ get_plugin_config + + + Perl prototype: + + weechat::get_plugin_config(option); + + + + Python prototype: + + weechat.get_plugin_config(option) + + + + Ruby prototype: + + Weechat.get_plugin_config(option) + + + + Lua prototype: + + weechat.get_plugin_config(option) + + + + Return value of a plugin option. Option is read from file + "~/.weechat/plugins.rc" and is like: + "plugin.option=value" (note: plugin name + is automatically added). + + + Arguments: + + + + : name of option to read + + + + + + Return value: value of option, empty string if not found. + + + Examples : + +# perl +$value = weechat::get_plugin_config("my_var"); + +# python +value = weechat.get_plugin_config("my_var") + +# ruby +value = Weechat.get_plugin_config("my_var") + +-- lua +value = weechat.get_plugin_config("my_var") + + +
+ +
+ set_plugin_config + + + Perl prototype: + + weechat::set_plugin_config(option, value); + + + + Python prototype: + + weechat.set_plugin_config(option, value) + + + + Ruby prototype: + + Weechat.set_plugin_config(option, value) + + + + Lua prototype: + + weechat.set_plugin_config(option, value) + + + + Update value of a plugin option. Option is written in file + "~/.weechat/plugins.rc" and is like: + "plugin.option=value" (note: plugin name + is automatically added). + + + Arguments: + + + + : name of option to update + + + + + : new value for option + + + + + + Return value: 1 if option was successfully updated, 0 if an error + occurred. + + + Examples: + +# perl +weechat::set_plugin_config("my_var", "value"); + +# python +weechat.set_plugin_config("my_var", "value") + +# ruby +Weechat.set_plugin_config("my_var", "value") + +-- lua +weechat.set_plugin_config("my_var", "value") + + +
+ +
+ get_irc_color + + + Perl prototype: + + weechat::get_irc_color(color); + + + + Python prototype: + + weechat.get_irc_color(color) + + + + Ruby prototype: + + Weechat.get_irc_color(color) + + + + Lua prototype: + + weechat.get_irc_color(color) + + + + Return IRC color index with name. + + + Return value: IRC color index, -1 if color is not found + (see ). + + + Examples: + +# 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") + + +
+ +
+ input_color + + + Perl prototype: + + weechat::input_color(color); + + + + Python prototype: + + weechat.input_color(color) + + + + Ruby prototype: + + Weechat.input_color(color) + + + + Lua prototype: + + weechat.input_color(color) + + + + Add color in input buffer. + + + Return value: none. + + + Examples: + +# 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) + + +
+ +
+ get_window_info + + + Perl prototype: + + weechat::get_window_info(); + + + + Python prototype: + + weechat.get_window_info() + + + + Ruby prototype: + + Weechat.get_window_info() + + + + Lua prototype: + + weechat.get_window_info() + + + + Return list of WeeChat windows. + + + Return value: list of WeeChat windows + (see ). + + + Examples: + +# perl +my @wf = weechat::get_window_info(); +if (@wf) +{ + weechat::print("**** windows infos ****"); + foreach my $w (@wf) + { + while ( my ($key, $value) = each %$w) + { + weechat::print(" > $key => $value"); + } + weechat::print("----------------------"); + } +} +else +{ + weechat::print("**** no window info ****"); +} + +# python +wf = weechat.get_window_info() +if wf != None and wf != []: + weechat.prnt ("**** windows infos ****") + for w in wf: + for i in w: + weechat.prnt (" > %s => %s" % (i, w[i])) + weechat.prnt ("----------------------") +else: + weechat.prnt ("**** no window info ****") + +# ruby +wf = Weechat.get_window_info() +if wf != nil and wf != [] + Weechat.print("**** windows infos ****") + wf.each do |w| + w.each do |key, value| + Weechat.print(" > #{key} => #{value}") + end + Weechat.print("----------------------") + end +else + Weechat.print("**** no window info ****") +end + +-- lua +wf = weechat.get_window_info() +if wf then + weechat.print ("**** windows infos ****") + 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("**** no window info ****") +end + + +
+ +
+ get_buffer_info + + + Perl prototype: + + weechat::get_buffer_info(); + + + + Python prototype: + + weechat.get_buffer_info() + + + + Ruby prototype: + + Weechat.get_buffer_info() + + + + Lua prototype: + + weechat.get_buffer_info() + + + + Return list of WeeChat buffers. + + + Return value: list of WeeChat buffers + (see ). + + + Examples: + +# 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"); + } + weechat::print("----------------------"); + } +} +else +{ + weechat::print("**** no buffer info ****"); +} + +# python +bf = weechat.get_buffer_info() +if bf != None and bf != {}: + for b in bf: + weechat.prnt ("**** info for buffer no %d ****" % b) + for c in bf[b]: + weechat.prnt (" > %s => %s" % (c, bf[b][c])) + weechat.prnt ("----------------------") +else: + weechat.prnt ("**** no buffer info ****") + +# ruby +bf = Weechat.get_buffer_info() +if bf != nil and bf != {} + bf.each do |n, c| + Weechat.print("**** info for buffer no #{n} ****") + c.each do |key, value| + Weechat.print(" > #{key} => #{value}") + end + Weechat.print("----------------------") + end +else + Weechat.print("**** no buffer info ****") +end + +-- lua +bf = weechat.get_buffer_info() +if bf then + b, binfos = next (bf, nil) + while (b) do + weechat.print("**** info for buffer no " .. b .. " ****") + key, value = next (binfos, nil) + while (key) do + weechat.print(" > " .. key .. " => " .. value) + key, value = next (binfos, key) + end + weechat.print ("----------------------") + b, infos = next (bf, b) + end +else + weechat.print("**** no buffer info ****") +end + + +
+ +
+ get_buffer_data + + + Perl prototype: + + weechat::get_buffer_data(server, channel); + + + + Python prototype: + + weechat.get_buffer_data(server, channel) + + + + Ruby prototype: + + Weechat.get_buffer_data(server, channel) + + + + Lua prototype: + + weechat.get_buffer_data(server, channel) + + + + Return content of buffer. + + + Return value: list of lines for buffer + (see ). + + + Examples: + +# perl +my $server = weechat::get_info("server"); +my $channel = weechat::get_info("channel"); +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 = weechat.get_info("server") +channel = weechat.get_info("channel") +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 = Weechat.get_info("server") +channel = Weechat.get_info("channel") +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 = weechat.get_info("server") +channel = weechat.get_info("channel") +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 (bdatas, 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 + + +
+ +
+ +
diff --git a/doc/en/plugins.en.xml b/doc/en/plugins.en.xml new file mode 100644 index 000000000..723633668 --- /dev/null +++ b/doc/en/plugins.en.xml @@ -0,0 +1,213 @@ + + + + + + Plugins + + + This chapter describes WeeChat plugins interface (API) and + the default scripts plugins (Perl, Python, Ruby, Lua), provided with + WeeChat. + + +
+ Plugins in WeeChat + + + A plugin is a C program which can call WeeChat functions defined in + an interface. + + + + This C program does not need WeeChat sources to compile and can be + dynamically loaded into WeeChat with command + /plugin. + + + + The plugin has to be a dynamic library, for dynamic loading by + operating system. + Under GNU/Linux, the file has ".so" extension, ".dll" under + Windows. + + +
+ +
+ Write a plugin + + + The plugin has to include "weechat-plugin.h" file (available in + WeeChat source code). + This file defines structures and types used to communicate with + WeeChat. + + + + The plugin must have some variables and functions (mandatory, + without them the plugin can't load): + + + + + Variable + Description + + + + + char plugin_name[] + plugin name + + + char plugin_version[] + plugin version + + + char plugin_description[] + short description of plugin + + + + + + + + + + Function + Description + + + + + int weechat_plugin_init (t_weechat_plugin *plugin) + + function called when plugin is loaded, must return + PLUGIN_RC_OK if successful, PLUGIN_RC_KO if error + (if error, plugin will NOT be loaded) + + + + void weechat_plugin_end (t_weechat_plugin *plugin) + function called when plugin is unloaded + + + + + + + &plugin_api.en.xml; + +
+ Compile plugin + + + Compile does not need WeeChat sources, only file + "weechat-plugin.h". + + + + To compile a plugin which has one file "toto.c" (under GNU/Linux): + +$ gcc -fPIC -Wall -c toto.c +$ gcc -shared -fPIC -o libtoto.so toto.o + + + +
+ +
+ Load plugin into WeeChat + + + Copy "libtoto.so" file into system plugins directory (for example + "/usr/local/lib/weechat/plugins") or into + user's plugins directory (for example + "/home/xxxxx/.weechat/plugins"). + + + + Under WeeChat: + /plugin load toto + + +
+ +
+ Plugin example + + + Full example of plugin, which adds a /double command, which displays + two times arguments on current channel (ok that's not very useful, + but that's just an example!): + +#include <stdlib.h> + +#include "weechat-plugin.h" + +char plugin_name[] = "Double"; +char plugin_version[] = "0.1"; +char plugin_description[] = "Test plugin for WeeChat"; + +/* "/double" command manager */ + +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", + "Display two times a message", + "msg", + "msg: message to display two times", + NULL, + &double_cmd, + NULL, NULL); + return PLUGIN_RC_OK; +} + +void weechat_plugin_end (t_weechat_plugin *plugin) +{ + /* nothing done here */ +} + + + +
+ +
+ + &plugin_charset.en.xml; + + &plugin_scripts.en.xml; + +
diff --git a/doc/en/usage.en.xml b/doc/en/usage.en.xml new file mode 100644 index 000000000..f934ddb06 --- /dev/null +++ b/doc/en/usage.en.xml @@ -0,0 +1,947 @@ + + + + + + Usage + + + This chapter explains how to run WeeChat, the default key bindings + used, internal and IRC commands, setup file, and FIFO pipe use. + + +
+ Running WeeChat + + + Command line arguments: + + + + + Parameter + Description + + + + + -a, --no-connect + + Disable auto-connect to servers at startup + + + + -c, --config + + Display config help (list of options) + + + + -d, --dir <path> + + Set path as home for WeeChat (used for configuration files, + logs, user plugins and scripts). Default value is + "~/.weechat". Please note that directory + is created if not found by WeeChat. + + + + -f, --key-functions + + Display WeeChat internal functions for keys + + + + -h, --help + + Display help + + + + -i, --irc-commands + + Display IRC commands list + + + + -k, --keys + + Display WeeChat default keys + + + + -l, --license + + Display WeeChat license + + + + -p, --no-plugin + + Disable plugins auto-load + + + + -v, --version + + Display WeeChat version + + + + -w, --weechat-commands + + Display WeeChat commands list + + + + + + + + + It is also possible to give URL for one or many IRC servers, as + follow: + irc[6][s]://[pseudo[:mot_passe]@]irc.example.org[:port][/channel][,channel[...] + Example to join #weechat and #toto on + "irc.freenode.net" server, default port (6667), + with "nono" nick: + $ weechat-curses irc://nono@irc.freenode.net/#weechat,#toto + + + + To start WeeChat, issue this command: + + + + for Curses GUI: weechat-curses + + + + + for Gtk GUI: weechat-gtk + + + + + for wxWidgets GUI: weechat-wxwidgets + + + + + for Qt GUI: weechat-qt + + + + + + + When you run WeeChat for the first time, a default configuration + file is created, with default options. + The default configuration file is: + "~/.weechat/weechat.rc" + + + + You can edit this file at your convenience to configure WeeChat + (ONLY if WeeChat is not running), or you can set parameters with + "/set" command in WeeChat + (see ) + + +
+ +
+ Key bindings + + + + + + + Key + Action + + + + + Left arrow / Ctrl + B + + Go to previous char in command line + + + + Right arrow / Ctrl + F + + Go to next char in command line + + + + Ctrl + left arrow + + Go to previous word in command line + + + + Ctrl + right arrow + + Go to next word in command line + + + + Home / Ctrl + A + + Go to the beginning of command line + + + + Ctrl + C then B + + Insert code for bold text. + + + + Ctrl + C then C + + Insert code for colored text. + + + + Ctrl + C then O + + Insert code for color reset. + + + + Ctrl + C then R + + Insert code for reverse color. + + + + Ctrl + C then U + + Insert code for underlined text. + + + + End / Ctrl + E + + Go to the end of command line + + + + Ctrl + K + + Delete from cursor until end of command line + + + + Ctrl + L + + Redraw whole window + + + + Ctrl + R + + Search for text in buffer history + (two times: search exact text) + + + + Ctrl + S then Ctrl + U + + Set unread marker on all buffers + + + + Ctrl + T + + Transpose chars + + + + Ctrl + U + + Delete from cursor until beginning of command line + + + + Ctrl + W + + Delete previous word of command line + + + + Ctrl + Y + + Paste clipboard content + + + + Backspace / Ctrl + H + + Delete previous char in command line + + + + Delete / Ctrl + D + + Delete next char in command line + + + + Tab / Shift + Tab + + Complete command or nick + (Tab again: find next completion) + + + + Any char + + Insert char at cursor position in command line + + + + Enter / Ctrl + J / Ctrl + M + + Execute command or send message + (in search mode: stop search) + + + + Up arrow / Down arrow + + Call again last commands/messages (in search mode: search + up/down) + + + + Ctrl + up arrow / Ctrl + down arrow + + Call again last commands/messages in global history + (common for all buffers) + + + + PageUp / PageDown + + Scroll up / down one page in buffer history + + + + Alt + PageUp / Alt + PageDown + + Scroll up / down a few lines in buffer history + + + + Alt + Home / Alt + End + + Scroll to top / bottom of buffer + + + + F5 / Alt + left arrow + + Switch to previous buffer + + + + F6 / Alt + right arrow + + Switch to next buffer + + + + F7 + + Switch to previous window + + + + F8 + + Switch to next window + + + + F9 / F10 + + Scroll topic + + + + F11 / F12 + + Scroll nicklist + + + + Alt + F11 / Alt + F12 + + Go to the beginning / the end of nicklist + + + + Alt + A + + Switch to next buffer with activity + (with priority: highlight, message, other) + + + + Alt + B + + Go to previous word in command line + + + + Alt + D + + Delete next word in command line + + + + Alt + F + + Go to next word in command line + + + + Alt + H + + Clear hotlist + (activity notification on other buffers) + + + + Alt + I + + Remove last infobar message + + + + Alt + J then Alt + D + + Display DCC buffer + + + + Alt + J then Alt + L + + Switch to last buffer + + + + Alt + J then Alt + P + + Switch to buffer previously displayed + + + + Alt + J then Alt + R + + Switch to raw IRC data buffer + + + + Alt + J then Alt + S + + Switch to server buffer + + + + Alt + J then Alt + X + + Switch to first channel of next server + (or server buffer if no channel is opened) + + + + Alt + digit (0-9) + + Switch to buffer by number (0 = 10) + + + + Alt + J then number (01-99) + + Switch to buffer by number + + + + Alt + K + + Grab a key and insert its code in command line + + + + Alt + N + + Scroll to next highlight + + + + Alt + P + + Scroll to previous highlight + + + + Alt + R + + Delete entire command line + + + + Alt + S + + Switch servers on servers buffer + (if option "look_one_server_buffer" is enabled) + + + + Alt + U + + Scroll to first unread line in buffer + + + + Alt + W then Alt + arrow + + Switch to window with direction + + + + + + + +
+ +
+ Command line + + + WeeChat command line (at the bottom of window) lets you send text on + channels and execute WeeChat or IRC commands (see + ). + + + + Commands begin with "/" char, followed by name of command. + For example, to initiate a private chat with "toto": + /query toto + + + + Text sent to a channel is any text that does not begin with "/" char. + For example, to send text "hello" on current + channel: + hello + + + + However, it is possible to start with "/" char, by adding another. + For example, to send text "/query toto" on current + channel: + //query toto + + + + If option for sending IRC colors ("irc_colors_send") + is enabled, you can use color codes and attributes, as follow (press + Ctrl-C then following letter, with optional value): + + + + + Code + Description + + + + + ^Cb + + bold text + + + + ^Ccxx + + text color "xx" + (see colors table below) + + + + ^Ccxx,yy + + text color "xx" + and background "yy" + (see colors table below) + + + + ^Co + + disable color and attributes + + + + ^Cr + + reverse video (revert text color with background) + + + + ^Cu + + underlined text + + + + + + Note: the same code (without number for ^Cc) may be used to stop the + attribute. + + + + Color codes for ^Cc are: + + + + + Code + Color + + + + + 00 + white + + + 01 + black + + + 02 + dark blue + + + 03 + dark green + + + 04 + light red + + + 05 + dark red + + + 06 + magenta + + + 07 + orange + + + 08 + yellow + + + 09 + light green + + + 10 + cyan + + + 11 + light cyan + + + 12 + light blue + + + 13 + light magenta + + + 14 + gray + + + 15 + light gray (white) + + + + + + + + Example: display of "hello everybody!" with + "hello" in light blue bold, and + "everybody" in light red underlined: +^Cc12^Cbhello^Cb^Cc04^Cu everybody^Cu^Cc! + + +
+ +
+ WeeChat / IRC commands + + + This chapter lists all WeeChat and IRC commands. + + +
+ WeeChat commands + + + &weechat_commands.xml; + + +
+ +
+ Key functions + + + + + + + Function + Description + + + + + &key_functions.xml; + + + + + + +
+ +
+ IRC commands + + + &irc_commands.xml; + + +
+ +
+ +
+ Configuration file + + + List of options for config file: + + + + + Option + Type + Values + Default + Description + + + + + &config.xml; + + + + + + + + Colors for Curses GUI are: + + + + + Keyword + Color + + + + + default + default color (transparent for background) + + + black + black + + + red + dark red + + + lightred + light red + + + green + dark green + + + lightgreen + light green + + + brown + brown + + + yellow + yellow + + + blue + dark blue + + + lightblue + light blue + + + magenta + dark magenta + + + lightmagenta + light magenta + + + cyan + dark cyan + + + lightcyan + light cyan + + + white + white + + + + + + +
+ +
+ FIFO pipe + + + You can remote control WeeChat, by sending commands or text to a + FIFO pipe (you have to enable option "irc_fifo_pipe", it is disabled + by default). + + + + The FIFO pipe is located in "~/.weechat/" and is + called "weechat_fifo_xxxxx" (where xxxxx is the process ID (PID) of + running WeeChat). So if many WeeChat are running, you have many FIFO + pipes, one for each session. + + + + The syntax for the FIFO pipe commands/text is: + server,channel *text or command here + where server and channel are optional, but if channel is here, server + should be too. + + + + Some examples: + + + + nick change on freenode to "mynick|out" : + $ echo 'freenode */nick mynick|out' >~/.weechat/weechat_fifo_12345 + + + + + display text on #weechat channel: + $ echo 'freenode,#weechat *hello everybody!' >~/.weechat/weechat_fifo_12345 + + + + + display text on current channel (buffer displayed by WeeChat): + $ echo '*hello!' >~/.weechat/weechat_fifo_12345 + Warning: this is dangerous and you should + not do that except if you know what you do! + + + + + send two commands to unload/reload Perl scripts (you have to + separate them with "\n"): + $ echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345 + + + + + + + You can write a script to send command to all running WeeChat at same + time, for example: + + #!/bin/sh + if [ $# -eq 1 ]; then + for fifo in ~/.weechat/weechat_fifo_* + do + echo -e "$1" >$fifo + done + fi + + If the script is called "auto_weechat_command", you can run it with: + $ ./auto_weechat_command "freenode,#weechat *hello" + + +
+ +
diff --git a/doc/en/weechat.en.xml b/doc/en/weechat.en.xml index d5985f546..d2e8102a0 100644 --- a/doc/en/weechat.en.xml +++ b/doc/en/weechat.en.xml @@ -24,11 +24,22 @@ along with this program. If not, see . + + + + + + + + + + ]> @@ -85,8062 +96,14 @@ along with this program. If not, see . - + &intro.en.xml; - - Introduction - - - This chapter describes WeeChat and pre-requisites for its installation. - - -
- Description - - - WeeChat (Wee Enhanced Environment for Chat) is a free chat client, - fast and light, designed for many operating systems. - - - - Main features are: - - - - multi-servers connection (with SSL, IPv6, proxy) - - - - - many GUI: Curses, wxWidgets, Gtk and Qt - - - - - small, fast and light - - - - - customizable and extensible with plugins and scripts - - - - - compliant with RFCs - 1459, - 2810, - 2811, - 2812 and - 2813 - - - - - multi-platform (GNU/Linux, *BSD, MacOS X, Windows and other) - - - - - 100% GPL, free software - - - - - - - WeeChat homepage is here: - - http://weechat.flashtux.org - - - -
- -
- Pre-requisites - - - In order to install WeeChat, you need: - - - - a running GNU/Linux system (with compiler tools for source - package) - - - - - "root" privileges (to install WeeChat) - - - - - according to GUI, one of the following libraries: - - - - Curses: ncurses library - - - - - Gtk: *** GUI not developed *** - - - - - WxWidgets: *** GUI not developed *** - - - - - Qt: *** GUI not developed *** - - - - - - - - -
-
+ &install.en.xml; - + &usage.en.xml; - - Installation - - - This chapter explains how to install WeeChat. - - -
- Binary packages - - - Binary packages are available for these distributions: - - - - Debian (or any Debian compatible distribution): - apt-get install weechat - - - - - Mandriva/RedHat (or any RPM compatible distribution): - - rpm -i /chemin/weechat-x.y.z-1.i386.rpm - - - - - - Gentoo : - emerge weechat - - - - - For other distributions, please look at your manual for - installation instructions. - - -
- -
- Source package - - - All you have to do is to run in a console or a terminal: -$ ./configure -$ make - - - Then get root privileges and install WeeChat: -$ su -(enter root password) -# make install - - -
- -
- GIT sources - - - Warning: GIT sources are for advanced users: it may not compile - or not be stable. You're warned! - - - - To get GIT sources, issue this command: -$ git-clone git://git.sv.gnu.org/weechat.git - - - - Execute this script: - ./autogen.sh - - - - Then follow instructions for source package - (see ) - - -
- -
+ &plugins.en.xml; - - - - Usage - - - This chapter explains how to run WeeChat, the default key bindings - used, internal and IRC commands, setup file, and FIFO pipe use. - - -
- Running WeeChat - - - Command line arguments: - - - - - Parameter - Description - - - - - -a, --no-connect - - Disable auto-connect to servers at startup - - - - -c, --config - - Display config help (list of options) - - - - -d, --dir <path> - - Set path as home for WeeChat (used for configuration files, - logs, user plugins and scripts). Default value is - "~/.weechat". Please note that directory - is created if not found by WeeChat. - - - - -f, --key-functions - - Display WeeChat internal functions for keys - - - - -h, --help - - Display help - - - - -i, --irc-commands - - Display IRC commands list - - - - -k, --keys - - Display WeeChat default keys - - - - -l, --license - - Display WeeChat license - - - - -p, --no-plugin - - Disable plugins auto-load - - - - -v, --version - - Display WeeChat version - - - - -w, --weechat-commands - - Display WeeChat commands list - - - - - - - - - It is also possible to give URL for one or many IRC servers, as - follow: - irc[6][s]://[pseudo[:mot_passe]@]irc.example.org[:port][/channel][,channel[...] - Example to join #weechat and #toto on - "irc.freenode.net" server, default port (6667), - with "nono" nick: - $ weechat-curses irc://nono@irc.freenode.net/#weechat,#toto - - - - To start WeeChat, issue this command: - - - - for Curses GUI: weechat-curses - - - - - for Gtk GUI: weechat-gtk - - - - - for wxWidgets GUI: weechat-wxwidgets - - - - - for Qt GUI: weechat-qt - - - - - - - When you run WeeChat for the first time, a default configuration - file is created, with default options. - The default configuration file is: - "~/.weechat/weechat.rc" - - - - You can edit this file at your convenience to configure WeeChat - (ONLY if WeeChat is not running), or you can set parameters with - "/set" command in WeeChat - (see ) - - -
- -
- Key bindings - - - - - - - Key - Action - - - - - Left arrow / Ctrl + B - - Go to previous char in command line - - - - Right arrow / Ctrl + F - - Go to next char in command line - - - - Ctrl + left arrow - - Go to previous word in command line - - - - Ctrl + right arrow - - Go to next word in command line - - - - Home / Ctrl + A - - Go to the beginning of command line - - - - Ctrl + C then B - - Insert code for bold text. - - - - Ctrl + C then C - - Insert code for colored text. - - - - Ctrl + C then O - - Insert code for color reset. - - - - Ctrl + C then R - - Insert code for reverse color. - - - - Ctrl + C then U - - Insert code for underlined text. - - - - End / Ctrl + E - - Go to the end of command line - - - - Ctrl + K - - Delete from cursor until end of command line - - - - Ctrl + L - - Redraw whole window - - - - Ctrl + R - - Search for text in buffer history - (two times: search exact text) - - - - Ctrl + S then Ctrl + U - - Set unread marker on all buffers - - - - Ctrl + T - - Transpose chars - - - - Ctrl + U - - Delete from cursor until beginning of command line - - - - Ctrl + W - - Delete previous word of command line - - - - Ctrl + Y - - Paste clipboard content - - - - Backspace / Ctrl + H - - Delete previous char in command line - - - - Delete / Ctrl + D - - Delete next char in command line - - - - Tab / Shift + Tab - - Complete command or nick - (Tab again: find next completion) - - - - Any char - - Insert char at cursor position in command line - - - - Enter / Ctrl + J / Ctrl + M - - Execute command or send message - (in search mode: stop search) - - - - Up arrow / Down arrow - - Call again last commands/messages (in search mode: search - up/down) - - - - Ctrl + up arrow / Ctrl + down arrow - - Call again last commands/messages in global history - (common for all buffers) - - - - PageUp / PageDown - - Scroll up / down one page in buffer history - - - - Alt + PageUp / Alt + PageDown - - Scroll up / down a few lines in buffer history - - - - Alt + Home / Alt + End - - Scroll to top / bottom of buffer - - - - F5 / Alt + left arrow - - Switch to previous buffer - - - - F6 / Alt + right arrow - - Switch to next buffer - - - - F7 - - Switch to previous window - - - - F8 - - Switch to next window - - - - F9 / F10 - - Scroll topic - - - - F11 / F12 - - Scroll nicklist - - - - Alt + F11 / Alt + F12 - - Go to the beginning / the end of nicklist - - - - Alt + A - - Switch to next buffer with activity - (with priority: highlight, message, other) - - - - Alt + B - - Go to previous word in command line - - - - Alt + D - - Delete next word in command line - - - - Alt + F - - Go to next word in command line - - - - Alt + H - - Clear hotlist - (activity notification on other buffers) - - - - Alt + I - - Remove last infobar message - - - - Alt + J then Alt + D - - Display DCC buffer - - - - Alt + J then Alt + L - - Switch to last buffer - - - - Alt + J then Alt + P - - Switch to buffer previously displayed - - - - Alt + J then Alt + R - - Switch to raw IRC data buffer - - - - Alt + J then Alt + S - - Switch to server buffer - - - - Alt + J then Alt + X - - Switch to first channel of next server - (or server buffer if no channel is opened) - - - - Alt + digit (0-9) - - Switch to buffer by number (0 = 10) - - - - Alt + J then number (01-99) - - Switch to buffer by number - - - - Alt + K - - Grab a key and insert its code in command line - - - - Alt + N - - Scroll to next highlight - - - - Alt + P - - Scroll to previous highlight - - - - Alt + R - - Delete entire command line - - - - Alt + S - - Switch servers on servers buffer - (if option "look_one_server_buffer" is enabled) - - - - Alt + U - - Scroll to first unread line in buffer - - - - Alt + W then Alt + arrow - - Switch to window with direction - - - - - - - -
- -
- Command line - - - WeeChat command line (at the bottom of window) lets you send text on - channels and execute WeeChat or IRC commands (see - ). - - - - Commands begin with "/" char, followed by name of command. - For example, to initiate a private chat with "toto": - /query toto - - - - Text sent to a channel is any text that does not begin with "/" char. - For example, to send text "hello" on current - channel: - hello - - - - However, it is possible to start with "/" char, by adding another. - For example, to send text "/query toto" on current - channel: - //query toto - - - - If option for sending IRC colors ("irc_colors_send") - is enabled, you can use color codes and attributes, as follow (press - Ctrl-C then following letter, with optional value): - - - - - Code - Description - - - - - ^Cb - - bold text - - - - ^Ccxx - - text color "xx" - (see colors table below) - - - - ^Ccxx,yy - - text color "xx" - and background "yy" - (see colors table below) - - - - ^Co - - disable color and attributes - - - - ^Cr - - reverse video (revert text color with background) - - - - ^Cu - - underlined text - - - - - - Note: the same code (without number for ^Cc) may be used to stop the - attribute. - - - - Color codes for ^Cc are: - - - - - Code - Color - - - - - 00 - white - - - 01 - black - - - 02 - dark blue - - - 03 - dark green - - - 04 - light red - - - 05 - dark red - - - 06 - magenta - - - 07 - orange - - - 08 - yellow - - - 09 - light green - - - 10 - cyan - - - 11 - light cyan - - - 12 - light blue - - - 13 - light magenta - - - 14 - gray - - - 15 - light gray (white) - - - - - - - - Example: display of "hello everybody!" with - "hello" in light blue bold, and - "everybody" in light red underlined: -^Cc12^Cbhello^Cb^Cc04^Cu everybody^Cu^Cc! - - -
- -
- WeeChat / IRC commands - - - This chapter lists all WeeChat and IRC commands. - - -
- WeeChat commands - - - &weechat_commands.xml; - - -
- -
- Key functions - - - - - - - Function - Description - - - - - &key_functions.xml; - - - - - - -
- -
- IRC commands - - - &irc_commands.xml; - - -
- -
- -
- Configuration file - - - List of options for config file: - - - - - Option - Type - Values - Default - Description - - - - - &config.xml; - - - - - - - - Colors for Curses GUI are: - - - - - Keyword - Color - - - - - default - default color (transparent for background) - - - black - black - - - red - dark red - - - lightred - light red - - - green - dark green - - - lightgreen - light green - - - brown - brown - - - yellow - yellow - - - blue - dark blue - - - lightblue - light blue - - - magenta - dark magenta - - - lightmagenta - light magenta - - - cyan - dark cyan - - - lightcyan - light cyan - - - white - white - - - - - - -
- -
- FIFO pipe - - - You can remote control WeeChat, by sending commands or text to a - FIFO pipe (you have to enable option "irc_fifo_pipe", it is disabled - by default). - - - - The FIFO pipe is located in "~/.weechat/" and is - called "weechat_fifo_xxxxx" (where xxxxx is the process ID (PID) of - running WeeChat). So if many WeeChat are running, you have many FIFO - pipes, one for each session. - - - - The syntax for the FIFO pipe commands/text is: - server,channel *text or command here - where server and channel are optional, but if channel is here, server - should be too. - - - - Some examples: - - - - nick change on freenode to "mynick|out" : - $ echo 'freenode */nick mynick|out' >~/.weechat/weechat_fifo_12345 - - - - - display text on #weechat channel: - $ echo 'freenode,#weechat *hello everybody!' >~/.weechat/weechat_fifo_12345 - - - - - display text on current channel (buffer displayed by WeeChat): - $ echo '*hello!' >~/.weechat/weechat_fifo_12345 - Warning: this is dangerous and you should - not do that except if you know what you do! - - - - - send two commands to unload/reload Perl scripts (you have to - separate them with "\n"): - $ echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345 - - - - - - - You can write a script to send command to all running WeeChat at same - time, for example: - -#!/bin/sh -if [ $# -eq 1 ]; then - for fifo in ~/.weechat/weechat_fifo_* - do - echo -e "$1" >$fifo - done -fi - - If the script is called "auto_weechat_command", you can run it with: - $ ./auto_weechat_command "freenode,#weechat *hello" - - -
- -
- - - - - Plugins - - - This chapter describes WeeChat plugins interface (API) and - the default scripts plugins (Perl, Python, Ruby, Lua), provided with - WeeChat. - - -
- Plugins in WeeChat - - - A plugin is a C program which can call WeeChat functions defined in - an interface. - - - - This C program does not need WeeChat sources to compile and can be - dynamically loaded into WeeChat with command - /plugin. - - - - The plugin has to be a dynamic library, for dynamic loading by - operating system. - Under GNU/Linux, the file has ".so" extension, ".dll" under - Windows. - - -
- -
- Write a plugin - - - The plugin has to include "weechat-plugin.h" file (available in - WeeChat source code). - This file defines structures and types used to communicate with - WeeChat. - - - - The plugin must have some variables and functions (mandatory, - without them the plugin can't load): - - - - - Variable - Description - - - - - char plugin_name[] - plugin name - - - char plugin_version[] - plugin version - - - char plugin_description[] - short description of plugin - - - - - - - - - - Function - Description - - - - - int weechat_plugin_init (t_weechat_plugin *plugin) - - function called when plugin is loaded, must return - PLUGIN_RC_OK if successful, PLUGIN_RC_KO if error - (if error, plugin will NOT be loaded) - - - - void weechat_plugin_end (t_weechat_plugin *plugin) - function called when plugin is unloaded - - - - - - -
- API functions - -
- set_charset - - - Prototype: - - void set_charset (t_weechat_plugin *plugin, char *charset) - - - - Set new plugin charset. - - - Arguments: - - - - : pointer to plugin structure - - - - - : new charset to use - - - - - - Example: - plugin->set_charset (plugin, "ISO-8859-1"); - -
- -
- iconv_to_internal - - - Prototype: - - void iconv_to_internal (t_weechat_plugin *plugin, char *charset, - char *string) - - - - Convert string to WeeChat internal charset (UTF-8). - - - Arguments: - - - - : pointer to plugin structure - - - - - : charset to convert - - - - - : string to convert - - - - - - Return value: converted string. - - - Note: result has to be free by a call to "free" after use. - - - Example: - char *str = plugin->iconv_to_internal (plugin, "ISO-8859-1", "iso string: é à"); - -
- -
- iconv_from_internal - - - Prototype: - - void iconv_from_internal (t_weechat_plugin *plugin, char *charset, - char *string) - - - - Convert string from internal WeeChat charset (UTF-8) to another. - - - Arguments: - - - - : pointer to plugin structure - - - - - : target charset - - - - - : string to convert - - - - - - Return value: converted string. - - - Note: result has to be free by a call to "free" after use. - - - Example: - char *str = plugin->iconv_from_internal (plugin, "ISO-8859-1", "utf-8 string: é à"); - -
- -
- ascii_strcasecmp - - - Prototype: - - int ascii_strcasecmp (t_weechat_plugin *plugin, - char *string1, char *string2) - - - - Locale and case independent string comparison. - - - Arguments: - - - - : pointer to plugin structure - - - - - : first string for comparison - - - - - : second string for comparison - - - - - - Return value: difference between two strings: negative if - string1 < string2, zero if string1 == string2, positive if - string1 > string2 - - - Example: - if (plugin->ascii_strcasecmp (plugin, "abc", "def") != 0) ... - -
- -
- ascii_strncasecmp - - - Prototype: - - int ascii_strncasecmp (t_weechat_plugin *plugin, - char *string1, char *string2, int max) - - - - Locale and case independent string comparison, for "max" chars. - - - Arguments: - - - - : pointer to plugin struct - - - - - : first string for comparison - - - - - : second string for comparison - - - - - : max number of chars for comparison - - - - - - Return value: difference between two strings: negative if - string1 < string2, zero if string1 == string2, positive if - string1 > string2 - - - Example: - if (plugin->ascii_strncasecmp (plugin, "abc", "def", 2) != 0) ... - -
- -
- explode_string - - - Prototype: - - char **explode_string (t_weechat_plugin *plugin, char *string, - char *separators, int num_items_max, int *num_items) - - - - Explode a string according to one or more delimiter(s). - - - Arguments: - - - - : pointer to plugin struct - - - - - : string to explode - - - - - : delimiters used for explosion - - - - - : maximum number of items - created (0 = no limit) - - - - - : pointer to int which will - contain number of items created - - - - - - Return value: array of strings, NULL if problem. - - - Note: result has to be free by a call to "free_exloded_string" - after use. - - - Example: - -char **argv; -int argc; -argv = plugin->explode_string (plugin, string, " ", 0, &argc); -... -if (argv != NULL) - plugin->free_exploded_string (plugin, argv); - - -
- -
- free_exploded_string - - - Prototype: - - char **free_exploded_string (t_weechat_plugin *plugin, - char **string) - - - - Free memory used by a string explosion. - - - Arguments: - - - - : pointer to plugin structure - - - - - : string exploded by - "explode_string" function - - - - - - Return value: none. - - - Example: - -char *argv; -int argc; -argv = plugin->explode_string (plugin, string, " ", 0, &argc); -... -if (argv != NULL) - plugin->free_exploded_string (plugin, argv); - - -
- -
- mkdir_home - - - Prototype: - - int mkdir_home (t_weechat_plugin *plugin, char *directory) - - - - Create a directory in WeeChat home. - - - Arguments: - - - - : pointer to plugin structure - - - - - : directory to create - - - - - - Return value: 1 if directory was successfully created, 0 if an - error occurred. - - - Example: - -if (!plugin->mkdir_home (plugin, "temp")) - plugin->print_server(plugin, "Failed to create 'temp' directory in WeeChat home."); - - -
- -
- exec_on_files - - - Prototype: - - void exec_on_files (t_weechat_plugin *plugin, char *directory, - int (*callback)(t_weechat_plugin *, char *)) - - - - Execute a function on all files of a directory. - - - Arguments: - - - - : pointer to plugin structure - - - - - : directory for searching files - - - - - : function called for each file - found - - - - - - Return value: none. - - - Example: - -int callback (t_weechat_plugin *plugin, char *file) -{ - plugin->print_server (plugin, "file: %s", file); - return 1; -} -... -plugin->exec_on_files (plugin, "/tmp", &callback); - - -
- -
- print - - - Prototype: - - void print (t_weechat_plugin *plugin, - char *server, char *channel, char *message, ...) - - - - Display a message on a WeeChat buffer, identified by server and - channel (both may be NULL for current buffer). - - - Arguments: - - - - : pointer to plugin structure - - - - - : internal name of server to find - buffer for message display (may be NULL) - - - - - : name of channel to find buffer - for message display (may be NULL) - - - - - : message - - - - - - To display colored text, there are following codes: - - - - - Code - Description - - - - - 0x02 - - bold text - - - - 0x03 + "xx" - - text color "xx" - (see for colors) - - - - 0x03 + "xx,yy" - - text color "xx" - and background "yy" - (see for colors) - - - - 0x0F - - disable color and attributes - - - - 0x12 - - reverse video (revert text color with background) - - - - 0x1F - - underlined text - - - - - - Note: the same code (without number for 0x03) may be used to stop - the attribute. - - - Return value: none. - - - Examples: - -plugin->print (plugin, NULL, NULL, "hello"); -plugin->print (plugin, NULL, "#weechat", "hello"); -plugin->print (plugin, "freenode", "#weechat", "hello"); -plugin->print (plugin, NULL, NULL, - "test: \x02 bold \x0F\x03%02d blue \x03%02d green", - plugin->get_irc_color (plugin, "blue"), - plugin->get_irc_color (plugin, "green")); - - -
- -
- print_server - - - Prototype: - - void print_server (t_weechat_plugin *plugin, - char *message, ...) - - - - Display a message on current server buffer. - - - Arguments: - - - - : pointer to plugin structure - - - - - : message - - - - - - To display colored text, see . - - - Return value: none. - - - Example: plugin->print_server (plugin, "hello"); - -
- -
- print_infobar - - - Prototype: - - void print_infobar (t_weechat_plugin *plugin, - int time, char *message, ...) - - - - Display a message in infobar for a specified time. - - - Arguments: - - - - : pointer to plugin structure - - - - - : time (in seconds) for displaying - message (0 = never erased) - - - - - - Return value: none. - - - Example: - -plugin->print_infobar (plugin, 5, "hello"); - - -
- -
- infobar_remove - - - Prototype: - - void infobar_remove (t_weechat_plugin *plugin, int count) - - - - Remove one or more messages in infobar stack. - - - Arguments: - - - - : pointer to plugin structure - - - - - : number of messages to remove - (if argument is <= 0, then all messages are removed) - - - - - - Return value: none. - - - Example: plugin->infobar_remove (1); - -
- -
- log - - - Prototype: - - void log (t_weechat_plugin *plugin, - char *server, char *channel, char *message, ...) - - - - Write a message in log file for a server or a channel. - - - Arguments: - - - - : pointer to plugin structure - - - - - : internal name of server to find - buffer for log (may be NULL) - - - - - : name of channel to find buffer - for log (may be NULL) - - - - - : message - - - - - - Return value: none. - - - Example: - -plugin->log (plugin, "freenode", "#weechat", "test"); - - -
- -
- msg_handler_add - - - Prototype: - - t_plugin_handler *msg_handler_add (t_weechat_plugin - *plugin, char *message, t_plugin_handler_func *function, - char *handler_args, void *handler_pointer) - - - - Add an IRC message handler, called when an IRC message is - received. - - - Arguments: - - - - : pointer to plugin structure - - - - - : name of IRC message ("*" for all - messages). - To know list of IRC messages, please consult - RFCs - 1459 - and - 2812. - Moreover you can use a special name, prefixed by "weechat_" - to catch special events, as written in table below: - - - - - Name - Description - - - - - weechat_pv - private message received - - - weechat_highlight - - message with highlight (on a channel or pv) - - - - weechat_ctcp - - CTCP message received (VERSION, PING, ..) - - - - weechat_dcc - - DCC message received (chat or file) - - - - - - - - - - : function called when message - is received - - - It uses following prototype: - - int my_function (t_weechat_plugin *plugin, - int argc, char **argv, - char *handler_args, void *handler_pointer) - - - - Argument argc is set to 3, following values are set in - argv array: - - - argv[0] = server name - - - argv[1] = IRC message - - - argv[2] = command arguments - - - - - - - : arguments given to function - when called - - - - - : pointer given to function - when called - - - - - - Return value: pointer to new message handler. - - - Note: function called when message is received has to return - one of following values: - - - - PLUGIN_RC_KO: function failed - - - - - PLUGIN_RC_OK: function successfully - completed - - - - - PLUGIN_RC_OK_IGNORE_WEECHAT: message - will not be sent to WeeChat - - - - - PLUGIN_RC_OK_IGNORE_PLUGINS: message - will not be sent to other plugins - - - - - PLUGIN_RC_OK_IGNORE_ALL: message - will not be sent to WeeChat neither other plugins - - - - - PLUGIN_RC_OK_WITH_HIGHLIGHT: function - successfully completed and make "highlight" on received - message - - - - - - Example: - -int msg_kick (t_weechat_plugin *plugin, int argc, char **argv, - char *handler_args, void *handler_pointer) -{ - plugin->print (plugin, argv[0], NULL, "KICK received"); - return PLUGIN_RC_OK; -} -... -t_plugin_handler *msg_handler; -msg_handler = plugin->msg_handler_add (plugin, "KICK", - &msg_kick, NULL, NULL); - - -
- -
- cmd_handler_add - - - Prototype: - - t_plugin_handler *cmd_handler_add (t_weechat_plugin - *plugin, char *command, char *description, char *arguments, - char *arguments_description, char *completion_template, - t_plugin_handler_func *fonction, char *handler_args, - void *handler_pointer) - - - - Add a WeeChat command handler, called when user uses command - (for example /command). - - - Arguments: - - - - : pointer to plugin structure - - - - - : the new command name, which - may be an existing command (be careful, replaced command - will not be available until plugin is unloaded) - - - - - : short command description - (displayed by /help command) - - - - - : short description of command - arguments (displayed by /help command) - - - - - : long description - of command arguments (displayed by /help command) - - - - - : template for - completion, like "abc|%w def|%i" - which means "abc" or a WeeChat command for first argument, - "def" or IRC command for second. - An empty string lets WeeChat complete any argument with - a nick from current channel, NULL or "-" disable completion - for all command arguments. - - - Following codes can be used: - - - - - Code - Description - - - - - %- - no completion for argument - - - %* - - repeat last completion for all following arguments - (this code has to be at the end of completion - template, preceded by "|") - - - - %a - alias - - - %A - - alias and commands (WeeChat, IRC and plugins) - - - - %c - current channel - - - %C - all channels (including queries) - - - %f - file name - - - %h - plugins commands - - - %i - IRC commands (sent) - - - %I - IRC commands (received) - - - %k - key functions - - - %m - nick on current server - - - %M - - nicks on current server (on all open channels) - - - - %n - nicks of current channel - - - %N - nicks and hostnames of current channel - - - %o - setup options - - - %O - plugin options - - - %p - default "part" message - - - %q - default "quit" message - - - %s - current server name - - - %S - all servers names - - - %t - topic of current channel - - - %v - setup option value - - - %V - plugin option value - - - %w - WeeChat commands - - - - - - - - - : function called when command - is executed - - - It uses following prototype: - - int my_function (t_weechat_plugin *plugin, - int argc, char **argv, - char *handler_args, void *handler_pointer) - - - - Argument argc is set to 3, following values are set in - argc array: - - - argv[0] = server name - - - argv[1] = command - - - argv[2] = command arguments - - - - - - - : arguments given to function - when called - - - - - : pointer given to function - when called - - - - - - Return value: pointer to new command handler. - - - Note: function called when command is executed has to return - one of following values: - - - - PLUGIN_RC_KO: function failed - - - - - PLUGIN_RC_OK: function successfully - completed - - - - - - Example: - -int cmd_test (t_weechat_plugin *plugin, int argc, char **argv, - char *handler_args, void *handler_pointer) -{ - plugin->print (plugin, argv[0], NULL, - "test command, nick: %s", - (argv[2]) ? argv[2] : "none"); - return PLUGIN_RC_OK; -} -... -t_plugin_handler *cmd_handler; -cmd_handler = plugin->cmd_handler_add (plugin, "test", "Test command", - "[nick]", "nick: nick of channel", - "%n", &cmd_test, NULL, NULL); - - -
- -
- timer_handler_add - - - Prototype: - - t_plugin_handler *timer_handler_add (t_weechat_plugin - *plugin, int interval, t_plugin_handler_func *function, - char *handler_args, void *handler_pointer) - - - - Add a timer handler which periodically calls a function. - - - Arguments: - - - - : pointer to plugin structure - - - - - : interval (in seconds) between - two calls of function. - - - - - : function called - - - It uses following prototype: - - int my_function (t_weechat_plugin *plugin, - int argc, char **argv, - char *handler_args, void *handler_pointer) - - - - Argument argc is set to 0, and argv is set to NULL. - - - - - : arguments given to function - when called - - - - - : pointer given to function - when called - - - - - - Return value: pointer to new timer handler. - - - Note: function called has to return one of following values: - - - - PLUGIN_RC_KO: function failed - - - - - PLUGIN_RC_OK: function successfully - completed - - - - - - Example: - -int my_timer (t_weechat_plugin *plugin, int argc, char **argv, - char *handler_args, void *handler_pointer) -{ - plugin->print (plugin, NULL, NULL, "my timer"); - return PLUGIN_RC_OK; -} -... -t_plugin_handler *timer_handler; -timer_handler = plugin->timer_handler_add (plugin, 60, &my_timer); - - -
- -
- keyboard_handler_add - - - Prototype: - - t_plugin_handler *keyboard_handler_add (t_weechat_plugin - *plugin, t_plugin_handler_func *function, - char *handler_args, void *handler_pointer) - - - - Add a keyboard handler, called for any key pressed. - - - Arguments: - - - - : pointer to plugin structure - - - - - : function called - - - It uses following prototype: - - int my_function (t_weechat_plugin *plugin, - int argc, char **argv, - char *handler_args, void *handler_pointer) - - - - Argument argc is set to 3, following values are set in - argc array: - - - - argv[0] = key pressed (name of internal function or - '*' followed by a key code) - - - - - argv[1] = command line before key action - - - - - argv[2] = command line after key action - - - - - - - - : arguments given to function - when called - - - - - : pointer given to function - when called - - - - - - Return value: pointer to new message handler. - - - Note: function called has to return one of following values: - - - - PLUGIN_RC_KO: function failed - - - - - PLUGIN_RC_OK: function successfully - completed - - - - - - Example: - -int my_keyb (t_weechat_plugin *plugin, int argc, char **argv, - char *handler_args, void *handler_pointer) -{ - if (argc == 2) - { - plugin->print (plugin, NULL, NULL, "key pressed: %s", argv[0]); - if (argv[1] && (argv[1][0] == '1')) - plugin->print (plugin, NULL, NULL, "input text changed"); - else - plugin->print (plugin, NULL, NULL, "input text not changed"); - } - return PLUGIN_RC_OK; -} -... -t_plugin_handler *keyb_handler; -keyb_handler = plugin->keyboard_handler_add (plugin, &my_keyb); - - -
- -
- event_handler_add - - - Prototype: - - t_plugin_handler *event_handler_add (t_weechat_plugin - *plugin, char *event, t_plugin_handler_func *function, - char *handler_args, void *handler_pointer) - - - - Add an event handler, called when an event happens. - - - Arguments: - - - - : pointer to plugin structure - - - - - : event (see table below) - - - - - : function called - - - It uses following prototype: - - int my_function (t_weechat_plugin *plugin, - int argc, char **argv, - char *handler_args, void *handler_pointer) - - - - Arguments depend on event (see table below). - - - - - : arguments given to function - when called - - - - - : pointer given to function - when called - - - - - - List of events: - - - - - Event - Description - Arguments - - - - - buffer_open - a buffer was open - - argc = 1, argv = { buffer number } - - - - buffer_close - a buffer was closed - - argc = 1, argv = { buffer number } - - - - buffer_move - a buffer was moved - - argc = 2, argv = { new buffer number, old number } - - - - - - - - Return value: pointer to new event handler. - - - Note: function called has to return one of following values: - - - - PLUGIN_RC_KO: function failed - - - - - PLUGIN_RC_OK: function successfully - completed - - - - - - Example: - -int my_event (t_weechat_plugin *plugin, int argc, char **argv, - char *handler_args, void *handler_pointer) -{ - plugin->print (plugin, NULL, NULL, "my_event"); - return PLUGIN_RC_OK; -} -... -t_plugin_handler *event_handler; -event_handler = plugin->event_handler_add (plugin, "buffer_open", - &my_event); - - -
- -
- handler_remove - - - Prototype: - - void handler_remove (t_weechat_plugin *plugin, - t_plugin_handler *handler) - - - - Remove a command or message handler. - - - Arguments: - - - - : pointer to plugin structure - - - - - : handler to remove - - - - - - Return value: none. - - - Example: - plugin->handler_remove (plugin, my_handler); - -
- -
- handler_remove_all - - - Prototype: - - void handler_remove_all (t_weechat_plugin *plugin) - - - - Remove all handlers for a plugin. - - - Arguments: - - - - : pointer to plugin structure - - - - - - Return value: none. - - - Example: - plugin->handler_remove_all (plugin); - -
- -
- modifier_add - - - Prototype: - - t_plugin_modifier *modifier_add (t_weechat_plugin *plugin, - char *type, char *message, t_plugin_modifier_func *function, - char *modifier_args, void *modifier_pointer) - - - - Add a message modifier. - - - Arguments: - - - - : pointer to plugin structure - - - - - : modifier type: - - - - - Type - Description - - - - - irc_in - called for incoming IRC messages - - - irc_user - - called for each user message (or command) (before - WeeChat parses message) - - - - irc_out - - called for outgoing messages, immediately before - sending it to IRC server (this includes messages - sent automatically by WeeChat to server) - - - - - - - - - - : name of IRC message (used only for - types "irc_in" and "irc_out"). - To know list of IRC messages, please consult - RFCs - 1459 - and - 2812. - Moreover, special value "*" means all messages (no filter). - - - - - : function called - - - It uses following prototype: - - int my_function (t_weechat_plugin *plugin, - int argc, char **argv, - char *modifier_args, void *modifier_pointer) - - - - Argument argc is set to 2, following values are set in - argv array: - - - argv[0] = server name - - - argv[1] = message - - - - - - - : arguments given to function - when called - - - - - : pointer given to function - when called - - - - - - Return value: pointer to new message modifier. - - - Note: function has to return modified string, or NULL if no - changes are made to message. - If function returns empty string, then message is dropped and - will not be read at all by WeeChat (be careful when dropping - messages!). - Returned string must have been allocated by malloc() and will - be freed (with call to free()) automatically by WeeChat after use. - - - Example: - -char *adder (t_weechat_plugin *plugin, int argc, char **argv, - char *modifier_args, void *modifier_pointer) -{ - char *string; - string = (char *)malloc (strlen (argv[1]) + 16); - strcpy (string, argv[1]); - strcat (string, "test"); - return string; -} -... -t_plugin_modifier *modifier; -modifier = plugin->modifier_add (plugin, "irc_in", "privmsg", - &adder, NULL, NULL); - - -
- -
- modifier_remove - - - Prototype: - - void modifier_remove (t_weechat_plugin *plugin, - t_plugin_modifier *modifier) - - - - Remove a message modifier. - - - Arguments: - - - - : pointer to plugin structure - - - - - : modifier to remove - - - - - - Return value: none. - - - Example: - plugin->modifier_remove (plugin, my_modifier); - -
- -
- modifier_remove_all - - - Prototype: - - void modifier_remove_all (t_weechat_plugin *plugin) - - - - Remove all modifiers for a plugin. - - - Arguments: - - - - : pointer to plugin structure - - - - - - Return value: none. - - - Example: - plugin->modifier_remove_all (plugin); - -
- -
- exec_command - - - Prototype: - - void exec_command (t_weechat_plugin - *plugin, char *server, char *channel, char *command) - - - - Execute a WeeChat command (or send a message to a channel). - - - Arguments: - - - - : pointer to plugin structure - - - - - : internal name of server for - executing command (may be NULL) - - - - - : name of channel for executing - command (may be NULL) - - - - - : command - - - - - - Return value: none. - - - Examples: - -plugin->exec_command (plugin, NULL, NULL, "/help nick"); -plugin->exec_command (plugin, "freenode", "#weechat", "hello"); - - -
- -
- get_info - - - Prototype: - - char *get_info (t_weechat_plugin *plugin, - char *info, char *server) - - - - Return an info about WeeChat or a channel. - - - Arguments: - - - - : pointer to plugin structure - - - - - : name of info to read: - - - - - Info - Description - - - - - version - WeeChat's version - - - nick - nick - - - channel - - name of channel (NULL for a server or private) - - - - server - name of server - - - type - - buffer type: 0=standard, 1=DCC, 2=raw IRC data - - - - away - "away" flag - - - inactivity - - number of seconds since last key was pressed - - - - input - - content of command line for current window - - - - input_mask - - content of color mask for command line - - - - input_pos - - cursor position in command line - - - - weechat_dir - - WeeChat home directory - (by default: ~/.weechat/) - - - - weechat_libdir - WeeChat system lib directory - - - weechat_sharedir - WeeChat system share directory - - - - - - - - - : internal name of server for - reading info (if needed) - - - - - - Return value: information asked, NULL if not found. - - - Note: result has to be free by a call to "free" function after - use. - - - Examples: - -char *version = plugin->get_info (plugin, "version", NULL); -char *nick = plugin->get_info (plugin, "nick", "freenode"); -char *inactivity = plugin->get_info (plugin, "inactivity", NULL); - -plugin->print (plugin, NULL, NULL, - "WeeChat version %s, you are %s on freenode " - "(inactive for %s seconds)", - version, nick, inactivity); - -if (version) - free (version); -if (nick) - free (nick); -if (inactivity) - free (inactivity); - - -
- -
- get_dcc_info - - - Prototype: - - t_plugin_info_dcc *get_dcc_info (t_weechat_plugin *plugin) - - - - Return list of DCC currently active or finished. - - - Arguments: - - - - : pointer to plugin structure - - - - - - Return value: linked list of DCC. - - - - - Type - Field - Description - - - - - char * - server - IRC server - - - char * - channel - IRC channel - - - int - type - - DCC type: - 0 = chat received, - 1 = chat sent, - 2 = file received, - 3 = file sent - - - - int* - status - - DCC status: - 0 = waiting, - 1 = connecting, - 2 = active, - 3 = finished, - 4 = failed, - 5 = interrupted by user - - - - time_t - start_time - date/time of DCC creation - - - time_t - start_transfer - date/time of DCC transfer start - - - unsigned long - addr - IP address of remote user - - - int - port - port used for DCC - - - char * - nick - remote nick - - - char * - filename - file name - - - char * - local_filename - local file name - - - int - filename_suffix - suffix if renaming file - - - unsigned long - size - file size - - - unsigned long - pos - position in file - - - unsigned long - start_resume - start position after interruption - - - unsigned long - bytes_per_sec - - number of bytes per second since transfer start - - - - t_plugin_dcc_info * - prev_dcc - - pointer to previous DCC info - - - - t_plugin_dcc_info * - next_dcc - - pointer to next DCC info - - - - - - - - - Note: result has to be free by a call to "free_dcc_info" function - after use. - - - Examples: - -t_plugin_dcc_info *dcc_info = plugin->get_dcc_info (plugin); -for (ptr_dcc = dcc_info; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc) -{ - plugin->print_server (plugin, "DCC type=%d, with: %s", - ptr_dcc->type, ptr_dcc->nick); -} -if (dcc_info) - plugin->free_dcc_info (plugin, dcc_info); - - -
- -
- free_dcc_info - - - Prototype: - - void free_dcc_info (t_weechat_plugin *plugin, - t_plugin_dcc_info *dcc_info) - - - - Free memory used by a DCC list. - - - Arguments: - - - - : pointer to plugin structure - - - - - : pointer to DCC list returned by - "get_dcc_info" function - - - - - - Return value: none. - - - Example: - plugin->free_dcc_info (plugin, dcc_info); - -
- -
- get_server_info - - - Prototype: - - t_plugin_server_info *get_server_info (t_weechat_plugin *plugin) - - - - Return list of IRC servers (connected or not). - - - Arguments: - - - - : pointer to plugin structure - - - - - - Return value: linked list of IRC servers. - - - - - Type - Field - Description - - - - - char * - name - server internal name - - - int - autoconnect - 1 if autoconnect at start-up, 0 otherwise - - - int - autoreconnect - - 1 if autoreconnect when disconnected, - 0 otherwise - - - - int - autoreconnect_delay - delay before trying again connection - - - int - command_line - - 1 if server was on command line (so it is temporary), - 0 otherwise - - - - char * - address - server address (host or IP) - - - int - port - port - - - int - ipv6 - IPv6 connection - - - int - ssl - SSL connection - - - char * - password - server password - - - char * - nick1 - first nickname - - - char * - nick2 - alternate nickname - - - char * - nick3 - second alternate nickname - - - char * - username - user name - - - char * - real name - real name - - - char * - command - command run once connected - - - int - command_delay - delay after execution of command - - - char * - autojoin - channels joined automatically - - - int - autorejoin - - 1 if channels are rejoined when kicked, - 0 otherwise - - - - char * - notify_levels - channels notify levels - - - char * - charset_decode_iso - channels charsets for decoding ISO - - - char * - charset_decode_utf - channels charsets for decoding UTF - - - char * - charset_encode - channels charsets for encoding messages - - - int - is_connected - 1 if connected to server, 0 otherwise - - - int - ssl_connected - 1 if connected with SSL, 0 otherwise - - - char * - nick - current nickname - - - int - is_away - 1 if away, 0 otherwise - - - time_t - away_time - time when user is marking as away - - - int - lag - lag (in milliseconds) - - - t_plugin_server_info * - prev_server - pointer to previous server info - - - t_plugin_server_info * - next_server - pointer to next server info - - - - - - - Note: result has to be free by a call to "free_server_info" - function after use. - - - Example: - -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, - "server: %s, address: %s, port: %d %s", - ptr_server_info->name, - ptr_server_info->address, - ptr_server_info->port, - (ptr_server_info->is_connected) ? "(connected)" : ""); - } - plugin->free_server_info (plugin, server_info); -} - - -
- -
- free_server_info - - - Prototype: - - void free_server_info (t_weechat_plugin *plugin, - t_plugin_server_info *server_info) - - - - Free memory used by server info list. - - - Arguments: - - - - : pointer to plugin structure - - - - - : pointer to server list - returned by "get_server_info" function - - - - - - Return value: none. - - - Example: - plugin->free_server_info (plugin, server_info); - -
- -
- get_channel_info - - - Prototype: - - t_plugin_channel_info *get_channel_info (t_weechat_plugin *plugin, - char *server) - - - - Return list of IRC channels for a server. - - - Arguments: - - - - : pointer to plugin structure - - - - - : internal server name - - - - - - Return value: linked list of IRC channels for server. - - - - - Type - Field - Description - - - - - int - type - 0 for a channel, 1 for a private - - - char * - name - name of channel - - - char * - topic - topic of channel - - - char * - modes - channel modes - - - int - limit - user limit - - - char * - key - channel key - - - int - nicks_count - number of nicks on channel - - - t_plugin_channel_info * - prev_channel - pointer to previous channel info - - - t_plugin_channel_info * - next_channel - pointer to next channel info - - - - - - - Note: result has to be free by a call to "free_channel_info" - function after use. - - - Example: - -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); -} - - -
- -
- free_channel_info - - - Prototype: - - void free_channel_info (t_weechat_plugin *plugin, - t_plugin_channel_info *channel_info) - - - - Free memory used by channel info list. - - - Arguments: - - - - : pointer to plugin structure - - - - - : pointer to channel info list - returned by "get_channel_info" function - - - - - - Return value: none. - - - Example: - plugin->free_channel_info (plugin, channel_info); - -
- -
- get_nick_info - - - Prototype: - - t_plugin_nick_info *get_nick_info (t_weechat_plugin *plugin, - char *server, char *channel) - - - - Return list of nicks for a channel. - - - Arguments: - - - - : pointer to plugin structure - - - - - : internal server name - - - - - : channel name - - - - - - Return value: linked list of nicks on channel. - - - - - Type - Field - Description - - - - - char * - nick - nick name - - - char * - host - hostname - - - int - flags - - nick flags, binary "or" between values (1 = channel - owner, 2 = channel admin, 4 = op, 8 = halfop, - 16 = voice, 32 = away) - - - - t_plugin_nick_info * - prev_nick - pointer to previous nick info - - - t_plugin_nick_info * - next_nick - pointer to next nick info - - - - - - - Note: result has to be free by a call to "free_nick_info" - function after use. - - - Example: - -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); -} - - -
- -
- free_nick_info - - - Prototype: - - void free_nick_info (t_weechat_plugin *plugin, - t_plugin_nick_info *nick_info) - - - - Free memory used by nick info list. - - - Arguments: - - - - : pointer to plugin structure - - - - - : pointer to nick info list - returned by "get_nick_info" function - - - - - - Return value: none. - - - Example: - plugin->free_nick_info (plugin, nick_info); - -
- -
- get_config - - - Prototype: - - char *get_config (t_weechat_plugin *plugin, char *option) - - - - Return value of a WeeChat config option. - - - Arguments: - - - - : pointer to plugin structure - - - - - : name of option to read - - - - - - Return value: option value, NULL if not found. - - - Note: result has to be free by a call to "free" function after - use. - - - Examples: - -char *value1 = plugin->get_config (plugin, "look_set_title"); -char *value2 = plugin->get_config (plugin, "freenode.server_autojoin"); - - -
- -
- set_config - - - Prototype: - - int set_config (t_weechat_plugin *plugin, - char *option, char *value) - - - - Update value of a WeeChat config option. - - - Arguments: - - - - : pointer to plugin structure - - - - - : name of option to update - - - - - : new value for option - - - - - - Return value: 1 if option was successfully updated, 0 if an - error occurred. - - - Example: - -plugin->set_config (plugin, "look_nicklist", "off"); - - -
- -
- get_plugin_config - - - Prototype: - - char *get_plugin_config (t_weechat_plugin *plugin, char *option) - - - - Return value of a plugin option. - Option is read from file "~/.weechat/plugins.rc" - and is like: "plugin.option=value" - (note: plugin name is automatically added). - - - Arguments: - - - - : pointer to plugin structure - - - - - : name of option to read - - - - - - Return value: option value, NULL if not found. - - - Note: result has to be free by a call to "free" function after - use. - - - Example: - -char *value = plugin->get_plugin_config (plugin, "my_var"); - - -
- -
- set_plugin_config - - - Prototype: - - int set_plugin_config (t_weechat_plugin *plugin, - char *option, char *value) - - - - Update value of a plugin option. - Option is written in file "~/.weechat/plugins.rc" - and is like: "plugin.option=value" - (note: plugin name is automatically added). - - - Arguments: - - - - : pointer to plugin structure - - - - - : name of option to update - - - - - : new value for option - - - - - - Return value: 1 if option was successfully updated, 0 if an - error occurred. - - - Example: - -plugin->set_plugin_config (plugin, "my_var", "value"); - - -
- -
- get_irc_color - - - Prototype: - - int get_irc_color (t_weechat_plugin *plugin, - char *color_name) - - - - Get IRC color index with name. - - - Arguments: - - - - : pointer to plugin structure - - - - - : color name - Allowed colors are: - - - - - Color name - Value - - - - - white - 0 - - - black - 1 - - - blue - 2 - - - green - 3 - - - lightred - 4 - - - red - 5 - - - magenta - 6 - - - brown - 7 - - - yellow - 8 - - - lightgreen - 9 - - - cyan - 10 - - - lightcyan - 11 - - - lightblue - 12 - - - lightmagenta - 13 - - - gray - 14 - - - lightgray - 15 - - - - - - - - - - Return value: IRC color index, -1 if color is not found. - - - Example: - -int color_blue = plugin->get_irc_color (plugin, "blue"); /* return 2 */ - - -
- -
- input_color - - - Prototype: - - void input_color (t_weechat_plugin *plugin, - int color, int start, int length) - - - - Add color in input buffer. - - - Arguments: - - - - : pointer to plugin structure - - - - - : color for text (if < 0, then input - buffer is refresh, and there's no change in input buffer - content) - - - - - : start position for color (if < 0, - then mask is reinitialized) - - - - - : length for color (if <= 0, - then mask is reinitialized) - - - - - - Return value: none. - - - Example: - -plugin->input_color (plugin, plugin->get_irc_color (plugin, "blue"), 10, 5); - - -
- -
- get_window_info - - - Prototype: - - t_plugin_window_info *get_window_info (t_weechat_plugin *plugin) - - - - Return list of WeeChat windows. - - - Arguments: - - - - : pointer to plugin structure - - - - - - Return value: linked list of WeeChat windows. - - - - - Type - Field - Description - - - - - int - win_x - horizontal position of window - - - int - win_y - vertical position of window - - - int - win_width - width of window - - - int - win_height - height of window - - - int - win_width_pct - width % (compared to parent window) - - - int - win_height_pct - height % (compared to parent window) - - - int - num_buffer - number of displayed buffer - - - t_plugin_window_info * - prev_window - pointer to previous window info - - - t_plugin_window_info * - next_window - pointer to next window info - - - - - - - Note: result has to be free by a call to "free_window_info" - function after use. - - - Example: - -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, "--- window info ---"); - 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, "no window info!"); - - -
- -
- free_window_info - - - Prototype: - - void free_window_info (t_weechat_plugin *plugin, - t_plugin_window_info *window_info) - - - - Free memory used by window info list. - - - Arguments: - - - - : pointer to plugin structure - - - - - : pointer to window info list - returned by "get_window_info" function - - - - - - Return value: none. - - - Example: - plugin->free_window_info (plugin, window_info); - -
- -
- get_buffer_info - - - Prototype: - - t_plugin_buffer_info *get_buffer_info (t_weechat_plugin *plugin) - - - - Return list of WeeChat buffers. - - - Arguments: - - - - : pointer to plugin structure - - - - - - Return value: linked list of WeeChat buffers. - - - - - Type - Field - Description - - - - - int - type - buffer type: 0=standard, 1=DCC, 2=raw IRC data - - - int - number - buffer number - - - int - num_displayed - number of windows displaying buffer - - - char * - server_name - server name for buffer (may be NULL) - - - char * - channel_name - channel name for buffer (may be NULL) - - - int - notify_level - notify level for buffer - - - char * - log_filename - log filename (NULL means not logging) - - - t_plugin_buffer_info * - prev_buffer - pointer to previous buffer info - - - t_plugin_buffer_info * - next_buffer - pointer to next buffer info - - - - - - - Note: result has to be free by a call to "free_buffer_info" - function after use. - - - Example: - -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, "--- buffer info ---"); - 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, "no buffer info!"); - - -
- -
- free_buffer_info - - - Prototype: - - void free_buffer_info (t_weechat_plugin *plugin, - t_plugin_buffer_info *buffer_info) - - - - Free memory used by buffer info list. - - - Arguments: - - - - : pointer to plugin structure - - - - - : pointer to buffer info list - returned by "get_buffer_info" function - - - - - - Return value: none. - - - Example: - plugin->free_buffer_info (plugin, buffer_info); - -
- -
- get_buffer_data - - - Prototype: - - t_plugin_buffer_data *get_buffer_info (t_weechat_plugin *plugin, - char *server, char *channel) - - - - Return content of buffer. - - - Arguments: - - - - : pointer to plugin structure - - - - - : internal name of server - - - - - : channel name - - - - - - Return value: buffer content (linked list of lines). - - - - - Type - Field - Description - - - - - time_t - date - date and time - - - char * - nick - nick - - - char * - data - line content (color codes are removed) - - - t_plugin_buffer_line * - prev_line - pointer to previous line - - - t_plugin_buffer_line * - next_line - pointer to next line - - - - - - - Note: result has to be free by a call to "free_buffer_data" - function after use. - - - Example: - -t_plugin_buffer_line *buffer_line, *ptr_line; -char text_time[256]; - -buffer_line = plugin->get_buffer_data (plugin); -if (buffer_line) -{ - for (ptr_line = buffer_line; ptr_line; ptr_line = ptr_line->next_line) - { - strftime (text_time, sizeof (text_time), "%x %X", localtime (&(ptr_line->date))); - plugin->print (plugin, NULL, NULL, "date: %s, nick: %s, data: %s", - text_time, ptr_line->nick, ptr_line->data); - } - plugin->free_buffer_data (plugin, buffer_line); -} - - -
- -
- free_buffer_data - - - Prototype: - - void free_buffer_data (t_weechat_plugin *plugin, - t_plugin_buffer_line *buffer_line) - - - - Free memory used by buffer line list. - - - Arguments: - - - - : pointer to plugin structure - - - - - : pointer to buffer line list - returned by "get_buffer_data" function - - - - - - Return value: none. - - - Example: - plugin->free_buffer_data (plugin, buffer_line); - -
- -
- -
- Compile plugin - - - Compile does not need WeeChat sources, only file - "weechat-plugin.h". - - - - To compile a plugin which has one file "toto.c" (under GNU/Linux): - -$ gcc -fPIC -Wall -c toto.c -$ gcc -shared -fPIC -o libtoto.so toto.o - - - -
- -
- Load plugin into WeeChat - - - Copy "libtoto.so" file into system plugins directory (for example - "/usr/local/lib/weechat/plugins") or into - user's plugins directory (for example - "/home/xxxxx/.weechat/plugins"). - - - - Under WeeChat: - /plugin load toto - - -
- -
- Plugin example - - - Full example of plugin, which adds a /double command, which displays - two times arguments on current channel (ok that's not very useful, - but that's just an example!): - -#include <stdlib.h> - -#include "weechat-plugin.h" - -char plugin_name[] = "Double"; -char plugin_version[] = "0.1"; -char plugin_description[] = "Test plugin for WeeChat"; - -/* "/double" command manager */ - -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", - "Display two times a message", - "msg", - "msg: message to display two times", - NULL, - &double_cmd, - NULL, NULL); - return PLUGIN_RC_OK; -} - -void weechat_plugin_end (t_weechat_plugin *plugin) -{ - /* nothing done here */ -} - - - -
- -
- -
- Charset plugin - - - Charset plugin lets you encode or decode data using charsets, with 3 - levels: global, by server, or by channel. - This plugin is optional, but recommended: if it's not loaded, WeeChat - can only read/write UTF-8 data. - - - - Charset plugin should be autoloaded by WeeChat at startup. - To be sure plugin is loaded, try: - "/charset". - If command is not found, then load plugin with command: - /plugin load charset - If plugin is not found, then you should compile again WeeChat with - plugins and Charset support. - - - - When Charset plugin starts, it displays terminal and internal charsets. - Terminal charset depends on your locale, and internal is UTF-8. - For example : - --P- Charset plugin starting, terminal charset: ISO-8859-15 (WeeChat internal: UTF-8) - - - -
- Settings - - - - - To set global decode and encode charsets, use - "/setp" command. - For example: - -/setp charset.global.decode = ISO-8859-15 -/setp charset.global.encode = ISO-8859-15 - - If global decode charset is not set (for example during first - load of Charset plugin), it will be automatically set to terminal - charset (if it's different from UTF-8), or by default to - "ISO-8859-1". - Default encode value is empty, so it sends by default with - internal charset (UTF-8). - - - - - To set server charset, use "/charset" command - on server buffer. - If you give only charset, then it will set "decode" and "encode" - values. - For example: - /charset ISO-8859-15 - It's equivalent to: - -/charset decode ISO-8859-15 -/charset encode ISO-8859-15 - - - - - - To set channel (or private) charset, use same commands as server, - but on channel (or private) buffer. - - - - -
- -
- FAQ - - - If you have problems with chars or accents using Charset plugin: - - - - check that weechat-curses is linked to libncursesw (warning: - needed on most distributions but not all) : - ldd /path/to/weechat-curses - - - - - check charset line (on server buffer), you should see - ISO-XXXXXX or UTF-8 for terminal charset. If you see - ANSI_X3.4-1968 or other values, probably your locale is wrong. - - - - - setup global decode value, for example: - /setp charset.global.decode = ISO-8859-15 - - - - - -
- -
- -
- Scripts plugins - - - Four plugins are provided with WeeChat to use script languages: - Perl, Python, Ruby and Lua. - - -
- Load / unload scripts - - - Scripts are loaded and unloaded with /perl, - /python, /ruby and - /lua commands - (type /help in WeeChat for help about commands). - - - - Examples: - - - - Load a Perl script: - /perl load /tmp/test.pl - - - - - List all loaded Perl scripts: - /perl - - - - - Load a Python script: - /python load /tmp/test.py - - - - - List all loaded Python scripts: - /python - - - - - Load a Ruby script: - /ruby load /tmp/test.rb - - - - - List all loaded Ruby scripts: - /ruby - - - - - Load a Lua script: - /lua load /tmp/test.lua - - - - - List all loaded Lua scripts: - /lua - - - - - -
- -
- Syntax by language - -
- Perl - - - In a WeeChat Perl script, all API functions and variables are - prefixed by "weechat::". - Example: -weechat::register("test", "1.0", "end_test", "WeeChat perl script"); - - -
- -
- Python - - - A WeeChat Python script has to start by importing weechat: - import weechat - - - - All API functions and variables are prefixed by - "weechat.". - Example: -weechat.register("test", "1.0", "end_test", "WeeChat python script") - - -
- -
- Ruby - - - In a WeeChat Ruby script, all code has to be in functions. - So for main code, you have to define a - "weechat_init" function, which is automatically - called when script is loaded by WeeChat. Example: - -def weechat_init - Weechat.register("test", "1.0", "end_test", "WeeChat ruby script") - Weechat.add_command_handler("command", "my_command") - return Weechat::PLUGIN_RC_OK -end - -def my_command(server, args) - Weechat.print("my command") - return Weechat::PLUGIN_RC_OK -end - - - - - All API functions are prefixed by - "Weechat." and variables by - "Weechat::". - - -
- -
- Lua - - - In a WeeChat Lua script, all API functions are prefixed by - "weechat.". - Variables are prefixed by "weechat." and - suffixed by "()". - Example: - -function message_handler(server, args) - weechat.print("I am a message handler") - return weechat.PLUGIN_RC_OK() -end - - - -
- -
- -
- WeeChat / scripts API - -
- register - - - Perl prototype: - - weechat::register(name, version, end_function, description, - [charset]); - - - - Python prototype: - - weechat.register(name, version, end_function, description, - [charset]) - - - - Ruby prototype: - - Weechat.register(name, version, end_function, description, - [charset]) - - - - Lua prototype: - - weechat.register(name, version, end_function, description, - [charset]) - - - - This is first function to call in script. - All WeeChat scripts have to call this function. - - - Arguments: - - - - : unique name to identify script - (each script must have unique name) - - - - - : script version - - - - - : function called when script is - unloaded (optional parameter, empty string means nothing is - called at the end) - - - - - : short description of script - - - - - : charset used by script, you should - set this if script is not written with UTF-8 - - - - - - Return value: 1 if script was registered, 0 if an error occured. - - - Examples: - -# perl -weechat::register("test", "1.0", "end_test", "Test script!", "ISO-8859-1"); - -# python -weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1") - -# ruby -Weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1") - --- lua -weechat.register("test", "1.0", "end_test", "Test script!", "ISO-8859-1") - - -
- -
- set_charset - - - Perl prototype: - - weechat::set_charset(charset); - - - - Python prototype: - - weechat.set_charset(charset) - - - - Ruby prototype: - - Weechat.set_charset(charset) - - - - Lua prototype: - - weechat.set_charset(charset) - - - - Set new script charset. - - - Arguments: - - - - : new script charset - - - - - - Return value: 1 if new charset was set, 0 if an error occured. - - - Examples: - -# perl -weechat::set_charset("ISO-8859-1"); - -# python -weechat.set_charset("ISO-8859-1") - -# ruby -Weechat.set_charset("ISO-8859-1") - --- lua -weechat.set_charset("ISO-8859-1") - - -
- -
- print - - - Perl prototype: - - weechat::print(message, [channel, [server]]) - - - - Python prototype: - - weechat.prnt(message, [channel, [server]]) - - - - Ruby prototype: - - Weechat.print(message, [channel, [server]]) - - - - Lua prototype: - - weechat.print(message, [channel, [server]]) - - - - Display a message on a WeeChat buffer, identified by server - and channel. - - - Arguments: - - - - : message - - - - - : name of channel to find buffer - for message display - - - - - : internal name of server to find - buffer for message display - - - - - - To display colored text, see . - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::print("message"); -weechat::print("message", "#weechat"); -weechat::print("message", "#weechat", "freenode"); -weechat::print("test: \x0305 red \x0F normal"); - -# 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") - - -
- -
- print_server - - - Perl prototype: - - weechat::print_server(message) - - - - Python prototype: - - weechat.print_server(message) - - - - Ruby prototype: - - Weechat.print_server(message) - - - - Lua prototype: - - weechat.print_server(message) - - - - Display a message on server buffer. - - - Arguments: - - - - : message - - - - - - To display colored text, see . - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::print_server("message"); -weechat::print_server("test: \x0305 red \x0F normal"); - -# python -weechat.print_server("message") - -# ruby -Weechat.print_server("message") - --- lua -weechat.print_server("message") - - -
- -
- print_infobar - - - Perl prototype: - - weechat::print_infobar(time, message); - - - - Python prototype: - - weechat.print_infobar(time, message) - - - - Ruby prototype: - - Weechat.print_infobar(time, message) - - - - Lua prototype: - - weechat.print_infobar(time, message) - - - - Display a message in infobar for a specified time. - - - Arguments: - - - - : time (in seconds) for displaying - message (0 = never erased) - - - - - : message - - - - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::print_infobar(5, "message"); - -# python -weechat.print_infobar(5, "message") - -# ruby -Weechat.print_infobar(5, "message") - --- lua -weechat.print_infobar(5, "message") - - -
- -
- remove_infobar - - - Perl prototype: - - weechat::remove_infobar([count]); - - - - Python prototype: - - weechat.remove_infobar([count]) - - - - Ruby prototype: - - Weechat.remove_infobar([count]) - - - - Lua prototype: - - weechat.remove_infobar([count]) - - - - Remove one or more messages in infobar stack. - - - Arguments: - - - - : number of messages to remove - (if argument not given or <= 0, then all messages are - removed) - - - - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::remove_infobar(1); - -# python -weechat.remove_infobar(1) - -# ruby -Weechat.remove_infobar(1) - --- lua -weechat.remove_infobar(1) - - -
- -
- log - - - Perl prototype: - - weechat::log(message, [channel, [server]]); - - - - Python prototype: - - weechat.log(message, [channel, [server]]) - - - - Ruby prototype: - - Weechat.log(message, [channel, [server]]) - - - - Lua prototype: - - weechat.log(message, [channel, [server]]) - - - - Write a message in log file for a server or a channel. - - - Arguments: - - - - : message - - - - - : name of channel to find buffer - for log - - - - - : internal name of server to find - buffer for log - - - - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::log("message", "#weechat", "freenode"); - -# python -weechat.log("message", "#weechat", "freenode") - -# ruby -Weechat.log("message", "#weechat", "freenode") - --- lua -weechat.log("message", "#weechat", "freenode") - - -
- -
- add_message_handler - - - Perl prototype: - - weechat::add_message_handler(message, function); - - - - Python prototype: - - weechat.add_message_handler(message, function) - - - - Ruby prototype: - - Weechat.add_message_handler(message, function) - - - - Lua prototype: - - weechat.add_message_handler(message, function) - - - - Add an IRC message handler, called when an IRC message is - received. - - - Arguments: - - - - : name of IRC message. To know list - of IRC messages, please consult RFCs - 1459 - and - 2812. - Moreover you can use a special name, prefixed by "weechat_" - to catch special events (see - ). - - - - - : function called when message is - received - - - - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::add_message_handler ("privmsg", "my_function"); -sub my_function -{ - weechat::print("server=$_[0]"); - ($null, $channel, $message) = split ":",$_[1],3; - ($mask, $null, $channel) = split " ", $channel; - weechat::print("mask=$mask, channel=$channel, msg=$message"); - return weechat::PLUGIN_RC_OK; -} - -# python -weechat.add_message_handler ("privmsg", "my_function") -def my_function(server, args): - weechat.prnt("server="+server) - null, channel, message = string.split(args, ":", 2) - mask, null, channel = string.split(string.strip(channel), " ", 2) - weechat.prnt("mask="+mask+", canal="+channel+", message="+message) - return weechat.PLUGIN_RC_OK - -# ruby -Weechat.add_message_handler("privmsg", "my_function") -def my_function(server, args) - Weechat.print("server=#{server}, args=#{args}") - return Weechat::PLUGIN_RC_OK -end - --- lua -weechat.add_message_handler ("privmsg", "my_function") -function my_function(server, args) - weechat.print("server=" .. server .. ", args=" .. args) - return weechat.PLUGIN_RC_OK() -end - - - - Note: function called when message is received has to return - one of following values: - - - - PLUGIN_RC_KO: function failed - - - - - PLUGIN_RC_OK: function successfully - completed - - - - - PLUGIN_RC_OK_IGNORE_WEECHAT: message - will not be sent to WeeChat - - - - - PLUGIN_RC_OK_IGNORE_PLUGINS: message - will not be sent to other plugins - - - - - PLUGIN_RC_OK_IGNORE_ALL: message - will not be sent to WeeChat neither other plugins - - - - - PLUGIN_RC_OK_WITH_HIGHLIGHT: function - successfully completed and make "highlight" on received - message - - - - -
- -
- add_command_handler - - - Perl prototype: - - weechat::add_command_handler(command, function, - [description, arguments, arguments_description, - completion_template]); - - - - Python prototype: - - weechat.add_command_handler(command, function, - [description, arguments, arguments_description, - completion_template]) - - - - Ruby prototype: - - Weechat.add_command_handler(command, function, - [description, arguments, arguments_description, - completion_template]) - - - - Lua prototype: - - weechat.add_command_handler(command, function, - [description, arguments, arguments_description, - completion_template]) - - - - Add a WeeChat command handler, called when user uses command - (for example /command). - - - Arguments: - - - - : the new command name, which - may be an existing command (be careful, replaced command - will not be available until script is unloaded) - - - - - : function called when command - is executed - - - - - : short description of command - arguments (displayed by /help command) - - - - - : long description - of command arguments (displayed by /help command) - - - - - : template for - completion, like "abc|%w def|%i" which - means "abc" or a WeeChat command for first argument, - "def" or IRC command for second. - (see ) - - - - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::add_command_handler("command", "my_command"); -sub my_command -{ - weechat::print("server= $_[0], args: $_[1]"); - return weechat::PLUGIN_RC_OK; -} - -# python -weechat.add_command_handler("command", "my_command") -def my_command(server, args): - weechat.prnt("server="+server+", args="+args) - return weechat.PLUGIN_RC_OK - -# ruby -Weechat.add_command_handler("command", "my_command") -def my_command(server, args) - Weechat.print("server=#{server}, args=#{args}") - return Weechat::PLUGIN_RC_OK -end - --- lua -weechat.add_command_handler("command", "my_command") -def my_command(server, args) - weechat.print("server="..server..", args="..args) - return weechat.PLUGIN_RC_OK() -end - - - - Notes: function called when command is executed has to return - one of following values: - - - - PLUGIN_RC_KO : function failed - - - - - PLUGIN_RC_OK : function successfully - completed - - - - -
- -
- add_timer_handler - - - Perl prototype: - - weechat::add_timer_handler(interval, function); - - - - Python prototype: - - weechat.add_timer_handler(interval, function) - - - - Ruby prototype: - - Weechat.add_timer_handler(interval, function) - - - - Lua prototype: - - weechat.add_timer_handler(interval, function) - - - - Add a timer handler which periodically calls a function. - - - Arguments: - - - - : interval (in seconds) between - two calls of function. - - - - - : function called - - - - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::add_timer_handler(60, "my_timer"); -sub my_timer -{ - weechat::print("this is timer handler"); - return weechat::PLUGIN_RC_OK; -} - -# python -weechat.add_timer_handler(60, "my_timer") -def my_timer(): - weechat.prnt("this is timer handler") - return weechat.PLUGIN_RC_OK - -# ruby -Weechat.add_timer_handler(60, "my_timer") -def my_timer() - Weechat.print("this is timer handler") - return Weechat::PLUGIN_RC_OK -end - --- lua -weechat.add_timer_handler(60, "my_timer") -function my_timer() - weechat.print("this is timer handler") - return weechat.PLUGIN_RC_OK() -end - - - - Note: function called has to return one of following values: - - - - PLUGIN_RC_KO: function failed - - - - - PLUGIN_RC_OK: function successfully - completed - - - - -
- -
- add_keyboard_handler - - - Perl prototype: - - weechat::add_keyboard_handler(function); - - - - Python prototype: - - weechat.add_keyboard_handler(function) - - - - Ruby prototype: - - Weechat.add_keyboard_handler(function) - - - - Lua prototype: - - weechat.add_keyboard_handler(function) - - - - Add a keyboard handler, called for any key pressed. - - - Arguments: - - - - : function called - - - - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::add_keyboard_handler("my_keyboard"); -sub my_keyboard -{ - my $key = shift; - my $input_before = shift; - my $input_after = shift; - weechat::print("keyboard handler: key = '$key', " - ."input before = '$input_before' " - ."after = '$input_after'"); - return weechat::PLUGIN_RC_OK; -} - -# python -weechat.add_keyboard_handler("my_keyboard") -def my_keyboard(key, input_before, input_after): - weechat.prnt("keyboard handler: key = '%s', " \ - "input before = '%s' after = '%s'" - %(key, input_before, input_after)) - return weechat.PLUGIN_RC_OK - -# ruby -Weechat.add_keyboard_handler("my_keyboard") -def my_keyboard(key, input_before, input_after) - Weechat.print("keyboard handler: key = '#{key}', " \ - "input before = '#{input_before}' " \ - "after = '#{input_after}'") - return Weechat::PLUGIN_RC_OK -end - --- lua -weechat.add_keyboard_handler("my_keyboard") -function my_keyboard(key, input_before, input_after) - weechat.print("keyboard handler: key = '"..key.. - "', input before = '"..input_before.. - "' after = '"..input_after.."'") - return weechat.PLUGIN_RC_OK() -end - - - - Note: function called has to return one of following values: - - - - PLUGIN_RC_KO: function failed - - - - - PLUGIN_RC_OK: function successfully - completed - - - - -
- -
- add_event_handler - - - Perl prototype: - - weechat::add_event_handler(event, function); - - - - Python prototype: - - weechat.add_event_handler(event, function) - - - - Ruby prototype: - - Weechat.add_event_handler(event, function) - - - - Lua prototype: - - weechat.add_event_handler(event, function) - - - - Add an event handler, called when an event happens. - - - Arguments: - - - - : event - (see ) - - - - - : function called - - - - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::add_event_handler("buffer_open", "my_event"); -sub my_event -{ - weechat::print("buffer open"); - return weechat::PLUGIN_RC_OK; -} - -# python -weechat.add_event_handler("buffer_open", "my_event") -def my_event(): - weechat.prnt("buffer open") - return weechat.PLUGIN_RC_OK - -# ruby -Weechat.add_event_handler("buffer_open", "my_event") -def my_event() - Weechat.print("buffer open") - return Weechat::PLUGIN_RC_OK -end - --- lua -weechat.add_event_handler("buffer_open", "my_event") -function my_event() - weechat.print("buffer open") - return weechat.PLUGIN_RC_OK() -end - - - - Note: function called has to return one of following values: - - - - PLUGIN_RC_KO: function failed - - - - - PLUGIN_RC_OK: function successfully - completed - - - - -
- -
- remove_handler - - - Perl prototype: - - weechat::remove_handler(name, function); - - - - Python prototype: - - weechat.remove_handler(name, function) - - - - Ruby prototype: - - Weechat.remove_handler(name, function) - - - - Lua prototype: - - weechat.remove_handler(name, function) - - - - Remove a message or command handler. - - - Arguments: - - - - : name of IRC message or command - - - - - : function - - - - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::remove_handler("command", "my_command"); - -# python -weechat.remove_handler("command", "my_command") - -# ruby -Weechat.remove_handler("command", "my_command") - --- lua -weechat.remove_handler("command", "my_command") - - -
- -
- remove_timer_handler - - - Perl prototype: - - weechat::remove_timer_handler(function); - - - - Python prototype: - - weechat.remove_timer_handler(function) - - - - Ruby prototype: - - Weechat.remove_timer_handler(function) - - - - Lua prototype: - - weechat.remove_timer_handler(function) - - - - Remove a timer handler. - - - Arguments: - - - - : function - - - - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::remove_timer_handler("my_timer"); - -# python -weechat.remove_timer_handler("my_timer") - -# ruby -Weechat.remove_timer_handler("my_timer") - --- lua -weechat.remove_timer_handler("my_timer") - - -
- -
- remove_keyboard_handler - - - Perl prototype: - - weechat::remove_keyboard_handler(function); - - - - Python prototype: - - weechat.remove_keyboard_handler(function) - - - - Ruby prototype: - - Weechat.remove_keyboard_handler(function) - - - - Lua prototype: - - weechat.remove_keyboard_handler(function) - - - - Remove a keyboard handler. - - - Arguments: - - - - : function - - - - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::remove_keyboard_handler("my_keyboard"); - -# python -weechat.remove_keyboard_handler("my_keyboard") - -# ruby -Weechat.remove_keyboard_handler("my_keyboard") - --- lua -weechat.remove_keyboard_handler("my_keyboard") - - -
- -
- remove_event_handler - - - Perl prototype: - - weechat::remove_event_handler(function); - - - - Python prototype: - - weechat.remove_event_handler(function) - - - - Ruby prototype: - - Weechat.remove_event_handler(function) - - - - Lua prototype: - - weechat.remove_event_handler(function) - - - - Remove an event handler. - - - Arguments: - - - - : function - - - - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::remove_event_handler("my_event"); - -# python -weechat.remove_event_handler("my_event") - -# ruby -Weechat.remove_event_handler("my_event") - --- lua -weechat.remove_event_handler("my_event") - - -
- -
- add_modifier - - - Perl prototype: - - weechat::add_modifier(type, message, function); - - - - Python prototype: - - weechat.add_modifier(type, message, function) - - - - Ruby prototype: - - Weechat.add_modifier(type, message, function) - - - - Lua prototype: - - weechat.add_modifier(type, message, function) - - - - Add a message modifier. - - - Arguments: - - - - : modifier type: - - - - - Type - Description - - - - - irc_in - called for incoming IRC messages - - - irc_user - - called for each user message (or command) (before - WeeChat parses message) - - - - irc_out - - called for outgoing messages, immediately before - sending it to IRC server (this includes messages - sent automatically by WeeChat to server) - - - - - - - - - - : name of IRC message (used only for - types "irc_in" and "irc_out"). - To know list of IRC messages, please consult - RFCs - 1459 - and - 2812. - Moreover, special value "*" means all messages (no filter). - - - - - : function called - - - - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::add_modifier("irc_in", "privmsg", "mod_in"); -weechat::add_modifier("irc_out", "privmsg", "mod_out"); -sub mod_in -{ - return "$_[1] [modifier IN]"; -} -sub mod_out -{ - return "$_[1] [modifier OUT]"; -} - -# python -weechat.add_modifier("irc_in", "privmsg", "mod_in") -weechat.add_modifier("irc_out", "privmsg", "mod_out") -def mod_in(serveur, args): - return args + " [modifier IN]" -def mod_out(serveur, args): - return args + " [modifier OUT]" - -# ruby -Weechat.add_modifier("irc_in", "privmsg", "mod_in") -Weechat.add_modifier("irc_out", "privmsg", "mod_out") -def mod_in(server, args) - return args + " [modifier IN]" -end -def mod_out(server, args) - return args + " [modifier OUT]" -end - --- lua -weechat.add_modifier("irc_in", "privmsg", "mod_in") -weechat.add_modifier("irc_out", "privmsg", "mod_out") -function mod_in(server, args) - return args .. " [modifier IN]" -end -function mod_out(server, args) - return args .. " [modifier OUT]" -end - - -
- -
- remove_modifier - - - Perl prototype: - - weechat::remove_modifier(type, message, function); - - - - Python prototype: - - weechat.remove_modifier(type, message, function) - - - - Ruby prototype: - - Weechat.remove_modifier(type, message, function) - - - - Lua prototype: - - weechat.remove_modifier(type, message, function) - - - - Remove a message modifier. - - - Arguments: - - - - : modifier type - - - - - : message managed by modifier - - - - - : function - - - - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::remove_modifier("irc_in", "privmsg", "mod_in"); - -# python -weechat.remove_modifier("irc_in", "privmsg", "mod_in") - -# ruby -Weechat.remove_modifier("irc_in", "privmsg", "mod_in") - --- lua -weechat.remove_modifier("irc_in", "privmsg", "mod_in") - - -
- -
- command - - - Perl prototype: - - weechat::command(command, [channel, [server]]); - - - - Python prototype: - - weechat.command(command, [channel, [server]]) - - - - Ruby prototype: - - Weechat.command(command, [channel, [server]]) - - - - Lua prototype: - - weechat.command(command, [channel, [server]]) - - - - Execute a WeeChat command (or send a message to a channel). - - - Arguments: - - - - : command - - - - - : name of channel for executing - command - - - - - : internal name of server for - executing command - - - - - - Return value: 1 if success, 0 if an error occurred. - - - Examples: - -# perl -weechat::command("hello everybody!"); -weechat::command("/kick toto please leave this channel", "#weechat"); -weechat::command("/nick newnick", "", "freenode"); - -# python -weechat.command("hello everybody!") -weechat.command("/kick toto please leave this channel", "#weechat") -weechat.command("/nick newnick", "", "freenode") - -# ruby -Weechat.command("hello everybody!") -Weechat.command("/kick toto please leave this channel", "#weechat") -Weechat.command("/nick newnick", "", "freenode") - --- lua -weechat.command("hello everybody!") -weechat.command("/kick toto please leave this channel", "#weechat") -weechat.command("/nick newnick", "", "freenode") - - -
- -
- get_info - - - Perl prototype: - - weechat::get_info(name, [server]); - - - - Python prototype: - - weechat.get_info(name, [server]) - - - - Ruby prototype: - - Weechat.get_info(name, [server]) - - - - Lua prototype: - - weechat.get_info(name, [server]) - - - - Return an info about WeeChat or a channel. - - - Arguments: - - - - : name of info to read - (see ) - - - - - : internal name of server for - reading info (if needed) - - - - - - Return value: information asked, empty string if an error - occurred. - - - Examples: - -# 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") - - -
- -
- get_dcc_info - - - Perl prototype: - - weechat::get_dcc_info(); - - - - Python prototype: - - weechat.get_dcc_info() - - - - Ruby prototype: - - Weechat.get_dcc_info() - - - - Lua prototype: - - weechat.get_dcc_info() - - - - Return list of DCC currently active or finished. - - - Return value: list of DCC - (see ). - - - Examples: - -# 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("no DCC"); -} - -# python -dccs = weechat.get_dcc_info() -if dccs != None: - if dccs == []: - weechat.prnt("no DCC") - else: - for d in dccs: - for b in d.keys(): - weechat.prnt("%s = '%s'" %(b, d[b])) -else: - weechat.prnt("error while getting DCC") - -# ruby -dccs = Weechat.get_dcc_info() -if dccs != nil - if dccs == [] - Weechat.print("no DCC") - else - dccs.each do |m| - m.each do |key, value| - Weechat.print("#{key} = '#{value}'") - end - end - end -else - Weechat.print("error while getting 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("no DCC") - end -else - weechat.print("error while getting DCC") -end - - -
- -
- get_server_info - - - Perl prototype: - - weechat::get_server_info(); - - - - Python prototype: - - weechat.get_server_info() - - - - Ruby prototype: - - Weechat.get_server_info() - - - - Lua prototype: - - weechat.get_server_info() - - - - Return list of IRC servers (connected or not). - - - Return value: list of servers - (see ). - - - Examples: - -# 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("no server"); -} - -# python -servers = weechat.get_server_info() -if servers != None: - if servers == {}: - weechat.prnt("no server") - else: - for s in servers: - for i in servers[s]: - weechat.prnt("%s -> %s = '%s'" % (s, i, str(servers[s][i]))) -else: - weechat.prnt("error while getting servers") - -# ruby -servers = Weechat.get_server_info() -if servers != nil - if servers == [] - Weechat.print("no server") - else - servers.each do |n, s| - s.each do |key, value| - Weechat.print("#{n} -> #{key} = '#{value}'") - end - end - end -else - Weechat.print("error while getting servers") -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("no server") - end -else - weechat.print("error while getting servers") -end - - -
- -
- get_channel_info - - - Perl prototype: - - weechat::get_channel_info(server); - - - - Python prototype: - - weechat.get_channel_info(server) - - - - Ruby prototype: - - Weechat.get_channel_info(server) - - - - Lua prototype: - - weechat.get_channel_info(server) - - - - Return list of IRC channels for a server. - - - Return value: list of IRC channels for server - (see ). - - - Examples: - -# 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("no channel"); -} - -# python -chans = weechat.get_channel_info(weechat.get_info("server")) -if chans != None: - if chans == {}: - weechat.prnt("no channel") - else: - for s in chans: - for i in chans[s]: - weechat.prnt("%s -> %s = '%s'" % (s, i, str(chans[s][i]))) -else: - weechat.prnt("error while getting channels") - -# ruby -channels = Weechat.get_channel_info(Weechat.get_info("server")) -if channels != nil - if channels == {} - Weechat.print("no channel") - else - channels.each do |n, c| - c.each do |key, value| - Weechat.print("#{n} -> #{key} = '#{value}'") - end - end - end -else - Weechat.print("error while getting channels") -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("no channel") - end -else - weechat.print("error while getting channels") -end - - -
- -
- get_nick_info - - - Perl prototype: - - weechat::get_nick_info(server, channel); - - - - Python prototype: - - weechat.get_nick_info(server, channel) - - - - Ruby prototype: - - Weechat.get_nick_info(server, channel) - - - - Lua prototype: - - weechat.get_nick_info(server, channel) - - - - Return list of nicks for a channel. - - - Return value: list of nicks on channel - (see ). - - - Examples: - -# 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("no nick"); -} - -# python -nicks = weechat.get_nick_info("freenode", "#weechat") -if nicks != None: - if nicks == {}: - weechat.prnt("no nick") - else: - for n in nicks: - for f in nicks[n]: - weechat.prnt("%s -> %s = '%s'" % (n, f, str(nicks[n][f]))) -else: - weechat.prnt("error while getting nicks") - -# ruby -nicks = Weechat.get_nick_info("freenode", "#weechat") -if nicks != nil - if nicks == {} - Weechat.print("no nick") - else - nicks.each do |nk, nattr| - nattr.each do |key, value| - Weechat.print("#{nk} -> #{key} = '#{value}'") - end - end - end -else - Weechat.print("error while getting nicks") -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("no nick") - end -else - weechat.print("error while getting nicks") -end - - -
- -
- get_config - - - Perl prototype: - - weechat::get_config(option); - - - - Python prototype: - - weechat.get_config(option) - - - - Ruby prototype: - - Weechat.get_config(option) - - - - Lua prototype: - - weechat.get_config(option) - - - - Return value of a WeeChat config option. - - - Arguments: - - - - : name of option to read - - - - - - Return value: option value, empty string if not found. - - - Examples: - -# perl -$value1 = weechat::get_config("look_nicklist"); -$value2 = weechat::get_config("freenode.server_autojoin"); - -# python -value1 = weechat.get_config("look_nicklist") -value2 = weechat.get_config("freenode.server_autojoin") - -# ruby -value1 = Weechat.get_config("look_nicklist") -value2 = Weechat.get_config("freenode.server_autojoin") - --- lua -value1 = weechat.get_config("look_nicklist") -value2 = weechat.get_config("freenode.server_autojoin") - - -
- -
- set_config - - - Perl prototype: - - weechat::set_config(option, value); - - - - Python prototype: - - weechat.set_config(option, value) - - - - Ruby prototype: - - Weechat.set_config(option, value) - - - - Lua prototype: - - weechat.set_config(option, value) - - - - Update value of a WeeChat config option. - - - Arguments: - - - - : name of option to update - - - - - : new value for option - - - - - - Return value: 1 if option was successfully updated, 0 if an error - occurred. - - - Examples: - -# perl -weechat::set_config("look_nicklist", "off"); -weechat::set_config("freenode.server_autojoin", "#weechat"); - -# python -weechat.set_config("look_nicklist", "off") -weechat.set_config("freenode.server_autojoin", "#weechat") - -# ruby -Weechat.set_config("look_nicklist", "off") -Weechat.set_config("freenode.server_autojoin", "#weechat") - --- lua -weechat.set_config("look_nicklist", "off") -weechat.set_config("freenode.server_autojoin", "#weechat") - - -
- -
- get_plugin_config - - - Perl prototype: - - weechat::get_plugin_config(option); - - - - Python prototype: - - weechat.get_plugin_config(option) - - - - Ruby prototype: - - Weechat.get_plugin_config(option) - - - - Lua prototype: - - weechat.get_plugin_config(option) - - - - Return value of a plugin option. Option is read from file - "~/.weechat/plugins.rc" and is like: - "plugin.option=value" (note: plugin name - is automatically added). - - - Arguments: - - - - : name of option to read - - - - - - Return value: value of option, empty string if not found. - - - Examples : - -# perl -$value = weechat::get_plugin_config("my_var"); - -# python -value = weechat.get_plugin_config("my_var") - -# ruby -value = Weechat.get_plugin_config("my_var") - --- lua -value = weechat.get_plugin_config("my_var") - - -
- -
- set_plugin_config - - - Perl prototype: - - weechat::set_plugin_config(option, value); - - - - Python prototype: - - weechat.set_plugin_config(option, value) - - - - Ruby prototype: - - Weechat.set_plugin_config(option, value) - - - - Lua prototype: - - weechat.set_plugin_config(option, value) - - - - Update value of a plugin option. Option is written in file - "~/.weechat/plugins.rc" and is like: - "plugin.option=value" (note: plugin name - is automatically added). - - - Arguments: - - - - : name of option to update - - - - - : new value for option - - - - - - Return value: 1 if option was successfully updated, 0 if an error - occurred. - - - Examples: - -# perl -weechat::set_plugin_config("my_var", "value"); - -# python -weechat.set_plugin_config("my_var", "value") - -# ruby -Weechat.set_plugin_config("my_var", "value") - --- lua -weechat.set_plugin_config("my_var", "value") - - -
- -
- get_irc_color - - - Perl prototype: - - weechat::get_irc_color(color); - - - - Python prototype: - - weechat.get_irc_color(color) - - - - Ruby prototype: - - Weechat.get_irc_color(color) - - - - Lua prototype: - - weechat.get_irc_color(color) - - - - Return IRC color index with name. - - - Return value: IRC color index, -1 if color is not found - (see ). - - - Examples: - -# 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") - - -
- -
- input_color - - - Perl prototype: - - weechat::input_color(color); - - - - Python prototype: - - weechat.input_color(color) - - - - Ruby prototype: - - Weechat.input_color(color) - - - - Lua prototype: - - weechat.input_color(color) - - - - Add color in input buffer. - - - Return value: none. - - - Examples: - -# 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) - - -
- -
- get_window_info - - - Perl prototype: - - weechat::get_window_info(); - - - - Python prototype: - - weechat.get_window_info() - - - - Ruby prototype: - - Weechat.get_window_info() - - - - Lua prototype: - - weechat.get_window_info() - - - - Return list of WeeChat windows. - - - Return value: list of WeeChat windows - (see ). - - - Examples: - -# perl -my @wf = weechat::get_window_info(); -if (@wf) -{ - weechat::print("**** windows infos ****"); - foreach my $w (@wf) - { - while ( my ($key, $value) = each %$w) - { - weechat::print(" > $key => $value"); - } - weechat::print("----------------------"); - } -} -else -{ - weechat::print("**** no window info ****"); -} - -# python -wf = weechat.get_window_info() -if wf != None and wf != []: - weechat.prnt ("**** windows infos ****") - for w in wf: - for i in w: - weechat.prnt (" > %s => %s" % (i, w[i])) - weechat.prnt ("----------------------") -else: - weechat.prnt ("**** no window info ****") - -# ruby -wf = Weechat.get_window_info() -if wf != nil and wf != [] - Weechat.print("**** windows infos ****") - wf.each do |w| - w.each do |key, value| - Weechat.print(" > #{key} => #{value}") - end - Weechat.print("----------------------") - end -else - Weechat.print("**** no window info ****") -end - --- lua -wf = weechat.get_window_info() -if wf then - weechat.print ("**** windows infos ****") - 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("**** no window info ****") -end - - -
- -
- get_buffer_info - - - Perl prototype: - - weechat::get_buffer_info(); - - - - Python prototype: - - weechat.get_buffer_info() - - - - Ruby prototype: - - Weechat.get_buffer_info() - - - - Lua prototype: - - weechat.get_buffer_info() - - - - Return list of WeeChat buffers. - - - Return value: list of WeeChat buffers - (see ). - - - Examples: - -# 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"); - } - weechat::print("----------------------"); - } -} -else -{ - weechat::print("**** no buffer info ****"); -} - -# python -bf = weechat.get_buffer_info() -if bf != None and bf != {}: - for b in bf: - weechat.prnt ("**** info for buffer no %d ****" % b) - for c in bf[b]: - weechat.prnt (" > %s => %s" % (c, bf[b][c])) - weechat.prnt ("----------------------") -else: - weechat.prnt ("**** no buffer info ****") - -# ruby -bf = Weechat.get_buffer_info() -if bf != nil and bf != {} - bf.each do |n, c| - Weechat.print("**** info for buffer no #{n} ****") - c.each do |key, value| - Weechat.print(" > #{key} => #{value}") - end - Weechat.print("----------------------") - end -else - Weechat.print("**** no buffer info ****") -end - --- lua -bf = weechat.get_buffer_info() -if bf then - b, binfos = next (bf, nil) - while (b) do - weechat.print("**** info for buffer no " .. b .. " ****") - key, value = next (binfos, nil) - while (key) do - weechat.print(" > " .. key .. " => " .. value) - key, value = next (binfos, key) - end - weechat.print ("----------------------") - b, infos = next (bf, b) - end -else - weechat.print("**** no buffer info ****") -end - - -
- -
- get_buffer_data - - - Perl prototype: - - weechat::get_buffer_data(server, channel); - - - - Python prototype: - - weechat.get_buffer_data(server, channel) - - - - Ruby prototype: - - Weechat.get_buffer_data(server, channel) - - - - Lua prototype: - - weechat.get_buffer_data(server, channel) - - - - Return content of buffer. - - - Return value: list of lines for buffer - (see ). - - - Examples: - -# perl -my $server = weechat::get_info("server"); -my $channel = weechat::get_info("channel"); -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 = weechat.get_info("server") -channel = weechat.get_info("channel") -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 = Weechat.get_info("server") -channel = Weechat.get_info("channel") -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 = weechat.get_info("server") -channel = weechat.get_info("channel") -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 (bdatas, 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 - - -
- -
- -
- -
- - - - - Authors / Support - - - This chapter lists authors and contributors for WeeChat, and - shows ways to get support. - - -
- Authors - - - WeeChat is developed by: - - - - FlashCode (Sébastien Helleu) - flashcode AT flashtux.org - - main developer - - - - - kolter (Emmanuel Bouthenot) - kolter AT openics.org - - developer - - - - - Ptitlouis - ptitlouis AT sysif.net - - Debian packager - - - - - -
- -
- Contributors - - - Following people contributed to WeeChat: - - - - Jiri Golembiovsky - - czech translation, patches - - - - - Rudolf Polzer - - patches - - - - - Jim Ramsay - - patches - - - - - Odin - - SuSE RPM - - - - - Pistos - - patches - - - - - Gwenn - - patches - - - - - voroskoi - - hungarian translation - - - - - Frank Zacharias - - german translation - - - - - Pavel Shevchuk - - russian translation - - - - - -
- -
- Get support - - - Before asking for support, be sure you've read documentation and FAQ - provided with WeeChat (documentation is this document, if you don't - read all lines until this sentence, you can start again!) - - - - - - - IRC: server "irc.freenode.net", - channel "#weechat" - - - - - WeeChat forum: - - http://forums.flashtux.org - - - - - - Mailing list: - - - - To subscribe: - - http://mail.nongnu.org/mailman/listinfo/weechat-support - - - - - - To send a mail on mailing list: - weechat-support@nongnu.org - - - - Mailing list archives are available here: - - http://mail.nongnu.org/archive/html/weechat-support - - - - - - -
- -
+ &authors.en.xml;
diff --git a/doc/fr/Makefile.am b/doc/fr/Makefile.am index 12e7b328e..8f921edef 100644 --- a/doc/fr/Makefile.am +++ b/doc/fr/Makefile.am @@ -16,7 +16,12 @@ LANGCODE = fr BOOK = weechat.$(LANGCODE) -BOOK_INCLUDE = weechat_commands.xml irc_commands.xml key_functions.xml config.xml +BOOK_INCLUDE = intro.$(LANGCODE).xml install.$(LANGCODE).xml \ + usage.$(LANGCODE).xml plugins.$(LANGCODE).xml \ + plugin_api.$(LANGCODE).xml plugin_charset.$(LANGCODE).xml \ + plugin_scripts.$(LANGCODE).xml \ + weechat_commands.xml irc_commands.xml key_functions.xml \ + config.xml QUICKSTART = weechat_quickstart.$(LANGCODE).txt EXTRA_DIST = $(BOOK).xml $(BOOK_INCLUDE) $(QUICKSTART) diff --git a/doc/fr/authors.fr.xml b/doc/fr/authors.fr.xml new file mode 100644 index 000000000..5b60cc680 --- /dev/null +++ b/doc/fr/authors.fr.xml @@ -0,0 +1,185 @@ + + + + + + Auteurs / Support + + + Ce chapitre liste les auteurs et contributeurs pour WeeChat, et + indique les moyens d'obtenir du support. + + +
+ Auteurs + + + WeeChat est développé par : + + + + FlashCode (Sébastien Helleu) + flashcode AT flashtux.org - + développeur principal + + + + + kolter (Emmanuel Bouthenot) + kolter AT openics.org - + développeur + + + + + Ptitlouis + ptitlouis AT sysif.net - + empaqueteur Debian + + + + + +
+ +
+ Contributeurs + + + Les personnes suivantes ont contribué à WeeChat : + + + + Jiri Golembiovsky - + traduction en tchèque, patchs + + + + + Rudolf Polzer - + patchs + + + + + Jim Ramsay - + patchs + + + + + Odin - + RPM pour SuSE + + + + + Pistos - + patchs + + + + + Gwenn - + patchs + + + + + voroskoi - + traduction en hongrois + + + + + Frank Zacharias - + traduction en allemand + + + + + Pavel Shevchuk - + traduction en russe + + + + + +
+ +
+ Obtenir du support + + + Avant de faire appel au support, merci de lire la documentation et + la FAQ de WeeChat (la documentation est le document que vous êtes + en train de lire, si vous n'avez pas tout lu jusqu'ici, il est encore + temps de recommencer !) + + + + + + + IRC : serveur "irc.freenode.net", + canal "#weechat" + + + + + Forum WeeChat : + + http://forums.flashtux.org + + + + + + Liste de diffusion : + + + + Pour souscrire : + + http://mail.nongnu.org/mailman/listinfo/weechat-support + + + + + + Pour envoyer un mail à la liste de diffusion : + weechat-support@nongnu.org + + + + Les archives de la liste de diffusion sont ici : + + http://mail.nongnu.org/archive/html/weechat-support + + + + + + +
+ +
diff --git a/doc/fr/install.fr.xml b/doc/fr/install.fr.xml new file mode 100644 index 000000000..70b1ada77 --- /dev/null +++ b/doc/fr/install.fr.xml @@ -0,0 +1,109 @@ + + + + + + Installation + + + Ce chapitre explique comment installer WeeChat. + + +
+ Paquets binaires + + + Les paquets binaires sont disponibles pour les distributions + suivantes : + + + + Debian (ou toute distribution compatible Debian) : + apt-get install weechat + + + + + Mandriva/RedHat (ou toute distribution compatible avec les RPM) : + + rpm -i /chemin/weechat-x.y.z-1.i386.rpm + + + + + + Gentoo : + emerge weechat + + + + + Pour les autres distributions supportées, merci de vous + référer au manuel de la distribution pour la méthode d'installation. + + +
+ +
+ Paquet source + + + Tapez simplement dans une console ou un terminal : +$ ./configure +$ make + + + Obtenez les droits root et installez WeeChat : +$ su +(entrez le mot de passe root) +# make install + + +
+ +
+ Sources GIT + + + Attention : les sources GIT 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 ! + + + + Pour récupérer les sources GIT, tapez cette commande : +$ git-clone git://git.sv.gnu.org/weechat.git + + + + Exécutez ce script : + ./autogen.sh + + + + Suivez alors les instructions du paquet source + (voir ) + + +
+ +
diff --git a/doc/fr/intro.fr.xml b/doc/fr/intro.fr.xml new file mode 100644 index 000000000..04227b6cb --- /dev/null +++ b/doc/fr/intro.fr.xml @@ -0,0 +1,148 @@ + + + + + + Introduction + + + Ce chapitre décrit WeeChat et les pré-requis pour son installation. + + +
+ Description + + + WeeChat (Wee Enhanced Environment for Chat) est un client + chat libre, rapide et léger, conçu pour différents systèmes + d'exploitation. + + + + Ses principales caractéristiques sont les suivantes : + + + + connexion multi-serveurs (avec SSL, IPv6, proxy) + + + + + plusieurs interfaces : Curses, wxWidgets, Gtk et Qt + + + + + petit, rapide et léger + + + + + paramétrable et extensible avec des extensions et des scripts + + + + + conforme aux RFCs + 1459, + 2810, + 2811, + 2812 et + 2813 + + + + + multi plates-formes (GNU/L'index, *BSD, MacOS X, Windows et + d'autres systèmes) + + + + + 100% GPL, logiciel libre + + + + + + + La page d'accueil de WeeChat est ici : + + http://weechat.flashtux.org + + + +
+ +
+ Pré-requis + + + Pour installer WeeChat, vous devez avoir : + + + + un système GNU/Linux (avec le compilateur et les outils + associés pour le paquet des sources) + + + + + droits "root" (pour installer WeeChat) + + + + + selon l'interface, une des bibliothèques + suivantes : + + + + Curses : la bibliothèque ncurses + + + + + Gtk : + *** interface non développée *** + + + + + WxWidgets : + *** interface non développée *** + + + + + Qt : + *** interface non développée *** + + + + + + + + +
+
diff --git a/doc/fr/plugin_api.fr.xml b/doc/fr/plugin_api.fr.xml new file mode 100644 index 000000000..e1e0e74a9 --- /dev/null +++ b/doc/fr/plugin_api.fr.xml @@ -0,0 +1,3640 @@ + + + + +
+ Fonctions de l'interface (API) + +
+ set_charset + + + Prototype : + + void set_charset (t_weechat_plugin *plugin, char *charset) + + + + Change le jeu de caractères de l'extension. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nouveau jeu de caractères à + utiliser + + + + + + Exemple : + plugin->set_charset (plugin, "ISO-8859-1"); + +
+ +
+ iconv_to_internal + + + Prototype : + + void iconv_to_internal (t_weechat_plugin *plugin, char *charset, + char *string) + + + + Convertit une chaîne de caractères vers le jeu de caractères + interne WeeChat (UTF-8). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : le jeu de caractères de départ + + + + + : la chaîne à convertir + + + + + + Valeur renvoyée : la chaîne convertie. + + + Note : le résultat doit être libéré par un appel à la fonction + "free" après utilisation. + + + Exemple : + char *str = plugin->iconv_to_internal (plugin, "ISO-8859-1", "chaine iso: é à"); + +
+ +
+ iconv_from_internal + + + Prototype : + + void iconv_from_internal (t_weechat_plugin *plugin, char *charset, + char *string) + + + + Convertit une chaîne de caractères depuis le jeu de caractères + interne WeeChat (UTF-8) vers un autre. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : le jeu de caractères voulu + + + + + : la chaîne à convertir + + + + + + Valeur renvoyée : la chaîne convertie. + + + Note : le résultat doit être libéré par un appel à la fonction + "free" après utilisation. + + + Exemple : + char *str = plugin->iconv_from_internal (plugin, "ISO-8859-1", "chaine utf-8: é à"); + +
+ +
+ ascii_strcasecmp + + + Prototype : + + int ascii_strcasecmp (t_weechat_plugin *plugin, + char *chaine1, char *chaine2) + + + + Effectue une comparaison entre deux chaînes, sans tenir compte des + majuscules/minuscules ni de la locale. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : la première chaîne à comparer + + + + + : la deuxième chaîne à comparer + + + + + + Valeur renvoyée : la différence entre les deux chaînes : négatif + si chaine1 < chaine2, zéro si chaine1 == chaine2, positif si + chaine1 > chaine2 + + + Exemple : + if (plugin->ascii_strcasecmp (plugin, "abc", "def") != 0) ... + +
+ +
+ ascii_strncasecmp + + + Prototype : + + int ascii_strncasecmp (t_weechat_plugin *plugin, + char *chaine1, char *chaine2, int max) + + + + Effectue une comparaison entre deux chaînes, sans tenir compte des + majuscules/minuscules ni de la locale, en comparant au plus "max" + caractères. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : la première chaîne à comparer + + + + + : la deuxième chaîne à comparer + + + + + : nombre de caractères max à comparer + + + + + + Valeur renvoyée : la différence entre les deux chaînes : négatif + si chaine1 < chaine2, zéro si chaine1 == chaine 2, positif si + chaine1 > chaine2 + + + Exemple : + if (plugin->ascii_strncasecmp (plugin, "abc", "def", 2) != 0) ... + +
+ +
+ explode_string + + + Prototype : + + char **explode_string (t_weechat_plugin *plugin, char *chaine, + char *separateurs, int num_items_max, int *num_items) + + + + Explose une chaîne en plusieurs selon un/des délimiteur(s). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : la chaîne à exploser + + + + + : les délimiteurs utilisés + pour exploser la chaîne + + + + + : nombre maximum de + sous-chaînes créées (0 = pas de limite) + + + + + : pointeur vers un entier qui + contiendra le nombre de sous-chaînes créées en retour + + + + + + Valeur renvoyée : un tableau de chaînes, ou NULL si un problème + a été rencontré. + + + Note : le résultat doit être libéré par un appel à la fonction + "free_exploded_string" après utilisation. + + + Exemple : + +char **argv; +int argc; +argv = plugin->explode_string (plugin, chaine, " ", 0, &argc); +... +if (argv != NULL) + plugin->free_exploded_string (plugin, argv); + + +
+ +
+ free_exploded_string + + + Prototype : + + char **free_exploded_string (t_weechat_plugin *plugin, + char **chaine) + + + + Libère la mémoire utilisée pour une explosion de chaîne. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : la chaîne explosée par la fonction + "explode_string" + + + + + + Valeur renvoyée : aucune. + + + Exemple : + +char *argv; +int argc; +argv = plugin->explode_string (plugin, chaine, " ", 0, &argc); +... +if (argv != NULL) + plugin->free_exploded_string (plugin, argv); + + +
+ +
+ mkdir_home + + + Prototype : + + int mkdir_home (t_weechat_plugin *plugin, char *repertoire) + + + + Créé un répertoire dans le répertoire de base de WeeChat. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : répertoire à créer + + + + + + Valeur renvoyée : 1 si le répertoire a été créé avec succès, + 0 si une erreur s'est produite. + + + Example: + +if (!plugin->mkdir_home (plugin, "temp")) + plugin->print_server(plugin, "Impossible de créer le répertoire 'temp' dans la base WeeChat."); + + +
+ +
+ exec_on_files + + + Prototype : + + void exec_on_files (t_weechat_plugin *plugin, char *repertoire, + int (*callback)(t_weechat_plugin *, char *)) + + + + Exécute une fonction sur tous les fichiers d'un répertoire. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : le répertoire où les fichiers + sont recherchés + + + + + : une fonction appelée pour chaque + fichier trouvé + + + + + + Valeur renvoyée : aucune. + + + Exemple : + +int callback (t_weechat_plugin *plugin, char *fichier) +{ + plugin->print_server (plugin, "fichier: %s", fichier); + return 1; +} +... +plugin->exec_on_files (plugin, "/tmp", &callback); + + +
+ +
+ print + + + Prototype : + + void print (t_weechat_plugin *plugin, + char *serveur, char *canal, char *message, ...) + + + + Affiche un message sur un tampon WeeChat, identifié par le serveur + et le canal (tous deux pouvant être NULL pour le tampon courant). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom interne du serveur pour + trouver le tampon dans lequel afficher (peut être NULL) + + + + + : nom du canal pour trouver le + tampon dans lequel afficher (peut être NULL) + + + + + : message à afficher + + + + + + Pour afficher du texte en couleur, il faut utiliser les codes + suivants : + + + + + Code + Description + + + + + 0x02 + + texte gras + + + + 0x03 + "xx" + + couleur du texte "xx" + (voir pour les + couleurs) + + + + 0x03 + "xx,yy" + + couleur du texte "xx" + et du fond "yy" + (voir pour les + couleurs) + + + + 0x0F + + désactiver la couleur et tous les attributs + + + + 0x12 + + vidéo inverse (inversion de la couleur d'écriture et du + fond) + + + + 0x1F + + texte souligné + + + + + + NB: le même code (sans le numéro pour 0x03) peut être utilisé pour + stopper l'attribut défini. + + + Valeur renvoyée : aucune. + + + Exemples : + +plugin->print (plugin, NULL, NULL, "hello"); +plugin->print (plugin, NULL, "#weechat", "hello"); +plugin->print (plugin, "freenode", "#weechat", "hello"); +plugin->print (plugin, "freenode", "#weechat", "hello"); +plugin->print (plugin, NULL, NULL, + "test: \x02 gras \x0F\x03%02d bleu \x03%02d vert", + plugin->get_irc_color (plugin, "blue"), + plugin->get_irc_color (plugin, "green")); + + +
+ +
+ print_server + + + Prototype : + + void print_server (t_weechat_plugin *plugin, + char *message, ...) + + + + Affiche un message sur le tampon du serveur courant. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : message à afficher + + + + + + Pour afficher du texte en couleur, voir + . + + + Valeur renvoyée : aucune. + + + Exemple : plugin->print_server (plugin, "hello"); + +
+ +
+ print_infobar + + + Prototype : + + void print_infobar (t_weechat_plugin *plugin, + int temps, char *message, ...) + + + + Affiche un message sur la barre d'infos pour un temps déterminé. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : temps (en secondes) pendant lequel + le message est affiché (0 = jamais effacé) + + + + + + Valeur renvoyée : aucune. + + + Exemple : + +plugin->print_infobar (plugin, 5, "hello"); + + +
+ +
+ infobar_remove + + + Prototype : + + void infobar_remove (t_weechat_plugin *plugin, int nombre) + + + + Efface un ou plusieurs messages dans la pile de la barre d'infos. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nombre de messages à supprimer + (si paramètre non présent ou <= 0, alors tous les messages + sont effacés) + + + + + + Valeur renvoyée : aucune. + + + Exemple : plugin->infobar_remove (1); + +
+ +
+ log + + + Prototype : + + void log (t_weechat_plugin *plugin, + char *serveur, char *canal, char *message, ...) + + + + Ecrit un message dans le fichier de log pour un serveur ou un + canal. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom interne du serveur pour + trouver le log du tampon (peut être NULL) + + + + + : nom du canal pour trouver le + tampon le log du tampon (peut être NULL) + + + + + : message + + + + + + Valeur renvoyée : aucune. + + + Exemple : + +plugin->log (plugin, "freenode", "#weechat", "test"); + + +
+ +
+ msg_handler_add + + + Prototype : + + t_plugin_handler *msg_handler_add (t_weechat_plugin + *plugin, char *message, t_plugin_handler_func *fonction, + char *handler_args, void *handler_pointer) + + + + Ajoute un gestionnaire de messages IRC, appelé dès qu'un message + IRC est reçu. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom du message IRC pour lequel la + fonction est appelée ("*" pour tous les messages). + Pour connaître la liste des messages IRC disponibles, merci + de consulter les RFCs + 1459 + et + 2812. + 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 : + + + + + Nom + Description + + + + + weechat_pv + message privé reçu + + + weechat_highlight + + message avec highlight (sur un canal ou en privé) + + + + weechat_ctcp + + message CTCP reçu (VERSION, PING, etc...) + + + + weechat_dcc + + message DCC reçu (discussion ou fichier) + + + + + + + + + + : fonction appelée lorsque le + message est reçu + + + Elle a le prototype suivant : + + int ma_fonction (t_weechat_plugin *plugin, + int argc, char **argv, + char *handler_args, void *handler_pointer) + + + + Le paramètre argc vaut 3 et les arguments suivants sont + passés dans le tableau argv : + + + argv[0] = nom du serveur + + + argv[1] = message IRC + + + argv[2] = arguments de la commande + + + + + + + : paramètres passés à la + fonction appelée + + + + + : pointeur passé à la + fonction appelée + + + + + + Valeur renvoyée : le pointeur vers le nouveau gestionnaire de + messages. + + + Note : la fonction appelée lorsque le message est reçu doit + renvoyer une des valeurs suivantes : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + + PLUGIN_RC_OK_IGNORE_WEECHAT : le message + ne sera pas transmis à WeeChat + + + + + PLUGIN_RC_OK_IGNORE_PLUGINS : le message + ne sera pas transmis à d'autres extensions + + + + + PLUGIN_RC_OK_IGNORE_ALL : le message + ne sera ni transmis à WeeChat ni à d'autres extensions + + + + + PLUGIN_RC_OK_WITH_HIGHLIGHT : la fonction + a réussi et provoque un "highlight" sur le message reçu + + + + + + Exemple : + +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; +} +... +t_plugin_handler *msg_handler; +msg_handler = plugin->msg_handler_add (plugin, "KICK", + &msg_kick, NULL, NULL); + + +
+ +
+ cmd_handler_add + + + Prototype : + + t_plugin_handler *cmd_handler_add (t_weechat_plugin + *plugin, char *commande, char *description, char *arguments, + char *arguments_description, char *modele_completion, + t_plugin_handler_func *fonction, char *handler_args, + void *handler_pointer) + + + + Ajoute un gestionnaire de commande WeeChat, appelé dès que + l'utilisateur utilise la commande (par exemple /commande). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de la nouvelle commande, + qui peut être une commande déjà existante (attention la + commande remplacée ne sera plus disponible jusqu'à ce que + l'extension soit déchargée) + + + + + : brève description de la + commande (affichée par /help commande) + + + + + : brève description des + paramètres de la commande (affichée par /help commande) + + + + + : longue description + des paramètres de la commande (affichée par /help commande) + + + + + : modèle pour la + complétion sous la forme "abc|%w def|%i" + qui 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. + + + Les codes suivants peuvent être utilisés : + + + + + Code + Description + + + + + %- + aucune complétion pour le paramètre + + + %* + + répétition de la dernière complétion pour tous + les paramètres suivants (ce code doit être à la + fin du modèle de complétion, précédé d'un "|") + + + + %a + alias + + + %A + + alias et commandes (WeeChat, IRC et extensions) + + + + %c + canal courant + + + %C + tous les canaux (y compris les privés) + + + %f + nom de fichier + + + %h + commandes définies par des extensions + + + %i + commandes IRC (envoyées) + + + %I + commandes IRC (reçues) + + + %k + fonctions associées aux touches + + + %m + pseudo sur le serveur courant + + + %M + + pseudos sur le serveur courant + (tous les canaux ouverts) + + + + %n + pseudos du canal courant + + + %N + + pseudos et noms de machines du canal + courant + + + + %o + options de configuration + + + %O + options des extensions + + + %p + message de "part" par défaut + + + %q + message de "quit" par défaut + + + %s + nom du serveur courant + + + %S + tous les serveurs + + + %t + titre du canal courant + + + %v + valeur d'une option de configuration + + + %V + valeur d'une option d'extension + + + %w + commandes WeeChat + + + + + + + + + : fonction appelée lorsque la + commande est exécutée. + + + Elle a le prototype suivant : + + int ma_fonction (t_weechat_plugin *plugin, + int argc, char **argv, + char *handler_args, void *handler_pointer) + + + + Le paramètre argc vaut 3 et les arguments suivants sont + passés dans le tableau argv : + + + argv[0] = nom du serveur + + + argv[1] = commande + + + argv[2] = arguments de la commande + + + + + + + : paramètres passés à la + fonction appelée + + + + + : pointeur passé à la + fonction appelée + + + + + + Valeur renvoyée : le pointeur vers le nouveau gestionnaire de + commande. + + + Note : la fonction appelée lorsque la commande est exécutée doit + renvoyer une des valeurs suivantes : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + + + Exemple : + +int cmd_test (t_weechat_plugin *plugin, 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; +} +... +t_plugin_handler *cmd_handler; +cmd_handler = plugin->cmd_handler_add (plugin, "test", "Commande test", + "[pesudo]", "pseudo: un pseudo du canal", + "%n", &cmd_test, NULL, NULL); + + +
+ +
+ timer_handler_add + + + Prototype : + + t_plugin_handler *timer_handler_add (t_weechat_plugin + *plugin, int intervalle, t_plugin_handler_func *fonction, + char *handler_args, void *handler_pointer) + + + + Ajoute un gestionnaire de temps, qui appelle périodiquement une + fonction. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : intervalle (en secondes) + entre deux appels de la fonction. + + + + + : fonction appelée + + + Elle a le prototype suivant : + + int ma_fonction (t_weechat_plugin *plugin, + int argc, char **argv, + char *handler_args, void *handler_pointer) + + + + Le paramètre argc vaut 0 et argv vaut NULL. + + + + + : paramètres passés à la + fonction appelée + + + + + : pointeur passé à la + fonction appelée + + + + + + Valeur renvoyée : le pointeur vers le nouveau gestionnaire de + temps. + + + Note : la fonction appelée doit renvoyer une des valeurs + suivantes : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + + + Exemple : + +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; +} +... +t_plugin_handler *timer_handler; +timer_handler = plugin->timer_handler_add (plugin, 60, &mon_timer); + + +
+ +
+ keyboard_handler_add + + + Prototype : + + t_plugin_handler *keyboard_handler_add (t_weechat_plugin + *plugin, t_plugin_handler_func *fonction, + char *handler_args, void *handler_pointer) + + + + Ajoute un gestionnaire de clavier, appelé dès qu'une touche est + pressée. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : fonction appelée + + + Elle a le prototype suivant : + + int ma_fonction (t_weechat_plugin *plugin, + int argc, char **argv, + char *handler_args, void *handler_pointer) + + + + Le paramètre argc vaut 3 et les arguments suivants sont + passés dans le tableau argv : + + + + argv[0] = touche appuyée (nom d'une fonction interne + ou bien '*' suivi du code d'une touche) + + + + + argv[1] = la ligne de commande avant l'action de la + touche + + + + + argv[2] = la ligne de commande après l'action de la + touche + + + + + + + + : paramètres passés à la + fonction appelée + + + + + : pointeur passé à la + fonction appelée + + + + + + Valeur renvoyée : le pointeur vers le nouveau gestionnaire de + clavier. + + + Note : la fonction appelée doit renvoyer une des valeurs + suivantes : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + + + Exemple : + +int mon_keyb (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; +} +... +t_plugin_handler *keyb_handler; +keyb_handler = plugin->keyboard_handler_add (plugin, &mon_keyb); + + +
+ +
+ event_handler_add + + + Prototype : + + t_plugin_handler *event_handler_add (t_weechat_plugin + *plugin, char *evenement, t_plugin_handler_func *fonction, + char *handler_args, void *handler_pointer) + + + + Ajoute un gestionnaire d'évènement, appelé dès qu'un évènement se + produit. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : évènement (voir le tableau + ci-dessous) + + + + + : fonction appelée + + + Elle a le prototype suivant : + + int ma_fonction (t_weechat_plugin *plugin, + int argc, char **argv, + char *handler_args, void *handler_pointer) + + + + Les paramètres passés à la fonction dépendent de l'évènement + (voir le tableau ci-dessous). + + + + + : paramètres passés à la + fonction appelée + + + + + : pointeur passé à la + fonction appelée + + + + + + Liste des évènements : + + + + + Evènement + Description + Paramètres + + + + + buffer_open + un tampon a été ouvert + + argc = 1, argv = { numéro de tampon } + + + + buffer_close + un tampon a été fermé + + argc = 1, argv = { numéro de tampon } + + + + buffer_move + un tampon a été déplacé + + argc = 2, argv = { nouveau numéro de tampon, ancien + numéro } + + + + + + + + Valeur renvoyée : le pointeur vers le nouveau gestionnaire + d'évènement. + + + Note : la fonction appelée doit renvoyer une des valeurs + suivantes : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + + + Exemple : + +int mon_evenement (t_weechat_plugin *plugin, int argc, char **argv, + char *handler_args, void *handler_pointer) +{ + plugin->print (plugin, NULL, NULL, "mon_evenement"); + return PLUGIN_RC_OK; +} +... +t_plugin_handler *event_handler; +event_handler = plugin->event_handler_add (plugin, "buffer_open", + &mon_evenement); + + +
+ +
+ handler_remove + + + Prototype : + + void handler_remove (t_weechat_plugin *plugin, + t_plugin_handler *handler) + + + + Supprime un gestionnaire de commande ou message. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : le gestionnaire à supprimer + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->handler_remove (plugin, mon_handler); + +
+ +
+ handler_remove_all + + + Prototype : + + void handler_remove_all (t_weechat_plugin *plugin) + + + + Supprime tous les gestionnaires d'une extension. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->handler_remove_all (plugin); + +
+ +
+ modifier_add + + + Prototype : + + t_plugin_modifier *modifier_add (t_weechat_plugin *plugin, + char *type, char *message, t_plugin_modifier_func *fonction, + char *modifier_args, void *modifier_pointer) + + + + Ajoute un modifieur de message. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : type de modifieur : + + + + + Type + Description + + + + + irc_in + appelé pour chaque message IRC reçu + + + irc_user + + appelé pour chaque message (ou commande) envoyé par + l'utilisateur (avant traitement et affichage par + WeeChat) + + + + irc_out + + appelé pour chaque message sortant juste avant + envoi au serveur IRC (y compris pour les messages + envoyés automatiquement et de manière transparente + par WeeChat) + + + + + + + + + + : nom du message IRC pour lequel la + fonction est appelée (utilisé uniquement pour les types + "irc_in" et "irc_out"). + Pour connaître la liste des messages IRC disponibles, merci + de consulter les RFCs + 1459 + et + 2812. + La valeur spéciale "*" signifie tous les messages (pas de + filtre). + + + + + : fonction appelée + + + Elle a le prototype suivant : + + char *ma_fonction (t_weechat_plugin *plugin, + int argc, char **argv, + char *modifier_args, void *modifier_pointer) + + + + Le paramètre argc vaut 2 et les arguments suivants sont + passés dans le tableau argv : + + + argv[0] = nom du serveur + + + argv[1] = message + + + + + + + : paramètres passés à la + fonction appelée + + + + + : pointeur passé à la + fonction appelée + + + + + + Valeur renvoyée : le pointeur vers le nouveau modifieur de message. + + + Note : la fonction doit retourner une chaîne modifiée, ou NULL si + elle ne souhaite pas modifier le message. + Si elle retourne une chaine vide, alors le message est supprimé et + ne sera pas traité du tout par WeeChat (soyez prudent en supprimant + des messages !). + La chaîne renvoyée doit avoir été allouée par malloc() et sera + libérée (par appel à free()) automatiquement par WeeChat après + utilisation. + + + Exemple : + +char *adder (t_weechat_plugin *plugin, int argc, char **argv, + char *modifier_args, void *modifier_pointer) +{ + char *string; + string = (char *)malloc (strlen (argv[1]) + 16); + strcpy (string, argv[1]); + strcat (string, "test"); + return string; +} +... +t_plugin_modifier *modifier; +modifier = plugin->modifier_add (plugin, "irc_in", "privmsg", + &adder, NULL, NULL); + + +
+ +
+ modifier_remove + + + Prototype : + + void modifier_remove (t_weechat_plugin *plugin, + t_plugin_modifier *modifier) + + + + Supprime un modifieur de message. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : le modifieur à supprimer + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->modifier_remove (plugin, mon_modifier); + +
+ +
+ modifier_remove_all + + + Prototype : + + void modifier_remove_all (t_weechat_plugin *plugin) + + + + Supprime tous les modifieurs d'une extension. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->modifier_remove_all (plugin); + +
+ +
+ exec_command + + + Prototype : + + void exec_command (t_weechat_plugin + *plugin, char *serveur, char *canal, char *commande) + + + + Execute une commande WeeChat ou envoie un message à un canal. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom interne du serveur où + exécuter la commande (peut être NULL) + + + + + : nom du canal où exécuter la + commande (peut être NULL) + + + + + : la commande à exécuter + + + + + + Valeur renvoyée : aucune. + + + Exemples : + +plugin->exec_command (plugin, NULL, NULL, "/help nick"); +plugin->exec_command (plugin, "freenode", "#weechat", "bonjour"); + + +
+ +
+ get_info + + + Prototype : + + char *get_info (t_weechat_plugin *plugin, + char *info, char *serveur) + + + + Renvoie une information sur WeeChat ou un canal. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de l'info à obtenir : + + + + + Info + Description + + + + + version + version de WeeChat + + + nick + pesudo + + + channel + + nom du canal (NULL pour un serveur ou un privé) + + + + server + nom du serveur + + + type + + type de tampon: 0=standard, 1=DCC, + 2=données IRC brutes + + + + away + drapeau "away" + + + inactivity + + nombre de secondes écoulées depuis que la dernière + touche a été appuyée + + + + input + + contenu de la ligne de commande de la fenêtre + courante + + + + input_mask + + contenu du masque de couleur de la ligne de + commande + + + + input_pos + + position du curseur dans la ligne de commande + + + + weechat_dir + + répertoire de base de WeeChat + (par défaut: ~/.weechat/) + + + + weechat_libdir + répertoire "lib" système de WeeChat + + + weechat_sharedir + répertoire "share" système de WeeChat + + + + + + + + + : nom interne du serveur où + récupérer l'information (si nécessaire) + + + + + + Valeur renvoyée : l'information recherchée, NULL si non trouvée. + + + Note : le résultat doit être libéré par un appel à la fonction + "free" après utilisation. + + + Exemples : + +char *version = plugin->get_info (plugin, "version", NULL); +char *nick = plugin->get_info (plugin, "nick", "freenode"); +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); + + +
+ +
+ get_dcc_info + + + Prototype : + + t_plugin_info_dcc *get_dcc_info (t_weechat_plugin *plugin) + + + + Renvoie la liste des DCC en cours ou terminés. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + + Valeur renvoyée : la liste chaînée des DCC. + + + + + Type + Champ + Description + + + + + char * + server + le serveur IRC + + + char * + channel + le canal IRC + + + int + type + + le type de DCC : + 0 = discussion reçue, + 1 = discussion envoyée, + 2 = fichier reçu, + 3 = fichier envoyé + + + + int + status + + le statut du DCC : + 0 = en attente, + 1 = en cours de connexion, + 2 = actif, + 3 = terminé, + 4 = échoué, + 5 = interrompu par l'utilisateur + + + + time_t + start_time + la date et heure de création du DCC + + + time_t + start_transfer + la date et heure de démarrage du transfert + + + unsigned long + addr + adresse IP de l'utilisateur distant + + + int + port + port utilisé pour le DCC + + + char * + nick + pseudo de l'utilisateur distant + + + char * + filename + nom de fichier + + + char * + local_filename + nom de fichier local + + + int + filename_suffix + suffixe si renommage de fichier + + + unsigned long + size + taille du fichier + + + unsigned long + pos + position actuelle dans le fichier + + + unsigned long + start_resume + position de démarrage après une interruption + + + unsigned long + bytes_per_sec + + nombre d'octets transmis par seconde depuis le début + du transfert + + + + t_plugin_dcc_info * + prev_dcc + + pointeur vers l'info DCC précédente + + + + t_plugin_dcc_info * + next_dcc + + pointeur vers l'info DCC suivante + + + + + + + + Note : le résultat doit être libéré par un appel à la fonction + "free_dcc_info" après utilisation. + + + Exemples : + +t_plugin_dcc_info *dcc_info = plugin->get_dcc_info (plugin); +for (ptr_dcc = dcc_info; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc) +{ + plugin->print_server (plugin, "DCC type=%d, avec: %s", + ptr_dcc->type, ptr_dcc->nick); +} +if (dcc_info) + plugin->free_dcc_info (plugin, dcc_info); + + +
+ +
+ free_dcc_info + + + Prototype : + + void free_dcc_info (t_weechat_plugin *plugin, + t_plugin_dcc_info *dcc_info) + + + + Libère la mémoire utilisée par une liste de DCC. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : pointeur vers la liste DCC + renvoyée par la fonction "get_dcc_info" + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->free_dcc_info (plugin, dcc_info); + +
+ +
+ get_server_info + + + Prototype : + + t_plugin_server_info *get_server_info (t_weechat_plugin *plugin) + + + + Renvoie la liste des serveurs IRC (connectés ou non). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + + Valeur retournée : la liste chaînée des serveurs IRC. + + + + + Type + Champ + Description + + + + + char * + name + nom interne du serveur + + + int + autoconnect + 1 si auto-connexion au démarrage, 0 sinon + + + int + autoreconnect + + 1 si auto-reconnexion quand déconnecté, + 0 sinon + + + + int + autoreconnect_delay + délai avant de tenter une reconnexion + + + int + command_line + + 1 si le serveur vient de la ligne de commande + (donc temporaire), 0 sinon + + + + char * + address + adresse du serveur (nom ou IP) + + + int + port + port + + + int + ipv6 + connexion IPv6 + + + int + ssl + connexion SSL + + + char * + password + mot de passe pour le serveur + + + char * + nick1 + premier pseudo + + + char * + nick2 + pseudo alternatif + + + char * + nick3 + second pseudo alternatif + + + char * + username + nom d'utilisateur + + + char * + real name + nom réel + + + char * + command + commande exécutée une fois connecté + + + int + command_delay + délai après exécution de la commande + + + char * + autojoin + canaux joints automatiquement + + + int + autorejoin + + 1 si les canaux sont rejoints après un "kick", + 0 sinon + + + + char * + notify_levels + niveaux de notification des canaux + + + char * + charset_decode_iso + + jeux de caractères de décodage ISO pour les canaux + + + + char * + charset_decode_utf + + jeux de caractères de décodage UTF pour les canaux + + + + char * + charset_encode + + jeux de caractères d'encodage pour les canaux + + + + int + is_connected + 1 si connecté au serveur, 0 sinon + + + int + ssl_connected + 1 si connecté via SSL, 0 sinon + + + char * + nick + pseudo courant + + + int + is_away + 1 si absent, 0 sinon + + + time_t + away_time + + date/heure à laquelle l'utilisateur a été marqué absent + + + + int + lag + lag (en millisecondes) + + + t_plugin_server_info * + prev_server + pointeur vers les infos du serveur précédent + + + t_plugin_server_info * + next_server + pointeur vers les infos du serveur suivant + + + + + + + Note : le résultat doit être libéré par un appel à la fonction + "free_server_info" après utilisation. + + + Exemple : + +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); +} + + +
+ +
+ free_server_info + + + Prototype : + + void free_server_info (t_weechat_plugin *plugin, + t_plugin_server_info *server_info) + + + + Libère la mémoire utilisée par une liste de serveurs. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : pointeur vers la liste de + serveurs retournée par la fonction "get_server_info" + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->free_server_info (plugin, server_info); + +
+ +
+ get_channel_info + + + Prototype : + + t_plugin_channel_info *get_channel_info (t_weechat_plugin *plugin, + char *serveur) + + + + Renvoie la liste des canaux IRC pour un serveur. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom interne du serveur + + + + + + Valeur renvoyée : la liste chaînée des canaux IRC du serveur. + + + + + Type + Field + Description + + + + + int + type + 0 pour un canal, 1 pour un privé + + + char * + name + nom du canal + + + char * + topic + titre du canal + + + char * + modes + modes du canal + + + int + limit + limite d'utilisateurs + + + char * + key + clé du canal + + + int + nicks_count + nombre de pseudos présents sur le canal + + + t_plugin_channel_info * + prev_channel + pointeur vers les infos du canal précédent + + + t_plugin_channel_info * + next_channel + pointeur vers les infos du canal suivant + + + + + + + Note : le résultat doit être libéré par un appel à la fonction + "free_channel_info" après utilisation. + + + Exemple : + +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); +} + + +
+ +
+ free_channel_info + + + Prototype : + + void free_channel_info (t_weechat_plugin *plugin, + t_plugin_channel_info *channel_info) + + + + Libère la mémoire utilisée par une liste de canaux. + + + Arguments: + + + + : pointeur vers la structure + de l'extension + + + + + : pointeur vers la liste de + canaux retournée par la fonction "get_channel_info" + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->free_channel_info (plugin, channel_info); + +
+ +
+ get_nick_info + + + Prototype : + + t_plugin_nick_info *get_nick_info (t_weechat_plugin *plugin, + char *serveur, char *canal) + + + + Renvoie la liste des pseudos pour un canal. + + + Arguments: + + + + : pointeur vers la structure + de l'extension + + + + + : nom interne du serveur + + + + + : nom du canal + + + + + + Valeur renvoyée : la liste chaînée des pseudos présents + sur le canal. + + + + + Type + Champ + Description + + + + + char * + nick + pseudo + + + char * + host + nom de machine + + + int + flags + + 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) + + + + t_plugin_nick_info * + prev_nick + pointeur vers les infos du pseudo précédent + + + t_plugin_nick_info * + next_nick + pointeur vers les infos du pseudo précédent + + + + + + + Note : le résultat doit être libéré par un appel à la fonction + "free_nick_info" après utilisation. + + + Exemple : + +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); +} + + +
+ +
+ free_nick_info + + + Prototype : + + void free_nick_info (t_weechat_plugin *plugin, + t_plugin_nick_info *nick_info) + + + + Libère la mémoire utilisée par une liste de pseudos. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : pointeur vers la liste de + pseudos retournée par la fonction "get_nick_info" + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->free_nick_info (plugin, nick_info); + +
+ +
+ get_config + + + Prototype : + + char *get_config (t_weechat_plugin *plugin, char *option) + + + + Renvoie la valeur d'une option de configuration WeeChat. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de l'option à lire + + + + + + Valeur renvoyée : la valeur de l'option, NULL si non trouvée. + + + Note : le résultat doit être libéré par un appel à la fonction + "free" après utilisation. + + + Exemples : + +char *value1 = plugin->get_config (plugin, "look_set_title"); +char *value2 = plugin->get_config (plugin, "freenode.server_autojoin"); + + +
+ +
+ set_config + + + Prototype : + + int set_config (t_weechat_plugin *plugin, + char *option, char *valeur) + + + + Modifie la valeur d'une option de configuration WeeChat. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de l'option à mettre à jour + + + + + : nouvelle valeur pour l'option + + + + + + Valeur renvoyée : 1 si l'option a été modifiée avec succès, 0 si + une erreur s'est produite. + + + Exemple : + +plugin->set_config (plugin, "look_nicklist", "off"); + + +
+ +
+ get_plugin_config + + + Prototype : + + char *get_plugin_config (t_weechat_plugin *plugin, char *option) + + + + Renvoie la valeur d'une option de l'extension. + L'option est lue depuis le fichier + "~/.weechat/plugins.rc" et est + sous cette forme : "extension.option=valeur" + (NB : le nom de l'extension est ajouté automatiquement). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de l'option à lire + + + + + + Valeur renvoyée : la valeur de l'option, NULL si non trouvée. + + + Note : le résultat doit être libéré par un appel à la fonction + "free" après utilisation. + + + Exemple : + +char *value = plugin->get_plugin_config (plugin, "ma_variable"); + + +
+ +
+ set_plugin_config + + + Prototype : + + int set_plugin_config (t_weechat_plugin *plugin, + char *option, char *valeur) + + + + Modifie la valeur d'une option de l'extension. + L'option est écrite dans le fichier + "~/.weechat/plugins.rc" et est + sous cette forme : "extension.option=valeur" + (NB : le nom de l'extension est ajouté automatiquement). + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de l'option à mettre à jour + + + + + : nouvelle valeur pour l'option + + + + + + Valeur renvoyée : 1 si l'option a été modifiée avec succès, 0 si + une erreur s'est produite. + + + Exemple : + +plugin->set_plugin_config (plugin, "ma_variable", "valeur"); + + +
+ +
+ get_irc_color + + + Prototype : + + int get_irc_color (t_weechat_plugin *plugin, + char *nom_couleur) + + + + Renvoie le numéro d'une couleur IRC avec son nom. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom de la couleur + Les couleure autorisées sont : + + + + + Nom couleur + Valeur + + + + + white + 0 + + + black + 1 + + + blue + 2 + + + green + 3 + + + lightred + 4 + + + red + 5 + + + magenta + 6 + + + brown + 7 + + + yellow + 8 + + + lightgreen + 9 + + + cyan + 10 + + + lightcyan + 11 + + + lightblue + 12 + + + lightmagenta + 13 + + + gray + 14 + + + lightgray + 15 + + + + + + + + + + Valeur renvoyée : numéro de la couleur IRC, -1 si la couleur + n'est pas trouvée. + + + Exemple : + +int color_blue = plugin->get_irc_color (plugin, "blue"); /* retourne 2 */ + + +
+ +
+ input_color + + + Prototype : + + void input_color (t_weechat_plugin *plugin, + int couleur, int debut, int longueur) + + + + Ajoute de la couleur dans la zone de saisie. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : couleur pour le texte (si < 0, + alors la zone de saisie est rafraichie, et il n'y a aucun + changement dans son contenu) + + + + + : position de début pour la coloration + (si < 0, alors le masque est réinitialisé) + + + + + : longueur pour la coloration + (si <= 0, alors le masque est réinitialisé) + + + + + + Valeur renvoyée : aucune. + + + Exemple : + +plugin->input_color (plugin, plugin->get_irc_color (plugin, "blue"), 10, 5); + + +
+ +
+ get_window_info + + + Prototype : + + t_plugin_window_info *get_window_info (t_weechat_plugin *plugin) + + + + Retourne la liste des fenêtres WeeChat. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + + Valeur renvoyée : liste chaînée des fenêtres WeeChat. + + + + + Type + Champ + Description + + + + + int + win_x + position horizontale de la fenêtre + + + int + win_y + position verticale de la fenêtre + + + int + win_width + largeur de la fenêtre + + + int + win_height + hauteur de la fenêtre + + + int + win_width_pct + largeur en % (comparé à la fenêtre parent) + + + int + win_height_pct + hauteur en % (comparé à la fenêtre parent) + + + int + num_buffer + numéro du tampon affiché + + + t_plugin_window_info * + prev_window + pointeur vers les infos de la fenêtre précédente + + + t_plugin_window_info * + next_window + pointeur vers les infos de la fenêtre suivante + + + + + + + Note : le résultat doit être libéré par un appel à la fonction + "free_window_info" après utilisation. + + + Exemple : + +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 !"); + + +
+ +
+ free_window_info + + + Prototype : + + void free_window_info (t_weechat_plugin *plugin, + t_plugin_window_info *window_info) + + + + Libère la mémoire utilisée par une liste de fenêtres. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : pointeur vers la liste des + infos fenêtres retournée par la fonction "get_window_info" + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->free_window_info (plugin, window_info); + +
+ +
+ get_buffer_info + + + Prototype : + + t_plugin_buffer_info *get_buffer_info (t_weechat_plugin *plugin) + + + + Retourne la liste des tampons WeeChat. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + + Valeur renvoyée : liste chaînée des tampons WeeChat. + + + + + Type + Champ + Description + + + + + int + type + + type de tampon: 0=standard, 1=DCC, + 2=données IRC brutes + + + + int + number + numéro de tampon + + + int + num_displayed + nombre de fenêtres affichant ce tampon + + + char * + server_name + nom du serveur pour le tampon (peut être NULL) + + + char * + channel_name + nom du canal pout le tampon (peut être NULL) + + + int + notify_level + niveau de notification du tampon + + + char * + log_filename + + nom du fichier de log (NULL signifie qu'il n'y a + pas de log) + + + + t_plugin_buffer_info * + prev_buffer + pointeur vers les infos du tampon précédent + + + t_plugin_buffer_info * + next_buffer + pointeur vers les infos du tampon suivant + + + + + + + Note : le résultat doit être libéré par un appel à la fonction + "free_buffer_info" après utilisation. + + + Exemple : + +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 !"); + + +
+ +
+ free_buffer_info + + + Prototype: + + void free_buffer_info (t_weechat_plugin *plugin, + t_plugin_buffer_info *buffer_info) + + + + Libère la mémoire utilisée par une liste de tampons. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : pointeur vers la liste des + infos tampons retournée par la fonction "get_buffer_info" + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->free_buffer_info (plugin, buffer_info); + +
+ +
+ get_buffer_data + + + Prototype: + + t_plugin_buffer_data *get_buffer_info (t_weechat_plugin *plugin, + char *serveur, char *canal) + + + + Renvoie le contenu du tampon. + + + Paramètres : + + + + : pointeur vers la structure + de l'extension + + + + + : nom interne du serveur + + + + + : nom du canal + + + + + + Valeur renvoyée : contenu du tampon (liste chaînée de lignes). + + + + + Type + Champ + Description + + + + + time_t + date + date et heure + + + char * + nick + pseudo + + + char * + data + + contenu de la ligne (les codes couleur sont + retirés) + + + + t_plugin_buffer_line * + prev_line + pointeur vers la ligne précédente + + + t_plugin_buffer_line * + next_line + pointeur vers la ligne suivante + + + + + + + Note : le résultat doit être libéré par un appel à la fonction + "free_buffer_data" après utilisation. + + + Exemple : + +t_plugin_buffer_line *buffer_line, *ptr_line; +char text_time[256]; + +buffer_line = plugin->get_buffer_data (plugin); +if (buffer_line) +{ + for (ptr_line = buffer_line; ptr_line; ptr_line = ptr_line->next_line) + { + strftime (text_time, sizeof (text_time), "%x %X", localtime (&(ptr_line->date))); + plugin->print (plugin, NULL, NULL, "date: %s, pseudo: %s, données: %s", + text_time, ptr_line->nick, ptr_line->data); + } + plugin->free_buffer_data (plugin, buffer_line); +} + + +
+ +
+ free_buffer_data + + + Prototype: + + void free_buffer_data (t_weechat_plugin *plugin, + t_plugin_buffer_line *buffer_line) + + + + Libère la mémoire utilisée par les lignes d'un tampon. + + + Arguments: + + + + : pointeur vers la structure + de l'extension + + + + + : pointeur vers la liste des + lignes du tampon retournée par la fonction "get_buffer_data" + + + + + + Valeur renvoyée : aucune. + + + Exemple : + plugin->free_buffer_data (plugin, buffer_line); + +
+ +
diff --git a/doc/fr/plugin_charset.fr.xml b/doc/fr/plugin_charset.fr.xml new file mode 100644 index 000000000..438688e12 --- /dev/null +++ b/doc/fr/plugin_charset.fr.xml @@ -0,0 +1,140 @@ + + + + +
+ Extension Charset + + + L'extension Charset vous permet d'encoder et décoder les données en + utilisant un jeu de caractères, avec 3 niveaux : global, par serveur, + ou par canal. + Cette extension est facultative, mais recommandée : si elle n'est pas + chargée, WeeChat pourra uniquement lire/écrire des données UTF-8. + + + + L'extension Charset devrait être automatiquement chargée par WeeChat + au démarrage. + Pour s'assurer que l'extension est bien chargée, essayez : + "/charset". + Si la commande n'est pas trouvée, alors chargez l'extension avec la + commande : + /plugin load charset + Si l'extension n'est pas trouvée, alors vous devriez recompiler + WeeChat avec les extensions et le support de Charset. + + + + Lorsque l'extension Charset démarre, elle affiche le jeu de caractères + du terminal et l'interne. + Le jeu de caractères du terminal dépend de votre locale, et l'interne + est UTF-8. + Par exemple : + +-P- Charset plugin starting, terminal charset: ISO-8859-15 (WeeChat internal: UTF-8) + + + +
+ Configuration + + + + + Pour modifier les jeux de caractères de décodage et d'encodage + globaux, utilisez la commande "/setp". + Par exemple : + +/setp charset.global.decode = ISO-8859-15 +/setp charset.global.encode = ISO-8859-15 + + Si le jeu de caractères de décodage global n'est pas renseigné + (par exemple pendant le premier chargement de Charset), il sera + renseigné automatiquement avec le jeu de caractères du terminal + (s'il est différent de UTF-8) ou par défaut à + "ISO-8859-1". + La valeur d'encodage par défaut est vide, donc WeeChat envoie par + défaut avec le jeu de caractères interne (UTF-8). + + + + + Pour modifier le jeu de caractères d'un serveur, utilisez la + commande "/charset" sur le tampon serveur. + Si vous donnez seulement le jeu de caractères, alors vous + modifiez en même temps les valeurs de décodage et d'encodage. + Par exemple : + /charset ISO-8859-15 + Ce qui est équivalent à : + +/charset decode ISO-8859-15 +/charset encode ISO-8859-15 + + + + + + Pour modifier le jeu de caractères d'un canal (ou d'une + conversation privée), utilisez la même commande que pour le + serveur, mais sur le tampon du canal (ou du privé). + + + + +
+ +
+ FAQ + + + Si vous avez des problèmes avec certains caractères ou les accents en + utilisant l'extension Charset : + + + + vérifiez que weechat-curses est lié avec libncursesw + (attention : nécessaire sur beaucoup de distributions, mais pas + toutes) : + ldd /chemin/vers/weechat-curses + + + + + vérifiez la ligne charset (sur le tampon serveur), vous devriez + voir ISO-XXXXXX ou UTF-8 pour le charset du terminal. Si vous + voyez ANSI_X3.4-1968 ou d'autres valeurs, votre locale est + probablement erronée. + + + + + affectez la valeur pour le décodage global, par exemple : + /setp charset.global.decode = ISO-8859-15 + + + + + +
+ +
diff --git a/doc/fr/plugin_scripts.fr.xml b/doc/fr/plugin_scripts.fr.xml new file mode 100644 index 000000000..b32548699 --- /dev/null +++ b/doc/fr/plugin_scripts.fr.xml @@ -0,0 +1,3005 @@ + + + + +
+ Extensions pour scripts + + + Quatre extensions sont fournies en standard avec WeeChat pour utiliser + des langages de script : Perl, Python, Ruby et Lua. + + +
+ Charger / décharger des scripts + + + Les scripts sont chargés et déchargés avec les commandes + /perl, /python, + /ruby et /lua + (tapez /help dans WeeChat pour obtenir + de l'aide sur les commandes). + + + + Exemples : + + + + Charger un script Perl : + /perl load /tmp/essai.pl + + + + + Lister les scripts Perl chargés : + /perl + + + + + Charger un script Python : + /python load /tmp/essai.py + + + + + Lister les scripts Python chargés : + /python + + + + + Charger un script Ruby : + /ruby load /tmp/essai.rb + + + + + Lister les scripts Ruby chargés : + /ruby + + + + + Charger un script Lua : + /lua load /tmp/essai.lua + + + + + Lister les scripts Lua chargés : + /lua + + + + + +
+ +
+ Syntaxe par langage + +
+ Perl + + + Dans un script Perl WeeChat, toutes les fonctions et variables + de l'interface sont préfixées par "weechat::". + Exemple : +weechat::register("test", "1.0", "end_test", "Script perl WeeChat"); + + +
+ +
+ Python + + + Un script Python WeeChat doit commencer par importer weechat : + import weechat + + + + Toutes les fonctions et variables de l'interface sont préfixées + par "weechat.". + Exemple : +weechat.register("test", "1.0", "end_test", "Script python WeeChat") + + +
+ +
+ Ruby + + + Dans un script Ruby WeeChat, tout le code doit être dans des + fonctions. Pour le code principal, vous devez définir une + fonction "weechat_init", qui est appelée + automatiquement quand le script est chargé par WeeChat. + Exemple : + +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 + + + + + Toutes les fonctions de l'interface sont préfixées par + "Weechat." et les variables par + "Weechat::". + + +
+ +
+ Lua + + + Dans un script Lua WeeChat, toutes les fonctions de l'interface + sont préfixées par "weechat.". + Les variables sont préfixées par "weechat." et + suffixées par "()". + Exemple : + +function message_handler(server, args) + weechat.print("Je suis un message handler") + return weechat.PLUGIN_RC_OK() +end + + + +
+ +
+ +
+ Interface WeeChat / scripts + +
+ register + + + Prototype Perl : + + weechat::register(nom, version, fonction_de_fin, description, + [charset]); + + + + Prototype Python : + + weechat.register(nom, version, fonction_de_fin, description, + [charset]) + + + + Prototype Ruby : + + Weechat.register(nom, version, fonction_de_fin, description, + [charset]) + + + + Prototype Lua : + + weechat.register(nom, version, fonction_de_fin, description, + [charset]) + + + + C'est la première fonction à appeler dans le script. + Tout script pour WeeChat doit appeler cette fonction. + + + Paramètres : + + + + : nom unique pour identifier le script + (chaque script doit avoir un nom différent) + + + + + : version du script + + + + + : fonction appelée quand + le script est déchargé (paramètre facultatif, une chaîne + vide signifiant qu'il n'y a pas de fonction à appeler) + + + + + : brève description du script + + + + + : jeu de caractères du script, à + préciser si le script n'est pas écrit en UTF-8 + + + + + + Valeur renvoyée : 1 si le script a été enregistré, 0 si une erreur + s'est produite. + + + Exemples : + +# perl +weechat::register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1"); + +# python +weechat.register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1") + +# ruby +Weechat.register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1") + +-- lua +weechat.register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1") + + +
+ +
+ set_charset + + + Prototype Perl : + + weechat::set_charset(charset); + + + + Prototype Python : + + weechat.set_charset(charset) + + + + Prototype Ruby : + + Weechat.set_charsetr(charset) + + + + Prototype Lua : + + weechat.set_charset(charset) + + + + Change le jeu de caractères du script. + + + Paramètres : + + + + : nouveau jeu de caractères + + + + + + Valeur renvoyée : 1 si le nouveau jeu de caractères a été + mis en place, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::set_charset("ISO-8859-1"); + +# python +weechat.set_charset("ISO-8859-1") + +# ruby +Weechat.set_charset("ISO-8859-1") + +-- lua +weechat.set_charset("ISO-8859-1") + + +
+ +
+ print + + + Prototype Perl : + + weechat::print(message, [canal, [serveur]]) + + + + Prototype Python : + + weechat.prnt(message, [canal, [serveur]]) + + + + Prototype Ruby : + + Weechat.print(message, [canal, [serveur]]) + + + + Prototype Lua : + + weechat.print(message, [canal, [serveur]]) + + + + Affiche un message sur un tampon WeeChat, identifié par le + serveur et le canal. + + + Paramètres : + + + + : message à afficher + + + + + : nom du canal pour trouver le + tampon dans lequel afficher + + + + + : nom interne du serveur pour + trouver le tampon dans lequel afficher + + + + + + Pour afficher du texte en couleur, voir + . + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::print("message"); +weechat::print("message", "#weechat"); +weechat::print("message", "#weechat", "freenode"); +weechat::print("test: \x0305 rouge \x0F normal"); + +# 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") + + +
+ +
+ print_server + + + Prototype Perl : + + weechat::print_server(message) + + + + Prototype Python : + + weechat.print_server(message) + + + + Prototype Ruby : + + Weechat.print_server(message) + + + + Prototype Lua : + + weechat.print_server(message) + + + + Affiche un message sur le tampon serveur. + + + Paramètres : + + + + : message à afficher + + + + + + Pour afficher du texte en couleur, voir + . + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::print_server("message"); +weechat::print_server("test: \x0305 rouge \x0F normal"); + +# python +weechat.print_server("message") + +# ruby +Weechat.print_server("message") + +-- lua +weechat.print_server("message") + + +
+ +
+ print_infobar + + + Prototype Perl : + + weechat::print_infobar(temps, message); + + + + Prototype Python : + + weechat.print_infobar(temps, message) + + + + Prototype Ruby : + + Weechat.print_infobar(temps, message) + + + + Prototype Lua : + + weechat.print_infobar(temps, message) + + + + Affiche un message sur la barre d'infos pour un temps déterminé. + + + Paramètres : + + + + : temps (en secondes) pendant + lequel le message est affiché (0 = jamais effacé) + + + + + : message à afficher + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::print_infobar(5, "message"); + +# python +weechat.print_infobar(5, "message") + +# ruby +Weechat.print_infobar(5, "message") + +-- lua +weechat.print_infobar(5, "message") + + +
+ +
+ remove_infobar + + + Prototype Perl : + + weechat::remove_infobar([nombre]); + + + + Prototype Python : + + weechat.remove_infobar([nombre]) + + + + Prototype Ruby : + + Weechat.remove_infobar([nombre]) + + + + Prototype Lua : + + weechat.remove_infobar([nombre]) + + + + Efface un ou plusieurs messages dans la pile de la barre d'infos. + + + Paramètres : + + + + : nombre de messages à supprimer + (si paramètre non présent ou <= 0, alors tous les messages + sont effacés) + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::remove_infobar(1); + +# python +weechat.remove_infobar(1) + +# ruby +Weechat.remove_infobar(1) + +-- lua +weechat.remove_infobar(1) + + +
+ +
+ log + + + Prototype Perl : + + weechat::log(message, [canal, [serveur]]); + + + + Prototype Python : + + weechat.log(message, [canal, [serveur]]) + + + + Prototype Ruby : + + Weechat.log(message, [canal, [serveur]]) + + + + Prototype Lua : + + weechat.log(message, [canal, [serveur]]) + + + + Ecrit un message dans le fichier de log pour un serveur ou un + canal. + + + Paramètres : + + + + : message + + + + + : nom du canal pour trouver le + log du tampon + + + + + : nom interne du serveur pour + trouver le log du tampon + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::log("message", "#weechat", "freenode"); + +# python +weechat.log("message", "#weechat", "freenode") + +# ruby +Weechat.log("message", "#weechat", "freenode") + +-- lua +weechat.log("message", "#weechat", "freenode") + + +
+ +
+ add_message_handler + + + Prototype Perl : + + weechat::add_message_handler(message, fonction); + + + + Prototype Python : + + weechat.add_message_handler(message, fonction) + + + + Prototype Ruby : + + Weechat.add_message_handler(message, fonction) + + + + Prototype Lua : + + weechat.add_message_handler(message, fonction) + + + + Ajoute un gestionnaire de messages IRC, appelé dès qu'un message + IRC est reçu. + + + Paramètres : + + + + : nom du message IRC pour lequel la + fonction est appelée. + Pour connaître la liste des messages IRC disponibles, merci + de consulter les RFCs + 1459 + et + 2812. + De plus, vous pouvez utiliser un nom spécial, préfixé par + "weechat_" pour capturer des évènements spéciaux + (voir ). + + + + + : fonction appelée lorsque le + message est reçu + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::add_message_handler("privmsg", "ma_fonction"); +sub ma_fonction +{ + weechat::print("serveur=$_[0]"); + ($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 + + + + Note : la fonction appelée lorsque le message est reçu doit + renvoyer une des valeurs suivantes : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + + PLUGIN_RC_OK_IGNORE_WEECHAT : le message + ne sera pas transmis à WeeChat + + + + + PLUGIN_RC_OK_IGNORE_PLUGINS : le message + ne sera pas transmis à d'autres extensions + + + + + PLUGIN_RC_OK_IGNORE_ALL : le message + ne sera ni transmis à WeeChat ni à d'autres extensions + + + + + PLUGIN_RC_OK_WITH_HIGHLIGHT : la fonction + a réussi et provoque un "highlight" sur le message reçu + + + + +
+ +
+ add_command_handler + + + Prototype Perl : + + weechat::add_command_handler(commande, fonction, + [description, arguments, arguments_description, + modele_completion]); + + + + Prototype Python : + + weechat.add_command_handler(commande, fonction, + [description, arguments, arguments_description, + modele_completion]) + + + + Prototype Ruby : + + Weechat.add_command_handler(commande, fonction, + [description, arguments, arguments_description, + modele_completion]) + + + + Prototype Lua : + + weechat.add_command_handler(commande, fonction, + [description, arguments, arguments_description, + modele_completion]) + + + + Ajoute un gestionnaire de commande WeeChat, appelé dès que + l'utilisateur utilise la commande (par exemple /commande). + + + Paramètres : + + + + : nom de la nouvelle commande, + qui peut être une commande déjà existante (attention la + commande remplacée ne sera plus disponible jusqu'à ce que + le script soit déchargé) + + + + + : fonction appelée lorsque la + commande est exécutée + + + + + : brève description des + paramètres de la commande (affichée par /help commande) + + + + + : longue description + des paramètres de la commande (affichée par /help commande) + + + + + : modèle pour la + complétion sous la forme "abc|%w def|%i" + qui signifie "abc" ou une commande WeeChat pour le premier + paramètre, et "def" ou une commande IRC pour le deuxième. + (voir ) + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::add_command_handler("commande", "ma_commande"); +sub ma_commande +{ + weechat::print("serveur=$_[0], 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 + + + + Notes : la fonction appelée lorsque la commande est exécutée + doit renvoyer une des valeurs suivantes : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + +
+ +
+ add_timer_handler + + + Prototype Perl : + + weechat::add_timer_handler(intervalle, fonction); + + + + Prototype Python : + + weechat.add_timer_handler(intervalle, fonction) + + + + Prototype Ruby : + + Weechat.add_timer_handler(intervalle, fonction) + + + + Prototype Lua : + + weechat.add_timer_handler(intervalle, fonction) + + + + Ajoute un gestionnaire de temps, qui appelle périodiquement une + fonction. + + + Paramètres : + + + + : intervalle (en secondes) + entre deux appels de la fonction. + + + + + : fonction appelée + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# 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 + + + + Note : la fonction appelée doit renvoyer une des valeurs + suivantes : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + +
+ +
+ add_keyboard_handler + + + Prototype Perl : + + weechat::add_keyboard_handler(fonction); + + + + Prototype Python : + + weechat.add_keyboard_handler(fonction) + + + + Prototype Ruby : + + Weechat.add_keyboard_handler(fonction) + + + + Prototype Lua : + + weechat.add_keyboard_handler(fonction) + + + + Ajoute un gestionnaire de clavier, appelé dès qu'une touche est + pressée. + + + Paramètres : + + + + : fonction appelée + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# 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_keyboard_handler("mon_clavier") +def mon_clavier(key, 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_keyboard_handler("mon_clavier") +function mon_clavier(key, 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 + + + + Note : la fonction appelée doit renvoyer une des valeurs + suivantes : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + +
+ +
+ add_event_handler + + + Prototype Perl : + + weechat::add_event_handler(évènement, fonction); + + + + Prototype Python : + + weechat.add_event_handler(évènement, fonction) + + + + Prototype Ruby : + + Weechat.add_event_handler(évènement, fonction) + + + + Prototype Lua : + + weechat.add_event_handler(évènement, fonction) + + + + Ajoute un gestionnaire d'évènement, appelé dès qu'un évènement se + produit. + + + Paramètres : + + + + : évènement + (voir ) + + + + + + + : fonction appelée + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::add_event_handler("buffer_open", "mon_evenement"); +sub mon_evenement +{ + weechat::print("buffer open"); + return weechat::PLUGIN_RC_OK; +} + +# python +weechat.add_event_handler("buffer_open", "mon_evenement") +def mon_evenement(): + weechat.prnt("buffer open") + return weechat.PLUGIN_RC_OK + +# ruby +Weechat.add_event_handler("buffer_open", "mon_evenement") +def mon_evenement() + Weechat.print("buffer open") + return Weechat::PLUGIN_RC_OK +end + +-- lua +weechat.add_event_handler("buffer_open", "mon_evenement") +function mon_evenement() + weechat.print("buffer open") + return weechat.PLUGIN_RC_OK() +end + + + + Note : la fonction appelée doit renvoyer une des valeurs + suivantes : + + + + PLUGIN_RC_KO : la fonction a échoué + + + + + PLUGIN_RC_OK : la fonction a réussi + + + + +
+ +
+ remove_handler + + + Prototype Perl : + + weechat::remove_handler(nom, fonction); + + + + Prototype Python : + + weechat.remove_handler(nom, fonction) + + + + Prototype Ruby : + + Weechat.remove_handler(nom, fonction) + + + + Prototype Lua : + + weechat.remove_handler(nom, fonction) + + + + Supprime un gestionnaire de message ou de commande. + + + Paramètres : + + + + : nom du message IRC ou de la commande + + + + + : fonction associée + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::remove_handler("commande", "ma_commande"); + +# python +weechat.remove_handler("commande", "ma_commande") + +# ruby +Weechat.remove_handler("commande", "ma_commande") + +-- lua +weechat.remove_handler("commande", "ma_commande") + + +
+ +
+ remove_timer_handler + + + Prototype Perl : + + weechat::remove_timer_handler(fonction); + + + + Prototype Python : + + weechat.remove_timer_handler(fonction) + + + + Prototype Ruby : + + Weechat.remove_timer_handler(fonction) + + + + Prototype Lua : + + weechat.remove_timer_handler(fonction) + + + + Supprime un gestionnaire de temps. + + + Paramètres : + + + + : fonction + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# 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") + + +
+ +
+ remove_keyboard_handler + + + Prototype Perl : + + weechat::remove_keyboard_handler(fonction); + + + + Prototype Python : + + weechat.remove_keyboard_handler(fonction) + + + + Prototype Ruby : + + Weechat.remove_keyboard_handler(fonction) + + + + Prototype Lua : + + weechat.remove_keyboard_handler(fonction) + + + + Supprime un gestionnaire de clavier. + + + Paramètres : + + + + : fonction + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# 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") + + +
+ +
+ remove_event_handler + + + Prototype Perl : + + weechat::remove_event_handler(fonction); + + + + Prototype Python : + + weechat.remove_event_handler(fonction) + + + + Prototype Ruby : + + Weechat.remove_event_handler(fonction) + + + + Prototype Lua : + + weechat.remove_event_handler(fonction) + + + + Supprime un gestionnaire d'évènement. + + + Paramètres : + + + + : fonction + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::remove_event_handler("mon_evenement"); + +# python +weechat.remove_event_handler("mon_evenement") + +# ruby +Weechat.remove_event_handler("mon_evenement") + +-- lua +weechat.remove_event_handler("mon_evenement") + + +
+ +
+ add_modifier + + + Prototype Perl : + + weechat::add_modifier(type, message, fonction); + + + + Prototype Python : + + weechat.add_modifier(type, message, fonction) + + + + Prototype Ruby : + + Weechat.add_modifier(type, message, fonction) + + + + Prototype Lua : + + weechat.add_modifier(type, message, fonction) + + + + Ajoute un modifieur de messages. + + + Paramètres : + + + + : type de modifieur : + + + + + Type + Description + + + + + irc_in + appelé pour chaque message IRC reçu + + + irc_user + + appelé pour chaque message (ou commande) envoyé par + l'utilisateur (avant traitement et affichage par + WeeChat) + + + + irc_out + + appelé pour chaque message sortant juste avant + envoi au serveur IRC (y compris pour les messages + envoyés automatiquement et de manière transparente + par WeeChat) + + + + + + + + + + : nom du message IRC pour lequel la + fonction est appelée (utilisé uniquement pour les types + "irc_in" et "irc_out"). + Pour connaître la liste des messages IRC disponibles, merci + de consulter les RFCs + 1459 + et + 2812. + La valeur spéciale "*" signifie tous les messages (pas de + filtre). + + + + + : fonction appelée + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::add_modifier("irc_in", "privmsg", "mod_in"); +weechat::add_modifier("irc_out", "privmsg", "mod_out"); +sub mod_in +{ + return "$_[1] [modifier IN]"; +} +sub mod_out +{ + return "$_[1] [modifier OUT]"; +} + +# python +weechat.add_modifier("irc_in", "privmsg", "mod_in") +weechat.add_modifier("irc_out", "privmsg", "mod_out") +def mod_in(serveur, args): + return args + " [modifier IN]" +def mod_out(serveur, args): + return args + " [modifier OUT]" + +# ruby +Weechat.add_modifier("irc_in", "privmsg", "mod_in") +Weechat.add_modifier("irc_out", "privmsg", "mod_out") +def mod_in(server, args) + return args + " [modifier IN]" +end +def mod_out(server, args) + return args + " [modifier OUT]" +end + +-- lua +weechat.add_modifier("irc_in", "privmsg", "mod_in") +weechat.add_modifier("irc_out", "privmsg", "mod_out") +function mod_in(server, args) + return args .. " [modifier IN]" +end +function mod_out(server, args) + return args .. " [modifier OUT]" +end + + +
+ +
+ remove_modifier + + + Prototype Perl : + + weechat::remove_modifier(type, message, fonction); + + + + Prototype Python : + + weechat.remove_handler(type, message, fonction) + + + + Prototype Ruby : + + Weechat.remove_handler(type, message, fonction) + + + + Prototype Lua : + + weechat.remove_handler(type, message, fonction) + + + + Supprime un modifieur de messages. + + + Paramètres : + + + + : type de modifieur + + + + + : message traité par le modifieur + + + + + : fonction associée + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::remove_modifier("irc_in", "privmsg", "mod_in"); + +# python +weechat.remove_modifier("irc_in", "privmsg", "mod_in") + +# ruby +Weechat.remove_modifier("irc_in", "privmsg", "mod_in") + +-- lua +weechat.remove_modifier("irc_in", "privmsg", "mod_in") + + +
+ +
+ command + + + Prototype Perl : + + weechat::command(commande, [canal, [serveur]]); + + + + Prototype Python : + + weechat.command(commande, [canal, [serveur]]) + + + + Prototype Ruby : + + Weechat.command(commande, [canal, [serveur]]) + + + + Prototype Lua : + + weechat.command(commande, [canal, [serveur]]) + + + + Exécute une commande ou envoie un message à un canal. + + + Paramètres : + + + + : la commande à exécuter + + + + + : nom du canal où exécuter la + commande + + + + + : nom interne du serveur où + exécuter la commande + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. + + + Exemples : + +# perl +weechat::command("bonjour tout le monde !"); +weechat::command("/kick toto merci de quitter ce canal", "#weechat"); +weechat::command("/nick newnick", "", "freenode"); + +# python +weechat.command("bonjour tout le monde !") +weechat.command("/kick toto merci de quitter ce canal", "#weechat") +weechat.command("/nick newnick", "", "freenode") + +# ruby +Weechat.command("bonjour tout le monde !") +Weechat.command("/kick toto merci de quitter ce canal", "#weechat") +Weechat.command("/nick newnick", "", "freenode") + +-- lua +weechat.command("bonjour tout le monde !") +weechat.command("/kick toto merci de quitter ce canal", "#weechat") +weechat.command("/nick newnick", "", "freenode") + + +
+ +
+ get_info + + + Prototype Perl : + + weechat::get_info(nom, [serveur]); + + + + Prototype Python : + + weechat.get_info(nom, [serveur]) + + + + Prototype Ruby : + + Weechat.get_info(nom, [serveur]) + + + + Prototype Lua : + + weechat.get_info(nom, [serveur]) + + + + Renvoie une information sur WeeChat ou un canal. + + + Paramètres : + + + + : nom de l'info à obtenir + (voir ) + + + + + : nom interne du serveur où + récupérer l'information (si nécessaire) + + + + + + Valeur renvoyée : l'information demandée, chaîne vide si une + erreur s'est produite ou que l'information n'a pas été trouvée. + + + Exemples : + +# perl +$version = get_info("version"); +$nick = get_info("nick", "freenode"); + +# python +version = weechat.get_info("version") +nick = weechat.get_info("nick", "freenode") + +# ruby +version = Weechat.get_info("version") +nick = Weechat.get_info("nick", "freenode") + +-- lua +version = weechat.get_info("version") +nick = weechat.get_info("nick", "freenode") + + +
+ +
+ get_dcc_info + + + Prototype Perl : + + weechat::get_dcc_info(); + + + + Prototype Python : + + weechat.get_dcc_info() + + + + Prototype Ruby : + + Weechat.get_dcc_info() + + + + Prototype Lua : + + weechat.get_dcc_info() + + + + Renvoie la liste des DCC en cours ou terminés. + + + Valeur renvoyée : la liste des DCC + (voir ). + + + Exemples : + +# 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 + + +
+ +
+ get_server_info + + + Prototype Perl : + + weechat::get_server_info(); + + + + Prototype Python : + + weechat.get_server_info() + + + + Prototype Ruby : + + Weechat.get_server_info() + + + + Prototype Lua : + + weechat.get_server_info() + + + + Renvoie la liste des serveurs IRC (connectés ou non). + + + Valeur renvoyée : la liste des serveurs IRC (connectés ou non) + (voir ). + + + Exemples : + +# 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 + + +
+ +
+ get_channel_info + + + Prototype Perl : + + weechat::get_channel_info(serveur); + + + + Prototype Python : + + weechat.get_channel_info(serveur) + + + + Prototype Ruby : + + Weechat.get_channel_info(serveur) + + + + Prototype Lua : + + weechat.get_channel_info(serveur) + + + + Renvoie la liste des canaux IRC pour un serveur. + + + Valeur renvoyée : la liste des canaux IRC du serveur + (voir ). + + + Exemples : + +# 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 + + +
+ +
+ get_nick_info + + + Prototype Perl : + + weechat::get_nick_info(serveur, canal); + + + + Prototype Python : + + weechat.get_nick_info(serveur, canal) + + + + Prototype Ruby : + + Weechat.get_nick_info(serveur, canal) + + + + Prototype Lua : + + weechat.get_nick_info(serveur, canal) + + + + Renvoie la liste des pseudos pour un canal. + + + Valeur renvoyée : la liste des pseudos présents sur le canal + (voir ). + + + Exemples : + +# 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 + + +
+ +
+ get_config + + + Prototype Perl : + + weechat::get_config(option); + + + + Prototype Python : + + weechat.get_config(option) + + + + Prototype Ruby : + + Weechat.get_config(option) + + + + Prototype Lua : + + weechat.get_config(option) + + + + Renvoie la valeur d'une option de configuration WeeChat. + + + Paramètres : + + + + : nom de l'option + + + + + + Valeur renvoyée : la valeur de l'option, chaîne vide si l'option + n'a pas été trouvée. + + + Exemples : + +# perl +$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") + + +
+ +
+ set_config + + + Prototype Perl : + + weechat::set_config(option, valeur); + + + + Prototype Python : + + weechat.set_config(option, valeur) + + + + Prototype Ruby : + + Weechat.set_config(option, valeur) + + + + Prototype Lua : + + weechat.set_config(option, valeur) + + + + Modifie la valeur d'une option de configuration WeeChat. + + + Paramètres : + + + + : nom de l'option + + + + + : la nouvelle valeur pour + l'option + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est + produite. + + + Exemples : + +# perl +weechat::set_config("look_nicklist", "off"); +weechat::set_config("freenode.server_autojoin", "#weechat"); + +# python +weechat.set_config("look_nicklist", "off") +weechat.set_config("freenode.server_autojoin", "#weechat") + +# ruby +Weechat.set_config("look_nicklist", "off") +Weechat.set_config("freenode.server_autojoin", "#weechat") + +-- lua +weechat.set_config("look_nicklist", "off") +weechat.set_config("freenode.server_autojoin", "#weechat") + + +
+ +
+ get_plugin_config + + + Prototype Perl : + + weechat::get_plugin_config(option); + + + + Prototype Python : + + weechat.get_plugin_config(option) + + + + Prototype Ruby : + + Weechat.get_plugin_config(option) + + + + Prototype Lua : + + weechat.get_plugin_config(option) + + + + Renvoie la valeur d'une option de l'extension. + L'option est lue depuis le fichier + "~/.weechat/plugins.rc" et est + sous cette forme : + "extension.script.option=valeur" + (NB : le nom de l'extension et du script sont ajoutés + automatiquement). + + + Paramètres : + + + + : nom de l'option + + + + + + Valeur renvoyée : la valeur de l'option, chaîne vide si l'option + n'a pas été trouvée. + + + Exemples : + +# perl +$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") + + +
+ +
+ set_plugin_config + + + Prototype Perl : + + weechat::set_plugin_config(option, valeur); + + + + Prototype Python : + + weechat.set_plugin_config(option, valeur) + + + + Prototype Ruby : + + Weechat.set_plugin_config(option, valeur) + + + + Prototype Lua : + + weechat.set_plugin_config(option, valeur) + + + + Modifie la valeur d'une option de l'extension. + L'option est écrite dans le fichier + "~/.weechat/plugins.rc" et est + sous cette forme : + "extension.script.option=valeur" + (NB : le nom de l'extension et du script sont rajoutés + automatiquement). + + + Paramètres : + + + + : nom de l'option + + + + + : la nouvelle valeur pour + l'option + + + + + + Valeur renvoyée : 1 si succès, 0 si une erreur s'est + produite. + + + Exemples : + +# perl +weechat::set_plugin_config("ma_variable", "valeur"); + +# python +weechat.set_plugin_config("ma_variable", "valeur") + +# ruby +Weechat.set_plugin_config("ma_variable", "valeur") + +-- lua +weechat.set_plugin_config("ma_variable", "valeur") + + +
+ +
+ get_irc_color + + + Prototype Perl : + + weechat::get_irc_color(color); + + + + Prototype Python : + + weechat.get_irc_color(color) + + + + Prototype Ruby : + + Weechat.get_irc_color(color) + + + + Prototype Lua : + + weechat.get_irc_color(color) + + + + Renvoie le numéro d'une couleur IRC avec son nom. + + + Valeur renvoyée : numéro de la couleur IRC, -1 si la couleur + n'est pas trouvée (voir ). + + + Exemples : + +# 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") + + +
+ +
+ input_color + + + Prototype Perl : + + weechat::input_color(color); + + + + Prototype Python : + + weechat.input_color(color) + + + + Prototype Ruby : + + Weechat.input_color(color) + + + + Prototype Lua : + + weechat.input_color(color) + + + + Ajoute de la couleur dans la zone de saisie. + + + Valeur renvoyée : aucune. + + + Exemples : + +# 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) + + +
+ +
+ get_window_info + + + Prototype Perl : + + weechat::get_window_info(); + + + + Prototype Python : + + weechat.get_window_info() + + + + Prototype Ruby : + + Weechat.get_window_info() + + + + Prototype Lua : + + weechat.get_window_info() + + + + Renvoie la liste des fenêtres WeeChat. + + + Valeur renvoyée : liste des fenêtres WeeChat + (voir ). + + + Exemples : + +# 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 + + +
+ +
+ get_buffer_info + + + Prototype Perl : + + weechat::get_buffer_info(); + + + + Prototype Python : + + weechat.get_buffer_info() + + + + Prototype Ruby : + + Weechat.get_buffer_info() + + + + Prototype Lua : + + weechat.get_buffer_info() + + + + Renvoie la liste des tampons WeeChat. + + + Valeur renvoyée : liste des tampons WeeChat + (voir ). + + + Exemples : + +# 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"); + } + weechat::print("----------------------"); + } +} +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])) + weechat.prnt ("----------------------") +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 + Weechat.print("----------------------") + 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 + weechat.print ("----------------------") + b, infos = next (bf, b) + end +else + weechat.print("**** pas d'info sur les tampons ****") +end + + +
+ +
+ get_buffer_data + + + Perl prototype: + + weechat::get_buffer_data(server, channel); + + + + Python prototype: + + weechat.get_buffer_data(server, channel) + + + + Ruby prototype: + + Weechat.get_buffer_data(server, channel) + + + + Lua prototype: + + weechat.get_buffer_data(server, channel) + + + + Return content of buffer. + + + Return value: list of lines for buffer + (see ). + + + Examples: + +# perl +my $server = weechat::get_info("server"); +my $channel = weechat::get_info("channel"); +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 = weechat.get_info("server") +channel = weechat.get_info("channel") +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 = Weechat.get_info("server") +channel = Weechat.get_info("channel") +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 = weechat.get_info("server") +channel = weechat.get_info("channel") +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 (bdatas, 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 + + +
+ +
+ +
diff --git a/doc/fr/plugins.fr.xml b/doc/fr/plugins.fr.xml new file mode 100644 index 000000000..bffd6dc27 --- /dev/null +++ b/doc/fr/plugins.fr.xml @@ -0,0 +1,215 @@ + + + + + + Extensions + + + Ce chapitre décrit l'interface des extensions (API) et les extensions + pour scripts (Perl, Python, Ruby, Lua), fournies avec WeeChat. + + +
+ Les extensions dans WeeChat + + + Une extension ("plugin" en anglais) est un programme écrit en C + qui peut appeler des fonctions de WeeChat définies dans une interface. + + + + Ce programme C n'a pas besoin des sources WeeChat pour être + compilé et peut être chargé/déchargé dynamiquement dans + WeeChat via la commande /plugin. + + + + L'extension doit être au format bibliothèque, chargeable + dynamiquement par le système d'exploitation. + Sous GNU/Linux, il s'agit d'un fichier ayant pour extension ".so", + sous Windows ".dll". + + +
+ +
+ Ecrire une extension + + + L'extension doit inclure le fichier "weechat-plugin.h" + (disponible dans les sources de WeeChat). + Ce fichier définit les structures et types dont l'extension aura + besoin pour communiquer avec WeeChat. + + + + L'extension doit comporter certaines variables et fonctions + obligatoires (sans quoi l'extension ne peut être chargée) : + + + + + Variable + Description + + + + + char plugin_name[] + le nom de l'extension + + + char plugin_version[] + la version de l'extension + + + char plugin_description[] + une courte description de l'extension + + + + + + + + + + Fonction + Description + + + + + int weechat_plugin_init (t_weechat_plugin *plugin) + + fonction appelée au chargement de l'extension + qui doit renvoyer PLUGIN_RC_OK en cas de succès, + PLUGIN_RC_KO en cas d'erreur (si erreur, l'extension + ne sera PAS chargée) + + + + void weechat_plugin_end (t_weechat_plugin *plugin) + fonction appelée au déchargement de l'extension + + + + + + + &plugin_api.fr.xml; + +
+ Compiler l'extension + + + La compilation ne nécessite pas les sources WeeChat, mais seulement + le fichier "weechat-plugin.h". + + + + Pour compiler une extension composée d'un fichier "toto.c" (sous + GNU/Linux) : + +$ gcc -fPIC -Wall -c toto.c +$ gcc -shared -fPIC -o libtoto.so toto.o + + + +
+ +
+ Charger l'extension dans WeeChat + + + Copier le fichier "libtoto.so" dans le répertoire système des + extensions (par exemple + "/usr/local/lib/weechat/plugins)" ou bien dans + celui de l'utilisateur (par exemple + "/home/xxxxx/.weechat/plugins"). + + + + Sous WeeChat : + /plugin load toto + + +
+ +
+ Exemple d'extension + + + Un exemple complet d'extension, qui ajoute une commande /double + affichant deux fois les paramètres passés sur le canal courant + (d'accord ce n'est pas très utile mais ceci est un exemple !) : + +#include <stdlib.h> + +#include "weechat-plugin.h" + +char plugin_name[] = "Double"; +char plugin_version[] = "0.1"; +char plugin_description[] = "Plugin de test pour WeeChat"; + +/* gestionnaire de commande "/double" */ + +int double_cmd (t_weechat_plugin *plugin, 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 */ +} + + + +
+ +
+ + &plugin_charset.fr.xml; + + &plugin_scripts.fr.xml; + +
diff --git a/doc/fr/usage.fr.xml b/doc/fr/usage.fr.xml new file mode 100644 index 000000000..01bf847e9 --- /dev/null +++ b/doc/fr/usage.fr.xml @@ -0,0 +1,966 @@ + + + + + + Utilisation + + + 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. + + +
+ Lancer WeeChat + + + Paramètres de ligne de commande : + + + + + Paramètre + Description + + + + + -a, --no-connect + + Supprimer la connexion automatique aux serveurs lors du + démarrage + + + + -c, --config + + Afficher l'aide sur le fichier de config (liste des options) + + + + -d, --dir <répertoire> + + 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 + "~/.weechat". NB: le répertoire est créé + s'il n'est pas trouvé par WeeChat. + + + + -f, --key-functions + + Afficher la liste des fonctions internes WeeChat pour les + touches + + + + -h, --help + + Afficher l'aide + + + + -i, --irc-commands + + Afficher la liste des commandes IRC + + + + -k, --keys + + Afficher les touches par défaut de WeeChat + + + + -l, --license + + Afficher la licence de WeeChat + + + + -p, --no-plugin + + Supprimer le chargement automatique des extensions au + démarrage + + + + -v, --version + + Afficher la version de WeeChat + + + + -w, --weechat-commands + + Afficher la liste des commandes WeeChat + + + + + + + + + Il est également possible de passer une URL pour un ou plusieurs + serveurs IRC, de la forme : + irc[6][s]://[pseudo[:mot_passe]@]irc.exemple.org[:port][/canal][,canal[...] + Exemple pour rejoindre #weechat et #toto sur le serveur + "irc.freenode.net", port par défaut (6667), sous + le pseudo "nono" : + $ weechat-curses irc://nono@irc.freenode.net/#weechat,#toto + + + + Pour lancer WeeChat, tapez cette commande : + + + + pour l'interface Curses : + weechat-curses + + + + + pour l'interface Gtk : + weechat-gtk + + + + + pour l'interface wxWidgets : + weechat-wxwidgets + + + + + pour l'interface Qt : + weechat-qt + + + + + + + Lorsque vous lancez WeeChat pour la première fois, un fichier de + configuration par défaut est créé, avec les options par défaut. + Le fichier de configuration par défaut est : + "~/.weechat/weechat.rc" + + + + Vous pouvez éditer ce fichier pour configurer WeeChat à votre + convenance (SEULEMENT si WeeChat ne tourne pas), ou vous pouvez + modifier les paramètres dans WeeChat avec la commande + "/set" + (voir ) + + +
+ +
+ Raccourcis clavier + + + + + + + Touche + Action + + + + + Flèche gauche / Ctrl + B + + Aller au caractère précédent sur la ligne de commande + + + + Flèche droite / Ctrl + F + + Aller au caractère suivant sur la ligne de commande + + + + Ctrl + flèche gauche + + Aller au mot précédent sur la ligne de commande + + + + Ctrl + flèche droite + + Aller au mot suivant sur la ligne de commande + + + + Home / Ctrl + A + + Aller au début de la ligne de commande + + + + Ctrl + C puis B + + Insérer le code pour mettre le texte en gras. + + + + Ctrl + C puis C + + Insérer le code pour écrire en couleur. + + + + Ctrl + C puis O + + Insérer le code pour réinitaliser la couleur. + + + + Ctrl + C puis R + + Insérer le code pour écrire en couleur inversée. + + + + Ctrl + C puis U + + Insérer le code pour écrire en souligné. + + + + End / Ctrl + E + + Aller à la fin de la ligne de commande + + + + Ctrl + K + + Effacer du curseur jusqu'à la fin de la ligne de commande + + + + Ctrl + L + + Réafficher toute la fenêtre + + + + Ctrl + R + + Chercher du texte dans l'historique du tampon + (deux appuis successifs pour rechercher du texte exact) + + + + Ctrl + S puis Ctrl + U + + Positionner le marqueur de données non lues sur tous les + tampons + + + + Ctrl + T + + Inverser deux caractères + + + + Ctrl + U + + Effacer du curseur jusqu'au début de la ligne de commande + + + + Ctrl + W + + Effacer le mot précédent sur la ligne de commande + + + + Ctrl + Y + + Coller le contenu du presse-papiers + + + + Backspace / Ctrl + H + + Effacer le caractère précédent sur la ligne de commande + + + + Delete / Ctrl + D + + Effacer le caractère suivant sur la ligne de commande + + + + Tab / Shift + Tab + + Compléter la commande ou le pseudo + (Tab de nouveau: trouver la complétion suivante) + + + + Tout caractère + + Insérer le caractère à la position du curseur + sur la ligne de commande + + + + Entrée / Ctrl + J / Ctrl + M + + Exécuter la commande ou envoyer le message + (en mode recherche: arrêter la recherche) + + + + Flèche haut / flèche bas + + Rappeler les dernières commandes ou messages + (en mode recherche: chercher en haut/bas) + + + + Ctrl + flèche haut / Ctrl + flèche bas + + Rappeler les dernières commandes ou messages dans + l'historique global (commun à tous les tampons) + + + + PageUp / PageDown + + Monter / descendre d'une page dans l'historique du tampon + + + + Alt + PageUp / Alt + PageDown + + Monter / descendre de quelques lignes dans l'historique + du tampon + + + + Alt + Home / Alt + End + + Aller au début / à la fin du tampon + + + + F5 / Alt + flèche gauche + + Aller au tampon précédent + + + + F6 / Alt + flèche droite + + Aller au tampon suivant + + + + F7 + + Aller à la fenêtre précédente + + + + F8 + + Aller à la fenêtre suivante + + + + F9 / F10 + + Faire défiler le titre du canal + + + + F11 / F12 + + Faire défiler la liste des pseudos + + + + Alt + F11 / Alt + F12 + + Aller au début / à la fin de la liste des pseudos + + + + Alt + A + + Sauter au prochain tampon avec activité + (avec priorité : highlight, message, autre) + + + + Alt + B + + Aller au mot précédent + + + + Alt + D + + Effacer le mot suivant + + + + Alt + F + + Aller au mot suivant + + + + Alt + H + + Vider la hotlist + (notification d'activité sur les autres tampons) + + + + Alt + I + + Effacer le dernier message de la barre d'informations + + + + Alt + J puis Alt + D + + Afficher le tampon des DCC + + + + Alt + J puis Alt + L + + Sauter au dernier tampon + + + + Alt + J puis Alt + P + + Sauter au tampon affiché précédemment + + + + Alt + J puis Alt + R + + Sauter au tampon de données brutes IRC + + + + Alt + J puis Alt + S + + Sauter au tampon du serveur + + + + Alt + J puis Alt + X + + Sauter au premier canal du serveur suivant + (ou tampon du serveur si aucun canal n'est ouvert) + + + + Alt + chiffre (0-9) + + Sauter au tampon qui porte ce numéro (0 = 10) + + + + Alt + J puis nombre (01-99) + + Sauter au tampon qui porte ce numéro + + + + Alt + K + + Capturer une touche et insérer son code sur la ligne + de commande + + + + Alt + N + + Se positionner sur le highlight suivant + + + + Alt + P + + Se positionner sur le highlight précédent + + + + Alt + R + + Effacer entièrement la ligne de commande + + + + Alt + S + + Changer de serveur sur le tampon des serveurs + (si l'option "look_one_server_buffer" est activée) + + + + Alt + U + + Se positionner sur la première ligne non lue du tampon + + + + Alt + W puis Alt + flèche + + Sauter à une fenêtre avec une direction + + + + + + + +
+ +
+ La ligne de commande + + + 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 ). + + + + Les commandes débutent par un caractère "/", suivi du nom de la + commande. Par exemple pour initier une conversation privée avec + "toto" : + /query toto + + + + Le texte envoyé à un canal est tout texte ne commençant pas par le + caractère "/", par exemple pour envoyer "bonjour" + sur le canal courant : + bonjour + + + + Il est cependant possible de faire débuter un texte par "/" en le + doublant. Par exemple pour envoyer le texte + "/query toto" sur le canal courant : + //query toto + + + + Si l'option d'envoi des couleurs IRC + ("irc_colors_send") est activée, il est possible + d'utiliser des codes couleur et attributs comme suit (appuyer sur Ctrl-C + puis la lettre qui suit et éventuellement une valeur) : + + + + + Code + Description + + + + + ^Cb + + texte gras + + + + ^Ccxx + + couleur du texte "xx" + (voir le tableau des couleurs ci-dessous) + + + + ^Ccxx,yy + + couleur du texte "xx" + et du fond "yy" + (voir le tableau des couleurs ci-dessous) + + + + ^Co + + désactiver la couleur et tous les attributs + + + + ^Cr + + vidéo inverse (inversion de la couleur d'écriture et du fond) + + + + ^Cu + + texte souligné + + + + + + NB: le même code (sans le numéro pour ^Cc) peut être utilisé pour + stopper l'attribut défini. + + + + Les codes couleur pour ^Cc sont : + + + + + Code + Couleur + + + + + 00 + blanc + + + 01 + noir + + + 02 + bleu foncé + + + 03 + vert foncé + + + 04 + rouge clair + + + 05 + rouge foncé + + + 06 + magenta + + + 07 + orange + + + 08 + jaune + + + 09 + vert clair + + + 10 + cyan + + + 11 + cyan clair + + + 12 + bleu clair + + + 13 + magenta clair + + + 14 + gris + + + 15 + gris clair (blanc) + + + + + + + + Exemple : affichage de "bonjour tout le monde !" + avec "bonjour" en bleu clair gras, et + "tout le monde" en rouge clair souligné : +^Cc12^Cbbonjour^Cb^Cc04^Cu tout le monde^Cu^Cc ! + + +
+ +
+ Commandes WeeChat / IRC + + + Ce chapitre liste toutes les commandes WeeChat et IRC. + + +
+ Commandes WeeChat + + + &weechat_commands.xml; + + +
+ +
+ Fonctions pour les touches + + + + + + + Fonction + Description + + + + + &key_functions.xml; + + + + + + +
+ +
+ Commandes IRC + + + &irc_commands.xml; + + +
+ +
+ +
+ Fichier de configuration + + + Liste des options du fichier de configuration : + + + + + Option + Type + Valeurs + Défaut + Description + + + + + &config.xml; + + + + + + + + Les couleurs pour l'interface Curses sont : + + + + + Mot clé + Couleur + + + + + default + couleur par défaut (transparent pour le fond) + + + black + noir + + + red + rouge foncé + + + lightred + rouge clair + + + green + vert foncé + + + lightgreen + vert clair + + + brown + marron + + + yellow + jaune + + + blue + bleu foncé + + + lightblue + bleu clair + + + magenta + violet foncé + + + lightmagenta + violet clair + + + cyan + cyan foncé + + + lightcyan + cyan clair + + + white + blanc + + + + + + +
+ +
+ Tube FIFO + + + Vous pouvez contrôler WeeChat à distance, en envoyant des commandes + ou du texte dans un tube FIFO (l'option "irc_fifo_pipe" doit être + activée, elle est désactivée par défaut). + + + + Le tube FIFO est dans le répertoire "~/.weechat/" + et s'appelle "weechat_fifo_xxxxx" (où xxxxx est l'ID du processus + (PID) du WeeChat qui tourne). Donc si plusieurs WeeChat tournent, il + y a plusieurs tubes FIFO, un pour chaque session. + + + + La syntaxe pour envoyer des commandes ou du texte dans le tube FIFO + est la suivante : + serveur,canal *texte ou commande ici + où le serveur et le canal sont facultatifs, mais si le canal est là, + le serveur doit l'être aussi. + + + + Quelques exemples : + + + + changement du pseudo sur freenode en "pseudo|absent" : + $ echo 'freenode */nick pseudo|absent' >~/.weechat/weechat_fifo_12345 + + + + + affichage de texte sur le canal #weechat : + $ echo 'freenode,#weechat *bonjour tout le monde !' >~/.weechat/weechat_fifo_12345 + + + + + affichage de texte sur le canal courant (le tampon affiché + par WeeChat) : + $ echo '*bonjour !' >~/.weechat/weechat_fifo_12345 + Attention : ceci est dangereux et vous ne + devriez pas le faire sauf si vous savez ce que vous faites ! + + + + + envoyer deux commandes pour décharger/recharger les scripts Perl + (vous devez les séparer par "\n") : + $ echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345 + + + + + + + Vous pouvez écrire un script qui envoie les commandes à tous les + WeeChat qui tournent en même temps, par exemple : + +#!/bin/sh +if [ $# -eq 1 ]; then + for fifo in ~/.weechat/weechat_fifo_* + do + echo -e "$1" >$fifo + done +fi + + Si le script s'appelle "auto_weechat_command", vous pouvez le lancer + ainsi : +$ ./auto_weechat_command "freenode,#weechat *bonjour" + + +
+ +
diff --git a/doc/fr/weechat.fr.xml b/doc/fr/weechat.fr.xml index c11696ac7..d6868c349 100644 --- a/doc/fr/weechat.fr.xml +++ b/doc/fr/weechat.fr.xml @@ -24,11 +24,22 @@ along with this program. If not, see . + + + + + + + + + + ]> @@ -87,8240 +98,14 @@ along with this program. If not, see . - + &intro.fr.xml; - - Introduction - - - Ce chapitre décrit WeeChat et les pré-requis pour son installation. - - -
- Description - - - WeeChat (Wee Enhanced Environment for Chat) est un client - chat libre, rapide et léger, conçu pour différents systèmes - d'exploitation. - - - - Ses principales caractéristiques sont les suivantes : - - - - connexion multi-serveurs (avec SSL, IPv6, proxy) - - - - - plusieurs interfaces : Curses, wxWidgets, Gtk et Qt - - - - - petit, rapide et léger - - - - - paramétrable et extensible avec des extensions et des scripts - - - - - conforme aux RFCs - 1459, - 2810, - 2811, - 2812 et - 2813 - - - - - multi plates-formes (GNU/L'index, *BSD, MacOS X, Windows et - d'autres systèmes) - - - - - 100% GPL, logiciel libre - - - - - - - La page d'accueil de WeeChat est ici : - - http://weechat.flashtux.org - - - -
- -
- Pré-requis - - - Pour installer WeeChat, vous devez avoir : - - - - un système GNU/Linux (avec le compilateur et les outils - associés pour le paquet des sources) - - - - - droits "root" (pour installer WeeChat) - - - - - selon l'interface, une des bibliothèques - suivantes : - - - - Curses : la bibliothèque ncurses - - - - - Gtk : - *** interface non développée *** - - - - - WxWidgets : - *** interface non développée *** - - - - - Qt : - *** interface non développée *** - - - - - - - - -
-
+ &install.fr.xml; - + &usage.fr.xml; - - Installation - - - Ce chapitre explique comment installer WeeChat. - - -
- Paquets binaires - - - Les paquets binaires sont disponibles pour les distributions - suivantes : - - - - Debian (ou toute distribution compatible Debian) : - apt-get install weechat - - - - - Mandriva/RedHat (ou toute distribution compatible avec les RPM) : - - rpm -i /chemin/weechat-x.y.z-1.i386.rpm - - - - - - Gentoo : - emerge weechat - - - - - Pour les autres distributions supportées, merci de vous - référer au manuel de la distribution pour la méthode d'installation. - - -
- -
- Paquet source - - - Tapez simplement dans une console ou un terminal : -$ ./configure -$ make - - - Obtenez les droits root et installez WeeChat : -$ su -(entrez le mot de passe root) -# make install - - -
- -
- Sources GIT - - - Attention : les sources GIT 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 ! - - - - Pour récupérer les sources GIT, tapez cette commande : -$ git-clone git://git.sv.gnu.org/weechat.git - - - - Exécutez ce script : - ./autogen.sh - - - - Suivez alors les instructions du paquet source - (voir ) - - -
- -
+ &plugins.fr.xml; - - - - Utilisation - - - 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. - - -
- Lancer WeeChat - - - Paramètres de ligne de commande : - - - - - Paramètre - Description - - - - - -a, --no-connect - - Supprimer la connexion automatique aux serveurs lors du - démarrage - - - - -c, --config - - Afficher l'aide sur le fichier de config (liste des options) - - - - -d, --dir <répertoire> - - 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 - "~/.weechat". NB: le répertoire est créé - s'il n'est pas trouvé par WeeChat. - - - - -f, --key-functions - - Afficher la liste des fonctions internes WeeChat pour les - touches - - - - -h, --help - - Afficher l'aide - - - - -i, --irc-commands - - Afficher la liste des commandes IRC - - - - -k, --keys - - Afficher les touches par défaut de WeeChat - - - - -l, --license - - Afficher la licence de WeeChat - - - - -p, --no-plugin - - Supprimer le chargement automatique des extensions au - démarrage - - - - -v, --version - - Afficher la version de WeeChat - - - - -w, --weechat-commands - - Afficher la liste des commandes WeeChat - - - - - - - - - Il est également possible de passer une URL pour un ou plusieurs - serveurs IRC, de la forme : - irc[6][s]://[pseudo[:mot_passe]@]irc.exemple.org[:port][/canal][,canal[...] - Exemple pour rejoindre #weechat et #toto sur le serveur - "irc.freenode.net", port par défaut (6667), sous - le pseudo "nono" : - $ weechat-curses irc://nono@irc.freenode.net/#weechat,#toto - - - - Pour lancer WeeChat, tapez cette commande : - - - - pour l'interface Curses : - weechat-curses - - - - - pour l'interface Gtk : - weechat-gtk - - - - - pour l'interface wxWidgets : - weechat-wxwidgets - - - - - pour l'interface Qt : - weechat-qt - - - - - - - Lorsque vous lancez WeeChat pour la première fois, un fichier de - configuration par défaut est créé, avec les options par défaut. - Le fichier de configuration par défaut est : - "~/.weechat/weechat.rc" - - - - Vous pouvez éditer ce fichier pour configurer WeeChat à votre - convenance (SEULEMENT si WeeChat ne tourne pas), ou vous pouvez - modifier les paramètres dans WeeChat avec la commande - "/set" - (voir ) - - -
- -
- Raccourcis clavier - - - - - - - Touche - Action - - - - - Flèche gauche / Ctrl + B - - Aller au caractère précédent sur la ligne de commande - - - - Flèche droite / Ctrl + F - - Aller au caractère suivant sur la ligne de commande - - - - Ctrl + flèche gauche - - Aller au mot précédent sur la ligne de commande - - - - Ctrl + flèche droite - - Aller au mot suivant sur la ligne de commande - - - - Home / Ctrl + A - - Aller au début de la ligne de commande - - - - Ctrl + C puis B - - Insérer le code pour mettre le texte en gras. - - - - Ctrl + C puis C - - Insérer le code pour écrire en couleur. - - - - Ctrl + C puis O - - Insérer le code pour réinitaliser la couleur. - - - - Ctrl + C puis R - - Insérer le code pour écrire en couleur inversée. - - - - Ctrl + C puis U - - Insérer le code pour écrire en souligné. - - - - End / Ctrl + E - - Aller à la fin de la ligne de commande - - - - Ctrl + K - - Effacer du curseur jusqu'à la fin de la ligne de commande - - - - Ctrl + L - - Réafficher toute la fenêtre - - - - Ctrl + R - - Chercher du texte dans l'historique du tampon - (deux appuis successifs pour rechercher du texte exact) - - - - Ctrl + S puis Ctrl + U - - Positionner le marqueur de données non lues sur tous les - tampons - - - - Ctrl + T - - Inverser deux caractères - - - - Ctrl + U - - Effacer du curseur jusqu'au début de la ligne de commande - - - - Ctrl + W - - Effacer le mot précédent sur la ligne de commande - - - - Ctrl + Y - - Coller le contenu du presse-papiers - - - - Backspace / Ctrl + H - - Effacer le caractère précédent sur la ligne de commande - - - - Delete / Ctrl + D - - Effacer le caractère suivant sur la ligne de commande - - - - Tab / Shift + Tab - - Compléter la commande ou le pseudo - (Tab de nouveau: trouver la complétion suivante) - - - - Tout caractère - - Insérer le caractère à la position du curseur - sur la ligne de commande - - - - Entrée / Ctrl + J / Ctrl + M - - Exécuter la commande ou envoyer le message - (en mode recherche: arrêter la recherche) - - - - Flèche haut / flèche bas - - Rappeler les dernières commandes ou messages - (en mode recherche: chercher en haut/bas) - - - - Ctrl + flèche haut / Ctrl + flèche bas - - Rappeler les dernières commandes ou messages dans - l'historique global (commun à tous les tampons) - - - - PageUp / PageDown - - Monter / descendre d'une page dans l'historique du tampon - - - - Alt + PageUp / Alt + PageDown - - Monter / descendre de quelques lignes dans l'historique - du tampon - - - - Alt + Home / Alt + End - - Aller au début / à la fin du tampon - - - - F5 / Alt + flèche gauche - - Aller au tampon précédent - - - - F6 / Alt + flèche droite - - Aller au tampon suivant - - - - F7 - - Aller à la fenêtre précédente - - - - F8 - - Aller à la fenêtre suivante - - - - F9 / F10 - - Faire défiler le titre du canal - - - - F11 / F12 - - Faire défiler la liste des pseudos - - - - Alt + F11 / Alt + F12 - - Aller au début / à la fin de la liste des pseudos - - - - Alt + A - - Sauter au prochain tampon avec activité - (avec priorité : highlight, message, autre) - - - - Alt + B - - Aller au mot précédent - - - - Alt + D - - Effacer le mot suivant - - - - Alt + F - - Aller au mot suivant - - - - Alt + H - - Vider la hotlist - (notification d'activité sur les autres tampons) - - - - Alt + I - - Effacer le dernier message de la barre d'informations - - - - Alt + J puis Alt + D - - Afficher le tampon des DCC - - - - Alt + J puis Alt + L - - Sauter au dernier tampon - - - - Alt + J puis Alt + P - - Sauter au tampon affiché précédemment - - - - Alt + J puis Alt + R - - Sauter au tampon de données brutes IRC - - - - Alt + J puis Alt + S - - Sauter au tampon du serveur - - - - Alt + J puis Alt + X - - Sauter au premier canal du serveur suivant - (ou tampon du serveur si aucun canal n'est ouvert) - - - - Alt + chiffre (0-9) - - Sauter au tampon qui porte ce numéro (0 = 10) - - - - Alt + J puis nombre (01-99) - - Sauter au tampon qui porte ce numéro - - - - Alt + K - - Capturer une touche et insérer son code sur la ligne - de commande - - - - Alt + N - - Se positionner sur le highlight suivant - - - - Alt + P - - Se positionner sur le highlight précédent - - - - Alt + R - - Effacer entièrement la ligne de commande - - - - Alt + S - - Changer de serveur sur le tampon des serveurs - (si l'option "look_one_server_buffer" est activée) - - - - Alt + U - - Se positionner sur la première ligne non lue du tampon - - - - Alt + W puis Alt + flèche - - Sauter à une fenêtre avec une direction - - - - - - - -
- -
- La ligne de commande - - - 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 ). - - - - Les commandes débutent par un caractère "/", suivi du nom de la - commande. Par exemple pour initier une conversation privée avec - "toto" : - /query toto - - - - Le texte envoyé à un canal est tout texte ne commençant pas par le - caractère "/", par exemple pour envoyer "bonjour" - sur le canal courant : - bonjour - - - - Il est cependant possible de faire débuter un texte par "/" en le - doublant. Par exemple pour envoyer le texte - "/query toto" sur le canal courant : - //query toto - - - - Si l'option d'envoi des couleurs IRC - ("irc_colors_send") est activée, il est possible - d'utiliser des codes couleur et attributs comme suit (appuyer sur Ctrl-C - puis la lettre qui suit et éventuellement une valeur) : - - - - - Code - Description - - - - - ^Cb - - texte gras - - - - ^Ccxx - - couleur du texte "xx" - (voir le tableau des couleurs ci-dessous) - - - - ^Ccxx,yy - - couleur du texte "xx" - et du fond "yy" - (voir le tableau des couleurs ci-dessous) - - - - ^Co - - désactiver la couleur et tous les attributs - - - - ^Cr - - vidéo inverse (inversion de la couleur d'écriture et du fond) - - - - ^Cu - - texte souligné - - - - - - NB: le même code (sans le numéro pour ^Cc) peut être utilisé pour - stopper l'attribut défini. - - - - Les codes couleur pour ^Cc sont : - - - - - Code - Couleur - - - - - 00 - blanc - - - 01 - noir - - - 02 - bleu foncé - - - 03 - vert foncé - - - 04 - rouge clair - - - 05 - rouge foncé - - - 06 - magenta - - - 07 - orange - - - 08 - jaune - - - 09 - vert clair - - - 10 - cyan - - - 11 - cyan clair - - - 12 - bleu clair - - - 13 - magenta clair - - - 14 - gris - - - 15 - gris clair (blanc) - - - - - - - - Exemple : affichage de "bonjour tout le monde !" - avec "bonjour" en bleu clair gras, et - "tout le monde" en rouge clair souligné : -^Cc12^Cbbonjour^Cb^Cc04^Cu tout le monde^Cu^Cc ! - - -
- -
- Commandes WeeChat / IRC - - - Ce chapitre liste toutes les commandes WeeChat et IRC. - - -
- Commandes WeeChat - - - &weechat_commands.xml; - - -
- -
- Fonctions pour les touches - - - - - - - Fonction - Description - - - - - &key_functions.xml; - - - - - - -
- -
- Commandes IRC - - - &irc_commands.xml; - - -
- -
- -
- Fichier de configuration - - - Liste des options du fichier de configuration : - - - - - Option - Type - Valeurs - Défaut - Description - - - - - &config.xml; - - - - - - - - Les couleurs pour l'interface Curses sont : - - - - - Mot clé - Couleur - - - - - default - couleur par défaut (transparent pour le fond) - - - black - noir - - - red - rouge foncé - - - lightred - rouge clair - - - green - vert foncé - - - lightgreen - vert clair - - - brown - marron - - - yellow - jaune - - - blue - bleu foncé - - - lightblue - bleu clair - - - magenta - violet foncé - - - lightmagenta - violet clair - - - cyan - cyan foncé - - - lightcyan - cyan clair - - - white - blanc - - - - - - -
- -
- Tube FIFO - - - Vous pouvez contrôler WeeChat à distance, en envoyant des commandes - ou du texte dans un tube FIFO (l'option "irc_fifo_pipe" doit être - activée, elle est désactivée par défaut). - - - - Le tube FIFO est dans le répertoire "~/.weechat/" - et s'appelle "weechat_fifo_xxxxx" (où xxxxx est l'ID du processus - (PID) du WeeChat qui tourne). Donc si plusieurs WeeChat tournent, il - y a plusieurs tubes FIFO, un pour chaque session. - - - - La syntaxe pour envoyer des commandes ou du texte dans le tube FIFO - est la suivante : - serveur,canal *texte ou commande ici - où le serveur et le canal sont facultatifs, mais si le canal est là, - le serveur doit l'être aussi. - - - - Quelques exemples : - - - - changement du pseudo sur freenode en "pseudo|absent" : - $ echo 'freenode */nick pseudo|absent' >~/.weechat/weechat_fifo_12345 - - - - - affichage de texte sur le canal #weechat : - $ echo 'freenode,#weechat *bonjour tout le monde !' >~/.weechat/weechat_fifo_12345 - - - - - affichage de texte sur le canal courant (le tampon affiché - par WeeChat) : - $ echo '*bonjour !' >~/.weechat/weechat_fifo_12345 - Attention : ceci est dangereux et vous ne - devriez pas le faire sauf si vous savez ce que vous faites ! - - - - - envoyer deux commandes pour décharger/recharger les scripts Perl - (vous devez les séparer par "\n") : - $ echo -e "freenode */perl unload\nfreenode */perl autoload" >~/.weechat/weechat_fifo_12345 - - - - - - - Vous pouvez écrire un script qui envoie les commandes à tous les - WeeChat qui tournent en même temps, par exemple : - -#!/bin/sh -if [ $# -eq 1 ]; then - for fifo in ~/.weechat/weechat_fifo_* - do - echo -e "$1" >$fifo - done -fi - - Si le script s'appelle "auto_weechat_command", vous pouvez le lancer - ainsi : - $ ./auto_weechat_command "freenode,#weechat *bonjour" - - -
- -
- - - - - Extensions - - - Ce chapitre décrit l'interface des extensions (API) et les extensions - pour scripts (Perl, Python, Ruby, Lua), fournies avec WeeChat. - - -
- Les extensions dans WeeChat - - - Une extension ("plugin" en anglais) est un programme écrit en C - qui peut appeler des fonctions de WeeChat définies dans une interface. - - - - Ce programme C n'a pas besoin des sources WeeChat pour être - compilé et peut être chargé/déchargé dynamiquement dans - WeeChat via la commande /plugin. - - - - L'extension doit être au format bibliothèque, chargeable - dynamiquement par le système d'exploitation. - Sous GNU/Linux, il s'agit d'un fichier ayant pour extension ".so", - sous Windows ".dll". - - -
- -
- Ecrire une extension - - - L'extension doit inclure le fichier "weechat-plugin.h" - (disponible dans les sources de WeeChat). - Ce fichier définit les structures et types dont l'extension aura - besoin pour communiquer avec WeeChat. - - - - L'extension doit comporter certaines variables et fonctions - obligatoires (sans quoi l'extension ne peut être chargée) : - - - - - Variable - Description - - - - - char plugin_name[] - le nom de l'extension - - - char plugin_version[] - la version de l'extension - - - char plugin_description[] - une courte description de l'extension - - - - - - - - - - Fonction - Description - - - - - int weechat_plugin_init (t_weechat_plugin *plugin) - - fonction appelée au chargement de l'extension - qui doit renvoyer PLUGIN_RC_OK en cas de succès, - PLUGIN_RC_KO en cas d'erreur (si erreur, l'extension - ne sera PAS chargée) - - - - void weechat_plugin_end (t_weechat_plugin *plugin) - fonction appelée au déchargement de l'extension - - - - - - -
- Fonctions de l'interface (API) - -
- set_charset - - - Prototype : - - void set_charset (t_weechat_plugin *plugin, char *charset) - - - - Change le jeu de caractères de l'extension. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : nouveau jeu de caractères à - utiliser - - - - - - Exemple : - plugin->set_charset (plugin, "ISO-8859-1"); - -
- -
- iconv_to_internal - - - Prototype : - - void iconv_to_internal (t_weechat_plugin *plugin, char *charset, - char *string) - - - - Convertit une chaîne de caractères vers le jeu de caractères - interne WeeChat (UTF-8). - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : le jeu de caractères de départ - - - - - : la chaîne à convertir - - - - - - Valeur renvoyée : la chaîne convertie. - - - Note : le résultat doit être libéré par un appel à la fonction - "free" après utilisation. - - - Exemple : - char *str = plugin->iconv_to_internal (plugin, "ISO-8859-1", "chaine iso: é à"); - -
- -
- iconv_from_internal - - - Prototype : - - void iconv_from_internal (t_weechat_plugin *plugin, char *charset, - char *string) - - - - Convertit une chaîne de caractères depuis le jeu de caractères - interne WeeChat (UTF-8) vers un autre. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : le jeu de caractères voulu - - - - - : la chaîne à convertir - - - - - - Valeur renvoyée : la chaîne convertie. - - - Note : le résultat doit être libéré par un appel à la fonction - "free" après utilisation. - - - Exemple : - char *str = plugin->iconv_from_internal (plugin, "ISO-8859-1", "chaine utf-8: é à"); - -
- -
- ascii_strcasecmp - - - Prototype : - - int ascii_strcasecmp (t_weechat_plugin *plugin, - char *chaine1, char *chaine2) - - - - Effectue une comparaison entre deux chaînes, sans tenir compte des - majuscules/minuscules ni de la locale. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : la première chaîne à comparer - - - - - : la deuxième chaîne à comparer - - - - - - Valeur renvoyée : la différence entre les deux chaînes : négatif - si chaine1 < chaine2, zéro si chaine1 == chaine2, positif si - chaine1 > chaine2 - - - Exemple : - if (plugin->ascii_strcasecmp (plugin, "abc", "def") != 0) ... - -
- -
- ascii_strncasecmp - - - Prototype : - - int ascii_strncasecmp (t_weechat_plugin *plugin, - char *chaine1, char *chaine2, int max) - - - - Effectue une comparaison entre deux chaînes, sans tenir compte des - majuscules/minuscules ni de la locale, en comparant au plus "max" - caractères. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : la première chaîne à comparer - - - - - : la deuxième chaîne à comparer - - - - - : nombre de caractères max à comparer - - - - - - Valeur renvoyée : la différence entre les deux chaînes : négatif - si chaine1 < chaine2, zéro si chaine1 == chaine 2, positif si - chaine1 > chaine2 - - - Exemple : - if (plugin->ascii_strncasecmp (plugin, "abc", "def", 2) != 0) ... - -
- -
- explode_string - - - Prototype : - - char **explode_string (t_weechat_plugin *plugin, char *chaine, - char *separateurs, int num_items_max, int *num_items) - - - - Explose une chaîne en plusieurs selon un/des délimiteur(s). - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : la chaîne à exploser - - - - - : les délimiteurs utilisés - pour exploser la chaîne - - - - - : nombre maximum de - sous-chaînes créées (0 = pas de limite) - - - - - : pointeur vers un entier qui - contiendra le nombre de sous-chaînes créées en retour - - - - - - Valeur renvoyée : un tableau de chaînes, ou NULL si un problème - a été rencontré. - - - Note : le résultat doit être libéré par un appel à la fonction - "free_exploded_string" après utilisation. - - - Exemple : - -char **argv; -int argc; -argv = plugin->explode_string (plugin, chaine, " ", 0, &argc); -... -if (argv != NULL) - plugin->free_exploded_string (plugin, argv); - - -
- -
- free_exploded_string - - - Prototype : - - char **free_exploded_string (t_weechat_plugin *plugin, - char **chaine) - - - - Libère la mémoire utilisée pour une explosion de chaîne. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : la chaîne explosée par la fonction - "explode_string" - - - - - - Valeur renvoyée : aucune. - - - Exemple : - -char *argv; -int argc; -argv = plugin->explode_string (plugin, chaine, " ", 0, &argc); -... -if (argv != NULL) - plugin->free_exploded_string (plugin, argv); - - -
- -
- mkdir_home - - - Prototype : - - int mkdir_home (t_weechat_plugin *plugin, char *repertoire) - - - - Créé un répertoire dans le répertoire de base de WeeChat. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : répertoire à créer - - - - - - Valeur renvoyée : 1 si le répertoire a été créé avec succès, - 0 si une erreur s'est produite. - - - Example: - -if (!plugin->mkdir_home (plugin, "temp")) - plugin->print_server(plugin, "Impossible de créer le répertoire 'temp' dans la base WeeChat."); - - -
- -
- exec_on_files - - - Prototype : - - void exec_on_files (t_weechat_plugin *plugin, char *repertoire, - int (*callback)(t_weechat_plugin *, char *)) - - - - Exécute une fonction sur tous les fichiers d'un répertoire. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : le répertoire où les fichiers - sont recherchés - - - - - : une fonction appelée pour chaque - fichier trouvé - - - - - - Valeur renvoyée : aucune. - - - Exemple : - -int callback (t_weechat_plugin *plugin, char *fichier) -{ - plugin->print_server (plugin, "fichier: %s", fichier); - return 1; -} -... -plugin->exec_on_files (plugin, "/tmp", &callback); - - -
- -
- print - - - Prototype : - - void print (t_weechat_plugin *plugin, - char *serveur, char *canal, char *message, ...) - - - - Affiche un message sur un tampon WeeChat, identifié par le serveur - et le canal (tous deux pouvant être NULL pour le tampon courant). - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : nom interne du serveur pour - trouver le tampon dans lequel afficher (peut être NULL) - - - - - : nom du canal pour trouver le - tampon dans lequel afficher (peut être NULL) - - - - - : message à afficher - - - - - - Pour afficher du texte en couleur, il faut utiliser les codes - suivants : - - - - - Code - Description - - - - - 0x02 - - texte gras - - - - 0x03 + "xx" - - couleur du texte "xx" - (voir pour les - couleurs) - - - - 0x03 + "xx,yy" - - couleur du texte "xx" - et du fond "yy" - (voir pour les - couleurs) - - - - 0x0F - - désactiver la couleur et tous les attributs - - - - 0x12 - - vidéo inverse (inversion de la couleur d'écriture et du - fond) - - - - 0x1F - - texte souligné - - - - - - NB: le même code (sans le numéro pour 0x03) peut être utilisé pour - stopper l'attribut défini. - - - Valeur renvoyée : aucune. - - - Exemples : - -plugin->print (plugin, NULL, NULL, "hello"); -plugin->print (plugin, NULL, "#weechat", "hello"); -plugin->print (plugin, "freenode", "#weechat", "hello"); -plugin->print (plugin, "freenode", "#weechat", "hello"); -plugin->print (plugin, NULL, NULL, - "test: \x02 gras \x0F\x03%02d bleu \x03%02d vert", - plugin->get_irc_color (plugin, "blue"), - plugin->get_irc_color (plugin, "green")); - - -
- -
- print_server - - - Prototype : - - void print_server (t_weechat_plugin *plugin, - char *message, ...) - - - - Affiche un message sur le tampon du serveur courant. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : message à afficher - - - - - - Pour afficher du texte en couleur, voir - . - - - Valeur renvoyée : aucune. - - - Exemple : plugin->print_server (plugin, "hello"); - -
- -
- print_infobar - - - Prototype : - - void print_infobar (t_weechat_plugin *plugin, - int temps, char *message, ...) - - - - Affiche un message sur la barre d'infos pour un temps déterminé. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : temps (en secondes) pendant lequel - le message est affiché (0 = jamais effacé) - - - - - - Valeur renvoyée : aucune. - - - Exemple : - -plugin->print_infobar (plugin, 5, "hello"); - - -
- -
- infobar_remove - - - Prototype : - - void infobar_remove (t_weechat_plugin *plugin, int nombre) - - - - Efface un ou plusieurs messages dans la pile de la barre d'infos. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : nombre de messages à supprimer - (si paramètre non présent ou <= 0, alors tous les messages - sont effacés) - - - - - - Valeur renvoyée : aucune. - - - Exemple : plugin->infobar_remove (1); - -
- -
- log - - - Prototype : - - void log (t_weechat_plugin *plugin, - char *serveur, char *canal, char *message, ...) - - - - Ecrit un message dans le fichier de log pour un serveur ou un - canal. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : nom interne du serveur pour - trouver le log du tampon (peut être NULL) - - - - - : nom du canal pour trouver le - tampon le log du tampon (peut être NULL) - - - - - : message - - - - - - Valeur renvoyée : aucune. - - - Exemple : - -plugin->log (plugin, "freenode", "#weechat", "test"); - - -
- -
- msg_handler_add - - - Prototype : - - t_plugin_handler *msg_handler_add (t_weechat_plugin - *plugin, char *message, t_plugin_handler_func *fonction, - char *handler_args, void *handler_pointer) - - - - Ajoute un gestionnaire de messages IRC, appelé dès qu'un message - IRC est reçu. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : nom du message IRC pour lequel la - fonction est appelée ("*" pour tous les messages). - Pour connaître la liste des messages IRC disponibles, merci - de consulter les RFCs - 1459 - et - 2812. - 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 : - - - - - Nom - Description - - - - - weechat_pv - message privé reçu - - - weechat_highlight - - message avec highlight (sur un canal ou en privé) - - - - weechat_ctcp - - message CTCP reçu (VERSION, PING, etc...) - - - - weechat_dcc - - message DCC reçu (discussion ou fichier) - - - - - - - - - - : fonction appelée lorsque le - message est reçu - - - Elle a le prototype suivant : - - int ma_fonction (t_weechat_plugin *plugin, - int argc, char **argv, - char *handler_args, void *handler_pointer) - - - - Le paramètre argc vaut 3 et les arguments suivants sont - passés dans le tableau argv : - - - argv[0] = nom du serveur - - - argv[1] = message IRC - - - argv[2] = arguments de la commande - - - - - - - : paramètres passés à la - fonction appelée - - - - - : pointeur passé à la - fonction appelée - - - - - - Valeur renvoyée : le pointeur vers le nouveau gestionnaire de - messages. - - - Note : la fonction appelée lorsque le message est reçu doit - renvoyer une des valeurs suivantes : - - - - PLUGIN_RC_KO : la fonction a échoué - - - - - PLUGIN_RC_OK : la fonction a réussi - - - - - PLUGIN_RC_OK_IGNORE_WEECHAT : le message - ne sera pas transmis à WeeChat - - - - - PLUGIN_RC_OK_IGNORE_PLUGINS : le message - ne sera pas transmis à d'autres extensions - - - - - PLUGIN_RC_OK_IGNORE_ALL : le message - ne sera ni transmis à WeeChat ni à d'autres extensions - - - - - PLUGIN_RC_OK_WITH_HIGHLIGHT : la fonction - a réussi et provoque un "highlight" sur le message reçu - - - - - - Exemple : - -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; -} -... -t_plugin_handler *msg_handler; -msg_handler = plugin->msg_handler_add (plugin, "KICK", - &msg_kick, NULL, NULL); - - -
- -
- cmd_handler_add - - - Prototype : - - t_plugin_handler *cmd_handler_add (t_weechat_plugin - *plugin, char *commande, char *description, char *arguments, - char *arguments_description, char *modele_completion, - t_plugin_handler_func *fonction, char *handler_args, - void *handler_pointer) - - - - Ajoute un gestionnaire de commande WeeChat, appelé dès que - l'utilisateur utilise la commande (par exemple /commande). - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : nom de la nouvelle commande, - qui peut être une commande déjà existante (attention la - commande remplacée ne sera plus disponible jusqu'à ce que - l'extension soit déchargée) - - - - - : brève description de la - commande (affichée par /help commande) - - - - - : brève description des - paramètres de la commande (affichée par /help commande) - - - - - : longue description - des paramètres de la commande (affichée par /help commande) - - - - - : modèle pour la - complétion sous la forme "abc|%w def|%i" - qui 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. - - - Les codes suivants peuvent être utilisés : - - - - - Code - Description - - - - - %- - aucune complétion pour le paramètre - - - %* - - répétition de la dernière complétion pour tous - les paramètres suivants (ce code doit être à la - fin du modèle de complétion, précédé d'un "|") - - - - %a - alias - - - %A - - alias et commandes (WeeChat, IRC et extensions) - - - - %c - canal courant - - - %C - tous les canaux (y compris les privés) - - - %f - nom de fichier - - - %h - commandes définies par des extensions - - - %i - commandes IRC (envoyées) - - - %I - commandes IRC (reçues) - - - %k - fonctions associées aux touches - - - %m - pseudo sur le serveur courant - - - %M - - pseudos sur le serveur courant - (tous les canaux ouverts) - - - - %n - pseudos du canal courant - - - %N - - pseudos et noms de machines du canal - courant - - - - %o - options de configuration - - - %O - options des extensions - - - %p - message de "part" par défaut - - - %q - message de "quit" par défaut - - - %s - nom du serveur courant - - - %S - tous les serveurs - - - %t - titre du canal courant - - - %v - valeur d'une option de configuration - - - %V - valeur d'une option d'extension - - - %w - commandes WeeChat - - - - - - - - - : fonction appelée lorsque la - commande est exécutée. - - - Elle a le prototype suivant : - - int ma_fonction (t_weechat_plugin *plugin, - int argc, char **argv, - char *handler_args, void *handler_pointer) - - - - Le paramètre argc vaut 3 et les arguments suivants sont - passés dans le tableau argv : - - - argv[0] = nom du serveur - - - argv[1] = commande - - - argv[2] = arguments de la commande - - - - - - - : paramètres passés à la - fonction appelée - - - - - : pointeur passé à la - fonction appelée - - - - - - Valeur renvoyée : le pointeur vers le nouveau gestionnaire de - commande. - - - Note : la fonction appelée lorsque la commande est exécutée doit - renvoyer une des valeurs suivantes : - - - - PLUGIN_RC_KO : la fonction a échoué - - - - - PLUGIN_RC_OK : la fonction a réussi - - - - - - Exemple : - -int cmd_test (t_weechat_plugin *plugin, 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; -} -... -t_plugin_handler *cmd_handler; -cmd_handler = plugin->cmd_handler_add (plugin, "test", "Commande test", - "[pesudo]", "pseudo: un pseudo du canal", - "%n", &cmd_test, NULL, NULL); - - -
- -
- timer_handler_add - - - Prototype : - - t_plugin_handler *timer_handler_add (t_weechat_plugin - *plugin, int intervalle, t_plugin_handler_func *fonction, - char *handler_args, void *handler_pointer) - - - - Ajoute un gestionnaire de temps, qui appelle périodiquement une - fonction. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : intervalle (en secondes) - entre deux appels de la fonction. - - - - - : fonction appelée - - - Elle a le prototype suivant : - - int ma_fonction (t_weechat_plugin *plugin, - int argc, char **argv, - char *handler_args, void *handler_pointer) - - - - Le paramètre argc vaut 0 et argv vaut NULL. - - - - - : paramètres passés à la - fonction appelée - - - - - : pointeur passé à la - fonction appelée - - - - - - Valeur renvoyée : le pointeur vers le nouveau gestionnaire de - temps. - - - Note : la fonction appelée doit renvoyer une des valeurs - suivantes : - - - - PLUGIN_RC_KO : la fonction a échoué - - - - - PLUGIN_RC_OK : la fonction a réussi - - - - - - Exemple : - -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; -} -... -t_plugin_handler *timer_handler; -timer_handler = plugin->timer_handler_add (plugin, 60, &mon_timer); - - -
- -
- keyboard_handler_add - - - Prototype : - - t_plugin_handler *keyboard_handler_add (t_weechat_plugin - *plugin, t_plugin_handler_func *fonction, - char *handler_args, void *handler_pointer) - - - - Ajoute un gestionnaire de clavier, appelé dès qu'une touche est - pressée. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : fonction appelée - - - Elle a le prototype suivant : - - int ma_fonction (t_weechat_plugin *plugin, - int argc, char **argv, - char *handler_args, void *handler_pointer) - - - - Le paramètre argc vaut 3 et les arguments suivants sont - passés dans le tableau argv : - - - - argv[0] = touche appuyée (nom d'une fonction interne - ou bien '*' suivi du code d'une touche) - - - - - argv[1] = la ligne de commande avant l'action de la - touche - - - - - argv[2] = la ligne de commande après l'action de la - touche - - - - - - - - : paramètres passés à la - fonction appelée - - - - - : pointeur passé à la - fonction appelée - - - - - - Valeur renvoyée : le pointeur vers le nouveau gestionnaire de - clavier. - - - Note : la fonction appelée doit renvoyer une des valeurs - suivantes : - - - - PLUGIN_RC_KO : la fonction a échoué - - - - - PLUGIN_RC_OK : la fonction a réussi - - - - - - Exemple : - -int mon_keyb (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; -} -... -t_plugin_handler *keyb_handler; -keyb_handler = plugin->keyboard_handler_add (plugin, &mon_keyb); - - -
- -
- event_handler_add - - - Prototype : - - t_plugin_handler *event_handler_add (t_weechat_plugin - *plugin, char *evenement, t_plugin_handler_func *fonction, - char *handler_args, void *handler_pointer) - - - - Ajoute un gestionnaire d'évènement, appelé dès qu'un évènement se - produit. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : évènement (voir le tableau - ci-dessous) - - - - - : fonction appelée - - - Elle a le prototype suivant : - - int ma_fonction (t_weechat_plugin *plugin, - int argc, char **argv, - char *handler_args, void *handler_pointer) - - - - Les paramètres passés à la fonction dépendent de l'évènement - (voir le tableau ci-dessous). - - - - - : paramètres passés à la - fonction appelée - - - - - : pointeur passé à la - fonction appelée - - - - - - Liste des évènements : - - - - - Evènement - Description - Paramètres - - - - - buffer_open - un tampon a été ouvert - - argc = 1, argv = { numéro de tampon } - - - - buffer_close - un tampon a été fermé - - argc = 1, argv = { numéro de tampon } - - - - buffer_move - un tampon a été déplacé - - argc = 2, argv = { nouveau numéro de tampon, ancien - numéro } - - - - - - - - Valeur renvoyée : le pointeur vers le nouveau gestionnaire - d'évènement. - - - Note : la fonction appelée doit renvoyer une des valeurs - suivantes : - - - - PLUGIN_RC_KO : la fonction a échoué - - - - - PLUGIN_RC_OK : la fonction a réussi - - - - - - Exemple : - -int mon_evenement (t_weechat_plugin *plugin, int argc, char **argv, - char *handler_args, void *handler_pointer) -{ - plugin->print (plugin, NULL, NULL, "mon_evenement"); - return PLUGIN_RC_OK; -} -... -t_plugin_handler *event_handler; -event_handler = plugin->event_handler_add (plugin, "buffer_open", - &mon_evenement); - - -
- -
- handler_remove - - - Prototype : - - void handler_remove (t_weechat_plugin *plugin, - t_plugin_handler *handler) - - - - Supprime un gestionnaire de commande ou message. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : le gestionnaire à supprimer - - - - - - Valeur renvoyée : aucune. - - - Exemple : - plugin->handler_remove (plugin, mon_handler); - -
- -
- handler_remove_all - - - Prototype : - - void handler_remove_all (t_weechat_plugin *plugin) - - - - Supprime tous les gestionnaires d'une extension. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - - Valeur renvoyée : aucune. - - - Exemple : - plugin->handler_remove_all (plugin); - -
- -
- modifier_add - - - Prototype : - - t_plugin_modifier *modifier_add (t_weechat_plugin *plugin, - char *type, char *message, t_plugin_modifier_func *fonction, - char *modifier_args, void *modifier_pointer) - - - - Ajoute un modifieur de message. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : type de modifieur : - - - - - Type - Description - - - - - irc_in - appelé pour chaque message IRC reçu - - - irc_user - - appelé pour chaque message (ou commande) envoyé par - l'utilisateur (avant traitement et affichage par - WeeChat) - - - - irc_out - - appelé pour chaque message sortant juste avant - envoi au serveur IRC (y compris pour les messages - envoyés automatiquement et de manière transparente - par WeeChat) - - - - - - - - - - : nom du message IRC pour lequel la - fonction est appelée (utilisé uniquement pour les types - "irc_in" et "irc_out"). - Pour connaître la liste des messages IRC disponibles, merci - de consulter les RFCs - 1459 - et - 2812. - La valeur spéciale "*" signifie tous les messages (pas de - filtre). - - - - - : fonction appelée - - - Elle a le prototype suivant : - - char *ma_fonction (t_weechat_plugin *plugin, - int argc, char **argv, - char *modifier_args, void *modifier_pointer) - - - - Le paramètre argc vaut 2 et les arguments suivants sont - passés dans le tableau argv : - - - argv[0] = nom du serveur - - - argv[1] = message - - - - - - - : paramètres passés à la - fonction appelée - - - - - : pointeur passé à la - fonction appelée - - - - - - Valeur renvoyée : le pointeur vers le nouveau modifieur de message. - - - Note : la fonction doit retourner une chaîne modifiée, ou NULL si - elle ne souhaite pas modifier le message. - Si elle retourne une chaine vide, alors le message est supprimé et - ne sera pas traité du tout par WeeChat (soyez prudent en supprimant - des messages !). - La chaîne renvoyée doit avoir été allouée par malloc() et sera - libérée (par appel à free()) automatiquement par WeeChat après - utilisation. - - - Exemple : - -char *adder (t_weechat_plugin *plugin, int argc, char **argv, - char *modifier_args, void *modifier_pointer) -{ - char *string; - string = (char *)malloc (strlen (argv[1]) + 16); - strcpy (string, argv[1]); - strcat (string, "test"); - return string; -} -... -t_plugin_modifier *modifier; -modifier = plugin->modifier_add (plugin, "irc_in", "privmsg", - &adder, NULL, NULL); - - -
- -
- modifier_remove - - - Prototype : - - void modifier_remove (t_weechat_plugin *plugin, - t_plugin_modifier *modifier) - - - - Supprime un modifieur de message. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : le modifieur à supprimer - - - - - - Valeur renvoyée : aucune. - - - Exemple : - plugin->modifier_remove (plugin, mon_modifier); - -
- -
- modifier_remove_all - - - Prototype : - - void modifier_remove_all (t_weechat_plugin *plugin) - - - - Supprime tous les modifieurs d'une extension. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - - Valeur renvoyée : aucune. - - - Exemple : - plugin->modifier_remove_all (plugin); - -
- -
- exec_command - - - Prototype : - - void exec_command (t_weechat_plugin - *plugin, char *serveur, char *canal, char *commande) - - - - Execute une commande WeeChat ou envoie un message à un canal. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : nom interne du serveur où - exécuter la commande (peut être NULL) - - - - - : nom du canal où exécuter la - commande (peut être NULL) - - - - - : la commande à exécuter - - - - - - Valeur renvoyée : aucune. - - - Exemples : - -plugin->exec_command (plugin, NULL, NULL, "/help nick"); -plugin->exec_command (plugin, "freenode", "#weechat", "bonjour"); - - -
- -
- get_info - - - Prototype : - - char *get_info (t_weechat_plugin *plugin, - char *info, char *serveur) - - - - Renvoie une information sur WeeChat ou un canal. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : nom de l'info à obtenir : - - - - - Info - Description - - - - - version - version de WeeChat - - - nick - pesudo - - - channel - - nom du canal (NULL pour un serveur ou un privé) - - - - server - nom du serveur - - - type - - type de tampon: 0=standard, 1=DCC, - 2=données IRC brutes - - - - away - drapeau "away" - - - inactivity - - nombre de secondes écoulées depuis que la dernière - touche a été appuyée - - - - input - - contenu de la ligne de commande de la fenêtre - courante - - - - input_mask - - contenu du masque de couleur de la ligne de - commande - - - - input_pos - - position du curseur dans la ligne de commande - - - - weechat_dir - - répertoire de base de WeeChat - (par défaut: ~/.weechat/) - - - - weechat_libdir - répertoire "lib" système de WeeChat - - - weechat_sharedir - répertoire "share" système de WeeChat - - - - - - - - - : nom interne du serveur où - récupérer l'information (si nécessaire) - - - - - - Valeur renvoyée : l'information recherchée, NULL si non trouvée. - - - Note : le résultat doit être libéré par un appel à la fonction - "free" après utilisation. - - - Exemples : - -char *version = plugin->get_info (plugin, "version", NULL); -char *nick = plugin->get_info (plugin, "nick", "freenode"); -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); - - -
- -
- get_dcc_info - - - Prototype : - - t_plugin_info_dcc *get_dcc_info (t_weechat_plugin *plugin) - - - - Renvoie la liste des DCC en cours ou terminés. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - - Valeur renvoyée : la liste chaînée des DCC. - - - - - Type - Champ - Description - - - - - char * - server - le serveur IRC - - - char * - channel - le canal IRC - - - int - type - - le type de DCC : - 0 = discussion reçue, - 1 = discussion envoyée, - 2 = fichier reçu, - 3 = fichier envoyé - - - - int - status - - le statut du DCC : - 0 = en attente, - 1 = en cours de connexion, - 2 = actif, - 3 = terminé, - 4 = échoué, - 5 = interrompu par l'utilisateur - - - - time_t - start_time - la date et heure de création du DCC - - - time_t - start_transfer - la date et heure de démarrage du transfert - - - unsigned long - addr - adresse IP de l'utilisateur distant - - - int - port - port utilisé pour le DCC - - - char * - nick - pseudo de l'utilisateur distant - - - char * - filename - nom de fichier - - - char * - local_filename - nom de fichier local - - - int - filename_suffix - suffixe si renommage de fichier - - - unsigned long - size - taille du fichier - - - unsigned long - pos - position actuelle dans le fichier - - - unsigned long - start_resume - position de démarrage après une interruption - - - unsigned long - bytes_per_sec - - nombre d'octets transmis par seconde depuis le début - du transfert - - - - t_plugin_dcc_info * - prev_dcc - - pointeur vers l'info DCC précédente - - - - t_plugin_dcc_info * - next_dcc - - pointeur vers l'info DCC suivante - - - - - - - - Note : le résultat doit être libéré par un appel à la fonction - "free_dcc_info" après utilisation. - - - Exemples : - -t_plugin_dcc_info *dcc_info = plugin->get_dcc_info (plugin); -for (ptr_dcc = dcc_info; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc) -{ - plugin->print_server (plugin, "DCC type=%d, avec: %s", - ptr_dcc->type, ptr_dcc->nick); -} -if (dcc_info) - plugin->free_dcc_info (plugin, dcc_info); - - -
- -
- free_dcc_info - - - Prototype : - - void free_dcc_info (t_weechat_plugin *plugin, - t_plugin_dcc_info *dcc_info) - - - - Libère la mémoire utilisée par une liste de DCC. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : pointeur vers la liste DCC - renvoyée par la fonction "get_dcc_info" - - - - - - Valeur renvoyée : aucune. - - - Exemple : - plugin->free_dcc_info (plugin, dcc_info); - -
- -
- get_server_info - - - Prototype : - - t_plugin_server_info *get_server_info (t_weechat_plugin *plugin) - - - - Renvoie la liste des serveurs IRC (connectés ou non). - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - - Valeur retournée : la liste chaînée des serveurs IRC. - - - - - Type - Champ - Description - - - - - char * - name - nom interne du serveur - - - int - autoconnect - 1 si auto-connexion au démarrage, 0 sinon - - - int - autoreconnect - - 1 si auto-reconnexion quand déconnecté, - 0 sinon - - - - int - autoreconnect_delay - délai avant de tenter une reconnexion - - - int - command_line - - 1 si le serveur vient de la ligne de commande - (donc temporaire), 0 sinon - - - - char * - address - adresse du serveur (nom ou IP) - - - int - port - port - - - int - ipv6 - connexion IPv6 - - - int - ssl - connexion SSL - - - char * - password - mot de passe pour le serveur - - - char * - nick1 - premier pseudo - - - char * - nick2 - pseudo alternatif - - - char * - nick3 - second pseudo alternatif - - - char * - username - nom d'utilisateur - - - char * - real name - nom réel - - - char * - command - commande exécutée une fois connecté - - - int - command_delay - délai après exécution de la commande - - - char * - autojoin - canaux joints automatiquement - - - int - autorejoin - - 1 si les canaux sont rejoints après un "kick", - 0 sinon - - - - char * - notify_levels - niveaux de notification des canaux - - - char * - charset_decode_iso - - jeux de caractères de décodage ISO pour les canaux - - - - char * - charset_decode_utf - - jeux de caractères de décodage UTF pour les canaux - - - - char * - charset_encode - - jeux de caractères d'encodage pour les canaux - - - - int - is_connected - 1 si connecté au serveur, 0 sinon - - - int - ssl_connected - 1 si connecté via SSL, 0 sinon - - - char * - nick - pseudo courant - - - int - is_away - 1 si absent, 0 sinon - - - time_t - away_time - - date/heure à laquelle l'utilisateur a été marqué absent - - - - int - lag - lag (en millisecondes) - - - t_plugin_server_info * - prev_server - pointeur vers les infos du serveur précédent - - - t_plugin_server_info * - next_server - pointeur vers les infos du serveur suivant - - - - - - - Note : le résultat doit être libéré par un appel à la fonction - "free_server_info" après utilisation. - - - Exemple : - -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); -} - - -
- -
- free_server_info - - - Prototype : - - void free_server_info (t_weechat_plugin *plugin, - t_plugin_server_info *server_info) - - - - Libère la mémoire utilisée par une liste de serveurs. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : pointeur vers la liste de - serveurs retournée par la fonction "get_server_info" - - - - - - Valeur renvoyée : aucune. - - - Exemple : - plugin->free_server_info (plugin, server_info); - -
- -
- get_channel_info - - - Prototype : - - t_plugin_channel_info *get_channel_info (t_weechat_plugin *plugin, - char *serveur) - - - - Renvoie la liste des canaux IRC pour un serveur. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : nom interne du serveur - - - - - - Valeur renvoyée : la liste chaînée des canaux IRC du serveur. - - - - - Type - Field - Description - - - - - int - type - 0 pour un canal, 1 pour un privé - - - char * - name - nom du canal - - - char * - topic - titre du canal - - - char * - modes - modes du canal - - - int - limit - limite d'utilisateurs - - - char * - key - clé du canal - - - int - nicks_count - nombre de pseudos présents sur le canal - - - t_plugin_channel_info * - prev_channel - pointeur vers les infos du canal précédent - - - t_plugin_channel_info * - next_channel - pointeur vers les infos du canal suivant - - - - - - - Note : le résultat doit être libéré par un appel à la fonction - "free_channel_info" après utilisation. - - - Exemple : - -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); -} - - -
- -
- free_channel_info - - - Prototype : - - void free_channel_info (t_weechat_plugin *plugin, - t_plugin_channel_info *channel_info) - - - - Libère la mémoire utilisée par une liste de canaux. - - - Arguments: - - - - : pointeur vers la structure - de l'extension - - - - - : pointeur vers la liste de - canaux retournée par la fonction "get_channel_info" - - - - - - Valeur renvoyée : aucune. - - - Exemple : - plugin->free_channel_info (plugin, channel_info); - -
- -
- get_nick_info - - - Prototype : - - t_plugin_nick_info *get_nick_info (t_weechat_plugin *plugin, - char *serveur, char *canal) - - - - Renvoie la liste des pseudos pour un canal. - - - Arguments: - - - - : pointeur vers la structure - de l'extension - - - - - : nom interne du serveur - - - - - : nom du canal - - - - - - Valeur renvoyée : la liste chaînée des pseudos présents - sur le canal. - - - - - Type - Champ - Description - - - - - char * - nick - pseudo - - - char * - host - nom de machine - - - int - flags - - 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) - - - - t_plugin_nick_info * - prev_nick - pointeur vers les infos du pseudo précédent - - - t_plugin_nick_info * - next_nick - pointeur vers les infos du pseudo précédent - - - - - - - Note : le résultat doit être libéré par un appel à la fonction - "free_nick_info" après utilisation. - - - Exemple : - -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); -} - - -
- -
- free_nick_info - - - Prototype : - - void free_nick_info (t_weechat_plugin *plugin, - t_plugin_nick_info *nick_info) - - - - Libère la mémoire utilisée par une liste de pseudos. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : pointeur vers la liste de - pseudos retournée par la fonction "get_nick_info" - - - - - - Valeur renvoyée : aucune. - - - Exemple : - plugin->free_nick_info (plugin, nick_info); - -
- -
- get_config - - - Prototype : - - char *get_config (t_weechat_plugin *plugin, char *option) - - - - Renvoie la valeur d'une option de configuration WeeChat. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : nom de l'option à lire - - - - - - Valeur renvoyée : la valeur de l'option, NULL si non trouvée. - - - Note : le résultat doit être libéré par un appel à la fonction - "free" après utilisation. - - - Exemples : - -char *value1 = plugin->get_config (plugin, "look_set_title"); -char *value2 = plugin->get_config (plugin, "freenode.server_autojoin"); - - -
- -
- set_config - - - Prototype : - - int set_config (t_weechat_plugin *plugin, - char *option, char *valeur) - - - - Modifie la valeur d'une option de configuration WeeChat. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : nom de l'option à mettre à jour - - - - - : nouvelle valeur pour l'option - - - - - - Valeur renvoyée : 1 si l'option a été modifiée avec succès, 0 si - une erreur s'est produite. - - - Exemple : - -plugin->set_config (plugin, "look_nicklist", "off"); - - -
- -
- get_plugin_config - - - Prototype : - - char *get_plugin_config (t_weechat_plugin *plugin, char *option) - - - - Renvoie la valeur d'une option de l'extension. - L'option est lue depuis le fichier - "~/.weechat/plugins.rc" et est - sous cette forme : "extension.option=valeur" - (NB : le nom de l'extension est ajouté automatiquement). - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : nom de l'option à lire - - - - - - Valeur renvoyée : la valeur de l'option, NULL si non trouvée. - - - Note : le résultat doit être libéré par un appel à la fonction - "free" après utilisation. - - - Exemple : - -char *value = plugin->get_plugin_config (plugin, "ma_variable"); - - -
- -
- set_plugin_config - - - Prototype : - - int set_plugin_config (t_weechat_plugin *plugin, - char *option, char *valeur) - - - - Modifie la valeur d'une option de l'extension. - L'option est écrite dans le fichier - "~/.weechat/plugins.rc" et est - sous cette forme : "extension.option=valeur" - (NB : le nom de l'extension est ajouté automatiquement). - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : nom de l'option à mettre à jour - - - - - : nouvelle valeur pour l'option - - - - - - Valeur renvoyée : 1 si l'option a été modifiée avec succès, 0 si - une erreur s'est produite. - - - Exemple : - -plugin->set_plugin_config (plugin, "ma_variable", "valeur"); - - -
- -
- get_irc_color - - - Prototype : - - int get_irc_color (t_weechat_plugin *plugin, - char *nom_couleur) - - - - Renvoie le numéro d'une couleur IRC avec son nom. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : nom de la couleur - Les couleure autorisées sont : - - - - - Nom couleur - Valeur - - - - - white - 0 - - - black - 1 - - - blue - 2 - - - green - 3 - - - lightred - 4 - - - red - 5 - - - magenta - 6 - - - brown - 7 - - - yellow - 8 - - - lightgreen - 9 - - - cyan - 10 - - - lightcyan - 11 - - - lightblue - 12 - - - lightmagenta - 13 - - - gray - 14 - - - lightgray - 15 - - - - - - - - - - Valeur renvoyée : numéro de la couleur IRC, -1 si la couleur - n'est pas trouvée. - - - Exemple : - -int color_blue = plugin->get_irc_color (plugin, "blue"); /* retourne 2 */ - - -
- -
- input_color - - - Prototype : - - void input_color (t_weechat_plugin *plugin, - int couleur, int debut, int longueur) - - - - Ajoute de la couleur dans la zone de saisie. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : couleur pour le texte (si < 0, - alors la zone de saisie est rafraichie, et il n'y a aucun - changement dans son contenu) - - - - - : position de début pour la coloration - (si < 0, alors le masque est réinitialisé) - - - - - : longueur pour la coloration - (si <= 0, alors le masque est réinitialisé) - - - - - - Valeur renvoyée : aucune. - - - Exemple : - -plugin->input_color (plugin, plugin->get_irc_color (plugin, "blue"), 10, 5); - - -
- -
- get_window_info - - - Prototype : - - t_plugin_window_info *get_window_info (t_weechat_plugin *plugin) - - - - Retourne la liste des fenêtres WeeChat. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - - Valeur renvoyée : liste chaînée des fenêtres WeeChat. - - - - - Type - Champ - Description - - - - - int - win_x - position horizontale de la fenêtre - - - int - win_y - position verticale de la fenêtre - - - int - win_width - largeur de la fenêtre - - - int - win_height - hauteur de la fenêtre - - - int - win_width_pct - largeur en % (comparé à la fenêtre parent) - - - int - win_height_pct - hauteur en % (comparé à la fenêtre parent) - - - int - num_buffer - numéro du tampon affiché - - - t_plugin_window_info * - prev_window - pointeur vers les infos de la fenêtre précédente - - - t_plugin_window_info * - next_window - pointeur vers les infos de la fenêtre suivante - - - - - - - Note : le résultat doit être libéré par un appel à la fonction - "free_window_info" après utilisation. - - - Exemple : - -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 !"); - - -
- -
- free_window_info - - - Prototype : - - void free_window_info (t_weechat_plugin *plugin, - t_plugin_window_info *window_info) - - - - Libère la mémoire utilisée par une liste de fenêtres. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : pointeur vers la liste des - infos fenêtres retournée par la fonction "get_window_info" - - - - - - Valeur renvoyée : aucune. - - - Exemple : - plugin->free_window_info (plugin, window_info); - -
- -
- get_buffer_info - - - Prototype : - - t_plugin_buffer_info *get_buffer_info (t_weechat_plugin *plugin) - - - - Retourne la liste des tampons WeeChat. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - - Valeur renvoyée : liste chaînée des tampons WeeChat. - - - - - Type - Champ - Description - - - - - int - type - - type de tampon: 0=standard, 1=DCC, - 2=données IRC brutes - - - - int - number - numéro de tampon - - - int - num_displayed - nombre de fenêtres affichant ce tampon - - - char * - server_name - nom du serveur pour le tampon (peut être NULL) - - - char * - channel_name - nom du canal pout le tampon (peut être NULL) - - - int - notify_level - niveau de notification du tampon - - - char * - log_filename - - nom du fichier de log (NULL signifie qu'il n'y a - pas de log) - - - - t_plugin_buffer_info * - prev_buffer - pointeur vers les infos du tampon précédent - - - t_plugin_buffer_info * - next_buffer - pointeur vers les infos du tampon suivant - - - - - - - Note : le résultat doit être libéré par un appel à la fonction - "free_buffer_info" après utilisation. - - - Exemple : - -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 !"); - - -
- -
- free_buffer_info - - - Prototype: - - void free_buffer_info (t_weechat_plugin *plugin, - t_plugin_buffer_info *buffer_info) - - - - Libère la mémoire utilisée par une liste de tampons. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : pointeur vers la liste des - infos tampons retournée par la fonction "get_buffer_info" - - - - - - Valeur renvoyée : aucune. - - - Exemple : - plugin->free_buffer_info (plugin, buffer_info); - -
- -
- get_buffer_data - - - Prototype: - - t_plugin_buffer_data *get_buffer_info (t_weechat_plugin *plugin, - char *serveur, char *canal) - - - - Renvoie le contenu du tampon. - - - Paramètres : - - - - : pointeur vers la structure - de l'extension - - - - - : nom interne du serveur - - - - - : nom du canal - - - - - - Valeur renvoyée : contenu du tampon (liste chaînée de lignes). - - - - - Type - Champ - Description - - - - - time_t - date - date et heure - - - char * - nick - pseudo - - - char * - data - - contenu de la ligne (les codes couleur sont - retirés) - - - - t_plugin_buffer_line * - prev_line - pointeur vers la ligne précédente - - - t_plugin_buffer_line * - next_line - pointeur vers la ligne suivante - - - - - - - Note : le résultat doit être libéré par un appel à la fonction - "free_buffer_data" après utilisation. - - - Exemple : - -t_plugin_buffer_line *buffer_line, *ptr_line; -char text_time[256]; - -buffer_line = plugin->get_buffer_data (plugin); -if (buffer_line) -{ - for (ptr_line = buffer_line; ptr_line; ptr_line = ptr_line->next_line) - { - strftime (text_time, sizeof (text_time), "%x %X", localtime (&(ptr_line->date))); - plugin->print (plugin, NULL, NULL, "date: %s, pseudo: %s, données: %s", - text_time, ptr_line->nick, ptr_line->data); - } - plugin->free_buffer_data (plugin, buffer_line); -} - - -
- -
- free_buffer_data - - - Prototype: - - void free_buffer_data (t_weechat_plugin *plugin, - t_plugin_buffer_line *buffer_line) - - - - Libère la mémoire utilisée par les lignes d'un tampon. - - - Arguments: - - - - : pointeur vers la structure - de l'extension - - - - - : pointeur vers la liste des - lignes du tampon retournée par la fonction "get_buffer_data" - - - - - - Valeur renvoyée : aucune. - - - Exemple : - plugin->free_buffer_data (plugin, buffer_line); - -
- -
- -
- Compiler l'extension - - - La compilation ne nécessite pas les sources WeeChat, mais seulement - le fichier "weechat-plugin.h". - - - - Pour compiler une extension composée d'un fichier "toto.c" (sous - GNU/Linux) : - -$ gcc -fPIC -Wall -c toto.c -$ gcc -shared -fPIC -o libtoto.so toto.o - - - -
- -
- Charger l'extension dans WeeChat - - - Copier le fichier "libtoto.so" dans le répertoire système des - extensions (par exemple - "/usr/local/lib/weechat/plugins)" ou bien dans - celui de l'utilisateur (par exemple - "/home/xxxxx/.weechat/plugins"). - - - - Sous WeeChat : - /plugin load toto - - -
- -
- Exemple d'extension - - - Un exemple complet d'extension, qui ajoute une commande /double - affichant deux fois les paramètres passés sur le canal courant - (d'accord ce n'est pas très utile mais ceci est un exemple !) : - -#include <stdlib.h> - -#include "weechat-plugin.h" - -char plugin_name[] = "Double"; -char plugin_version[] = "0.1"; -char plugin_description[] = "Plugin de test pour WeeChat"; - -/* gestionnaire de commande "/double" */ - -int double_cmd (t_weechat_plugin *plugin, 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 */ -} - - - -
- -
- -
- Extension Charset - - - L'extension Charset vous permet d'encoder et décoder les données en - utilisant un jeu de caractères, avec 3 niveaux : global, par serveur, - ou par canal. - Cette extension est facultative, mais recommandée : si elle n'est pas - chargée, WeeChat pourra uniquement lire/écrire des données UTF-8. - - - - L'extension Charset devrait être automatiquement chargée par WeeChat - au démarrage. - Pour s'assurer que l'extension est bien chargée, essayez : - "/charset". - Si la commande n'est pas trouvée, alors chargez l'extension avec la - commande : - /plugin load charset - Si l'extension n'est pas trouvée, alors vous devriez recompiler - WeeChat avec les extensions et le support de Charset. - - - - Lorsque l'extension Charset démarre, elle affiche le jeu de caractères - du terminal et l'interne. - Le jeu de caractères du terminal dépend de votre locale, et l'interne - est UTF-8. - Par exemple : - --P- Charset plugin starting, terminal charset: ISO-8859-15 (WeeChat internal: UTF-8) - - - -
- Configuration - - - - - Pour modifier les jeux de caractères de décodage et d'encodage - globaux, utilisez la commande "/setp". - Par exemple : - -/setp charset.global.decode = ISO-8859-15 -/setp charset.global.encode = ISO-8859-15 - - Si le jeu de caractères de décodage global n'est pas renseigné - (par exemple pendant le premier chargement de Charset), il sera - renseigné automatiquement avec le jeu de caractères du terminal - (s'il est différent de UTF-8) ou par défaut à - "ISO-8859-1". - La valeur d'encodage par défaut est vide, donc WeeChat envoie par - défaut avec le jeu de caractères interne (UTF-8). - - - - - Pour modifier le jeu de caractères d'un serveur, utilisez la - commande "/charset" sur le tampon serveur. - Si vous donnez seulement le jeu de caractères, alors vous - modifiez en même temps les valeurs de décodage et d'encodage. - Par exemple : - /charset ISO-8859-15 - Ce qui est équivalent à : - -/charset decode ISO-8859-15 -/charset encode ISO-8859-15 - - - - - - Pour modifier le jeu de caractères d'un canal (ou d'une - conversation privée), utilisez la même commande que pour le - serveur, mais sur le tampon du canal (ou du privé). - - - - -
- -
- FAQ - - - Si vous avez des problèmes avec certains caractères ou les accents en - utilisant l'extension Charset : - - - - vérifiez que weechat-curses est lié avec libncursesw - (attention : nécessaire sur beaucoup de distributions, mais pas - toutes) : - ldd /chemin/vers/weechat-curses - - - - - vérifiez la ligne charset (sur le tampon serveur), vous devriez - voir ISO-XXXXXX ou UTF-8 pour le charset du terminal. Si vous - voyez ANSI_X3.4-1968 ou d'autres valeurs, votre locale est - probablement erronée. - - - - - affectez la valeur pour le décodage global, par exemple : - /setp charset.global.decode = ISO-8859-15 - - - - - -
- -
- -
- Extensions pour scripts - - - Quatre extensions sont fournies en standard avec WeeChat pour utiliser - des langages de script : Perl, Python, Ruby et Lua. - - -
- Charger / décharger des scripts - - - Les scripts sont chargés et déchargés avec les commandes - /perl, /python, - /ruby et /lua - (tapez /help dans WeeChat pour obtenir - de l'aide sur les commandes). - - - - Exemples : - - - - Charger un script Perl : - /perl load /tmp/essai.pl - - - - - Lister les scripts Perl chargés : - /perl - - - - - Charger un script Python : - /python load /tmp/essai.py - - - - - Lister les scripts Python chargés : - /python - - - - - Charger un script Ruby : - /ruby load /tmp/essai.rb - - - - - Lister les scripts Ruby chargés : - /ruby - - - - - Charger un script Lua : - /lua load /tmp/essai.lua - - - - - Lister les scripts Lua chargés : - /lua - - - - - -
- -
- Syntaxe par langage - -
- Perl - - - Dans un script Perl WeeChat, toutes les fonctions et variables - de l'interface sont préfixées par "weechat::". - Exemple : -weechat::register("test", "1.0", "end_test", "Script perl WeeChat"); - - -
- -
- Python - - - Un script Python WeeChat doit commencer par importer weechat : - import weechat - - - - Toutes les fonctions et variables de l'interface sont préfixées - par "weechat.". - Exemple : -weechat.register("test", "1.0", "end_test", "Script python WeeChat") - - -
- -
- Ruby - - - Dans un script Ruby WeeChat, tout le code doit être dans des - fonctions. Pour le code principal, vous devez définir une - fonction "weechat_init", qui est appelée - automatiquement quand le script est chargé par WeeChat. - Exemple : - -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 - - - - - Toutes les fonctions de l'interface sont préfixées par - "Weechat." et les variables par - "Weechat::". - - -
- -
- Lua - - - Dans un script Lua WeeChat, toutes les fonctions de l'interface - sont préfixées par "weechat.". - Les variables sont préfixées par "weechat." et - suffixées par "()". - Exemple : - -function message_handler(server, args) - weechat.print("Je suis un message handler") - return weechat.PLUGIN_RC_OK() -end - - - -
- -
- -
- Interface WeeChat / scripts - -
- register - - - Prototype Perl : - - weechat::register(nom, version, fonction_de_fin, description, - [charset]); - - - - Prototype Python : - - weechat.register(nom, version, fonction_de_fin, description, - [charset]) - - - - Prototype Ruby : - - Weechat.register(nom, version, fonction_de_fin, description, - [charset]) - - - - Prototype Lua : - - weechat.register(nom, version, fonction_de_fin, description, - [charset]) - - - - C'est la première fonction à appeler dans le script. - Tout script pour WeeChat doit appeler cette fonction. - - - Paramètres : - - - - : nom unique pour identifier le script - (chaque script doit avoir un nom différent) - - - - - : version du script - - - - - : fonction appelée quand - le script est déchargé (paramètre facultatif, une chaîne - vide signifiant qu'il n'y a pas de fonction à appeler) - - - - - : brève description du script - - - - - : jeu de caractères du script, à - préciser si le script n'est pas écrit en UTF-8 - - - - - - Valeur renvoyée : 1 si le script a été enregistré, 0 si une erreur - s'est produite. - - - Exemples : - -# perl -weechat::register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1"); - -# python -weechat.register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1") - -# ruby -Weechat.register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1") - --- lua -weechat.register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1") - - -
- -
- set_charset - - - Prototype Perl : - - weechat::set_charset(charset); - - - - Prototype Python : - - weechat.set_charset(charset) - - - - Prototype Ruby : - - Weechat.set_charsetr(charset) - - - - Prototype Lua : - - weechat.set_charset(charset) - - - - Change le jeu de caractères du script. - - - Paramètres : - - - - : nouveau jeu de caractères - - - - - - Valeur renvoyée : 1 si le nouveau jeu de caractères a été - mis en place, 0 si une erreur s'est produite. - - - Exemples : - -# perl -weechat::set_charset("ISO-8859-1"); - -# python -weechat.set_charset("ISO-8859-1") - -# ruby -Weechat.set_charset("ISO-8859-1") - --- lua -weechat.set_charset("ISO-8859-1") - - -
- -
- print - - - Prototype Perl : - - weechat::print(message, [canal, [serveur]]) - - - - Prototype Python : - - weechat.prnt(message, [canal, [serveur]]) - - - - Prototype Ruby : - - Weechat.print(message, [canal, [serveur]]) - - - - Prototype Lua : - - weechat.print(message, [canal, [serveur]]) - - - - Affiche un message sur un tampon WeeChat, identifié par le - serveur et le canal. - - - Paramètres : - - - - : message à afficher - - - - - : nom du canal pour trouver le - tampon dans lequel afficher - - - - - : nom interne du serveur pour - trouver le tampon dans lequel afficher - - - - - - Pour afficher du texte en couleur, voir - . - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# perl -weechat::print("message"); -weechat::print("message", "#weechat"); -weechat::print("message", "#weechat", "freenode"); -weechat::print("test: \x0305 rouge \x0F normal"); - -# 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") - - -
- -
- print_server - - - Prototype Perl : - - weechat::print_server(message) - - - - Prototype Python : - - weechat.print_server(message) - - - - Prototype Ruby : - - Weechat.print_server(message) - - - - Prototype Lua : - - weechat.print_server(message) - - - - Affiche un message sur le tampon serveur. - - - Paramètres : - - - - : message à afficher - - - - - - Pour afficher du texte en couleur, voir - . - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# perl -weechat::print_server("message"); -weechat::print_server("test: \x0305 rouge \x0F normal"); - -# python -weechat.print_server("message") - -# ruby -Weechat.print_server("message") - --- lua -weechat.print_server("message") - - -
- -
- print_infobar - - - Prototype Perl : - - weechat::print_infobar(temps, message); - - - - Prototype Python : - - weechat.print_infobar(temps, message) - - - - Prototype Ruby : - - Weechat.print_infobar(temps, message) - - - - Prototype Lua : - - weechat.print_infobar(temps, message) - - - - Affiche un message sur la barre d'infos pour un temps déterminé. - - - Paramètres : - - - - : temps (en secondes) pendant - lequel le message est affiché (0 = jamais effacé) - - - - - : message à afficher - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# perl -weechat::print_infobar(5, "message"); - -# python -weechat.print_infobar(5, "message") - -# ruby -Weechat.print_infobar(5, "message") - --- lua -weechat.print_infobar(5, "message") - - -
- -
- remove_infobar - - - Prototype Perl : - - weechat::remove_infobar([nombre]); - - - - Prototype Python : - - weechat.remove_infobar([nombre]) - - - - Prototype Ruby : - - Weechat.remove_infobar([nombre]) - - - - Prototype Lua : - - weechat.remove_infobar([nombre]) - - - - Efface un ou plusieurs messages dans la pile de la barre d'infos. - - - Paramètres : - - - - : nombre de messages à supprimer - (si paramètre non présent ou <= 0, alors tous les messages - sont effacés) - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# perl -weechat::remove_infobar(1); - -# python -weechat.remove_infobar(1) - -# ruby -Weechat.remove_infobar(1) - --- lua -weechat.remove_infobar(1) - - -
- -
- log - - - Prototype Perl : - - weechat::log(message, [canal, [serveur]]); - - - - Prototype Python : - - weechat.log(message, [canal, [serveur]]) - - - - Prototype Ruby : - - Weechat.log(message, [canal, [serveur]]) - - - - Prototype Lua : - - weechat.log(message, [canal, [serveur]]) - - - - Ecrit un message dans le fichier de log pour un serveur ou un - canal. - - - Paramètres : - - - - : message - - - - - : nom du canal pour trouver le - log du tampon - - - - - : nom interne du serveur pour - trouver le log du tampon - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# perl -weechat::log("message", "#weechat", "freenode"); - -# python -weechat.log("message", "#weechat", "freenode") - -# ruby -Weechat.log("message", "#weechat", "freenode") - --- lua -weechat.log("message", "#weechat", "freenode") - - -
- -
- add_message_handler - - - Prototype Perl : - - weechat::add_message_handler(message, fonction); - - - - Prototype Python : - - weechat.add_message_handler(message, fonction) - - - - Prototype Ruby : - - Weechat.add_message_handler(message, fonction) - - - - Prototype Lua : - - weechat.add_message_handler(message, fonction) - - - - Ajoute un gestionnaire de messages IRC, appelé dès qu'un message - IRC est reçu. - - - Paramètres : - - - - : nom du message IRC pour lequel la - fonction est appelée. - Pour connaître la liste des messages IRC disponibles, merci - de consulter les RFCs - 1459 - et - 2812. - De plus, vous pouvez utiliser un nom spécial, préfixé par - "weechat_" pour capturer des évènements spéciaux - (voir ). - - - - - : fonction appelée lorsque le - message est reçu - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# perl -weechat::add_message_handler("privmsg", "ma_fonction"); -sub ma_fonction -{ - weechat::print("serveur=$_[0]"); - ($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 - - - - Note : la fonction appelée lorsque le message est reçu doit - renvoyer une des valeurs suivantes : - - - - PLUGIN_RC_KO : la fonction a échoué - - - - - PLUGIN_RC_OK : la fonction a réussi - - - - - PLUGIN_RC_OK_IGNORE_WEECHAT : le message - ne sera pas transmis à WeeChat - - - - - PLUGIN_RC_OK_IGNORE_PLUGINS : le message - ne sera pas transmis à d'autres extensions - - - - - PLUGIN_RC_OK_IGNORE_ALL : le message - ne sera ni transmis à WeeChat ni à d'autres extensions - - - - - PLUGIN_RC_OK_WITH_HIGHLIGHT : la fonction - a réussi et provoque un "highlight" sur le message reçu - - - - -
- -
- add_command_handler - - - Prototype Perl : - - weechat::add_command_handler(commande, fonction, - [description, arguments, arguments_description, - modele_completion]); - - - - Prototype Python : - - weechat.add_command_handler(commande, fonction, - [description, arguments, arguments_description, - modele_completion]) - - - - Prototype Ruby : - - Weechat.add_command_handler(commande, fonction, - [description, arguments, arguments_description, - modele_completion]) - - - - Prototype Lua : - - weechat.add_command_handler(commande, fonction, - [description, arguments, arguments_description, - modele_completion]) - - - - Ajoute un gestionnaire de commande WeeChat, appelé dès que - l'utilisateur utilise la commande (par exemple /commande). - - - Paramètres : - - - - : nom de la nouvelle commande, - qui peut être une commande déjà existante (attention la - commande remplacée ne sera plus disponible jusqu'à ce que - le script soit déchargé) - - - - - : fonction appelée lorsque la - commande est exécutée - - - - - : brève description des - paramètres de la commande (affichée par /help commande) - - - - - : longue description - des paramètres de la commande (affichée par /help commande) - - - - - : modèle pour la - complétion sous la forme "abc|%w def|%i" - qui signifie "abc" ou une commande WeeChat pour le premier - paramètre, et "def" ou une commande IRC pour le deuxième. - (voir ) - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# perl -weechat::add_command_handler("commande", "ma_commande"); -sub ma_commande -{ - weechat::print("serveur=$_[0], 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 - - - - Notes : la fonction appelée lorsque la commande est exécutée - doit renvoyer une des valeurs suivantes : - - - - PLUGIN_RC_KO : la fonction a échoué - - - - - PLUGIN_RC_OK : la fonction a réussi - - - - -
- -
- add_timer_handler - - - Prototype Perl : - - weechat::add_timer_handler(intervalle, fonction); - - - - Prototype Python : - - weechat.add_timer_handler(intervalle, fonction) - - - - Prototype Ruby : - - Weechat.add_timer_handler(intervalle, fonction) - - - - Prototype Lua : - - weechat.add_timer_handler(intervalle, fonction) - - - - Ajoute un gestionnaire de temps, qui appelle périodiquement une - fonction. - - - Paramètres : - - - - : intervalle (en secondes) - entre deux appels de la fonction. - - - - - : fonction appelée - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# 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 - - - - Note : la fonction appelée doit renvoyer une des valeurs - suivantes : - - - - PLUGIN_RC_KO : la fonction a échoué - - - - - PLUGIN_RC_OK : la fonction a réussi - - - - -
- -
- add_keyboard_handler - - - Prototype Perl : - - weechat::add_keyboard_handler(fonction); - - - - Prototype Python : - - weechat.add_keyboard_handler(fonction) - - - - Prototype Ruby : - - Weechat.add_keyboard_handler(fonction) - - - - Prototype Lua : - - weechat.add_keyboard_handler(fonction) - - - - Ajoute un gestionnaire de clavier, appelé dès qu'une touche est - pressée. - - - Paramètres : - - - - : fonction appelée - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# 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_keyboard_handler("mon_clavier") -def mon_clavier(key, 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_keyboard_handler("mon_clavier") -function mon_clavier(key, 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 - - - - Note : la fonction appelée doit renvoyer une des valeurs - suivantes : - - - - PLUGIN_RC_KO : la fonction a échoué - - - - - PLUGIN_RC_OK : la fonction a réussi - - - - -
- -
- add_event_handler - - - Prototype Perl : - - weechat::add_event_handler(évènement, fonction); - - - - Prototype Python : - - weechat.add_event_handler(évènement, fonction) - - - - Prototype Ruby : - - Weechat.add_event_handler(évènement, fonction) - - - - Prototype Lua : - - weechat.add_event_handler(évènement, fonction) - - - - Ajoute un gestionnaire d'évènement, appelé dès qu'un évènement se - produit. - - - Paramètres : - - - - : évènement - (voir ) - - - - - - - : fonction appelée - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# perl -weechat::add_event_handler("buffer_open", "mon_evenement"); -sub mon_evenement -{ - weechat::print("buffer open"); - return weechat::PLUGIN_RC_OK; -} - -# python -weechat.add_event_handler("buffer_open", "mon_evenement") -def mon_evenement(): - weechat.prnt("buffer open") - return weechat.PLUGIN_RC_OK - -# ruby -Weechat.add_event_handler("buffer_open", "mon_evenement") -def mon_evenement() - Weechat.print("buffer open") - return Weechat::PLUGIN_RC_OK -end - --- lua -weechat.add_event_handler("buffer_open", "mon_evenement") -function mon_evenement() - weechat.print("buffer open") - return weechat.PLUGIN_RC_OK() -end - - - - Note : la fonction appelée doit renvoyer une des valeurs - suivantes : - - - - PLUGIN_RC_KO : la fonction a échoué - - - - - PLUGIN_RC_OK : la fonction a réussi - - - - -
- -
- remove_handler - - - Prototype Perl : - - weechat::remove_handler(nom, fonction); - - - - Prototype Python : - - weechat.remove_handler(nom, fonction) - - - - Prototype Ruby : - - Weechat.remove_handler(nom, fonction) - - - - Prototype Lua : - - weechat.remove_handler(nom, fonction) - - - - Supprime un gestionnaire de message ou de commande. - - - Paramètres : - - - - : nom du message IRC ou de la commande - - - - - : fonction associée - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# perl -weechat::remove_handler("commande", "ma_commande"); - -# python -weechat.remove_handler("commande", "ma_commande") - -# ruby -Weechat.remove_handler("commande", "ma_commande") - --- lua -weechat.remove_handler("commande", "ma_commande") - - -
- -
- remove_timer_handler - - - Prototype Perl : - - weechat::remove_timer_handler(fonction); - - - - Prototype Python : - - weechat.remove_timer_handler(fonction) - - - - Prototype Ruby : - - Weechat.remove_timer_handler(fonction) - - - - Prototype Lua : - - weechat.remove_timer_handler(fonction) - - - - Supprime un gestionnaire de temps. - - - Paramètres : - - - - : fonction - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# 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") - - -
- -
- remove_keyboard_handler - - - Prototype Perl : - - weechat::remove_keyboard_handler(fonction); - - - - Prototype Python : - - weechat.remove_keyboard_handler(fonction) - - - - Prototype Ruby : - - Weechat.remove_keyboard_handler(fonction) - - - - Prototype Lua : - - weechat.remove_keyboard_handler(fonction) - - - - Supprime un gestionnaire de clavier. - - - Paramètres : - - - - : fonction - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# 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") - - -
- -
- remove_event_handler - - - Prototype Perl : - - weechat::remove_event_handler(fonction); - - - - Prototype Python : - - weechat.remove_event_handler(fonction) - - - - Prototype Ruby : - - Weechat.remove_event_handler(fonction) - - - - Prototype Lua : - - weechat.remove_event_handler(fonction) - - - - Supprime un gestionnaire d'évènement. - - - Paramètres : - - - - : fonction - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# perl -weechat::remove_event_handler("mon_evenement"); - -# python -weechat.remove_event_handler("mon_evenement") - -# ruby -Weechat.remove_event_handler("mon_evenement") - --- lua -weechat.remove_event_handler("mon_evenement") - - -
- -
- add_modifier - - - Prototype Perl : - - weechat::add_modifier(type, message, fonction); - - - - Prototype Python : - - weechat.add_modifier(type, message, fonction) - - - - Prototype Ruby : - - Weechat.add_modifier(type, message, fonction) - - - - Prototype Lua : - - weechat.add_modifier(type, message, fonction) - - - - Ajoute un modifieur de messages. - - - Paramètres : - - - - : type de modifieur : - - - - - Type - Description - - - - - irc_in - appelé pour chaque message IRC reçu - - - irc_user - - appelé pour chaque message (ou commande) envoyé par - l'utilisateur (avant traitement et affichage par - WeeChat) - - - - irc_out - - appelé pour chaque message sortant juste avant - envoi au serveur IRC (y compris pour les messages - envoyés automatiquement et de manière transparente - par WeeChat) - - - - - - - - - - : nom du message IRC pour lequel la - fonction est appelée (utilisé uniquement pour les types - "irc_in" et "irc_out"). - Pour connaître la liste des messages IRC disponibles, merci - de consulter les RFCs - 1459 - et - 2812. - La valeur spéciale "*" signifie tous les messages (pas de - filtre). - - - - - : fonction appelée - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# perl -weechat::add_modifier("irc_in", "privmsg", "mod_in"); -weechat::add_modifier("irc_out", "privmsg", "mod_out"); -sub mod_in -{ - return "$_[1] [modifier IN]"; -} -sub mod_out -{ - return "$_[1] [modifier OUT]"; -} - -# python -weechat.add_modifier("irc_in", "privmsg", "mod_in") -weechat.add_modifier("irc_out", "privmsg", "mod_out") -def mod_in(serveur, args): - return args + " [modifier IN]" -def mod_out(serveur, args): - return args + " [modifier OUT]" - -# ruby -Weechat.add_modifier("irc_in", "privmsg", "mod_in") -Weechat.add_modifier("irc_out", "privmsg", "mod_out") -def mod_in(server, args) - return args + " [modifier IN]" -end -def mod_out(server, args) - return args + " [modifier OUT]" -end - --- lua -weechat.add_modifier("irc_in", "privmsg", "mod_in") -weechat.add_modifier("irc_out", "privmsg", "mod_out") -function mod_in(server, args) - return args .. " [modifier IN]" -end -function mod_out(server, args) - return args .. " [modifier OUT]" -end - - -
- -
- remove_modifier - - - Prototype Perl : - - weechat::remove_modifier(type, message, fonction); - - - - Prototype Python : - - weechat.remove_handler(type, message, fonction) - - - - Prototype Ruby : - - Weechat.remove_handler(type, message, fonction) - - - - Prototype Lua : - - weechat.remove_handler(type, message, fonction) - - - - Supprime un modifieur de messages. - - - Paramètres : - - - - : type de modifieur - - - - - : message traité par le modifieur - - - - - : fonction associée - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# perl -weechat::remove_modifier("irc_in", "privmsg", "mod_in"); - -# python -weechat.remove_modifier("irc_in", "privmsg", "mod_in") - -# ruby -Weechat.remove_modifier("irc_in", "privmsg", "mod_in") - --- lua -weechat.remove_modifier("irc_in", "privmsg", "mod_in") - - -
- -
- command - - - Prototype Perl : - - weechat::command(commande, [canal, [serveur]]); - - - - Prototype Python : - - weechat.command(commande, [canal, [serveur]]) - - - - Prototype Ruby : - - Weechat.command(commande, [canal, [serveur]]) - - - - Prototype Lua : - - weechat.command(commande, [canal, [serveur]]) - - - - Exécute une commande ou envoie un message à un canal. - - - Paramètres : - - - - : la commande à exécuter - - - - - : nom du canal où exécuter la - commande - - - - - : nom interne du serveur où - exécuter la commande - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite. - - - Exemples : - -# perl -weechat::command("bonjour tout le monde !"); -weechat::command("/kick toto merci de quitter ce canal", "#weechat"); -weechat::command("/nick newnick", "", "freenode"); - -# python -weechat.command("bonjour tout le monde !") -weechat.command("/kick toto merci de quitter ce canal", "#weechat") -weechat.command("/nick newnick", "", "freenode") - -# ruby -Weechat.command("bonjour tout le monde !") -Weechat.command("/kick toto merci de quitter ce canal", "#weechat") -Weechat.command("/nick newnick", "", "freenode") - --- lua -weechat.command("bonjour tout le monde !") -weechat.command("/kick toto merci de quitter ce canal", "#weechat") -weechat.command("/nick newnick", "", "freenode") - - -
- -
- get_info - - - Prototype Perl : - - weechat::get_info(nom, [serveur]); - - - - Prototype Python : - - weechat.get_info(nom, [serveur]) - - - - Prototype Ruby : - - Weechat.get_info(nom, [serveur]) - - - - Prototype Lua : - - weechat.get_info(nom, [serveur]) - - - - Renvoie une information sur WeeChat ou un canal. - - - Paramètres : - - - - : nom de l'info à obtenir - (voir ) - - - - - : nom interne du serveur où - récupérer l'information (si nécessaire) - - - - - - Valeur renvoyée : l'information demandée, chaîne vide si une - erreur s'est produite ou que l'information n'a pas été trouvée. - - - Exemples : - -# perl -$version = get_info("version"); -$nick = get_info("nick", "freenode"); - -# python -version = weechat.get_info("version") -nick = weechat.get_info("nick", "freenode") - -# ruby -version = Weechat.get_info("version") -nick = Weechat.get_info("nick", "freenode") - --- lua -version = weechat.get_info("version") -nick = weechat.get_info("nick", "freenode") - - -
- -
- get_dcc_info - - - Prototype Perl : - - weechat::get_dcc_info(); - - - - Prototype Python : - - weechat.get_dcc_info() - - - - Prototype Ruby : - - Weechat.get_dcc_info() - - - - Prototype Lua : - - weechat.get_dcc_info() - - - - Renvoie la liste des DCC en cours ou terminés. - - - Valeur renvoyée : la liste des DCC - (voir ). - - - Exemples : - -# 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 - - -
- -
- get_server_info - - - Prototype Perl : - - weechat::get_server_info(); - - - - Prototype Python : - - weechat.get_server_info() - - - - Prototype Ruby : - - Weechat.get_server_info() - - - - Prototype Lua : - - weechat.get_server_info() - - - - Renvoie la liste des serveurs IRC (connectés ou non). - - - Valeur renvoyée : la liste des serveurs IRC (connectés ou non) - (voir ). - - - Exemples : - -# 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 - - -
- -
- get_channel_info - - - Prototype Perl : - - weechat::get_channel_info(serveur); - - - - Prototype Python : - - weechat.get_channel_info(serveur) - - - - Prototype Ruby : - - Weechat.get_channel_info(serveur) - - - - Prototype Lua : - - weechat.get_channel_info(serveur) - - - - Renvoie la liste des canaux IRC pour un serveur. - - - Valeur renvoyée : la liste des canaux IRC du serveur - (voir ). - - - Exemples : - -# 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 - - -
- -
- get_nick_info - - - Prototype Perl : - - weechat::get_nick_info(serveur, canal); - - - - Prototype Python : - - weechat.get_nick_info(serveur, canal) - - - - Prototype Ruby : - - Weechat.get_nick_info(serveur, canal) - - - - Prototype Lua : - - weechat.get_nick_info(serveur, canal) - - - - Renvoie la liste des pseudos pour un canal. - - - Valeur renvoyée : la liste des pseudos présents sur le canal - (voir ). - - - Exemples : - -# 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 - - -
- -
- get_config - - - Prototype Perl : - - weechat::get_config(option); - - - - Prototype Python : - - weechat.get_config(option) - - - - Prototype Ruby : - - Weechat.get_config(option) - - - - Prototype Lua : - - weechat.get_config(option) - - - - Renvoie la valeur d'une option de configuration WeeChat. - - - Paramètres : - - - - : nom de l'option - - - - - - Valeur renvoyée : la valeur de l'option, chaîne vide si l'option - n'a pas été trouvée. - - - Exemples : - -# perl -$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") - - -
- -
- set_config - - - Prototype Perl : - - weechat::set_config(option, valeur); - - - - Prototype Python : - - weechat.set_config(option, valeur) - - - - Prototype Ruby : - - Weechat.set_config(option, valeur) - - - - Prototype Lua : - - weechat.set_config(option, valeur) - - - - Modifie la valeur d'une option de configuration WeeChat. - - - Paramètres : - - - - : nom de l'option - - - - - : la nouvelle valeur pour - l'option - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est - produite. - - - Exemples : - -# perl -weechat::set_config("look_nicklist", "off"); -weechat::set_config("freenode.server_autojoin", "#weechat"); - -# python -weechat.set_config("look_nicklist", "off") -weechat.set_config("freenode.server_autojoin", "#weechat") - -# ruby -Weechat.set_config("look_nicklist", "off") -Weechat.set_config("freenode.server_autojoin", "#weechat") - --- lua -weechat.set_config("look_nicklist", "off") -weechat.set_config("freenode.server_autojoin", "#weechat") - - -
- -
- get_plugin_config - - - Prototype Perl : - - weechat::get_plugin_config(option); - - - - Prototype Python : - - weechat.get_plugin_config(option) - - - - Prototype Ruby : - - Weechat.get_plugin_config(option) - - - - Prototype Lua : - - weechat.get_plugin_config(option) - - - - Renvoie la valeur d'une option de l'extension. - L'option est lue depuis le fichier - "~/.weechat/plugins.rc" et est - sous cette forme : - "extension.script.option=valeur" - (NB : le nom de l'extension et du script sont ajoutés - automatiquement). - - - Paramètres : - - - - : nom de l'option - - - - - - Valeur renvoyée : la valeur de l'option, chaîne vide si l'option - n'a pas été trouvée. - - - Exemples : - -# perl -$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") - - -
- -
- set_plugin_config - - - Prototype Perl : - - weechat::set_plugin_config(option, valeur); - - - - Prototype Python : - - weechat.set_plugin_config(option, valeur) - - - - Prototype Ruby : - - Weechat.set_plugin_config(option, valeur) - - - - Prototype Lua : - - weechat.set_plugin_config(option, valeur) - - - - Modifie la valeur d'une option de l'extension. - L'option est écrite dans le fichier - "~/.weechat/plugins.rc" et est - sous cette forme : - "extension.script.option=valeur" - (NB : le nom de l'extension et du script sont rajoutés - automatiquement). - - - Paramètres : - - - - : nom de l'option - - - - - : la nouvelle valeur pour - l'option - - - - - - Valeur renvoyée : 1 si succès, 0 si une erreur s'est - produite. - - - Exemples : - -# perl -weechat::set_plugin_config("ma_variable", "valeur"); - -# python -weechat.set_plugin_config("ma_variable", "valeur") - -# ruby -Weechat.set_plugin_config("ma_variable", "valeur") - --- lua -weechat.set_plugin_config("ma_variable", "valeur") - - -
- -
- get_irc_color - - - Prototype Perl : - - weechat::get_irc_color(color); - - - - Prototype Python : - - weechat.get_irc_color(color) - - - - Prototype Ruby : - - Weechat.get_irc_color(color) - - - - Prototype Lua : - - weechat.get_irc_color(color) - - - - Renvoie le numéro d'une couleur IRC avec son nom. - - - Valeur renvoyée : numéro de la couleur IRC, -1 si la couleur - n'est pas trouvée (voir ). - - - Exemples : - -# 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") - - -
- -
- input_color - - - Prototype Perl : - - weechat::input_color(color); - - - - Prototype Python : - - weechat.input_color(color) - - - - Prototype Ruby : - - Weechat.input_color(color) - - - - Prototype Lua : - - weechat.input_color(color) - - - - Ajoute de la couleur dans la zone de saisie. - - - Valeur renvoyée : aucune. - - - Exemples : - -# 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) - - -
- -
- get_window_info - - - Prototype Perl : - - weechat::get_window_info(); - - - - Prototype Python : - - weechat.get_window_info() - - - - Prototype Ruby : - - Weechat.get_window_info() - - - - Prototype Lua : - - weechat.get_window_info() - - - - Renvoie la liste des fenêtres WeeChat. - - - Valeur renvoyée : liste des fenêtres WeeChat - (voir ). - - - Exemples : - -# 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 - - -
- -
- get_buffer_info - - - Prototype Perl : - - weechat::get_buffer_info(); - - - - Prototype Python : - - weechat.get_buffer_info() - - - - Prototype Ruby : - - Weechat.get_buffer_info() - - - - Prototype Lua : - - weechat.get_buffer_info() - - - - Renvoie la liste des tampons WeeChat. - - - Valeur renvoyée : liste des tampons WeeChat - (voir ). - - - Exemples : - -# 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"); - } - weechat::print("----------------------"); - } -} -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])) - weechat.prnt ("----------------------") -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 - Weechat.print("----------------------") - 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 - weechat.print ("----------------------") - b, infos = next (bf, b) - end -else - weechat.print("**** pas d'info sur les tampons ****") -end - - -
- -
- get_buffer_data - - - Perl prototype: - - weechat::get_buffer_data(server, channel); - - - - Python prototype: - - weechat.get_buffer_data(server, channel) - - - - Ruby prototype: - - Weechat.get_buffer_data(server, channel) - - - - Lua prototype: - - weechat.get_buffer_data(server, channel) - - - - Return content of buffer. - - - Return value: list of lines for buffer - (see ). - - - Examples: - -# perl -my $server = weechat::get_info("server"); -my $channel = weechat::get_info("channel"); -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 = weechat.get_info("server") -channel = weechat.get_info("channel") -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 = Weechat.get_info("server") -channel = Weechat.get_info("channel") -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 = weechat.get_info("server") -channel = weechat.get_info("channel") -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 (bdatas, 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 - - -
- -
- -
- -
- - - - - Auteurs / Support - - - Ce chapitre liste les auteurs et contributeurs pour WeeChat, et - indique les moyens d'obtenir du support. - - -
- Auteurs - - - WeeChat est développé par : - - - - FlashCode (Sébastien Helleu) - flashcode AT flashtux.org - - développeur principal - - - - - kolter (Emmanuel Bouthenot) - kolter AT openics.org - - développeur - - - - - Ptitlouis - ptitlouis AT sysif.net - - empaqueteur Debian - - - - - -
- -
- Contributeurs - - - Les personnes suivantes ont contribué à WeeChat : - - - - Jiri Golembiovsky - - traduction en tchèque, patchs - - - - - Rudolf Polzer - - patchs - - - - - Jim Ramsay - - patchs - - - - - Odin - - RPM pour SuSE - - - - - Pistos - - patchs - - - - - Gwenn - - patchs - - - - - voroskoi - - traduction en hongrois - - - - - Frank Zacharias - - traduction en allemand - - - - - Pavel Shevchuk - - traduction en russe - - - - - -
- -
- Obtenir du support - - - Avant de faire appel au support, merci de lire la documentation et - la FAQ de WeeChat (la documentation est le document que vous êtes - en train de lire, si vous n'avez pas tout lu jusqu'ici, il est encore - temps de recommencer !) - - - - - - - IRC : serveur "irc.freenode.net", - canal "#weechat" - - - - - Forum WeeChat : - - http://forums.flashtux.org - - - - - - Liste de diffusion : - - - - Pour souscrire : - - http://mail.nongnu.org/mailman/listinfo/weechat-support - - - - - - Pour envoyer un mail à la liste de diffusion : - weechat-support@nongnu.org - - - - Les archives de la liste de diffusion sont ici : - - http://mail.nongnu.org/archive/html/weechat-support - - - - - - -
- -
+ &authors.fr.xml;