From 0f3601bea0e40a258ad1f48b9b60955c4614bda8 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Thu, 26 Mar 2009 14:20:14 +0100 Subject: [PATCH] Update script API in doc (developer guide) --- doc/de/dev/plugin_api.de.xml | 2 +- doc/de/dev/plugin_script_api.de.xml | 2966 +++------------------------ doc/en/dev/plugin_api.en.xml | 2 +- doc/en/dev/plugin_script_api.en.xml | 2826 ++----------------------- doc/fr/dev/plugin_api.fr.xml | 2 +- doc/fr/dev/plugin_script_api.fr.xml | 2848 ++----------------------- 6 files changed, 720 insertions(+), 7926 deletions(-) diff --git a/doc/de/dev/plugin_api.de.xml b/doc/de/dev/plugin_api.de.xml index 40bcdbb9c..8ce6ce41a 100644 --- a/doc/de/dev/plugin_api.de.xml +++ b/doc/de/dev/plugin_api.de.xml @@ -27,6 +27,6 @@ along with this program. If not, see . &plugin_c_api.de.xml; - + &plugin_script_api.de.xml; diff --git a/doc/de/dev/plugin_script_api.de.xml b/doc/de/dev/plugin_script_api.de.xml index 48efbdae2..a23779a5e 100644 --- a/doc/de/dev/plugin_script_api.de.xml +++ b/doc/de/dev/plugin_script_api.de.xml @@ -21,96 +21,107 @@ along with this program. If not, see . --> -
- Skript-Plugins +
+ + Script plugin API - Vier Plugins werden von WeeChat angeboten um Skriptsprachen zu nutzen: - Perl, Python, Ruby und Lua. + Five plugins are provided with WeeChat to use script languages: + Perl, Python, Ruby, Lua and Tcl.
- Laden / Entfernen von Skripten + Load / unload scripts Scripts are loaded and unloaded with /perl, - /python, /ruby and - /lua commands + /python, /ruby, + /lua and /tcl 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: + Examples: - Laden eines Perl-Skripts: + Load a Perl script: /perl load /tmp/test.pl - Liste alle geladenen Perl-Skripte auf: + List all loaded Perl scripts: /perl - Laden eines Python-Skripts: + Load a Python script: /python load /tmp/test.py - Liste alle geladenen Python-Skripte auf: + List all loaded Python scripts: /python - Laden eines Ruby-Skripts: + Load a Ruby script: /ruby load /tmp/test.rb - Liste alle geladenen Ruby-Skripte auf: + List all loaded Ruby scripts: /ruby - Laden eines Lua-Skripts: + Load a Lua script: /lua load /tmp/test.lua - Liste alle geladenen Lua-Skripte auf: + List all loaded Lua scripts: /lua + + + Load a Tcl script: + /tcl load /tmp/test.tcl + + + + + List all loaded Tcl scripts: + /tcl + +
- Syntax in den Skriptsprachen + Syntax by language
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"); + In a WeeChat Perl script, all API functions and variables are + prefixed by "weechat::". + Example: + +weechat::register("test", "Author <author\@domain.com>", "1.0", + "GPL3", "Script description", "bye_bye", ""); +
@@ -119,16 +130,18 @@ along with this program. If not, see . Python - Ein WeeChat-Pythonskript muss mit einer Importdirektive für WeeChat - beginnen: + A WeeChat Python script has to start by importing weechat: import weechat - Allen API-Funktionen und Variablen ist ein - "weechat." vorangestellt. - Beispiel: -weechat.register("test", "1.0", "end_test", "WeeChat python script") + All API functions and variables are prefixed by + "weechat.". + Example: + +weechat.register("test", "Author <author@domain.com>", "1.0", + "GPL3", "Script description", "bye_bye", "") +
@@ -137,28 +150,23 @@ along with this program. If not, see . 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: + 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 + Weechat.register("test", "Author <author@domain.com>", "1.0", + "GPL3", "Script description", "bye_bye", "") + return Weechat::WEECHAT_RC_OK end - Allen API-Funktionen ist "Weechat." - und Variablen "Weechat::" vorangestellt. + All API functions are prefixed by + "Weechat." and variables by + "Weechat::".
@@ -167,16 +175,29 @@ end Lua - In einem WeeChat-Luaskript ist allen Funktionen ein - "weechat." vorangestellt. Variablen beginnen - mit "weechat." und enden mit - "()". - Beispiel: + 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.register("test", "Author <author@domain.com>", "1.0", + "GPL3", "Script description", "bye_bye", "") + + + +
+ +
+ Tcl + + + In a WeeChat Tcl script, all API functions are prefixed by + "weechat::". + Variables are prefixed by "$weechat::". + Example: + +weechat::register "test" "Author <author@domain.com>" "1.0" "GPL3" "Script description" "bye_bye" "" @@ -185,2698 +206,261 @@ end
- WeeChat / Skript-API + WeeChat / scripts 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) + weechat::register(name, author, version, license, description, + end_function, charset); Python prototype: - weechat.print_server(message) + weechat.register(name, author, version, license, description, + end_function, charset) Ruby prototype: - Weechat.print_server(message) + Weechat.register(name, author, version, license, description, + end_function, charset) Lua prototype: - weechat.print_server(message) + weechat.register(name, author, version, license, description, + end_function, charset) - Display a message on server buffer. + Tcl prototype: + + weechat::register name author version license description + end_function charset + + + + This is first function to call in script. + All WeeChat scripts have to call this function. Arguments: - : message + : unique name to identify script + (each script must have unique name) + + + + + : string with author (may include name, + nick, e-mail, ..) + + + + + : script version + + + + + : short description of script + + + + + : function called when script is + unloaded (optional parameter, empty string means nothing is + called at the end) + + + + + : charset used by script, you should + set this if script is NOT written with UTF-8 (you can use blank + value for UTF-8 script, which is default charset) - To display colored text, see . - - - Return value: 1 if success, 0 if an error occurred. + Return value: 1 if script was registered, 0 if an error occured. Examples: # perl -weechat::print_server("message"); -weechat::print_server("test: \x0305 rot \x0F normal"); +weechat::register("test", "Author <author\@domain.com>", "1.0", + "GPL3", "Script description", "bye_bye", ""); # python -weechat.print_server("message") +weechat.register("test", "Author <author@domain.com>", "1.0", + "GPL3", "Script description", "bye_bye", "") # ruby -Weechat.print_server("message") +Weechat.register("test", "Author <author@domain.com>", "1.0", + "GPL3", "Script description", "bye_bye", "") -- lua -weechat.print_server("message") +weechat.register("test", "Author <author@domain.com>", "1.0", + "GPL3", "Script description", "bye_bye", "") + +# tcl +weechat::register "test" "Author <author@domain.com>" "1.0" "GPL3" "Script description" "bye_bye" ""
-
- log +
+ Other functions - 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: + Following functions are in script API (for description, see + ). - - - : Nachricht - - - - - : Name des Channels, zu welchem der - Puffer der Logdatei gehört - - - - - : interner Name des Servers, zu - welchem der Puffer der Logdatei gehört - - + plugin_get_name + set_charset + plugin_get_name + charset_set + iconv_to_internal + iconv_from_internal + gettext + ngettext + string_remove_color + mkdir_home + mkdir + mkdir_parents + list_new + list_add + list_search + list_casesearch + list_get + list_set + list_next + list_prev + list_string + list_size + list_remove + list_remove_all + list_free + config_new + config_new_section + config_search_section + config_new_option + config_search_option + config_string_to_boolean + config_option_reset + config_option_set + config_option_set_null + config_option_unset + config_option_rename + config_option_is_null + config_option_default_is_null + config_boolean + config_boolean_default + config_integer + config_integer_default + config_string + config_string_default + config_color + config_color_default + config_write_option + config_write_line + config_write + config_read + config_reload + config_option_free + config_section_free_options + config_section_free + config_free + config_get + config_get_plugin + config_set_plugin + config_unset_plugin + prefix + color + print + print_date_tags + print_y + log_print + hook_command + hook_command_run + hook_timer + hook_fd + hook_process + hook_connect + hook_print + hook_signal + hook_signal_send + hook_config + hook_completion + hook_completion_list_add + hook_modifier + hook_modifier_exec + hook_info + hook_infolist + unhook + unhook_all + buffer_new + buffer_search + current_buffer + buffer_clear + buffer_close + buffer_get_integer + buffer_get_string + buffer_get_pointer + buffer_set + current_window + window_get_integer + window_get_string + window_get_pointer + nicklist_add_group + nicklist_search_group + nicklist_add_nick + nicklist_search_nick + nicklist_remove_group + nicklist_remove_nick + nicklist_remove_all + bar_item_search + bar_item_new + bar_item_update + bar_item_remove + bar_search + bar_new + bar_set + bar_update + bar_remove + command + info_get + infolist_new + infolist_new_var_integer + infolist_new_var_string + infolist_new_var_pointer + infolist_new_var_time + infolist_get + infolist_next + infolist_prev + infolist_fields + infolist_integer + infolist_string + infolist_pointer + infolist_time + infolist_free + upgrade_new + upgrade_write_object + upgrade_read + upgrade_close - - 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/en/dev/plugin_api.en.xml b/doc/en/dev/plugin_api.en.xml index 4ab7ac5be..35abc832f 100644 --- a/doc/en/dev/plugin_api.en.xml +++ b/doc/en/dev/plugin_api.en.xml @@ -26,6 +26,6 @@ along with this program. If not, see . &plugin_c_api.en.xml; - + &plugin_script_api.en.xml; diff --git a/doc/en/dev/plugin_script_api.en.xml b/doc/en/dev/plugin_script_api.en.xml index 479daf3d7..0067b6f3a 100644 --- a/doc/en/dev/plugin_script_api.en.xml +++ b/doc/en/dev/plugin_script_api.en.xml @@ -24,11 +24,9 @@ along with this program. If not, see .
Script plugin API - -
diff --git a/doc/fr/dev/plugin_api.fr.xml b/doc/fr/dev/plugin_api.fr.xml index 2710aec03..9ccfa416e 100644 --- a/doc/fr/dev/plugin_api.fr.xml +++ b/doc/fr/dev/plugin_api.fr.xml @@ -26,6 +26,6 @@ along with this program. If not, see . &plugin_c_api.fr.xml; - + &plugin_script_api.fr.xml; diff --git a/doc/fr/dev/plugin_script_api.fr.xml b/doc/fr/dev/plugin_script_api.fr.xml index 97cd230e9..508ab36d0 100644 --- a/doc/fr/dev/plugin_script_api.fr.xml +++ b/doc/fr/dev/plugin_script_api.fr.xml @@ -25,8 +25,8 @@ along with this program. If not, see . Extensions pour scripts - Quatre extensions sont fournies en standard avec WeeChat pour utiliser - des langages de script : Perl, Python, Ruby et Lua. + Cinq extensions sont fournies en standard avec WeeChat pour utiliser + des langages de script : Perl, Python, Ruby, Lua et Tcl.
@@ -35,9 +35,9 @@ along with this program. If not, see . 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). + /ruby, /lua + et /tcl (tapez /help dans WeeChat + pour obtenir de l'aide sur les commandes). @@ -91,6 +91,18 @@ along with this program. If not, see . /lua + + + Charger un script Tcl : + /tcl load /tmp/essai.tcl + + + + + Lister les scripts Tcl chargés : + /tcl + + @@ -106,7 +118,10 @@ along with this program. If not, see . 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"); + +weechat::register("test", "Auteur <auteur\@domaine.com>", "1.0", + "GPL3", "Description du script", "au_revoir", ""); +
@@ -123,7 +138,10 @@ along with this program. If not, see . 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") + +weechat.register("test", "Auteur <auteur@domaine.com>", "1.0", + "GPL3", "Description du script", "au_revoir", "") +
@@ -139,14 +157,9 @@ along with this program. If not, see . 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 + Weechat.register("test", "Auteur <auteur@domaine.com>", "1.0", + "GPL3", "Description du script", "au_revoir", "") + return Weechat::WEECHAT_RC_OK end @@ -169,10 +182,23 @@ end suffixées par "()". Exemple : -function message_handler(server, args) - weechat.print("Je suis un message handler") - return weechat.PLUGIN_RC_OK() -end +weechat.register("test", "Auteur <auteur@domaine.com>", "1.0", + "GPL3", "Description du script", "au_revoir", "") + + + + + +
+ Tcl + + + Dans un script Tcl WeeChat, toutes les fonctions de l'interface + sont préfixées par "weechat::". + Les variables sont préfixées par "$weechat::". + Exemple : + +weechat::register "test" "Auteur <auteur@domaine.com>" "1.0" "GPL3" "Description du script" "au_revoir" "" @@ -189,29 +215,36 @@ end Prototype Perl : - weechat::register(nom, version, fonction_de_fin, description, - [charset]); + weechat::register(nom, auteur, version, licence, description, + fonction_de_fin, charset); Prototype Python : - weechat.register(nom, version, fonction_de_fin, description, - [charset]) + weechat.register(nom, auteur, version, licence, description, + fonction_de_fin, charset) Prototype Ruby : - Weechat.register(nom, version, fonction_de_fin, description, - [charset]) + Weechat.register(nom, auteur, version, licence, description, + fonction_de_fin, charset) Prototype Lua : - weechat.register(nom, version, fonction_de_fin, description, - [charset]) + weechat.register(nom, auteur, version, licence, description, + fonction_de_fin, charset) + + + + Prototype Tcl : + + weechat::register nom auteur version licence description + fonction_de_fin charset @@ -227,11 +260,22 @@ end (chaque script doit avoir un nom différent) + + + : chaîne avec l'auteur (peut include + nom, pseudo, e-mail, etc...) + + : version du script + + + : brève description du script + + : fonction appelée quand @@ -239,15 +283,12 @@ end 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 + préciser si le script n'est PAS écrit en UTF-8 (vous pouvez + laisser blanc pour un script UTF-8, c'est le jeu de caractère + par défaut) @@ -260,2614 +301,169 @@ end Exemples : # perl -weechat::register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1"); +weechat::register("test", "Auteur <auteur\@domaine.com>", "1.0", + "GPL3", "Description du script", "au_revoir", ""); # python -weechat.register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1") +weechat.register("test", "Auteur <auteur@domaine.com>", "1.0", + "GPL3", "Description du script", "au_revoir", "") # ruby -Weechat.register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1") +Weechat.register("test", "Auteur <auteur@domaine.com>", "1.0", + "GPL3", "Description du script", "au_revoir", "") -- lua -weechat.register("essai", "1.0", "fin_essai", "Script d'essai !", "ISO-8859-1") +weechat.register("test", "Auteur <auteur@domaine.com>", "1.0", + "GPL3", "Description du script", "au_revoir", "") + +# tcl +weechat::register "test" "Auteur <auteur@domaine.com>" "1.0" "GPL3" "Description du script" "au_revoir" ""
- -
- set_charset + +
+ Autres fonctions - 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 : + Les fonctions suivantes sont dans l'API scripts (pour la description, + voir ). - - - : nouveau jeu de caractères - - + plugin_get_name + set_charset + plugin_get_name + charset_set + iconv_to_internal + iconv_from_internal + gettext + ngettext + string_remove_color + mkdir_home + mkdir + mkdir_parents + list_new + list_add + list_search + list_casesearch + list_get + list_set + list_next + list_prev + list_string + list_size + list_remove + list_remove_all + list_free + config_new + config_new_section + config_search_section + config_new_option + config_search_option + config_string_to_boolean + config_option_reset + config_option_set + config_option_set_null + config_option_unset + config_option_rename + config_option_is_null + config_option_default_is_null + config_boolean + config_boolean_default + config_integer + config_integer_default + config_string + config_string_default + config_color + config_color_default + config_write_option + config_write_line + config_write + config_read + config_reload + config_option_free + config_section_free_options + config_section_free + config_free + config_get + config_get_plugin + config_set_plugin + config_unset_plugin + prefix + color + print + print_date_tags + print_y + log_print + hook_command + hook_command_run + hook_timer + hook_fd + hook_process + hook_connect + hook_print + hook_signal + hook_signal_send + hook_config + hook_completion + hook_completion_list_add + hook_modifier + hook_modifier_exec + hook_info + hook_infolist + unhook + unhook_all + buffer_new + buffer_search + current_buffer + buffer_clear + buffer_close + buffer_get_integer + buffer_get_string + buffer_get_pointer + buffer_set + current_window + window_get_integer + window_get_string + window_get_pointer + nicklist_add_group + nicklist_search_group + nicklist_add_nick + nicklist_search_nick + nicklist_remove_group + nicklist_remove_nick + nicklist_remove_all + bar_item_search + bar_item_new + bar_item_update + bar_item_remove + bar_search + bar_new + bar_set + bar_update + bar_remove + command + info_get + infolist_new + infolist_new_var_integer + infolist_new_var_string + infolist_new_var_pointer + infolist_new_var_time + infolist_get + infolist_next + infolist_prev + infolist_fields + infolist_integer + infolist_string + infolist_pointer + infolist_time + infolist_free + upgrade_new + upgrade_write_object + upgrade_read + upgrade_close - - 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") - - -
- -
- 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 - -