From 4c34ac5d8f775782b89adaf796102eec7686c72c Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Thu, 9 Feb 2006 20:47:16 +0000 Subject: Added Lua script plugin --- doc/en/weechat.en.xml | 336 +++++++++++++++++++++++++++++++++++++++-- doc/fr/weechat.fr.xml | 340 ++++++++++++++++++++++++++++++++++++++++-- weechat/doc/en/weechat.en.xml | 336 +++++++++++++++++++++++++++++++++++++++-- weechat/doc/fr/weechat.fr.xml | 340 ++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 1308 insertions(+), 44 deletions(-) diff --git a/doc/en/weechat.en.xml b/doc/en/weechat.en.xml index c40f97151..65988b542 100644 --- a/doc/en/weechat.en.xml +++ b/doc/en/weechat.en.xml @@ -1151,7 +1151,7 @@ fi This chapter describes WeeChat plugins interface (API) and - the default scripts plugins (Perl, Python, Ruby), provided with + the default scripts plugins (Perl, Python, Ruby, Lua), provided with WeeChat. @@ -3203,8 +3203,8 @@ void weechat_plugin_end (t_weechat_plugin *plugin) Scripts plugins - Three plugins are provided with WeeChat to use script languages: - Perl, Python and Ruby. + Four plugins are provided with WeeChat to use script languages: + Perl, Python, Ruby and Lua.
@@ -3212,7 +3212,8 @@ void weechat_plugin_end (t_weechat_plugin *plugin) Scripts are loaded and unloaded with /perl, - /python and /ruby commands + /python, /ruby and + /lua commands (type /help in WeeChat for help about commands). @@ -3255,6 +3256,18 @@ void weechat_plugin_end (t_weechat_plugin *plugin) /ruby + + + Load a Lua script: + /lua load /tmp/test.lua + + + + + List all loaded Lua scripts: + /lua + + @@ -3284,6 +3297,12 @@ void weechat_plugin_end (t_weechat_plugin *plugin) Weechat.register ( name, version, end_function, description ) + + Lua prototype: + + weechat.register ( name, version, end_function, description ) + + This is first function to call in script. All WeeChat scripts have to call this function. @@ -3330,6 +3349,9 @@ weechat.register ("test", "1.0", "end_test", "Test script!") # ruby Weechat.register ("test", "1.0", "end_test", "Test script!") + +-- lua +weechat.register ("test", "1.0", "end_test", "Test script!")
@@ -3355,6 +3377,12 @@ Weechat.register ("test", "1.0", "end_test", "Test script!") Weechat.print ( message, [channel, [server]] ) + + Lua prototype: + + weechat.print ( message, [channel, [server]] ) + + Display a message on a WeeChat buffer, identified by server and channel. @@ -3401,6 +3429,11 @@ weechat.prnt ("message", "#weechat", "freenode") 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") @@ -3426,6 +3459,12 @@ Weechat.print ("message", "#weechat", "freenode") Weechat.print_infobar ( time, message ) + + Lua prototype: + + weechat.print_infobar ( time, message ) + + Display a message in infobar for a specified time. @@ -3459,6 +3498,9 @@ weechat.print_infobar (5, "message") # ruby Weechat.print_infobar (5, "message") + +-- lua +weechat.print_infobar (5, "message") @@ -3484,6 +3526,12 @@ Weechat.print_infobar (5, "message") Weechat.add_message_handler ( message, function ) + + Lua prototype: + + weechat.add_message_handler ( message, function ) + + Add an IRC message handler, called when an IRC message is received. @@ -3526,12 +3574,26 @@ sub my_function # python weechat.add_message_handler ("privmsg", my_function) -def ma_fonction(server, args): +def my_function(server, args): weechat.prnt("server="+server) null, channel, message = string.split(args, ":", 2) masque, null, channel = string.split(string.strip(channel), " ", 2) weechat.prnt("mask="+mask+", canal="+channel+", message="+message) return weechat.PLUGIN_RC_OK + +# ruby +def my_function(server, args) + Weechat.print("server=#{server}, args=#{args}") + return Weechat::PLUGIN_RC_OK +end +Weechat.add_message_handler ("privmsg", "my_function") + +-- 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 @@ -3599,6 +3661,14 @@ def ma_fonction(server, args): completion_template] ) + + Lua prototype: + + weechat.add_command_handler ( command, function, + [description, arguments, arguments_description, + completion_template] ) + + Add a WeeChat command handler, called when user uses command (for example /command). @@ -3652,15 +3722,29 @@ def ma_fonction(server, args): weechat::add_command_handler ("command", my_command); sub my_command { - weechat::print("Server: $_[0], arguments: $_[1]\n"); + weechat::print("server= $_[0], args: $_[1]\n"); return weechat::PLUGIN_RC_OK; } # python weechat.add_command_handler ("command", my_command) def my_command(server, args): - weechat.prnt("server:"+server+" arguments:"+args) + weechat.prnt("server="+server+", args="+args) return weechat.PLUGIN_RC_OK + +# ruby +def my_command(server, args) + Weechat.print("server=#{server}, args=#{args}") + return Weechat::PLUGIN_RC_OK +end +Weechat.add_command_handler ("command", "my_command") + +-- 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 @@ -3704,6 +3788,12 @@ def my_command(server, args): Weechat.remove_handler ( name, function ) + + Lua prototype: + + weechat.remove_handler ( name, function ) + + Remove a handler. @@ -3736,6 +3826,9 @@ weechat.remove_handler ("command", my_command) # ruby Weechat.remove_handler ("command", my_command) + +-- lua +weechat.remove_handler ("command", "my_command") @@ -3761,6 +3854,12 @@ Weechat.remove_handler ("command", my_command) Weechat.command ( command, [channel, [server]] ) + + Lua prototype: + + weechat.command ( command, [channel, [server]] ) + + Execute a WeeChat command (or send a message to a channel). @@ -3806,6 +3905,11 @@ weechat.command ("/nick newnick", "", "freenode") 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") @@ -3831,6 +3935,12 @@ Weechat.command ("/nick newnick", "", "freenode") Weechat.get_info ( name, [server] ) + + Lua prototype: + + weechat.get_info ( name, [server] ) + + Return an info about WeeChat or a channel. @@ -3865,6 +3975,14 @@ $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") @@ -3890,6 +4008,12 @@ nick = weechat.get_info ("nick", "freenode") Weechat.get_dcc_info ( ) + + Lua prototype: + + weechat.get_dcc_info ( ) + + Return list of DCC currently active or finished. @@ -3897,6 +4021,75 @@ nick = weechat.get_info ("nick", "freenode") Return value: list of DCC (see ). + + Examples: + +# perl +my @dccs = weechat::get_dcc_info(); +if (@dccs) +{ + foreach my $dcc (@dccs) + { + while (my ($key, $value) = each %$dcc) + { + weechat::print("$key = '$value'"); + } + } +} +else +{ + weechat::print("no DCC"); +} + +# python +dccs = weechat.get_dcc_info() +if dccs != None: + if dccs == []: + weechat.prnt("no DCC") + else: + for d in dccs: + for b in d.keys(): + weechat.prnt("%s = '%s'" %(b, d[b])) +else: + weechat.prnt("error while getting DCC") + +# ruby +dccs = Weechat.get_dcc_info() +if dccs != nil + if dccs == [] + Weechat.print("no DCC") + else + dccs.each do |m| + m.each do |key, value| + Weechat.print("#{key} = '#{value}'") + end + end + end +else + Weechat.print("error while getting DCC") +end + +-- lua +dccs = weechat.get_dcc_info() +if dccs ~= nil then + if dccs then + dcc, dccinfos = next (dccs, nil) + while (dcc) do + key, value = next (dccinfos, nil) + while (key) do + weechat.print(key.." = '"..value.."'") + key, value = next (dccinfos, key) + end + dcc, dccinfos = next (dccs, dcc) + end + else + weechat.print("no DCC") + end +else + weechat.print("error while getting DCC") +end + +
@@ -3920,6 +4113,12 @@ nick = weechat.get_info ("nick", "freenode") Weechat.get_server_info ( ) + + Lua prototype: + + weechat.get_server_info ( ) + + Return list of IRC servers (connected or not). @@ -3974,6 +4173,26 @@ if servers != nil 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(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
@@ -3999,6 +4218,12 @@ end Weechat.get_channel_info ( server ) + + Lua prototype: + + weechat.get_channel_info ( server ) + + Return list of IRC channels for a server. @@ -4010,7 +4235,7 @@ end Examples: # perl -my $channels = weechat::get_channel_info(weechat::get_info('server')); +my $channels = weechat::get_channel_info(weechat::get_info("server")); if ($channels) { while (my ($channame, $chaninfos) = each %$channels) @@ -4027,7 +4252,7 @@ else } # python -chans = weechat.get_channel_info(weechat.get_info('server')) +chans = weechat.get_channel_info(weechat.get_info("server")) if chans != None: if chans == {}: weechat.prnt("no channel") @@ -4039,7 +4264,7 @@ else: weechat.prnt("error while getting channels") # ruby -channels = Weechat.get_channel_info(Weechat.get_info('server')) +channels = Weechat.get_channel_info(Weechat.get_info("server")) if channels != nil if channels == {} Weechat.print("no channel") @@ -4053,6 +4278,26 @@ if channels != nil 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(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 @@ -4078,6 +4323,12 @@ end Weechat.get_nick_info ( server, channel ) + + Lua prototype: + + weechat.get_nick_info ( server, channel ) + + Return list of nicks for a channel. @@ -4132,6 +4383,26 @@ if nicks != nil 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 @@ -4157,6 +4428,12 @@ end Weechat.get_config ( option ) + + Lua prototype: + + weechat.get_config ( option ) + + Return value of a WeeChat config option. @@ -4183,6 +4460,14 @@ $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") @@ -4208,6 +4493,12 @@ value2 = weechat.get_config ("freenode.server_autojoin") Weechat.set_config ( option, value ) + + Lua prototype: + + weechat.set_config ( option, value ) + + Update value of a WeeChat config option. @@ -4244,6 +4535,10 @@ 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") @@ -4269,6 +4564,12 @@ Weechat.set_config ("freenode.server_autojoin, "#weechat") Weechat.get_plugin_config ( option ) + + Lua prototype: + + weechat.get_plugin_config ( option ) + + Return value of a plugin option. Option is read from file "~/.weechat/plugins.rc" and is like: @@ -4296,6 +4597,12 @@ $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") @@ -4321,6 +4628,12 @@ value = weechat.get_plugin_config ("my_var") Weechat.set_plugin_config ( option, value ) + + Lua prototype: + + weechat.set_plugin_config ( option, value ) + + Update value of a plugin option. Option is written in file "~/.weechat/plugins.rc" and is like: @@ -4357,6 +4670,9 @@ weechat.set_plugin_config ("my_var", "value") # ruby Weechat.set_plugin_config ("my_var", "value") + +-- lua +weechat.set_plugin_config ("my_var", "value") diff --git a/doc/fr/weechat.fr.xml b/doc/fr/weechat.fr.xml index 2d802c518..77a8e6b17 100644 --- a/doc/fr/weechat.fr.xml +++ b/doc/fr/weechat.fr.xml @@ -1168,7 +1168,7 @@ fi Ce chapitre décrit l'interface des extensions (API) et les extensions - pour scripts (Perl, Python, Ruby), fournies avec WeeChat. + pour scripts (Perl, Python, Ruby, Lua), fournies avec WeeChat.
@@ -3267,7 +3267,7 @@ void weechat_plugin_end (t_weechat_plugin *plugin) Trois extensions sont fournies en standard avec WeeChat pour utiliser - des langages de script : Perl, Python et Ruby. + des langages de script : Perl, Python, Ruby et Lua.
@@ -3275,9 +3275,10 @@ void weechat_plugin_end (t_weechat_plugin *plugin) Les scripts sont chargés et déchargés avec les commandes - /perl, /python et - /ruby (tapez /help dans - WeeChat pour obtenir de l'aide sur les commandes). + /perl, /python, + /ruby et /lua + (tapez /help dans WeeChat pour obtenir + de l'aide sur les commandes). @@ -3319,6 +3320,18 @@ void weechat_plugin_end (t_weechat_plugin *plugin) /ruby + + + Charger un script Lua : + /lua load /tmp/essai.lua + + + + + Lister les scripts Lua chargés : + /lua + + @@ -3348,6 +3361,12 @@ void weechat_plugin_end (t_weechat_plugin *plugin) Weechat.register ( nom, version, fonction_de_fin, description ) + + Prototype Lua : + + weechat.register ( nom, version, fonction_de_fin, description ) + + C'est la première fonction à appeler dans le script. Tout script pour WeeChat doit appeler cette fonction. @@ -3395,6 +3414,9 @@ weechat.register ("essai", "1.0", "fin_essai", "Script d'essai !") # ruby Weechat.register ("essai", "1.0", "fin_essai", "Script d'essai !") + +-- lua +weechat.register ("essai", "1.0", "fin_essai", "Script d'essai !")
@@ -3420,6 +3442,12 @@ Weechat.register ("essai", "1.0", "fin_essai", "Script d'essai !") 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. @@ -3466,6 +3494,11 @@ weechat.prnt ("message", "#weechat", "freenode") 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")
@@ -3491,6 +3524,12 @@ Weechat.print ("message", "#weechat", "freenode") Weechat.print_infobar ( temps, message ) + + Prototype Lua : + + weechat.print_infobar ( temps, message ) + + Affiche un message sur la barre d'infos pour un temps déterminé. @@ -3524,6 +3563,9 @@ weechat.print_infobar (5, "message") # ruby Weechat.print_infobar (5, "message") + +-- lua +weechat.print_infobar (5, "message") @@ -3549,6 +3591,12 @@ Weechat.print_infobar (5, "message") 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. @@ -3599,6 +3647,20 @@ def ma_fonction(serveur, args): masque, null, canal = string.split(string.strip(canal), " ", 2) weechat.prnt("masque="+masque+", canal="+canal+", message="+message) return weechat.PLUGIN_RC_OK + +# ruby +def ma_fonction(server, args) + Weechat.print("serveur=#{server}, args=#{args}") + return Weechat::PLUGIN_RC_OK +end +Weechat.add_message_handler ("privmsg", "ma_fonction") + +-- 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 @@ -3665,6 +3727,14 @@ def ma_fonction(serveur, args): 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). @@ -3719,15 +3789,29 @@ def ma_fonction(serveur, args): weechat::add_command_handler ("commande", ma_commande); sub ma_commande { - weechat::print("Serveur: $_[0], paramètres: $_[1]\n"); + weechat::print("serveur=$_[0], args=$_[1]\n"); return weechat::PLUGIN_RC_OK; } # python weechat.add_command_handler ("commande", ma_commande) def ma_commande(serveur, args): - weechat.prnt("serveur:"+serveur+" paramètres:"+args) + weechat.prnt("serveur="+serveur+", args="+args) return weechat.PLUGIN_RC_OK + +# ruby +def ma_commande(server, args) + Weechat.print("serveur=#{server} args=#{args}") + return Weechat::PLUGIN_RC_OK +end +Weechat.add_command_handler ("command", "ma_commande") + +-- lua +weechat.add_command_handler ("command", "ma_commande") +def my_command(server, args) + weechat.print("serveur="..server..", args="..args) + return weechat.PLUGIN_RC_OK() +end @@ -3770,6 +3854,12 @@ def ma_commande(serveur, args): Weechat.remove_handler ( nom, fonction ) + + Prototype Lua : + + weechat.remove_handler ( nom, fonction ) + + Supprime un gestionnaire. @@ -3802,6 +3892,9 @@ weechat.remove_handler ("commande", ma_commande) # ruby Weechat.remove_handler ("commande", ma_commande) + +-- lua +weechat.remove_handler ("commande", "ma_commande") @@ -3827,6 +3920,12 @@ Weechat.remove_handler ("commande", ma_commande) Weechat.command ( commande, [canal, [serveur]] ) + + Prototype Lua : + + weechat.command ( commande, [canal, [serveur]] ) + + Exécute une commande ou envoie un message à un canal. @@ -3872,6 +3971,11 @@ weechat.command ("/nick newnick", "", "freenode") 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") @@ -3897,6 +4001,12 @@ Weechat.command ("/nick newnick", "", "freenode") Weechat.get_info ( nom, [serveur] ) + + Prototype Lua : + + weechat.get_info ( nom, [serveur] ) + + Renvoie une information sur WeeChat ou un canal. @@ -3931,6 +4041,14 @@ $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") @@ -3956,6 +4074,12 @@ nick = weechat.get_info ("nick", "freenode") Weechat.get_dcc_info ( ) + + Prototype Lua : + + weechat.get_dcc_info ( ) + + Renvoie la liste des DCC en cours ou terminés. @@ -3963,6 +4087,75 @@ nick = weechat.get_info ("nick", "freenode") 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 + +
@@ -3986,6 +4179,12 @@ nick = weechat.get_info ("nick", "freenode") Weechat.get_server_info ( ) + + Prototype Lua : + + weechat.get_server_info ( ) + + Renvoie la liste des serveurs IRC (connectés ou non). @@ -4002,7 +4201,7 @@ if ($servers) { while (my ($srvname, $srvinfos) = each %$servers) { - while ( my ($key, $value) = each %$srvinfos) + while (my ($key, $value) = each %$srvinfos) { weechat::print("$srvname[$key] = '$value'"); } @@ -4040,6 +4239,26 @@ if servers != nil 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(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
@@ -4065,6 +4284,12 @@ end Weechat.get_channel_info ( serveur ) + + Prototype Lua : + + weechat.get_channel_info ( serveur ) + + Renvoie la liste des canaux IRC pour un serveur. @@ -4076,7 +4301,7 @@ end Exemples : # perl -my $channels = weechat::get_channel_info(weechat::get_info('server')); +my $channels = weechat::get_channel_info(weechat::get_info("server")); if ($channels) { while (my ($channame, $chaninfos) = each %$channels) @@ -4093,7 +4318,7 @@ else } # python -chans = weechat.get_channel_info(weechat.get_info('server')) +chans = weechat.get_channel_info(weechat.get_info("server")) if chans != None: if chans == {}: weechat.prnt("pas de canal") @@ -4105,7 +4330,7 @@ else: weechat.prnt("erreur de lecture des canaux") # ruby -channels = Weechat.get_channel_info(Weechat.get_info('server')) +channels = Weechat.get_channel_info(Weechat.get_info("server")) if channels != nil if channels == {} Weechat.print("pas de canal") @@ -4119,6 +4344,26 @@ if channels != nil 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(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 @@ -4129,7 +4374,7 @@ end Prototype Perl : - weechat::get_nick_info ( server, canal ); + weechat::get_nick_info ( serveur, canal ); @@ -4144,6 +4389,12 @@ end Weechat.get_nick_info ( serveur, canal ) + + Prototype Lua : + + weechat.get_nick_info ( serveur, canal ) + + Renvoie la liste des pseudos pour un canal. @@ -4198,6 +4449,26 @@ if nicks != nil 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 @@ -4223,6 +4494,12 @@ end Weechat.get_config ( option ) + + Prototype Lua : + + weechat.get_config ( option ) + + Renvoie la valeur d'une option de configuration WeeChat. @@ -4250,6 +4527,14 @@ $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") @@ -4275,6 +4560,12 @@ value2 = weechat.get_config ("freenode.server_autojoin") Weechat.set_config ( option, valeur ) + + Prototype Lua : + + weechat.set_config ( option, valeur ) + + Modifie la valeur d'une option de configuration WeeChat. @@ -4312,6 +4603,10 @@ 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") @@ -4337,6 +4632,12 @@ Weechat.set_config ("freenode.server_autojoin, "#weechat") 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 @@ -4368,6 +4669,12 @@ $value = weechat::get_plugin_config ("ma_variable"); # python value = weechat.get_plugin_config ("ma_variable") + +# ruby +value = Weechat.get_plugin_config ("ma_variable") + +-- lua +value = weechat.get_plugin_config ("ma_variable") @@ -4393,6 +4700,12 @@ value = weechat.get_plugin_config ("ma_variable") 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 @@ -4433,6 +4746,9 @@ weechat.set_plugin_config ("ma_variable", "valeur") # ruby Weechat.set_plugin_config ("ma_variable", "valeur") + +-- lua +weechat.set_plugin_config ("ma_variable", "valeur") diff --git a/weechat/doc/en/weechat.en.xml b/weechat/doc/en/weechat.en.xml index c40f97151..65988b542 100644 --- a/weechat/doc/en/weechat.en.xml +++ b/weechat/doc/en/weechat.en.xml @@ -1151,7 +1151,7 @@ fi This chapter describes WeeChat plugins interface (API) and - the default scripts plugins (Perl, Python, Ruby), provided with + the default scripts plugins (Perl, Python, Ruby, Lua), provided with WeeChat. @@ -3203,8 +3203,8 @@ void weechat_plugin_end (t_weechat_plugin *plugin) Scripts plugins - Three plugins are provided with WeeChat to use script languages: - Perl, Python and Ruby. + Four plugins are provided with WeeChat to use script languages: + Perl, Python, Ruby and Lua.
@@ -3212,7 +3212,8 @@ void weechat_plugin_end (t_weechat_plugin *plugin) Scripts are loaded and unloaded with /perl, - /python and /ruby commands + /python, /ruby and + /lua commands (type /help in WeeChat for help about commands). @@ -3255,6 +3256,18 @@ void weechat_plugin_end (t_weechat_plugin *plugin) /ruby + + + Load a Lua script: + /lua load /tmp/test.lua + + + + + List all loaded Lua scripts: + /lua + + @@ -3284,6 +3297,12 @@ void weechat_plugin_end (t_weechat_plugin *plugin) Weechat.register ( name, version, end_function, description ) + + Lua prototype: + + weechat.register ( name, version, end_function, description ) + + This is first function to call in script. All WeeChat scripts have to call this function. @@ -3330,6 +3349,9 @@ weechat.register ("test", "1.0", "end_test", "Test script!") # ruby Weechat.register ("test", "1.0", "end_test", "Test script!") + +-- lua +weechat.register ("test", "1.0", "end_test", "Test script!")
@@ -3355,6 +3377,12 @@ Weechat.register ("test", "1.0", "end_test", "Test script!") Weechat.print ( message, [channel, [server]] ) + + Lua prototype: + + weechat.print ( message, [channel, [server]] ) + + Display a message on a WeeChat buffer, identified by server and channel. @@ -3401,6 +3429,11 @@ weechat.prnt ("message", "#weechat", "freenode") 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") @@ -3426,6 +3459,12 @@ Weechat.print ("message", "#weechat", "freenode") Weechat.print_infobar ( time, message ) + + Lua prototype: + + weechat.print_infobar ( time, message ) + + Display a message in infobar for a specified time. @@ -3459,6 +3498,9 @@ weechat.print_infobar (5, "message") # ruby Weechat.print_infobar (5, "message") + +-- lua +weechat.print_infobar (5, "message") @@ -3484,6 +3526,12 @@ Weechat.print_infobar (5, "message") Weechat.add_message_handler ( message, function ) + + Lua prototype: + + weechat.add_message_handler ( message, function ) + + Add an IRC message handler, called when an IRC message is received. @@ -3526,12 +3574,26 @@ sub my_function # python weechat.add_message_handler ("privmsg", my_function) -def ma_fonction(server, args): +def my_function(server, args): weechat.prnt("server="+server) null, channel, message = string.split(args, ":", 2) masque, null, channel = string.split(string.strip(channel), " ", 2) weechat.prnt("mask="+mask+", canal="+channel+", message="+message) return weechat.PLUGIN_RC_OK + +# ruby +def my_function(server, args) + Weechat.print("server=#{server}, args=#{args}") + return Weechat::PLUGIN_RC_OK +end +Weechat.add_message_handler ("privmsg", "my_function") + +-- 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 @@ -3599,6 +3661,14 @@ def ma_fonction(server, args): completion_template] ) + + Lua prototype: + + weechat.add_command_handler ( command, function, + [description, arguments, arguments_description, + completion_template] ) + + Add a WeeChat command handler, called when user uses command (for example /command). @@ -3652,15 +3722,29 @@ def ma_fonction(server, args): weechat::add_command_handler ("command", my_command); sub my_command { - weechat::print("Server: $_[0], arguments: $_[1]\n"); + weechat::print("server= $_[0], args: $_[1]\n"); return weechat::PLUGIN_RC_OK; } # python weechat.add_command_handler ("command", my_command) def my_command(server, args): - weechat.prnt("server:"+server+" arguments:"+args) + weechat.prnt("server="+server+", args="+args) return weechat.PLUGIN_RC_OK + +# ruby +def my_command(server, args) + Weechat.print("server=#{server}, args=#{args}") + return Weechat::PLUGIN_RC_OK +end +Weechat.add_command_handler ("command", "my_command") + +-- 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 @@ -3704,6 +3788,12 @@ def my_command(server, args): Weechat.remove_handler ( name, function ) + + Lua prototype: + + weechat.remove_handler ( name, function ) + + Remove a handler. @@ -3736,6 +3826,9 @@ weechat.remove_handler ("command", my_command) # ruby Weechat.remove_handler ("command", my_command) + +-- lua +weechat.remove_handler ("command", "my_command") @@ -3761,6 +3854,12 @@ Weechat.remove_handler ("command", my_command) Weechat.command ( command, [channel, [server]] ) + + Lua prototype: + + weechat.command ( command, [channel, [server]] ) + + Execute a WeeChat command (or send a message to a channel). @@ -3806,6 +3905,11 @@ weechat.command ("/nick newnick", "", "freenode") 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") @@ -3831,6 +3935,12 @@ Weechat.command ("/nick newnick", "", "freenode") Weechat.get_info ( name, [server] ) + + Lua prototype: + + weechat.get_info ( name, [server] ) + + Return an info about WeeChat or a channel. @@ -3865,6 +3975,14 @@ $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") @@ -3890,6 +4008,12 @@ nick = weechat.get_info ("nick", "freenode") Weechat.get_dcc_info ( ) + + Lua prototype: + + weechat.get_dcc_info ( ) + + Return list of DCC currently active or finished. @@ -3897,6 +4021,75 @@ nick = weechat.get_info ("nick", "freenode") Return value: list of DCC (see ). + + Examples: + +# perl +my @dccs = weechat::get_dcc_info(); +if (@dccs) +{ + foreach my $dcc (@dccs) + { + while (my ($key, $value) = each %$dcc) + { + weechat::print("$key = '$value'"); + } + } +} +else +{ + weechat::print("no DCC"); +} + +# python +dccs = weechat.get_dcc_info() +if dccs != None: + if dccs == []: + weechat.prnt("no DCC") + else: + for d in dccs: + for b in d.keys(): + weechat.prnt("%s = '%s'" %(b, d[b])) +else: + weechat.prnt("error while getting DCC") + +# ruby +dccs = Weechat.get_dcc_info() +if dccs != nil + if dccs == [] + Weechat.print("no DCC") + else + dccs.each do |m| + m.each do |key, value| + Weechat.print("#{key} = '#{value}'") + end + end + end +else + Weechat.print("error while getting DCC") +end + +-- lua +dccs = weechat.get_dcc_info() +if dccs ~= nil then + if dccs then + dcc, dccinfos = next (dccs, nil) + while (dcc) do + key, value = next (dccinfos, nil) + while (key) do + weechat.print(key.." = '"..value.."'") + key, value = next (dccinfos, key) + end + dcc, dccinfos = next (dccs, dcc) + end + else + weechat.print("no DCC") + end +else + weechat.print("error while getting DCC") +end + +
@@ -3920,6 +4113,12 @@ nick = weechat.get_info ("nick", "freenode") Weechat.get_server_info ( ) + + Lua prototype: + + weechat.get_server_info ( ) + + Return list of IRC servers (connected or not). @@ -3974,6 +4173,26 @@ if servers != nil 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(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
@@ -3999,6 +4218,12 @@ end Weechat.get_channel_info ( server ) + + Lua prototype: + + weechat.get_channel_info ( server ) + + Return list of IRC channels for a server. @@ -4010,7 +4235,7 @@ end Examples: # perl -my $channels = weechat::get_channel_info(weechat::get_info('server')); +my $channels = weechat::get_channel_info(weechat::get_info("server")); if ($channels) { while (my ($channame, $chaninfos) = each %$channels) @@ -4027,7 +4252,7 @@ else } # python -chans = weechat.get_channel_info(weechat.get_info('server')) +chans = weechat.get_channel_info(weechat.get_info("server")) if chans != None: if chans == {}: weechat.prnt("no channel") @@ -4039,7 +4264,7 @@ else: weechat.prnt("error while getting channels") # ruby -channels = Weechat.get_channel_info(Weechat.get_info('server')) +channels = Weechat.get_channel_info(Weechat.get_info("server")) if channels != nil if channels == {} Weechat.print("no channel") @@ -4053,6 +4278,26 @@ if channels != nil 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(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 @@ -4078,6 +4323,12 @@ end Weechat.get_nick_info ( server, channel ) + + Lua prototype: + + weechat.get_nick_info ( server, channel ) + + Return list of nicks for a channel. @@ -4132,6 +4383,26 @@ if nicks != nil 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 @@ -4157,6 +4428,12 @@ end Weechat.get_config ( option ) + + Lua prototype: + + weechat.get_config ( option ) + + Return value of a WeeChat config option. @@ -4183,6 +4460,14 @@ $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") @@ -4208,6 +4493,12 @@ value2 = weechat.get_config ("freenode.server_autojoin") Weechat.set_config ( option, value ) + + Lua prototype: + + weechat.set_config ( option, value ) + + Update value of a WeeChat config option. @@ -4244,6 +4535,10 @@ 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") @@ -4269,6 +4564,12 @@ Weechat.set_config ("freenode.server_autojoin, "#weechat") Weechat.get_plugin_config ( option ) + + Lua prototype: + + weechat.get_plugin_config ( option ) + + Return value of a plugin option. Option is read from file "~/.weechat/plugins.rc" and is like: @@ -4296,6 +4597,12 @@ $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") @@ -4321,6 +4628,12 @@ value = weechat.get_plugin_config ("my_var") Weechat.set_plugin_config ( option, value ) + + Lua prototype: + + weechat.set_plugin_config ( option, value ) + + Update value of a plugin option. Option is written in file "~/.weechat/plugins.rc" and is like: @@ -4357,6 +4670,9 @@ weechat.set_plugin_config ("my_var", "value") # ruby Weechat.set_plugin_config ("my_var", "value") + +-- lua +weechat.set_plugin_config ("my_var", "value") diff --git a/weechat/doc/fr/weechat.fr.xml b/weechat/doc/fr/weechat.fr.xml index 2d802c518..77a8e6b17 100644 --- a/weechat/doc/fr/weechat.fr.xml +++ b/weechat/doc/fr/weechat.fr.xml @@ -1168,7 +1168,7 @@ fi Ce chapitre décrit l'interface des extensions (API) et les extensions - pour scripts (Perl, Python, Ruby), fournies avec WeeChat. + pour scripts (Perl, Python, Ruby, Lua), fournies avec WeeChat.
@@ -3267,7 +3267,7 @@ void weechat_plugin_end (t_weechat_plugin *plugin) Trois extensions sont fournies en standard avec WeeChat pour utiliser - des langages de script : Perl, Python et Ruby. + des langages de script : Perl, Python, Ruby et Lua.
@@ -3275,9 +3275,10 @@ void weechat_plugin_end (t_weechat_plugin *plugin) Les scripts sont chargés et déchargés avec les commandes - /perl, /python et - /ruby (tapez /help dans - WeeChat pour obtenir de l'aide sur les commandes). + /perl, /python, + /ruby et /lua + (tapez /help dans WeeChat pour obtenir + de l'aide sur les commandes). @@ -3319,6 +3320,18 @@ void weechat_plugin_end (t_weechat_plugin *plugin) /ruby + + + Charger un script Lua : + /lua load /tmp/essai.lua + + + + + Lister les scripts Lua chargés : + /lua + + @@ -3348,6 +3361,12 @@ void weechat_plugin_end (t_weechat_plugin *plugin) Weechat.register ( nom, version, fonction_de_fin, description ) + + Prototype Lua : + + weechat.register ( nom, version, fonction_de_fin, description ) + + C'est la première fonction à appeler dans le script. Tout script pour WeeChat doit appeler cette fonction. @@ -3395,6 +3414,9 @@ weechat.register ("essai", "1.0", "fin_essai", "Script d'essai !") # ruby Weechat.register ("essai", "1.0", "fin_essai", "Script d'essai !") + +-- lua +weechat.register ("essai", "1.0", "fin_essai", "Script d'essai !")
@@ -3420,6 +3442,12 @@ Weechat.register ("essai", "1.0", "fin_essai", "Script d'essai !") 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. @@ -3466,6 +3494,11 @@ weechat.prnt ("message", "#weechat", "freenode") 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")
@@ -3491,6 +3524,12 @@ Weechat.print ("message", "#weechat", "freenode") Weechat.print_infobar ( temps, message ) + + Prototype Lua : + + weechat.print_infobar ( temps, message ) + + Affiche un message sur la barre d'infos pour un temps déterminé. @@ -3524,6 +3563,9 @@ weechat.print_infobar (5, "message") # ruby Weechat.print_infobar (5, "message") + +-- lua +weechat.print_infobar (5, "message") @@ -3549,6 +3591,12 @@ Weechat.print_infobar (5, "message") 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. @@ -3599,6 +3647,20 @@ def ma_fonction(serveur, args): masque, null, canal = string.split(string.strip(canal), " ", 2) weechat.prnt("masque="+masque+", canal="+canal+", message="+message) return weechat.PLUGIN_RC_OK + +# ruby +def ma_fonction(server, args) + Weechat.print("serveur=#{server}, args=#{args}") + return Weechat::PLUGIN_RC_OK +end +Weechat.add_message_handler ("privmsg", "ma_fonction") + +-- 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 @@ -3665,6 +3727,14 @@ def ma_fonction(serveur, args): 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). @@ -3719,15 +3789,29 @@ def ma_fonction(serveur, args): weechat::add_command_handler ("commande", ma_commande); sub ma_commande { - weechat::print("Serveur: $_[0], paramètres: $_[1]\n"); + weechat::print("serveur=$_[0], args=$_[1]\n"); return weechat::PLUGIN_RC_OK; } # python weechat.add_command_handler ("commande", ma_commande) def ma_commande(serveur, args): - weechat.prnt("serveur:"+serveur+" paramètres:"+args) + weechat.prnt("serveur="+serveur+", args="+args) return weechat.PLUGIN_RC_OK + +# ruby +def ma_commande(server, args) + Weechat.print("serveur=#{server} args=#{args}") + return Weechat::PLUGIN_RC_OK +end +Weechat.add_command_handler ("command", "ma_commande") + +-- lua +weechat.add_command_handler ("command", "ma_commande") +def my_command(server, args) + weechat.print("serveur="..server..", args="..args) + return weechat.PLUGIN_RC_OK() +end @@ -3770,6 +3854,12 @@ def ma_commande(serveur, args): Weechat.remove_handler ( nom, fonction ) + + Prototype Lua : + + weechat.remove_handler ( nom, fonction ) + + Supprime un gestionnaire. @@ -3802,6 +3892,9 @@ weechat.remove_handler ("commande", ma_commande) # ruby Weechat.remove_handler ("commande", ma_commande) + +-- lua +weechat.remove_handler ("commande", "ma_commande") @@ -3827,6 +3920,12 @@ Weechat.remove_handler ("commande", ma_commande) Weechat.command ( commande, [canal, [serveur]] ) + + Prototype Lua : + + weechat.command ( commande, [canal, [serveur]] ) + + Exécute une commande ou envoie un message à un canal. @@ -3872,6 +3971,11 @@ weechat.command ("/nick newnick", "", "freenode") 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") @@ -3897,6 +4001,12 @@ Weechat.command ("/nick newnick", "", "freenode") Weechat.get_info ( nom, [serveur] ) + + Prototype Lua : + + weechat.get_info ( nom, [serveur] ) + + Renvoie une information sur WeeChat ou un canal. @@ -3931,6 +4041,14 @@ $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") @@ -3956,6 +4074,12 @@ nick = weechat.get_info ("nick", "freenode") Weechat.get_dcc_info ( ) + + Prototype Lua : + + weechat.get_dcc_info ( ) + + Renvoie la liste des DCC en cours ou terminés. @@ -3963,6 +4087,75 @@ nick = weechat.get_info ("nick", "freenode") 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 + +
@@ -3986,6 +4179,12 @@ nick = weechat.get_info ("nick", "freenode") Weechat.get_server_info ( ) + + Prototype Lua : + + weechat.get_server_info ( ) + + Renvoie la liste des serveurs IRC (connectés ou non). @@ -4002,7 +4201,7 @@ if ($servers) { while (my ($srvname, $srvinfos) = each %$servers) { - while ( my ($key, $value) = each %$srvinfos) + while (my ($key, $value) = each %$srvinfos) { weechat::print("$srvname[$key] = '$value'"); } @@ -4040,6 +4239,26 @@ if servers != nil 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(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
@@ -4065,6 +4284,12 @@ end Weechat.get_channel_info ( serveur ) + + Prototype Lua : + + weechat.get_channel_info ( serveur ) + + Renvoie la liste des canaux IRC pour un serveur. @@ -4076,7 +4301,7 @@ end Exemples : # perl -my $channels = weechat::get_channel_info(weechat::get_info('server')); +my $channels = weechat::get_channel_info(weechat::get_info("server")); if ($channels) { while (my ($channame, $chaninfos) = each %$channels) @@ -4093,7 +4318,7 @@ else } # python -chans = weechat.get_channel_info(weechat.get_info('server')) +chans = weechat.get_channel_info(weechat.get_info("server")) if chans != None: if chans == {}: weechat.prnt("pas de canal") @@ -4105,7 +4330,7 @@ else: weechat.prnt("erreur de lecture des canaux") # ruby -channels = Weechat.get_channel_info(Weechat.get_info('server')) +channels = Weechat.get_channel_info(Weechat.get_info("server")) if channels != nil if channels == {} Weechat.print("pas de canal") @@ -4119,6 +4344,26 @@ if channels != nil 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(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 @@ -4129,7 +4374,7 @@ end Prototype Perl : - weechat::get_nick_info ( server, canal ); + weechat::get_nick_info ( serveur, canal ); @@ -4144,6 +4389,12 @@ end Weechat.get_nick_info ( serveur, canal ) + + Prototype Lua : + + weechat.get_nick_info ( serveur, canal ) + + Renvoie la liste des pseudos pour un canal. @@ -4198,6 +4449,26 @@ if nicks != nil 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 @@ -4223,6 +4494,12 @@ end Weechat.get_config ( option ) + + Prototype Lua : + + weechat.get_config ( option ) + + Renvoie la valeur d'une option de configuration WeeChat. @@ -4250,6 +4527,14 @@ $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") @@ -4275,6 +4560,12 @@ value2 = weechat.get_config ("freenode.server_autojoin") Weechat.set_config ( option, valeur ) + + Prototype Lua : + + weechat.set_config ( option, valeur ) + + Modifie la valeur d'une option de configuration WeeChat. @@ -4312,6 +4603,10 @@ 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") @@ -4337,6 +4632,12 @@ Weechat.set_config ("freenode.server_autojoin, "#weechat") 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 @@ -4368,6 +4669,12 @@ $value = weechat::get_plugin_config ("ma_variable"); # python value = weechat.get_plugin_config ("ma_variable") + +# ruby +value = Weechat.get_plugin_config ("ma_variable") + +-- lua +value = weechat.get_plugin_config ("ma_variable") @@ -4393,6 +4700,12 @@ value = weechat.get_plugin_config ("ma_variable") 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 @@ -4433,6 +4746,9 @@ weechat.set_plugin_config ("ma_variable", "valeur") # ruby Weechat.set_plugin_config ("ma_variable", "valeur") + +-- lua +weechat.set_plugin_config ("ma_variable", "valeur") -- cgit v1.2.3