diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-10-25 13:09:11 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-10-25 13:09:11 +0200 |
commit | 4e6c4ceb5f350e0e54257ead8bc527492378f489 (patch) | |
tree | b8bc95e76ab3599795f302e13cc3e5a59ba3daff /doc | |
parent | e5afd593ab1342b265b373169ce7a62a9c6cbf1a (diff) | |
download | weechat-4e6c4ceb5f350e0e54257ead8bc527492378f489.zip |
Add irc modifier and irc_parse_message in scripting guide
Diffstat (limited to 'doc')
-rw-r--r-- | doc/de/weechat_scripting.de.txt | 47 | ||||
-rw-r--r-- | doc/en/weechat_scripting.en.txt | 45 | ||||
-rw-r--r-- | doc/fr/weechat_scripting.fr.txt | 47 | ||||
-rw-r--r-- | doc/it/weechat_scripting.it.txt | 47 |
4 files changed, 174 insertions, 12 deletions
diff --git a/doc/de/weechat_scripting.de.txt b/doc/de/weechat_scripting.de.txt index 6810a3528..25c17c0a1 100644 --- a/doc/de/weechat_scripting.de.txt +++ b/doc/de/weechat_scripting.de.txt @@ -277,9 +277,10 @@ Liste der Skript API Funktionen: prnt_date_tags), print_y (für Python: prnt_y), log_print | Hooks | 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_info_hashtable, hook_infolist, unhook, unhook_all + hook_connect, hook_print, hook_signal, hook_signal_send, hook_hsignal, + hook_hsignal_send, hook_config, hook_completion, hook_completion_list_add, + hook_modifier, hook_modifier_exec, hook_info, hook_info_hashtable, + hook_infolist, unhook, unhook_all | Buffer | buffer_new, current_buffer, buffer_search, buffer_search_main, buffer_clear, buffer_close, buffer_merge, buffer_unmerge, buffer_get_integer, @@ -698,6 +699,46 @@ def join_cb(data, signal, signal_data): weechat.hook_signal("*,irc_in2_join", "join_cb", "") ---------------------------------------- +// TRANSLATION MISSING +[[irc_modify_messages]] +Modify messages +^^^^^^^^^^^^^^^ + +IRC plugin sends a "modifier" called "irc_in_xxx" ("xxx" is IRC command) for a +message received, so that you can modify it. + +[source,python] +---------------------------------------- +def modifier_cb(data, modifier, modifier_data, string): + # add server name to all messages received + # (ok that's not very useful, but that's just an example!) + return "%s %s" % (string, modifier_data) + +weechat.hook_modifier("irc_in_privmsg", "modifier_cb", "") +---------------------------------------- + +[WARNING] +A malformed message could crash WeeChat or cause severe problems! + +// TRANSLATION MISSING +[[irc_parse_message]] +Parse message +^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +You can parse an IRC message with info_hashtable called "irc_parse_message". + +[source,python] +---------------------------------------- +dict = weechat.info_get_hashtable("irc_parse_message", + { "message": ":nick!user@host PRIVMSG #weechat :message here" }) +weechat.prnt("", "dict: %s" % dict) + +# output: +# dict: {'nick': 'nick', 'host': 'nick!user@host', 'command': 'PRIVMSG', 'arguments': '#weechat :message here', 'channel': '#weechat'} +---------------------------------------- + [[infos]] Infos ~~~~~ diff --git a/doc/en/weechat_scripting.en.txt b/doc/en/weechat_scripting.en.txt index 49af78bf7..157471160 100644 --- a/doc/en/weechat_scripting.en.txt +++ b/doc/en/weechat_scripting.en.txt @@ -270,9 +270,10 @@ List of functions in script API: prnt_date_tags), print_y (for python: prnt_y), log_print | hooks | 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_info_hashtable, hook_infolist, unhook, unhook_all + hook_connect, hook_print, hook_signal, hook_signal_send, hook_hsignal, + hook_hsignal_send, hook_config, hook_completion, hook_completion_list_add, + hook_modifier, hook_modifier_exec, hook_info, hook_info_hashtable, + hook_infolist, unhook, unhook_all | buffers | buffer_new, current_buffer, buffer_search, buffer_search_main, buffer_clear, buffer_close, buffer_merge, buffer_unmerge, buffer_get_integer, @@ -683,6 +684,44 @@ def join_cb(data, signal, signal_data): weechat.hook_signal("*,irc_in2_join", "join_cb", "") ---------------------------------------- +[[irc_modify_messages]] +Modify messages +^^^^^^^^^^^^^^^ + +IRC plugin sends a "modifier" called "irc_in_xxx" ("xxx" is IRC command) for a +message received, so that you can modify it. + +[source,python] +---------------------------------------- +def modifier_cb(data, modifier, modifier_data, string): + # add server name to all messages received + # (ok that's not very useful, but that's just an example!) + return "%s %s" % (string, modifier_data) + +weechat.hook_modifier("irc_in_privmsg", "modifier_cb", "") +---------------------------------------- + +[WARNING] +A malformed message could crash WeeChat or cause severe problems! + +[[irc_parse_message]] +Parse message +^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +You can parse an IRC message with info_hashtable called "irc_parse_message". + +[source,python] +---------------------------------------- +dict = weechat.info_get_hashtable("irc_parse_message", + { "message": ":nick!user@host PRIVMSG #weechat :message here" }) +weechat.prnt("", "dict: %s" % dict) + +# output: +# dict: {'nick': 'nick', 'host': 'nick!user@host', 'command': 'PRIVMSG', 'arguments': '#weechat :message here', 'channel': '#weechat'} +---------------------------------------- + [[infos]] Infos ~~~~~ diff --git a/doc/fr/weechat_scripting.fr.txt b/doc/fr/weechat_scripting.fr.txt index c95bd38ff..447466362 100644 --- a/doc/fr/weechat_scripting.fr.txt +++ b/doc/fr/weechat_scripting.fr.txt @@ -279,9 +279,10 @@ Liste des fonctions de l'API script : prnt_date_tags), print_y (for python: prnt_y), log_print | hooks | 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_info_hashtable, hook_infolist, unhook, unhook_all + hook_connect, hook_print, hook_signal, hook_signal_send, hook_hsignal, + hook_hsignal_send, hook_config, hook_completion, hook_completion_list_add, + hook_modifier, hook_modifier_exec, hook_info, hook_info_hashtable, + hook_infolist, unhook, unhook_all | tampons | buffer_new, current_buffer, buffer_search, buffer_search_main, buffer_clear, buffer_close, buffer_merge, buffer_unmerge, buffer_get_integer, @@ -701,6 +702,46 @@ def join_cb(data, signal, signal_data): weechat.hook_signal("*,irc_in2_join", "join_cb", "") ---------------------------------------- +[[irc_modify_messages]] +Modifier des messages +^^^^^^^^^^^^^^^^^^^^^ + +L'extension IRC envoie un "modifier" appelé "irc_in_xxx" ("xxx" est la commande +IRC) pour un message reçu, de sorte que vous puissiez le modifier. + +[source,python] +---------------------------------------- +def modifier_cb(data, modifier, modifier_data, string): + # ajouter le nom du serveur à tous les messages reçus + # (ok ce n'est pas très utile, mais c'est juste un exemple !) + return "%s %s" % (string, modifier_data) + +weechat.hook_modifier("irc_in_privmsg", "modifier_cb", "") +---------------------------------------- + +[WARNING] +Un message mal formé peut provoquer un plantage de WeeChat ou de sérieux +problèmes ! + +[[irc_parse_message]] +Parse message +^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.4._ + +Vous pouvez analyser un message IRC avec l'info_hashtable appelée +"irc_parse_message". + +[source,python] +---------------------------------------- +dict = weechat.info_get_hashtable("irc_parse_message", + { "message": ":nick!user@host PRIVMSG #weechat :message ici" }) +weechat.prnt("", "dict: %s" % dict) + +# output: +# dict: {'nick': 'nick', 'host': 'nick!user@host', 'command': 'PRIVMSG', 'arguments': '#weechat :message ici', 'channel': '#weechat'} +---------------------------------------- + [[infos]] Infos ~~~~~ diff --git a/doc/it/weechat_scripting.it.txt b/doc/it/weechat_scripting.it.txt index c18246942..40c83deed 100644 --- a/doc/it/weechat_scripting.it.txt +++ b/doc/it/weechat_scripting.it.txt @@ -279,9 +279,10 @@ Elenco di funzioni nelle API per gli script: prnt_date_tags), print_y (for python: prnt_y), log_print | hook | 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_info_hashtable, hook_infolist, unhook, unhook_all + hook_connect, hook_print, hook_signal, hook_signal_send, hook_hsignal, + hook_hsignal_send, hook_config, hook_completion, hook_completion_list_add, + hook_modifier, hook_modifier_exec, hook_info, hook_info_hashtable, + hook_infolist, unhook, unhook_all | buffer | buffer_new, current_buffer, buffer_search, buffer_search_main, buffer_clear, buffer_close, buffer_merge, buffer_unmerge, buffer_get_integer, @@ -700,6 +701,46 @@ def join_cb(data, signal, signal_data): weechat.hook_signal("*,irc_in2_join", "join_cb", "") ---------------------------------------- +// TRANSLATION MISSING +[[irc_modify_messages]] +Modify messages +^^^^^^^^^^^^^^^ + +IRC plugin sends a "modifier" called "irc_in_xxx" ("xxx" is IRC command) for a +message received, so that you can modify it. + +[source,python] +---------------------------------------- +def modifier_cb(data, modifier, modifier_data, string): + # add server name to all messages received + # (ok that's not very useful, but that's just an example!) + return "%s %s" % (string, modifier_data) + +weechat.hook_modifier("irc_in_privmsg", "modifier_cb", "") +---------------------------------------- + +[WARNING] +A malformed message could crash WeeChat or cause severe problems! + +// TRANSLATION MISSING +[[irc_parse_message]] +Parse message +^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +You can parse an IRC message with info_hashtable called "irc_parse_message". + +[source,python] +---------------------------------------- +dict = weechat.info_get_hashtable("irc_parse_message", + { "message": ":nick!user@host PRIVMSG #weechat :message here" }) +weechat.prnt("", "dict: %s" % dict) + +# output: +# dict: {'nick': 'nick', 'host': 'nick!user@host', 'command': 'PRIVMSG', 'arguments': '#weechat :message here', 'channel': '#weechat'} +---------------------------------------- + [[infos]] Info ~~~~ |