mirror of
https://github.com/weechat/weechat.git
synced 2026-06-28 13:56:37 +02:00
doc: protect monospace text with plus characters (scripting guide)
This commit is contained in:
@@ -60,14 +60,14 @@ Der Code eines Skripts wird ausgeführt:
|
||||
Sobald der Code eines Skripts ausgeführt wird wartet WeeChat bis zum Ende der
|
||||
Ausführung, bevor fortgefahren wird. Deshalb dürfen innerhalb des Skripts *KEINE*
|
||||
blockierende Operationen ausgeführt werden wie zum Beispiel Netzwerkaufrufe,
|
||||
ohne die dafür vorgesehene API-Funktion zu verwenden, `hook_process`.
|
||||
ohne die dafür vorgesehene API-Funktion zu verwenden, `+hook_process+`.
|
||||
|
||||
[IMPORTANT]
|
||||
Ein Skript darf *NIEMALS* einen fork nutzen oder einen eigenen Thread erstellen,
|
||||
dafür gibt es explizit eine API Funktion, andernfalls kann WeeChat abstürzen. +
|
||||
Wenn etwas in einem Hintergrundprozess ausgeführt werden soll, kann die Funktion
|
||||
`hook_process` genutzt werden. Siehe Beispiele im Kapitel <<hook_process,Hintergrundprozesse>>
|
||||
und die Dokumentation für die Funktion `hook_process` in link:weechat_plugin_api.en.html#_hook_process[WeeChat plugin API reference] (Englisch).
|
||||
`+hook_process+` genutzt werden. Siehe Beispiele im Kapitel <<hook_process,Hintergrundprozesse>>
|
||||
und die Dokumentation für die Funktion `+hook_process+` in link:weechat_plugin_api.en.html#_hook_process[WeeChat plugin API reference] (Englisch).
|
||||
|
||||
[[languages_specificities]]
|
||||
=== Besonderheiten der einzelnen Skriptsprachen
|
||||
@@ -81,7 +81,7 @@ importiert werden muss.
|
||||
|
||||
===== Funktionen
|
||||
|
||||
Funktionen werden aufgerufen mittels `weechat.xxx(arg1, arg2, ...)`.
|
||||
Funktionen werden aufgerufen mittels `+weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
Die Funktionen `+print*+` werden bei python durch `+prnt*+` ersetzt
|
||||
(`print` war ein reserviertes Schlüsselwort unter Python 2).
|
||||
@@ -110,9 +110,9 @@ Liste ist nicht vollständig):
|
||||
Eine Nachricht die von der IRC Erweiterung empfangen wurde und bevor sie nach UTF-8 dekodiert wurde (intern
|
||||
verwendet). +
|
||||
+
|
||||
Es wird empfohlen den Modifier `irc_in2_yyy` zu nutzen, da die empfangene Zeichenkette
|
||||
Es wird empfohlen den Modifier `+irc_in2_yyy+` zu nutzen, da die empfangene Zeichenkette
|
||||
immer UTF-8 gültig ist. +
|
||||
siehe Funktion `hook_modifier` in der
|
||||
siehe Funktion `+hook_modifier+` in der
|
||||
link:weechat_plugin_api.en.html#_hook_modifier[WeeChat Anleitung für API Erweiterung].
|
||||
|
||||
| hook_signal |
|
||||
@@ -125,9 +125,9 @@ Liste ist nicht vollständig):
|
||||
Eine Nachricht welche von der IRC Erweiterung versendet wurde, nachdem diese entsprechend
|
||||
der Benutzereinstellung `encode` Charset kodiert (falls abweichend von der `UTF-8` Standardeinstellung). +
|
||||
+
|
||||
Es wird empfohlen das Signal `xxx,irc_out1_yyy` zu nutzen, da die empfangene Zeichenkette
|
||||
Es wird empfohlen das Signal `+xxx,irc_out1_yyy+` zu nutzen, da die empfangene Zeichenkette
|
||||
immer UTF-8 gültig ist. +
|
||||
siehe Funktion `hook_signal` in der
|
||||
siehe Funktion `+hook_signal+` in der
|
||||
link:weechat_plugin_api.en.html#_hook_signal[WeeChat Anleitung für API Erweiterung].
|
||||
|
||||
| hook_process +
|
||||
@@ -146,7 +146,7 @@ oben genannten Fällen, ungültige UTF-8 Daten enthalten.
|
||||
|
||||
===== Funktionen
|
||||
|
||||
Funktionen werden aufgerufen mittels `weechat::xxx(arg1, arg2, ...);`.
|
||||
Funktionen werden aufgerufen mittels `+weechat::xxx(arg1, arg2, ...);+`.
|
||||
|
||||
==== Ruby
|
||||
|
||||
@@ -156,10 +156,10 @@ Es muss _weechat_init_ definiert werden und darin dann _register_ ausgeführt we
|
||||
|
||||
===== Functions
|
||||
|
||||
Funktionen werden aufgerufen mittels `Weechat.xxx(arg1, arg2, ...)`.
|
||||
Funktionen werden aufgerufen mittels `+Weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
Aufgrund einer Beschränkung von Ruby (maximal 15 Argumente pro Funktion), empfängt
|
||||
die Funktion `Weechat.config_new_option` ein Callback mit einem Array von 6 Zeichenketten
|
||||
die Funktion `+Weechat.config_new_option+` ein Callback mit einem Array von 6 Zeichenketten
|
||||
(3 Callbacks + 3 Datenzeichenketten), so sieht ein Aufruf dieser Funktion aus:
|
||||
|
||||
[source,ruby]
|
||||
@@ -172,19 +172,19 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt
|
||||
|
||||
===== Funktionen
|
||||
|
||||
Funktionen werden aufgerufen mittels `weechat.xxx(arg1, arg2, ...)`.
|
||||
Funktionen werden aufgerufen mittels `+weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
==== Tcl
|
||||
|
||||
===== Funktionen
|
||||
|
||||
Funktionen werden aufgerufen mittels `weechat::xxx arg1 arg2 ...`.
|
||||
Funktionen werden aufgerufen mittels `+weechat::xxx arg1 arg2 ...+`.
|
||||
|
||||
==== Guile (Scheme)
|
||||
|
||||
===== Funktionen
|
||||
|
||||
Funktionen werden aufgerufen mittels `(weechat:xxx arg1 arg2 ...)`.
|
||||
Funktionen werden aufgerufen mittels `+(weechat:xxx arg1 arg2 ...)+`.
|
||||
|
||||
Die folgenden Funktionen verwenden eine Liste von Argumenten (anstelle vieler Argumente
|
||||
für andere Funktionen), da die Anzahl der Argumente die zulässige Anzahl in Guile
|
||||
@@ -198,13 +198,13 @@ für andere Funktionen), da die Anzahl der Argumente die zulässige Anzahl in Gu
|
||||
|
||||
===== Funktionen
|
||||
|
||||
Funktionen werden aufgerufen mittels `weechat.xxx(arg1, arg2, ...);`.
|
||||
Funktionen werden aufgerufen mittels `+weechat.xxx(arg1, arg2, ...);+`.
|
||||
|
||||
==== PHP
|
||||
|
||||
===== Functions
|
||||
|
||||
Funktionen werden aufgerufen mittels `weechat_xxx(arg1, arg2, ...);`.
|
||||
Funktionen werden aufgerufen mittels `+weechat_xxx(arg1, arg2, ...);+`.
|
||||
|
||||
[[register_function]]
|
||||
=== Die "Register" Funktion
|
||||
@@ -981,7 +981,7 @@ bitte in WeeChat folgenden Befehl aus:
|
||||
[[hook_command]]
|
||||
==== neuen Befehl hinzufügen
|
||||
|
||||
Erstellt mittels `hook_command` einen benutzerdefinierten Befehl. Dabei kann
|
||||
Erstellt mittels `+hook_command+` einen benutzerdefinierten Befehl. Dabei kann
|
||||
eine benutzerdefinierte Vervollständigung der Argumente genutzt werden.
|
||||
|
||||
Beispiel:
|
||||
@@ -1015,7 +1015,7 @@ Der Befehl wird dann in WeeChat wie folgt genutzt:
|
||||
[[hook_timer]]
|
||||
==== Nutzung des Timers
|
||||
|
||||
Mittels `hook_timer` wird eine Zeitfunktion implementiert.
|
||||
Mittels `+hook_timer+` wird eine Zeitfunktion implementiert.
|
||||
|
||||
Beispiele:
|
||||
|
||||
@@ -1032,7 +1032,7 @@ weechat.hook_timer(60 * 1000, 60, 0, "timer_cb", "")
|
||||
[[hook_process]]
|
||||
==== Hintergrundprozesse
|
||||
|
||||
Mit der Funktion `hook_process` kann ein Hintergrundprozess gestartet werden.
|
||||
Mit der Funktion `+hook_process+` kann ein Hintergrundprozess gestartet werden.
|
||||
Der Callback wird aufgerufen sobald der Hintergrundprozess abgearbeitet wurde.
|
||||
Dies kann auch mehrfach der Fall sein.
|
||||
|
||||
@@ -1062,8 +1062,8 @@ weechat.hook_process("/bin/ls -l /etc", 10 * 1000, "my_process_cb", "")
|
||||
_Neu seit Version 0.3.7._
|
||||
|
||||
Um URLs herunterzuladen (oder um etwas zu einer URL zu senden), muss die Funktion
|
||||
`hook_process` genutzt werden. Müssen zusätzliche Optionen gesetzt werden, für
|
||||
einen URL Transfer, kommt die Funktion `hook_process_hashtable` zum Einsatz.
|
||||
`+hook_process+` genutzt werden. Müssen zusätzliche Optionen gesetzt werden, für
|
||||
einen URL Transfer, kommt die Funktion `+hook_process_hashtable+` zum Einsatz.
|
||||
|
||||
Beispiel eines URL Transfers, ohne zusätzliche Optionen: Die HTML Seite wird
|
||||
dabei in der Callback-Variable "out" gesichert (Standardausgabe des Prozesses):
|
||||
@@ -1104,7 +1104,7 @@ weechat.hook_process_hashtable("url:https://weechat.org/files/src/weechat-devel.
|
||||
----
|
||||
|
||||
Für weitere Informationen zum URL Transfer und verfügbare Optionen, siehe Funktionen
|
||||
`hook_process` und `hook_process_hashtable` in
|
||||
`+hook_process+` und `+hook_process_hashtable+` in
|
||||
link:weechat_plugin_api.en.html#_hook_process[WeeChat plugin API reference] (Englisch).
|
||||
|
||||
[[config_options]]
|
||||
@@ -1113,8 +1113,8 @@ link:weechat_plugin_api.en.html#_hook_process[WeeChat plugin API reference] (Eng
|
||||
[[config_options_set_script]]
|
||||
==== Optionen von Skripten setzen
|
||||
|
||||
Die Funktion `config_is_set_plugin` wird dazu benutzt um zu testen ob eine Option
|
||||
gesetzt ist oder nicht. Mit der Funktion `config_set_plugin` wird eine Option gesetzt.
|
||||
Die Funktion `+config_is_set_plugin+` wird dazu benutzt um zu testen ob eine Option
|
||||
gesetzt ist oder nicht. Mit der Funktion `+config_set_plugin+` wird eine Option gesetzt.
|
||||
|
||||
Beispiele:
|
||||
|
||||
@@ -1133,7 +1133,7 @@ for option, standardwert in skript_optionen.items():
|
||||
[[config_options_detect_changes]]
|
||||
==== Veränderungen bemerken
|
||||
|
||||
Die Funktion `hook_config` wird dazu benutzt um festzustellen falls ein Anwender
|
||||
Die Funktion `+hook_config+` wird dazu benutzt um festzustellen falls ein Anwender
|
||||
eine Option des Skripts verändert hat.
|
||||
|
||||
Beispiele:
|
||||
@@ -1159,8 +1159,8 @@ weechat.hook_config("plugins.var.python." + SKRIPT_NAME + ".*", "config_cb", "")
|
||||
[[config_options_weechat]]
|
||||
==== WeeChat Optionen lesen
|
||||
|
||||
Die Funktion `config_get` gibt einen Pointer zu einer Option zurück. Abhängig vom Typ der Option
|
||||
muss entweder `config_string`, `config_boolean`, `config_integer` oder `config_color` genutzt werden.
|
||||
Die Funktion `+config_get+` gibt einen Pointer zu einer Option zurück. Abhängig vom Typ der Option
|
||||
muss entweder `+config_string+`, `+config_boolean+`, `+config_integer+` oder `+config_color+` genutzt werden.
|
||||
|
||||
[source,python]
|
||||
----
|
||||
@@ -1257,7 +1257,7 @@ Man kann IRC Nachrichten mittels einer info_hashtable mit dem Namen
|
||||
|
||||
Das Ergebnis ist eine Hashtabelle mit folgenden Schlüsseln
|
||||
(das Beispiel bezieht sich auf folgende IRC Nachricht:
|
||||
`@time=2015-06-27T16:40:35.000Z :nick!user@host PRIVMSG #weechat :hello!`):
|
||||
`+@time=2015-06-27T16:40:35.000Z :nick!user@host PRIVMSG #weechat :hello!+`):
|
||||
|
||||
[width="100%",cols="1,^2,10,8",options="header"]
|
||||
|===
|
||||
@@ -1265,55 +1265,55 @@ Das Ergebnis ist eine Hashtabelle mit folgenden Schlüsseln
|
||||
|
||||
| Tags | ≥ 0.4.0 |
|
||||
Tags in der Nachricht (kann leer sein). |
|
||||
`time=2015-06-27T16:40:35.000Z`
|
||||
`+time=2015-06-27T16:40:35.000Z+`
|
||||
|
||||
| message_without_tags | ≥ 0.4.0 |
|
||||
Die IRC Nachricht ohne Tags (wie eine Nachricht ohne Tags). |
|
||||
`:nick!user@host PRIVMSG #weechat :hello!`
|
||||
`+:nick!user@host PRIVMSG #weechat :hello!+`
|
||||
|
||||
| nick | ≥ 0.3.4 |
|
||||
der ursprüngliche Nick. |
|
||||
`nick`
|
||||
`+nick+`
|
||||
|
||||
| user | ≥ 2.7 |
|
||||
der ursprüngliche Benutzer. |
|
||||
`user`
|
||||
`+user+`
|
||||
|
||||
| host | ≥ 0.3.4 |
|
||||
der ursprüngliche Host (beinhaltet den Nick). |
|
||||
`nick!user@host`
|
||||
`+nick!user@host+`
|
||||
|
||||
| command | ≥ 0.3.4 |
|
||||
der Befehl (_PRIVMSG_, _NOTICE_, ...). |
|
||||
`PRIVMSG`
|
||||
`+PRIVMSG+`
|
||||
|
||||
| channel | ≥ 0.3.4 |
|
||||
der Zielchanne.l|
|
||||
`#weechat`
|
||||
`+#weechat+`
|
||||
|
||||
| arguments | ≥ 0.3.4 |
|
||||
das Argument des Befehls (beinhaltet den Channel). |
|
||||
`#weechat :hello!`
|
||||
`+#weechat :hello!+`
|
||||
|
||||
| text | ≥ 1.3 |
|
||||
der Text (zum Beispiel eine Nachricht eines Users). |
|
||||
`hello!`
|
||||
`+hello!+`
|
||||
|
||||
| pos_command | ≥ 1.3 |
|
||||
Index von _command_ innerhalb einer Nachricht ("-1" falls _command_ nicht gefunden wird). |
|
||||
`47`
|
||||
`+47+`
|
||||
|
||||
| pos_arguments | ≥ 1.3 |
|
||||
Index von_arguments_ innerhalb einer Nachricht ("-1" falls _arguments_ nicht gefunden wird). |
|
||||
`55`
|
||||
`+55+`
|
||||
|
||||
| pos_channel | ≥ 1.3 |
|
||||
Index von _channel_ innerhalb einer Nachricht ("-1" falls _channel_ nicht gefunden wird). |
|
||||
`55`
|
||||
`+55+`
|
||||
|
||||
| pos_text | ≥ 1.3 |
|
||||
Index von _text_ innerhalb einer Nachricht ("-1" falls _text_ nicht gefunden wird). |
|
||||
`65`
|
||||
`+65+`
|
||||
|===
|
||||
|
||||
[source,python]
|
||||
@@ -1407,6 +1407,6 @@ if infolist:
|
||||
----
|
||||
|
||||
[IMPORTANT]
|
||||
Vergewissern Sie sich `infolist_free` aufzurufen um den Speicher wieder
|
||||
Vergewissern Sie sich `+infolist_free+` aufzurufen um den Speicher wieder
|
||||
frei zu geben der durch die Infoliste belegt wurde. WeeChat gibt diesen Speicher
|
||||
nicht automatisch frei.
|
||||
|
||||
@@ -53,14 +53,14 @@ The code of a script is executed:
|
||||
|
||||
When the code of a script is executed, WeeChat waits for the end of execution
|
||||
before going on. Therefore the script must *NOT* do blocking operations like
|
||||
network calls without using a dedicated API function like `hook_process`.
|
||||
network calls without using a dedicated API function like `+hook_process+`.
|
||||
|
||||
[IMPORTANT]
|
||||
A script must *NEVER* fork or create threads without using a dedicated API
|
||||
function, this can crash WeeChat. +
|
||||
If something must be run in background, the function `hook_process` can be used.
|
||||
If something must be run in background, the function `+hook_process+` can be used.
|
||||
See example in the chapter <<hook_process,Run a background process>>
|
||||
and the documentation on the function `hook_process` in the
|
||||
and the documentation on the function `+hook_process+` in the
|
||||
link:weechat_plugin_api.en.html#_hook_process[WeeChat plugin API reference].
|
||||
|
||||
[[languages_specificities]]
|
||||
@@ -74,7 +74,7 @@ WeeChat defines a `weechat` module which must be imported with `import weechat`.
|
||||
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat.xxx(arg1, arg2, ...)`.
|
||||
Functions are called with `+weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
Functions `+print*+` are called `+prnt*+` in python (because `print` was a
|
||||
reserved keyword in Python 2).
|
||||
@@ -100,9 +100,9 @@ receive a string of type `str` or `bytes` (this list is not exhaustive):
|
||||
A message received in IRC plugin, before it is decoded to UTF-8 (used
|
||||
internally). +
|
||||
+
|
||||
It is recommended to use modifier `irc_in2_yyy` instead, the string received
|
||||
It is recommended to use modifier `+irc_in2_yyy+` instead, the string received
|
||||
is always UTF-8 valid. +
|
||||
See function `hook_modifier` in the
|
||||
See function `+hook_modifier+` in the
|
||||
link:weechat_plugin_api.en.html#_hook_modifier[WeeChat plugin API reference].
|
||||
|
||||
| hook_signal |
|
||||
@@ -115,9 +115,9 @@ receive a string of type `str` or `bytes` (this list is not exhaustive):
|
||||
A message sent by IRC plugin, after it is encoded to the `encode` charset
|
||||
defined by the user (if different from the default `UTF-8`). +
|
||||
+
|
||||
It is recommended to use signal `xxx,irc_out1_yyy` instead, the string received
|
||||
It is recommended to use signal `+xxx,irc_out1_yyy+` instead, the string received
|
||||
is always UTF-8 valid. +
|
||||
See function `hook_signal` in the
|
||||
See function `+hook_signal+` in the
|
||||
link:weechat_plugin_api.en.html#_hook_signal[WeeChat plugin API reference].
|
||||
|
||||
| hook_process +
|
||||
@@ -136,7 +136,7 @@ UTF-8 data, in the cases mentioned above.
|
||||
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat::xxx(arg1, arg2, ...);`.
|
||||
Functions are called with `+weechat::xxx(arg1, arg2, ...);+`.
|
||||
|
||||
==== Ruby
|
||||
|
||||
@@ -146,10 +146,10 @@ You have to define _weechat_init_ and call _register_ inside.
|
||||
|
||||
===== Functions
|
||||
|
||||
Functions are called with `Weechat.xxx(arg1, arg2, ...)`.
|
||||
Functions are called with `+Weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
Due to a limitation of Ruby (15 arguments max by function), the function
|
||||
`Weechat.config_new_option` receives the callbacks in an array of 6 strings
|
||||
`+Weechat.config_new_option+` receives the callbacks in an array of 6 strings
|
||||
(3 callbacks + 3 data strings), so a call to this function looks like:
|
||||
|
||||
[source,ruby]
|
||||
@@ -162,19 +162,19 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt
|
||||
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat.xxx(arg1, arg2, ...)`.
|
||||
Functions are called with `+weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
==== Tcl
|
||||
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat::xxx arg1 arg2 ...`.
|
||||
Functions are called with `+weechat::xxx arg1 arg2 ...+`.
|
||||
|
||||
==== Guile (Scheme)
|
||||
|
||||
===== Functions
|
||||
|
||||
Functions are called with `(weechat:xxx arg1 arg2 ...)`.
|
||||
Functions are called with `+(weechat:xxx arg1 arg2 ...)+`.
|
||||
|
||||
The following functions take one list of arguments (instead of many arguments
|
||||
for other functions), because number of arguments exceed number of allowed
|
||||
@@ -188,13 +188,13 @@ arguments in Guile:
|
||||
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat.xxx(arg1, arg2, ...);`.
|
||||
Functions are called with `+weechat.xxx(arg1, arg2, ...);+`.
|
||||
|
||||
==== PHP
|
||||
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat_xxx(arg1, arg2, ...);`.
|
||||
Functions are called with `+weechat_xxx(arg1, arg2, ...);+`.
|
||||
|
||||
[[register_function]]
|
||||
=== Register function
|
||||
@@ -957,7 +957,7 @@ To see local variables of a buffer, do this command in WeeChat:
|
||||
[[hook_command]]
|
||||
==== Add new command
|
||||
|
||||
Add a custom command with `hook_command`. You can use a custom completion
|
||||
Add a custom command with `+hook_command+`. You can use a custom completion
|
||||
template to complete arguments of your command.
|
||||
|
||||
Example:
|
||||
@@ -991,7 +991,7 @@ And then in WeeChat:
|
||||
[[hook_timer]]
|
||||
==== Add a timer
|
||||
|
||||
Add a timer with `hook_timer`.
|
||||
Add a timer with `+hook_timer+`.
|
||||
|
||||
Example:
|
||||
|
||||
@@ -1008,7 +1008,7 @@ weechat.hook_timer(60 * 1000, 60, 0, "timer_cb", "")
|
||||
[[hook_process]]
|
||||
==== Run a background process
|
||||
|
||||
You can run a background process with `hook_process`. Your callback will be
|
||||
You can run a background process with `+hook_process+`. Your callback will be
|
||||
called when data is ready. It may be called many times.
|
||||
|
||||
For the last call to your callback, _rc_ is set to 0 or positive value, it's
|
||||
@@ -1036,8 +1036,8 @@ weechat.hook_process("/bin/ls -l /etc", 10 * 1000, "my_process_cb", "")
|
||||
|
||||
_New in version 0.3.7._
|
||||
|
||||
To download URL (or post to URL), you have to use function `hook_process`, or
|
||||
`hook_process_hashtable` if you need to set options for URL transfer.
|
||||
To download URL (or post to URL), you have to use function `+hook_process+`, or
|
||||
`+hook_process_hashtable+` if you need to set options for URL transfer.
|
||||
|
||||
Example of URL transfer without option: the HTML page will be received as "out"
|
||||
in callback (standard output of process):
|
||||
@@ -1078,7 +1078,7 @@ weechat.hook_process_hashtable("url:https://weechat.org/files/src/weechat-devel.
|
||||
----
|
||||
|
||||
For more information about URL transfer and available options, see functions
|
||||
`hook_process` and `hook_process_hashtable` in
|
||||
`+hook_process+` and `+hook_process_hashtable+` in
|
||||
link:weechat_plugin_api.en.html#_hook_process[WeeChat plugin API reference].
|
||||
|
||||
[[config_options]]
|
||||
@@ -1087,8 +1087,8 @@ link:weechat_plugin_api.en.html#_hook_process[WeeChat plugin API reference].
|
||||
[[config_options_set_script]]
|
||||
==== Set options for script
|
||||
|
||||
Function `config_is_set_plugin` is used to check if an option is set or not,
|
||||
and `config_set_plugin` to set option.
|
||||
Function `+config_is_set_plugin+` is used to check if an option is set or not,
|
||||
and `+config_set_plugin+` to set option.
|
||||
|
||||
Example:
|
||||
|
||||
@@ -1107,7 +1107,7 @@ for option, default_value in script_options.items():
|
||||
[[config_options_detect_changes]]
|
||||
==== Detect changes
|
||||
|
||||
You must use `hook_config` to be notified if user changes some script options.
|
||||
You must use `+hook_config+` to be notified if user changes some script options.
|
||||
|
||||
Example:
|
||||
|
||||
@@ -1132,9 +1132,9 @@ weechat.hook_config("plugins.var.python." + SCRIPT_NAME + ".*", "config_cb", "")
|
||||
[[config_options_weechat]]
|
||||
==== Read WeeChat options
|
||||
|
||||
Function `config_get` returns pointer to option. Then, depending on option type,
|
||||
you must call `config_string`, `config_boolean`, `config_integer` or
|
||||
`config_color`.
|
||||
Function `+config_get+` returns pointer to option. Then, depending on option type,
|
||||
you must call `+config_string+`, `+config_boolean+`, `+config_integer+` or
|
||||
`+config_color+`.
|
||||
|
||||
[source,python]
|
||||
----
|
||||
@@ -1229,7 +1229,7 @@ You can parse an IRC message with info_hashtable called "irc_message_parse".
|
||||
|
||||
The result is a hashtable with following keys
|
||||
(the example values are built with this message:
|
||||
`@time=2015-06-27T16:40:35.000Z :nick!user@host PRIVMSG #weechat :hello!`):
|
||||
`+@time=2015-06-27T16:40:35.000Z :nick!user@host PRIVMSG #weechat :hello!+`):
|
||||
|
||||
[width="100%",cols="1,^2,10,8",options="header"]
|
||||
|===
|
||||
@@ -1237,55 +1237,55 @@ The result is a hashtable with following keys
|
||||
|
||||
| tags | ≥ 0.4.0 |
|
||||
The tags in message (can be empty). |
|
||||
`time=2015-06-27T16:40:35.000Z`
|
||||
`+time=2015-06-27T16:40:35.000Z+`
|
||||
|
||||
| message_without_tags | ≥ 0.4.0 |
|
||||
The message without the tags (the same as message if there are no tags). |
|
||||
`:nick!user@host PRIVMSG #weechat :hello!`
|
||||
`+:nick!user@host PRIVMSG #weechat :hello!+`
|
||||
|
||||
| nick | ≥ 0.3.4 |
|
||||
The origin nick. |
|
||||
`nick`
|
||||
`+nick+`
|
||||
|
||||
| user | ≥ 2.7 |
|
||||
The origin user. |
|
||||
`user`
|
||||
`+user+`
|
||||
|
||||
| host | ≥ 0.3.4 |
|
||||
The origin host (includes the nick). |
|
||||
`nick!user@host`
|
||||
`+nick!user@host+`
|
||||
|
||||
| command | ≥ 0.3.4 |
|
||||
The command (_PRIVMSG_, _NOTICE_, ...). |
|
||||
`PRIVMSG`
|
||||
`+PRIVMSG+`
|
||||
|
||||
| channel | ≥ 0.3.4 |
|
||||
The target channel. |
|
||||
`#weechat`
|
||||
`+#weechat+`
|
||||
|
||||
| arguments | ≥ 0.3.4 |
|
||||
The command arguments (includes the channel). |
|
||||
`#weechat :hello!`
|
||||
`+#weechat :hello!+`
|
||||
|
||||
| text | ≥ 1.3 |
|
||||
The text (for example user message). |
|
||||
`hello!`
|
||||
`+hello!+`
|
||||
|
||||
| pos_command | ≥ 1.3 |
|
||||
The index of _command_ in message ("-1" if _command_ was not found). |
|
||||
`47`
|
||||
`+47+`
|
||||
|
||||
| pos_arguments | ≥ 1.3 |
|
||||
The index of _arguments_ in message ("-1" if _arguments_ was not found). |
|
||||
`55`
|
||||
`+55+`
|
||||
|
||||
| pos_channel | ≥ 1.3 |
|
||||
The index of _channel_ in message ("-1" if _channel_ was not found). |
|
||||
`55`
|
||||
`+55+`
|
||||
|
||||
| pos_text | ≥ 1.3 |
|
||||
The index of _text_ in message ("-1" if _text_ was not found). |
|
||||
`65`
|
||||
`+65+`
|
||||
|===
|
||||
|
||||
[source,python]
|
||||
@@ -1377,5 +1377,5 @@ if infolist:
|
||||
----
|
||||
|
||||
[IMPORTANT]
|
||||
Don't forget to call `infolist_free` to free memory used by infolist, because
|
||||
Don't forget to call `+infolist_free+` to free memory used by infolist, because
|
||||
WeeChat will not automatically free memory.
|
||||
|
||||
@@ -58,15 +58,15 @@ Le code d'un script est exécuté :
|
||||
Lorsque le code du script est exécuté, WeeChat attend la fin de l'exécution
|
||||
avant de continuer. Par conséquent, le script ne doit *PAS* faire d'opérations
|
||||
bloquantes comme des appels réseau sans utiliser une fonction API dédiée
|
||||
telle que `hook_process`.
|
||||
telle que `+hook_process+`.
|
||||
|
||||
[IMPORTANT]
|
||||
Un script ne doit *JAMAIS* faire de "fork" ou créer des threads sans utiliser
|
||||
une fonction dédiée de l'API, cela pourrait provoquer un crash de WeeChat. +
|
||||
Si quelque chose doit être lancé en arrière-plan, la fonction `hook_process`
|
||||
Si quelque chose doit être lancé en arrière-plan, la fonction `+hook_process+`
|
||||
peut être utilisée. Voir l'exemple dans le chapitre
|
||||
<<hook_process,Lancer un processus en tâche de fond>> et la documentation sur
|
||||
la fonction `hook_process` dans la
|
||||
la fonction `+hook_process+` dans la
|
||||
link:weechat_plugin_api.en.html#_hook_process[Référence API extension WeeChat].
|
||||
|
||||
[[languages_specificities]]
|
||||
@@ -80,7 +80,7 @@ WeeChat définit un module `weechat` qui doit être importé avec `import weecha
|
||||
|
||||
===== Fonctions
|
||||
|
||||
Les fonctions sont appelées avec `weechat.xxx(arg1, arg2, ...)`.
|
||||
Les fonctions sont appelées avec `+weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
Les fonctions `+print*+` se nomment `+prnt*+` en python (car `print` était un
|
||||
mot clé réservé en Python 2).
|
||||
@@ -107,9 +107,9 @@ pas exhaustive) :
|
||||
pass:[irc_in_notice] |
|
||||
Un message reçu dans l'extension IRC, avant qu'il ne soit décodé vers UTF-8. +
|
||||
+
|
||||
Il est recommandé d'utiliser plutôt le modificateur `irc_in2_yyy`, la chaîne
|
||||
Il est recommandé d'utiliser plutôt le modificateur `+irc_in2_yyy+`, la chaîne
|
||||
reçue sera toujours valide UTF-8. +
|
||||
Voir la fonction `hook_modifier` dans la
|
||||
Voir la fonction `+hook_modifier+` dans la
|
||||
link:weechat_plugin_api.fr.html#_hook_modifier[Référence API extension WeeChat].
|
||||
|
||||
| hook_signal |
|
||||
@@ -123,9 +123,9 @@ pas exhaustive) :
|
||||
`encode` défini par l'utilisateur (si différent de `UTF-8`, qui est la valeur
|
||||
par défaut). +
|
||||
+
|
||||
Il est recommandé d'utiliser plutôt le signal `xxx,irc_out1_yyy`, la chaîne
|
||||
Il est recommandé d'utiliser plutôt le signal `+xxx,irc_out1_yyy+`, la chaîne
|
||||
reçue sera toujours valide UTF-8. +
|
||||
Voir la fonction `hook_signal` dans la
|
||||
Voir la fonction `+hook_signal+` dans la
|
||||
link:weechat_plugin_api.fr.html#_hook_signal[Référence API extension WeeChat].
|
||||
|
||||
| hook_process +
|
||||
@@ -145,7 +145,7 @@ des données invalides UTF-8, dans les cas mentionnés ci-dessus.
|
||||
|
||||
===== Fonctions
|
||||
|
||||
Les fonctions sont appelées par `weechat::xxx(arg1, arg2, ...);`.
|
||||
Les fonctions sont appelées par `+weechat::xxx(arg1, arg2, ...);+`.
|
||||
|
||||
==== Ruby
|
||||
|
||||
@@ -155,10 +155,10 @@ Vous devez définir _weechat_init_ et appeler _register_ dedans.
|
||||
|
||||
===== Fonctions
|
||||
|
||||
Les fonctions sont appelées par `Weechat.xxx(arg1, arg2, ...)`.
|
||||
Les fonctions sont appelées par `+Weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
En raison d'une limitation de Ruby (15 paramètres maximum par fonction), la
|
||||
fonction `Weechat.config_new_option` reçoit les fonctions de rappel dans un
|
||||
fonction `+Weechat.config_new_option+` reçoit les fonctions de rappel dans un
|
||||
tableau de 6 chaînes de caractères (3 fonctions de rappel + 3 chaînes de
|
||||
données), donc un appel à cette fonction ressemble à ceci :
|
||||
|
||||
@@ -172,19 +172,19 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt
|
||||
|
||||
===== Fonctions
|
||||
|
||||
Les fonctions sont appelées par `weechat.xxx(arg1, arg2, ...)`.
|
||||
Les fonctions sont appelées par `+weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
==== Tcl
|
||||
|
||||
===== Fonctions
|
||||
|
||||
Les fonctions sont appelées par `weechat::xxx arg1 arg2 ...`.
|
||||
Les fonctions sont appelées par `+weechat::xxx arg1 arg2 ...+`.
|
||||
|
||||
==== Guile (Scheme)
|
||||
|
||||
===== Fonctions
|
||||
|
||||
Les fonctions sont appelées par `(weechat:xxx arg1 arg2 ...)`.
|
||||
Les fonctions sont appelées par `+(weechat:xxx arg1 arg2 ...)+`.
|
||||
|
||||
Les fonctions suivantes prennent une liste de paramètres en entrée (au lieu de
|
||||
plusieurs paramètres pour les autres fonctions), car le nombre de paramètres
|
||||
@@ -198,13 +198,13 @@ excède la limite de Guile :
|
||||
|
||||
===== Fonctions
|
||||
|
||||
Les fonctions sont appelées par `weechat.xxx(arg1, arg2, ...);`.
|
||||
Les fonctions sont appelées par `+weechat.xxx(arg1, arg2, ...);+`.
|
||||
|
||||
==== PHP
|
||||
|
||||
===== Fonctions
|
||||
|
||||
Les fonctions sont appelées par `weechat_xxx(arg1, arg2, ...);`.
|
||||
Les fonctions sont appelées par `+weechat_xxx(arg1, arg2, ...);+`.
|
||||
|
||||
[[register_function]]
|
||||
=== Fonction register
|
||||
@@ -984,7 +984,7 @@ WeeChat :
|
||||
[[hook_command]]
|
||||
==== Ajouter une nouvelle commande
|
||||
|
||||
Ajoutez une nouvelle commande avec `hook_command`. Vous pouvez utiliser une
|
||||
Ajoutez une nouvelle commande avec `+hook_command+`. Vous pouvez utiliser une
|
||||
complétion personnalisée pour compléter les paramètres de votre commande.
|
||||
|
||||
Exemple :
|
||||
@@ -1018,7 +1018,7 @@ Puis sous WeeChat :
|
||||
[[hook_timer]]
|
||||
==== Ajouter un minuteur
|
||||
|
||||
Ajoutez un minuteur avec `hook_timer`.
|
||||
Ajoutez un minuteur avec `+hook_timer+`.
|
||||
|
||||
Exemple :
|
||||
|
||||
@@ -1035,7 +1035,7 @@ weechat.hook_timer(60 * 1000, 60, 0, "timer_cb", "")
|
||||
[[hook_process]]
|
||||
==== Lancer un processus en tâche de fond
|
||||
|
||||
Vous pouvez lancer un processus en tâche de fond avec `hook_process`. Votre
|
||||
Vous pouvez lancer un processus en tâche de fond avec `+hook_process+`. Votre
|
||||
fonction de rappel sera appelée quand des données seront prêtes. Elle peut être
|
||||
appelée plusieurs fois.
|
||||
|
||||
@@ -1065,7 +1065,7 @@ weechat.hook_process("/bin/ls -l /etc", 10 * 1000, "my_process_cb", "")
|
||||
_Nouveau dans la version 0.3.7._
|
||||
|
||||
Pour télécharger une URL (ou poster vers une URL), vous devez utiliser la
|
||||
fonction `hook_process`, ou `hook_process_hashtable` si vous avez besoin
|
||||
fonction `+hook_process+`, ou `+hook_process_hashtable+` si vous avez besoin
|
||||
d'options pour le transfert d'URL.
|
||||
|
||||
Exemple de transfert d'URL sans option : la page HTML sera reçue comme "out"
|
||||
@@ -1108,7 +1108,7 @@ weechat.hook_process_hashtable("url:https://weechat.org/files/src/weechat-devel.
|
||||
----
|
||||
|
||||
Pour plus d'information sur le transfert d'URL et les options disponibles, voir
|
||||
les fonctions `hook_process` et `hook_process_hashtable` dans la
|
||||
les fonctions `+hook_process+` et `+hook_process_hashtable+` dans la
|
||||
link:weechat_plugin_api.fr.html#_hook_process[Référence API extension WeeChat].
|
||||
|
||||
[[config_options]]
|
||||
@@ -1117,8 +1117,8 @@ link:weechat_plugin_api.fr.html#_hook_process[Référence API extension WeeChat]
|
||||
[[config_options_set_script]]
|
||||
==== Définir des options pour le script
|
||||
|
||||
La fonction `config_is_set_plugin` est utilisée pour vérifier si une option est
|
||||
définie ou pas, et `config_set_plugin` pour définir une option.
|
||||
La fonction `+config_is_set_plugin+` est utilisée pour vérifier si une option est
|
||||
définie ou pas, et `+config_set_plugin+` pour définir une option.
|
||||
|
||||
Exemple :
|
||||
|
||||
@@ -1137,7 +1137,7 @@ for option, default_value in script_options.items():
|
||||
[[config_options_detect_changes]]
|
||||
==== Détecter des changements
|
||||
|
||||
Vous devez utiliser `hook_config` pour être notifié si l'utilisateur modifie
|
||||
Vous devez utiliser `+hook_config+` pour être notifié si l'utilisateur modifie
|
||||
certaines options du script.
|
||||
|
||||
Exemple :
|
||||
@@ -1163,9 +1163,9 @@ weechat.hook_config("plugins.var.python." + SCRIPT_NAME + ".*", "config_cb", "")
|
||||
[[config_options_weechat]]
|
||||
==== Lire les options WeeChat
|
||||
|
||||
La fonction `config_get` retourne un pointeur vers une option. Ensuite, en
|
||||
fonction du type de l'option, il faut appeler `config_string`, `config_boolean`,
|
||||
`config_integer` ou `config_color`.
|
||||
La fonction `+config_get+` retourne un pointeur vers une option. Ensuite, en
|
||||
fonction du type de l'option, il faut appeler `+config_string+`, `+config_boolean+`,
|
||||
`+config_integer+` ou `+config_color+`.
|
||||
|
||||
[source,python]
|
||||
----
|
||||
@@ -1266,7 +1266,7 @@ Vous pouvez analyser un message IRC avec l'info_hashtable appelée
|
||||
|
||||
Le résultat est une table de hachage avec les clés suivantes
|
||||
(les exemples de valeurs sont construits avec ce message :
|
||||
`@time=2015-06-27T16:40:35.000Z :nick!user@host PRIVMSG #weechat :hello!`) :
|
||||
`+@time=2015-06-27T16:40:35.000Z :nick!user@host PRIVMSG #weechat :hello!+`) :
|
||||
|
||||
[width="100%",cols="1,^2,10,8",options="header"]
|
||||
|===
|
||||
@@ -1274,56 +1274,56 @@ Le résultat est une table de hachage avec les clés suivantes
|
||||
|
||||
| tags | ≥ 0.4.0 |
|
||||
Les étiquettes dans le message (peut être vide). |
|
||||
`time=2015-06-27T16:40:35.000Z`
|
||||
`+time=2015-06-27T16:40:35.000Z+`
|
||||
|
||||
| message_without_tags | ≥ 0.4.0 |
|
||||
Le message sans les étiquettes (la même chose que le message s'il n'y a pas
|
||||
d'étiquettes). |
|
||||
`:nick!user@host PRIVMSG #weechat :hello!`
|
||||
`+:nick!user@host PRIVMSG #weechat :hello!+`
|
||||
|
||||
| nick | ≥ 0.3.4 |
|
||||
Le pseudo d'origine. |
|
||||
`nick`
|
||||
`+nick+`
|
||||
|
||||
| user | ≥ 2.7 |
|
||||
L'utilisateur d'origine. |
|
||||
`user`
|
||||
`+user+`
|
||||
|
||||
| host | ≥ 0.3.4 |
|
||||
L'hôte d'origine (incluant le pseudo). |
|
||||
`nick!user@host`
|
||||
`+nick!user@host+`
|
||||
|
||||
| command | ≥ 0.3.4 |
|
||||
La commande (_PRIVMSG_, _NOTICE_, ...). |
|
||||
`PRIVMSG`
|
||||
`+PRIVMSG+`
|
||||
|
||||
| channel | ≥ 0.3.4 |
|
||||
Le canal cible. |
|
||||
`#weechat`
|
||||
`+#weechat+`
|
||||
|
||||
| arguments | ≥ 0.3.4 |
|
||||
Les paramètres de la commande (incluant le canal). |
|
||||
`#weechat :hello!`
|
||||
`+#weechat :hello!+`
|
||||
|
||||
| text | ≥ 1.3 |
|
||||
Le texte (par exemple un message utilisateur). |
|
||||
`hello!`
|
||||
`+hello!+`
|
||||
|
||||
| pos_command | ≥ 1.3 |
|
||||
La position de _command_ dans le message ("-1" si _command_ n'a pas été trouvé). |
|
||||
`47`
|
||||
`+47+`
|
||||
|
||||
| pos_arguments | ≥ 1.3 |
|
||||
La position de _arguments_ dans le message ("-1" si _arguments_ n'a pas été trouvé). |
|
||||
`55`
|
||||
`+55+`
|
||||
|
||||
| pos_channel | ≥ 1.3 |
|
||||
La position de _channel_ dans le message ("-1" si _channel_ n'a pas été trouvé). |
|
||||
`55`
|
||||
`+55+`
|
||||
|
||||
| pos_text | ≥ 1.3 |
|
||||
La position de _text_ dans le message ("-1" si _text_ n'a pas été trouvé). |
|
||||
`65`
|
||||
`+65+`
|
||||
|===
|
||||
|
||||
[source,python]
|
||||
@@ -1417,5 +1417,5 @@ if infolist:
|
||||
----
|
||||
|
||||
[IMPORTANT]
|
||||
N'oubliez pas d'appeler `infolist_free` pour libérer la mémoire utilisée par
|
||||
N'oubliez pas d'appeler `+infolist_free+` pour libérer la mémoire utilisée par
|
||||
l'infolist, car WeeChat ne libère par automatiquement cette mémoire.
|
||||
|
||||
@@ -62,14 +62,14 @@ The code of a script is executed:
|
||||
|
||||
When the code of a script is executed, WeeChat waits for the end of execution
|
||||
before going on. Therefore the script must *NOT* do blocking operations like
|
||||
network calls without using a dedicated API function like `hook_process`.
|
||||
network calls without using a dedicated API function like `+hook_process+`.
|
||||
|
||||
[IMPORTANT]
|
||||
A script must *NEVER* fork or create threads without using a dedicated API
|
||||
function, this can crash WeeChat. +
|
||||
If something must be run in background, the function `hook_process` can be used.
|
||||
If something must be run in background, the function `+hook_process+` can be used.
|
||||
See example in the chapter <<hook_process,Eseguire un processo in background>>
|
||||
and the documentation on the function `hook_process` in the
|
||||
and the documentation on the function `+hook_process+` in the
|
||||
link:weechat_plugin_api.it.html#_hook_process[WeeChat plugin API reference].
|
||||
|
||||
[[languages_specificities]]
|
||||
@@ -85,7 +85,7 @@ WeeChat defines a `weechat` module which must be imported with `import weechat`.
|
||||
// TRANSLATION MISSING
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat.xxx(arg1, arg2, ...)`.
|
||||
Functions are called with `+weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
Functions `+print*+` are called `+prnt*+` in python (because `print` was a
|
||||
reserved keyword in Python 2).
|
||||
@@ -112,9 +112,9 @@ receive a string of type `str` or `bytes` (this list is not exhaustive):
|
||||
A message received in IRC plugin, before it is decoded to UTF-8 (used
|
||||
internally). +
|
||||
+
|
||||
It is recommended to use modifier `irc_in2_yyy` instead, the string received
|
||||
It is recommended to use modifier `+irc_in2_yyy+` instead, the string received
|
||||
is always UTF-8 valid. +
|
||||
See function `hook_modifier` in the
|
||||
See function `+hook_modifier+` in the
|
||||
link:weechat_plugin_api.it.html#_hook_modifier[WeeChat plugin API reference].
|
||||
|
||||
| hook_signal |
|
||||
@@ -127,9 +127,9 @@ receive a string of type `str` or `bytes` (this list is not exhaustive):
|
||||
A message sent by IRC plugin, after it is encoded to the `encode` charset
|
||||
defined by the user (if different from the default `UTF-8`). +
|
||||
+
|
||||
It is recommended to use signal `xxx,irc_out1_yyy` instead, the string received
|
||||
It is recommended to use signal `+xxx,irc_out1_yyy+` instead, the string received
|
||||
is always UTF-8 valid. +
|
||||
See function `hook_signal` in the
|
||||
See function `+hook_signal+` in the
|
||||
link:weechat_plugin_api.it.html#_hook_signal[WeeChat plugin API reference].
|
||||
|
||||
| hook_process +
|
||||
@@ -149,7 +149,7 @@ UTF-8 data, in the cases mentioned above.
|
||||
// TRANSLATION MISSING
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat::xxx(arg1, arg2, ...);`.
|
||||
Functions are called with `+weechat::xxx(arg1, arg2, ...);+`.
|
||||
|
||||
==== Ruby
|
||||
|
||||
@@ -161,10 +161,10 @@ You have to define _weechat_init_ and call _register_ inside.
|
||||
// TRANSLATION MISSING
|
||||
===== Functions
|
||||
|
||||
Functions are called with `Weechat.xxx(arg1, arg2, ...)`.
|
||||
Functions are called with `+Weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
Due to a limitation of Ruby (15 arguments max by function), the function
|
||||
`Weechat.config_new_option` receives the callbacks in an array of 6 strings
|
||||
`+Weechat.config_new_option+` receives the callbacks in an array of 6 strings
|
||||
(3 callbacks + 3 data strings), so a call to this function looks like:
|
||||
|
||||
[source,ruby]
|
||||
@@ -178,21 +178,21 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt
|
||||
// TRANSLATION MISSING
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat.xxx(arg1, arg2, ...)`.
|
||||
Functions are called with `+weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
==== Tcl
|
||||
|
||||
// TRANSLATION MISSING
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat::xxx arg1 arg2 ...`.
|
||||
Functions are called with `+weechat::xxx arg1 arg2 ...+`.
|
||||
|
||||
==== Guile (Scheme)
|
||||
|
||||
// TRANSLATION MISSING
|
||||
===== Functions
|
||||
|
||||
Functions are called with `(weechat:xxx arg1 arg2 ...)`.
|
||||
Functions are called with `+(weechat:xxx arg1 arg2 ...)+`.
|
||||
|
||||
The following functions take one list of arguments (instead of many arguments
|
||||
for other functions), because number of arguments exceed number of allowed
|
||||
@@ -207,14 +207,14 @@ arguments in Guile:
|
||||
// TRANSLATION MISSING
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat.xxx(arg1, arg2, ...);`.
|
||||
Functions are called with `+weechat.xxx(arg1, arg2, ...);+`.
|
||||
|
||||
==== PHP
|
||||
|
||||
// TRANSLATION MISSING
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat_xxx(arg1, arg2, ...);`.
|
||||
Functions are called with `+weechat_xxx(arg1, arg2, ...);+`.
|
||||
|
||||
[[register_function]]
|
||||
=== Registrare una funzione
|
||||
@@ -994,7 +994,7 @@ in WeeChat:
|
||||
[[hook_command]]
|
||||
==== Aggiungere un nuovo comando
|
||||
|
||||
Aggiunge un comando personalizzato con `hook_command`. Si può fare uso di
|
||||
Aggiunge un comando personalizzato con `+hook_command+`. Si può fare uso di
|
||||
un template di completamento personalizzato per completare gli argomenti
|
||||
del proprio comando.
|
||||
|
||||
@@ -1029,7 +1029,7 @@ E poi in WeeChat:
|
||||
[[hook_timer]]
|
||||
==== Aggiungere un timer
|
||||
|
||||
Aggiungere un timer con `hook_timer`.
|
||||
Aggiungere un timer con `+hook_timer+`.
|
||||
|
||||
Esempio:
|
||||
|
||||
@@ -1046,7 +1046,7 @@ weechat.hook_timer(60 * 1000, 60, 0, "timer_cb", "")
|
||||
[[hook_process]]
|
||||
==== Eseguire un processo in background
|
||||
|
||||
È possibile eseguire un processo in background con `hook_process`. La
|
||||
È possibile eseguire un processo in background con `+hook_process+`. La
|
||||
callback verrà chiamata quando i dati sono pronti. Può essere chiamata
|
||||
più volte.
|
||||
|
||||
@@ -1076,7 +1076,7 @@ weechat.hook_process("/bin/ls -l /etc", 10 * 1000, "my_process_cb", "")
|
||||
_Novità nella versione 0.3.7._
|
||||
|
||||
Per scaricare un URL (o inviare verso un URL), è necessario usare la funzione
|
||||
`hook_process` oppure `hook_process_hashtable` se ci fosse bisogno di impostare
|
||||
`+hook_process+` oppure `+hook_process_hashtable+` se ci fosse bisogno di impostare
|
||||
delle opzioni per il trasferimento dell'URL.
|
||||
|
||||
Esempio di trasferimento di un URL senza opzioni: la pagina HTML verrà
|
||||
@@ -1120,7 +1120,7 @@ weechat.hook_process_hashtable("url:https://weechat.org/files/src/weechat-devel.
|
||||
|
||||
// TRANSLATION MISSING
|
||||
For more information about URL transfer and available options, see functions
|
||||
`hook_process` and `hook_process_hashtable` in
|
||||
`+hook_process+` and `+hook_process_hashtable+` in
|
||||
link:weechat_plugin_api.it.html#_hook_process[WeeChat plugin API reference].
|
||||
|
||||
[[config_options]]
|
||||
@@ -1129,8 +1129,8 @@ link:weechat_plugin_api.it.html#_hook_process[WeeChat plugin API reference].
|
||||
[[config_options_set_script]]
|
||||
==== Impostare l'opzione per lo script
|
||||
|
||||
La funzione `config_is_set_plugin` viene utilizzare per verificare se un'opzione
|
||||
è impostata oppure no, e `config_set_plugin` per impostare l'opzione.
|
||||
La funzione `+config_is_set_plugin+` viene utilizzare per verificare se un'opzione
|
||||
è impostata oppure no, e `+config_set_plugin+` per impostare l'opzione.
|
||||
|
||||
Esempio:
|
||||
|
||||
@@ -1149,7 +1149,7 @@ for option, default_value in script_options.items():
|
||||
[[config_options_detect_changes]]
|
||||
==== Rilevare le modifiche
|
||||
|
||||
È necessario utilizzare `hook_config` per essere notificati se l'utente dovesse
|
||||
È necessario utilizzare `+hook_config+` per essere notificati se l'utente dovesse
|
||||
modificare alcune opzioni dello script.
|
||||
|
||||
Esempio:
|
||||
@@ -1175,9 +1175,9 @@ weechat.hook_config("plugins.var.python." + SCRIPT_NAME + ".*", "config_cb", "")
|
||||
[[config_options_weechat]]
|
||||
==== Leggere le opzioni di WeeChat
|
||||
|
||||
La funzione `config_get` restituisce il puntatore all'opzione. Poi, in base al tipo
|
||||
di opzione, è necessario chiamare `config_string`, `config_boolean`,
|
||||
`config_integer` oppure `config_color`.
|
||||
La funzione `+config_get+` restituisce il puntatore all'opzione. Poi, in base al tipo
|
||||
di opzione, è necessario chiamare `+config_string+`, `+config_boolean+`,
|
||||
`+config_integer+` oppure `+config_color+`.
|
||||
|
||||
[source,python]
|
||||
----
|
||||
@@ -1283,7 +1283,7 @@ _Novità nella versione 0.3.4._
|
||||
// TRANSLATION MISSING
|
||||
The result is a hashtable with following keys
|
||||
(the example values are built with this message:
|
||||
`@time=2015-06-27T16:40:35.000Z :nick!user@host PRIVMSG #weechat :hello!`):
|
||||
`+@time=2015-06-27T16:40:35.000Z :nick!user@host PRIVMSG #weechat :hello!+`):
|
||||
|
||||
[width="100%",cols="1,^2,10,8",options="header"]
|
||||
|===
|
||||
@@ -1291,56 +1291,56 @@ The result is a hashtable with following keys
|
||||
|
||||
| tags | ≥ 0.4.0 |
|
||||
The tags in message (can be empty). |
|
||||
`time=2015-06-27T16:40:35.000Z`
|
||||
`+time=2015-06-27T16:40:35.000Z+`
|
||||
|
||||
| message_without_tags | ≥ 0.4.0 |
|
||||
The message without the tags (the same as message if there are no tags). |
|
||||
`:nick!user@host PRIVMSG #weechat :hello!`
|
||||
`+:nick!user@host PRIVMSG #weechat :hello!+`
|
||||
|
||||
| nick | ≥ 0.3.4 |
|
||||
The origin nick. |
|
||||
`nick`
|
||||
`+nick+`
|
||||
|
||||
// TRANSLATION MISSING
|
||||
| user | ≥ 2.7 |
|
||||
The origin user. |
|
||||
`user`
|
||||
`+user+`
|
||||
|
||||
| host | ≥ 0.3.4 |
|
||||
The origin host (includes the nick). |
|
||||
`nick!user@host`
|
||||
`+nick!user@host+`
|
||||
|
||||
| command | ≥ 0.3.4 |
|
||||
The command (_PRIVMSG_, _NOTICE_, ...). |
|
||||
`PRIVMSG`
|
||||
`+PRIVMSG+`
|
||||
|
||||
| channel | ≥ 0.3.4 |
|
||||
The target channel. |
|
||||
`#weechat`
|
||||
`+#weechat+`
|
||||
|
||||
| arguments | ≥ 0.3.4 |
|
||||
The command arguments (includes the channel). |
|
||||
`#weechat :hello!`
|
||||
`+#weechat :hello!+`
|
||||
|
||||
| text | ≥ 1.3 |
|
||||
The text (for example user message). |
|
||||
`hello!`
|
||||
`+hello!+`
|
||||
|
||||
| pos_command | ≥ 1.3 |
|
||||
The index of _command_ in message ("-1" if _command_ was not found). |
|
||||
`47`
|
||||
`+47+`
|
||||
|
||||
| pos_arguments | ≥ 1.3 |
|
||||
The index of _arguments_ in message ("-1" if _arguments_ was not found). |
|
||||
`55`
|
||||
`+55+`
|
||||
|
||||
| pos_channel | ≥ 1.3 |
|
||||
The index of _channel_ in message ("-1" if _channel_ was not found). |
|
||||
`55`
|
||||
`+55+`
|
||||
|
||||
| pos_text | ≥ 1.3 |
|
||||
The index of _text_ in message ("-1" if _text_ was not found). |
|
||||
`65`
|
||||
`+65+`
|
||||
|===
|
||||
|
||||
[source,python]
|
||||
@@ -1434,6 +1434,6 @@ if infolist:
|
||||
----
|
||||
|
||||
[IMPORTANT]
|
||||
Non dimenticare di chiamare `infolist_free` per liberare la memoria
|
||||
Non dimenticare di chiamare `+infolist_free+` per liberare la memoria
|
||||
utilizzata dalla lista info, perché WeeChat non libererà automaticamente
|
||||
la memoria.
|
||||
|
||||
@@ -59,15 +59,15 @@ WeeChat はシングルスレッドで、この点はスクリプトも同じで
|
||||
|
||||
スクリプトのコードが実行されると、WeeChat
|
||||
は一時停止し、実行の完了を待ってから再開します。このため、スクリプトは操作をブロックしては
|
||||
*絶対にいけません*。ネットワークを呼び出す等の場合には、`hook_process` 等の専用 API 関数を使ってください。
|
||||
*絶対にいけません*。ネットワークを呼び出す等の場合には、`+hook_process+` 等の専用 API 関数を使ってください。
|
||||
|
||||
[IMPORTANT]
|
||||
WeeChat がクラッシュするため、スクリプトで fork したりスレッドを作ることは *禁止*
|
||||
されています。これが必要な場合には専用 API 関数を使ってください。 +
|
||||
どうしてもバックグラウンド実行を避けられない場合には `hook_process`
|
||||
どうしてもバックグラウンド実行を避けられない場合には `+hook_process+`
|
||||
関数を使ってください。<<hook_process,バックグラウンドプロセスの実行>>の例および
|
||||
link:weechat_plugin_api.ja.html#_hook_process[WeeChat プラグイン API リファレンス]内の
|
||||
`hook_process` 関数の文書を参照してください。
|
||||
`+hook_process+` 関数の文書を参照してください。
|
||||
|
||||
[[languages_specificities]]
|
||||
=== 言語仕様
|
||||
@@ -82,7 +82,7 @@ WeeChat defines a `weechat` module which must be imported with `import weechat`.
|
||||
// TRANSLATION MISSING
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat.xxx(arg1, arg2, ...)`.
|
||||
Functions are called with `+weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
Functions `+print*+` are called `+prnt*+` in python (because `print` was a
|
||||
reserved keyword in Python 2).
|
||||
@@ -109,9 +109,9 @@ receive a string of type `str` or `bytes` (this list is not exhaustive):
|
||||
A message received in IRC plugin, before it is decoded to UTF-8 (used
|
||||
internally). +
|
||||
+
|
||||
It is recommended to use modifier `irc_in2_yyy` instead, the string received
|
||||
It is recommended to use modifier `+irc_in2_yyy+` instead, the string received
|
||||
is always UTF-8 valid. +
|
||||
See function `hook_modifier` in the
|
||||
See function `+hook_modifier+` in the
|
||||
link:weechat_plugin_api.ja.html#_hook_modifier[WeeChat plugin API reference].
|
||||
|
||||
| hook_signal |
|
||||
@@ -124,9 +124,9 @@ receive a string of type `str` or `bytes` (this list is not exhaustive):
|
||||
A message sent by IRC plugin, after it is encoded to the `encode` charset
|
||||
defined by the user (if different from the default `UTF-8`). +
|
||||
+
|
||||
It is recommended to use signal `xxx,irc_out1_yyy` instead, the string received
|
||||
It is recommended to use signal `+xxx,irc_out1_yyy+` instead, the string received
|
||||
is always UTF-8 valid. +
|
||||
See function `hook_signal` in the
|
||||
See function `+hook_signal+` in the
|
||||
link:weechat_plugin_api.ja.html#_hook_signal[WeeChat plugin API reference].
|
||||
|
||||
| hook_process +
|
||||
@@ -146,7 +146,7 @@ UTF-8 data, in the cases mentioned above.
|
||||
// TRANSLATION MISSING
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat::xxx(arg1, arg2, ...);`.
|
||||
Functions are called with `+weechat::xxx(arg1, arg2, ...);+`.
|
||||
|
||||
==== Ruby
|
||||
|
||||
@@ -158,10 +158,10 @@ You have to define _weechat_init_ and call _register_ inside.
|
||||
// TRANSLATION MISSING
|
||||
===== Functions
|
||||
|
||||
Functions are called with `Weechat.xxx(arg1, arg2, ...)`.
|
||||
Functions are called with `+Weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
Due to a limitation of Ruby (15 arguments max by function), the function
|
||||
`Weechat.config_new_option` receives the callbacks in an array of 6 strings
|
||||
`+Weechat.config_new_option+` receives the callbacks in an array of 6 strings
|
||||
(3 callbacks + 3 data strings), so a call to this function looks like:
|
||||
|
||||
[source,ruby]
|
||||
@@ -175,21 +175,21 @@ Weechat.config_new_option(config, section, "name", "string", "description of opt
|
||||
// TRANSLATION MISSING
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat.xxx(arg1, arg2, ...)`.
|
||||
Functions are called with `+weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
==== Tcl
|
||||
|
||||
// TRANSLATION MISSING
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat::xxx arg1 arg2 ...`.
|
||||
Functions are called with `+weechat::xxx arg1 arg2 ...+`.
|
||||
|
||||
==== Guile (Scheme)
|
||||
|
||||
// TRANSLATION MISSING
|
||||
===== Functions
|
||||
|
||||
Functions are called with `(weechat:xxx arg1 arg2 ...)`.
|
||||
Functions are called with `+(weechat:xxx arg1 arg2 ...)+`.
|
||||
|
||||
The following functions take one list of arguments (instead of many arguments
|
||||
for other functions), because number of arguments exceed number of allowed
|
||||
@@ -204,14 +204,14 @@ arguments in Guile:
|
||||
// TRANSLATION MISSING
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat.xxx(arg1, arg2, ...);`.
|
||||
Functions are called with `+weechat.xxx(arg1, arg2, ...);+`.
|
||||
|
||||
==== PHP
|
||||
|
||||
// TRANSLATION MISSING
|
||||
===== Functions
|
||||
|
||||
Functions are called with `weechat_xxx(arg1, arg2, ...);`.
|
||||
Functions are called with `+weechat_xxx(arg1, arg2, ...);+`.
|
||||
|
||||
[[register_function]]
|
||||
=== 関数の登録
|
||||
@@ -976,7 +976,7 @@ weechat.buffer_set(buffer, "localvar_del_myvar", "")
|
||||
[[hook_command]]
|
||||
==== 新しいコマンドの追加
|
||||
|
||||
カスタムコマンドを追加するには `hook_command`
|
||||
カスタムコマンドを追加するには `+hook_command+`
|
||||
を使ってください。追加したコマンドに対してカスタム補完テンプレートを定義できます。
|
||||
|
||||
例:
|
||||
@@ -1010,7 +1010,7 @@ hook = weechat.hook_command("myfilter", "description of myfilter",
|
||||
[[hook_timer]]
|
||||
==== タイマーの追加
|
||||
|
||||
タイマーを追加するには `hook_timer` を使ってください。
|
||||
タイマーを追加するには `+hook_timer+` を使ってください。
|
||||
|
||||
例:
|
||||
|
||||
@@ -1027,7 +1027,7 @@ weechat.hook_timer(60 * 1000, 60, 0, "timer_cb", "")
|
||||
[[hook_process]]
|
||||
==== バックグラウンドプロセスの実行
|
||||
|
||||
バックグラウンドプロセスを実行するには `hook_process`
|
||||
バックグラウンドプロセスを実行するには `+hook_process+`
|
||||
を使います。コールバックはデータの準備が整った時点で呼び出されます。複数回呼び出されることもあります。
|
||||
|
||||
コールバックの最後の呼び出しでは _rc_ が 0
|
||||
@@ -1055,8 +1055,8 @@ weechat.hook_process("/bin/ls -l /etc", 10 * 1000, "my_process_cb", "")
|
||||
|
||||
_WeeChat バージョン 0.3.7 以上で利用可。_
|
||||
|
||||
URL をダウンロードする (または URL にポストする) には、関数 `hook_process` または URL
|
||||
転送にオプションが必要な場合は `hook_process_hashtable` を使わなければいけません。
|
||||
URL をダウンロードする (または URL にポストする) には、関数 `+hook_process+` または URL
|
||||
転送にオプションが必要な場合は `+hook_process_hashtable+` を使わなければいけません。
|
||||
|
||||
オプション無しの URL 転送の例: HTML ページの内容はコールバックの
|
||||
"out" 引数 (プロセスの標準出力) を通して渡されます。
|
||||
@@ -1098,7 +1098,7 @@ weechat.hook_process_hashtable("url:https://weechat.org/files/src/weechat-devel.
|
||||
|
||||
URL 転送に関するより詳しい情報と利用可能なオプションは
|
||||
link:weechat_plugin_api.ja.html#_hook_process[WeeChat プラグイン API リファレンス]の
|
||||
`hook_process` と `hook_process_hashtable` を参照してください。
|
||||
`+hook_process+` と `+hook_process_hashtable+` を参照してください。
|
||||
|
||||
[[config_options]]
|
||||
=== 設定 / オプション
|
||||
@@ -1106,8 +1106,8 @@ link:weechat_plugin_api.ja.html#_hook_process[WeeChat プラグイン API リフ
|
||||
[[config_options_set_script]]
|
||||
==== スクリプトのオプションを設定
|
||||
|
||||
オプションが設定されているかどうかを確認するには `config_is_set_plugin`
|
||||
関数、オプションを設定するには `config_set_plugin` 関数を使います。
|
||||
オプションが設定されているかどうかを確認するには `+config_is_set_plugin+`
|
||||
関数、オプションを設定するには `+config_set_plugin+` 関数を使います。
|
||||
|
||||
例:
|
||||
|
||||
@@ -1126,7 +1126,7 @@ for option, default_value in script_options.items():
|
||||
[[config_options_detect_changes]]
|
||||
==== 変更の検出
|
||||
|
||||
ユーザがスクリプトオプションを変更したことを検出するには `hook_config` を使わなければいけません。
|
||||
ユーザがスクリプトオプションを変更したことを検出するには `+hook_config+` を使わなければいけません。
|
||||
|
||||
例:
|
||||
|
||||
@@ -1151,8 +1151,8 @@ weechat.hook_config("plugins.var.python." + SCRIPT_NAME + ".*", "config_cb", "")
|
||||
[[config_options_weechat]]
|
||||
==== WeeChat オプションのロード
|
||||
|
||||
`config_get` 関数はオプションへのポインタを返します。オプションの型に従って
|
||||
`config_string`、`config_boolean`、`config_integer`、`config_color`
|
||||
`+config_get+` 関数はオプションへのポインタを返します。オプションの型に従って
|
||||
`+config_string+`、`+config_boolean+`、`+config_integer+`、`+config_color+`
|
||||
を呼び出さなければいけません。
|
||||
|
||||
[source,python]
|
||||
@@ -1256,7 +1256,7 @@ _WeeChat バージョン 0.3.4 以上で利用可。_
|
||||
|
||||
結果は以下のキーを持つハッシュテーブルです
|
||||
(例の値は以下のメッセージから作られました:
|
||||
`@time=2015-06-27T16:40:35.000Z :nick!user@host PRIVMSG #weechat :hello!`):
|
||||
`+@time=2015-06-27T16:40:35.000Z :nick!user@host PRIVMSG #weechat :hello!+`):
|
||||
|
||||
[width="100%",cols="1,^2,10,8",options="header"]
|
||||
|===
|
||||
@@ -1264,56 +1264,56 @@ _WeeChat バージョン 0.3.4 以上で利用可。_
|
||||
|
||||
| tags | 0.4.0 以上 |
|
||||
メッセージに付けられたタグ (空にすることも可) |
|
||||
`time=2015-06-27T16:40:35.000Z`
|
||||
`+time=2015-06-27T16:40:35.000Z+`
|
||||
|
||||
| message_without_tags | 0.4.0 以上 |
|
||||
タグを除いたメッセージ (タグが付けられていなければメッセージと同じ) |
|
||||
`:nick!user@host PRIVMSG #weechat :hello!`
|
||||
`+:nick!user@host PRIVMSG #weechat :hello!+`
|
||||
|
||||
| nick | 0.3.4 以上 |
|
||||
発信者のニックネーム |
|
||||
`nick`
|
||||
`+nick+`
|
||||
|
||||
// TRANSLATION MISSING
|
||||
| user | ≥ 2.7 |
|
||||
The origin user. |
|
||||
`user`
|
||||
`+user+`
|
||||
|
||||
| host | 0.3.4 以上 |
|
||||
発信者のホスト (ニックネームを含む) |
|
||||
`nick!user@host`
|
||||
`+nick!user@host+`
|
||||
|
||||
| command | 0.3.4 以上 |
|
||||
コマンド (_PRIVMSG_、_NOTICE_、...) |
|
||||
`PRIVMSG`
|
||||
`+PRIVMSG+`
|
||||
|
||||
| channel | 0.3.4 以上 |
|
||||
送信先チャンネル |
|
||||
`#weechat`
|
||||
`+#weechat+`
|
||||
|
||||
| arguments | 0.3.4 以上 |
|
||||
コマンド引数 (チャンネルを含む) |
|
||||
`#weechat :hello!`
|
||||
`+#weechat :hello!+`
|
||||
|
||||
| text | 1.3 以上 |
|
||||
テキスト (ユーザメッセージなど) |
|
||||
`hello!`
|
||||
`+hello!+`
|
||||
|
||||
| pos_command | 1.3 以上 |
|
||||
メッセージ内における _command_ のインデックス (_command_ が見つからない場合 "-1") |
|
||||
`47`
|
||||
`+47+`
|
||||
|
||||
| pos_arguments | 1.3 以上 |
|
||||
メッセージ内における _arguments_ のインデックス (_arguments_ が見つからない場合 "-1") |
|
||||
`55`
|
||||
`+55+`
|
||||
|
||||
| pos_channel | 1.3 以上 |
|
||||
メッセージ内における _channel_ のインデックス (_channel_ が見つからない場合 "-1") |
|
||||
`55`
|
||||
`+55+`
|
||||
|
||||
| pos_text | 1.3 以上 |
|
||||
メッセージ内における _text_ のインデックス (_text_ が見つからない場合 "-1") |
|
||||
`65`
|
||||
`+65+`
|
||||
|===
|
||||
|
||||
[source,python]
|
||||
@@ -1405,5 +1405,5 @@ if infolist:
|
||||
----
|
||||
|
||||
[IMPORTANT]
|
||||
WeeChat は自動的にメモリを解放しません、インフォリストによって使われたメモリを解放するには、`infolist_free`
|
||||
WeeChat は自動的にメモリを解放しません、インフォリストによって使われたメモリを解放するには、`+infolist_free+`
|
||||
を呼び出すことを忘れないでください。
|
||||
|
||||
@@ -59,14 +59,14 @@ Kod skryptu jest wykonywany:
|
||||
|
||||
Kiedy wykonywany jest kod skryptu, WeeChat czeka na koniec wykonania zanim przejdzie
|
||||
dalej. Dlatego skrypty *NIE* mogą wykonywac operacji blokujących jak operacje
|
||||
sieciowe bez użycia dedykowanej funkcji API jak `hook_process`.
|
||||
sieciowe bez użycia dedykowanej funkcji API jak `+hook_process+`.
|
||||
|
||||
[IMPORTANT]
|
||||
Skrypt *NIGDY* nie powinien się mnożyć ani tworzyć wątków bez użycia dedykowanych
|
||||
funkcji API, może to prowadzić to awarii WeeChat. +
|
||||
Jeśli coś musi zostać wykonane w tle, można użyć funkcji `hook_process`.
|
||||
Jeśli coś musi zostać wykonane w tle, można użyć funkcji `+hook_process+`.
|
||||
Zobacz przykład w rozdziale <<hook_process,Wykonanie procesu w tle>> oraz
|
||||
dokumentację do funkcji `hook_process` w
|
||||
dokumentację do funkcji `+hook_process+` w
|
||||
link:weechat_plugin_api.en.html#_hook_process[Opisu API wtyczek WeeChat] (Angielski).
|
||||
|
||||
[[languages_specificities]]
|
||||
@@ -80,7 +80,7 @@ WeeChat definiuje moduł `weechat`, który należy zaimportowac poprzez `import
|
||||
|
||||
===== Funkcje
|
||||
|
||||
Funkcje są wywoływane za pomocą `weechat.xxx(arg1, arg2, ...)`.
|
||||
Funkcje są wywoływane za pomocą `+weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
Funkcje `+print*+` nzwyają się `+prnt*+` (ponieważ `print` był zarezerwowanym
|
||||
łowem kluczowym w Pythonie 2).
|
||||
@@ -105,9 +105,9 @@ dlatego callback może otrzymać ciąc typu `str` lub `bytes` (lista nie jest pe
|
||||
Wiadomość otrzymana przez wtyczkę IRC, zanim jest zdekodowana do UTF-8
|
||||
(używana wewnętrznie) +
|
||||
+
|
||||
Zalecane jest używanie w zamian modyfikatora `irc_in2_yyy`, otrzymany ciąg
|
||||
Zalecane jest używanie w zamian modyfikatora `+irc_in2_yyy+`, otrzymany ciąg
|
||||
jest zawsze poprawnym UTF-8. +
|
||||
Zobacz funkcję `hook_modifier` w
|
||||
Zobacz funkcję `+hook_modifier+` w
|
||||
link:weechat_plugin_api.en.html#_hook_modifier[Opiie API wtyczek WeeChat].
|
||||
|
||||
| hook_signal |
|
||||
@@ -120,9 +120,9 @@ dlatego callback może otrzymać ciąc typu `str` lub `bytes` (lista nie jest pe
|
||||
Wiadomość wysłana przez serwer IRC po zakodowaniu na kodowanie `encode`
|
||||
zdefiniowane przez użytkownika (jeśli inne niż `UTF-8`). +
|
||||
+
|
||||
Zaleca się użycie w zamian sygnału `xxx,irc_out1_yyy`,otrzymany ciąg jest
|
||||
Zaleca się użycie w zamian sygnału `+xxx,irc_out1_yyy+`,otrzymany ciąg jest
|
||||
zawsze poprawnym UTF-8. +
|
||||
Zobacz funkcję `hook_signal` w
|
||||
Zobacz funkcję `+hook_signal+` w
|
||||
link:weechat_plugin_api.en.html#_hook_modifier[Opiie API wtyczek WeeChat].
|
||||
|
||||
| hook_process +
|
||||
@@ -141,7 +141,7 @@ dane UTF-8 w przypadkach wspomnianych wyżej.
|
||||
|
||||
===== Funkcje
|
||||
|
||||
Funkcje są wywoływane za pomocą `weechat::xxx(arg1, arg2, ...);`.
|
||||
Funkcje są wywoływane za pomocą `+weechat::xxx(arg1, arg2, ...);+`.
|
||||
|
||||
==== Ruby
|
||||
|
||||
@@ -151,10 +151,10 @@ Musisz zdefiniowac _weechat_init_ i wywołać wewnątrz _register_.
|
||||
|
||||
===== Funkcje
|
||||
|
||||
Funkcje wywoływane są za pomocą `Weechat.xxx(arg1, arg2, ...)`.
|
||||
Funkcje wywoływane są za pomocą `+Weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
Poprzez limitację Ruby (maksymalnie 15 argumentów dla funkcji), funkcja
|
||||
`Weechat.config_new_option` otrzymuje callbacki w tablicy 6 ciągów
|
||||
`+Weechat.config_new_option+` otrzymuje callbacki w tablicy 6 ciągów
|
||||
(3 callbacki + 3 ciągi danych), wywołanie tej funkcji wygląda następująco:
|
||||
|
||||
[source,ruby]
|
||||
@@ -167,19 +167,19 @@ Weechat.config_new_option(config, section, "name", "string", "opis opcji", "", 0
|
||||
|
||||
===== Funkcje
|
||||
|
||||
Funkcje są wywoływane za pomocą `weechat.xxx(arg1, arg2, ...)`.
|
||||
Funkcje są wywoływane za pomocą `+weechat.xxx(arg1, arg2, ...)+`.
|
||||
|
||||
==== Tcl
|
||||
|
||||
===== Funkcje
|
||||
|
||||
Funkcje są wywoływane za pomocą `weechat::xxx arg1 arg2 ...`.
|
||||
Funkcje są wywoływane za pomocą `+weechat::xxx arg1 arg2 ...+`.
|
||||
|
||||
==== Guile (Scheme)
|
||||
|
||||
===== Funkcje
|
||||
|
||||
Funkcje są wywoływane za pomocą `(weechat:xxx arg1 arg2 ...)`.
|
||||
Funkcje są wywoływane za pomocą `+(weechat:xxx arg1 arg2 ...)+`.
|
||||
|
||||
Następujące funkcje przyjmują litę argumentów (zamiast wielu argumentów dla
|
||||
innych funkcji), ponieważ ilość argumentów przekracza maksymalną ilość
|
||||
@@ -193,13 +193,13 @@ argumentów dozwolonych w Guile:
|
||||
|
||||
===== Funkcje
|
||||
|
||||
Funkcje są wywoływane za pomocą `weechat.xxx(arg1, arg2, ...);`.
|
||||
Funkcje są wywoływane za pomocą `+weechat.xxx(arg1, arg2, ...);+`.
|
||||
|
||||
==== PHP
|
||||
|
||||
===== Funkcje
|
||||
|
||||
Funkcje są wywoływane za pomocą `weechat_xxx(arg1, arg2, ...);`.
|
||||
Funkcje są wywoływane za pomocą `+weechat_xxx(arg1, arg2, ...);+`.
|
||||
|
||||
[[register_function]]
|
||||
=== Funkcja rejestrująca
|
||||
@@ -962,7 +962,7 @@ Aby zobaczyć lokalne zmienne danego bufora, należy wykonać tą komendę w Wee
|
||||
[[hook_command]]
|
||||
==== Dodanie nowej komendy
|
||||
|
||||
Aby dodać nową komendę należy użyć `hook_command`. Można użyć własnego szablonu
|
||||
Aby dodać nową komendę należy użyć `+hook_command+`. Można użyć własnego szablonu
|
||||
dopełnień dla uzupełniania argumentów własnej komendy.
|
||||
|
||||
Przykład:
|
||||
@@ -996,7 +996,7 @@ Następnie w WeeChat:
|
||||
[[hook_timer]]
|
||||
==== Dodanie timera
|
||||
|
||||
Do dodania timera służy `hook_timer`.
|
||||
Do dodania timera służy `+hook_timer+`.
|
||||
|
||||
Przykład:
|
||||
|
||||
@@ -1013,7 +1013,7 @@ weechat.hook_timer(60 * 1000, 60, 0, "timer_cb", "")
|
||||
[[hook_process]]
|
||||
==== Wykonanie procesu w tle
|
||||
|
||||
Do wykonywania procesów w tle służy `hook_process`. Twoje callbacki zostaną
|
||||
Do wykonywania procesów w tle służy `+hook_process+`. Twoje callbacki zostaną
|
||||
wywołane, kiedy dane będą gotowe. Może zostać wywołane wiele razy.
|
||||
|
||||
Dla ostatniego wykonania Twojego callbacku _rc_ jest ustawiane na 0, lub wartość
|
||||
@@ -1041,8 +1041,8 @@ weechat.hook_process("/bin/ls -l /etc", 10 * 1000, "my_process_cb", "")
|
||||
|
||||
_Nowe w wersji 0.3.7._
|
||||
|
||||
Aby pobrać URL (albo wysłać do URL), należy użyć funkcji `hook_process`, lub
|
||||
`hook_process_hashtable` jeśli konieczne jest przekazanie parametrów.
|
||||
Aby pobrać URL (albo wysłać do URL), należy użyć funkcji `+hook_process+`, lub
|
||||
`+hook_process_hashtable+` jeśli konieczne jest przekazanie parametrów.
|
||||
|
||||
Przykład transferu URL bez opcji: strona HTML jest otrzymywana jako "out"
|
||||
(standardowe wyjście procesu):
|
||||
@@ -1083,7 +1083,7 @@ weechat.hook_process_hashtable("url:https://weechat.org/files/src/weechat-devel.
|
||||
----
|
||||
|
||||
Więcej informacji o transferach URL i dostępnych opcjach dla funkcji
|
||||
`hook_process` oraz `hook_process_hashtable` można znaleźć w
|
||||
`+hook_process+` oraz `+hook_process_hashtable+` można znaleźć w
|
||||
link:weechat_plugin_api.en.html#_hook_process[Opisu API wtyczek WeeChat] (Angielski).
|
||||
|
||||
[[config_options]]
|
||||
@@ -1092,8 +1092,8 @@ link:weechat_plugin_api.en.html#_hook_process[Opisu API wtyczek WeeChat] (Angiel
|
||||
[[config_options_set_script]]
|
||||
==== Ustawianie opcji dla skryptu
|
||||
|
||||
Funkcja `config_is_set_plugin` używana jest do sprawdzenia czy opcja jest ustawiona,
|
||||
`config_set_plugin` ustawia opcję.
|
||||
Funkcja `+config_is_set_plugin+` używana jest do sprawdzenia czy opcja jest ustawiona,
|
||||
`+config_set_plugin+` ustawia opcję.
|
||||
|
||||
Example:
|
||||
|
||||
@@ -1112,7 +1112,7 @@ for option, default_value in script_options.items():
|
||||
[[config_options_detect_changes]]
|
||||
==== Wykrywanie zmian
|
||||
|
||||
Do wykrywania zmian opcji skryptu służy `hook_config`.
|
||||
Do wykrywania zmian opcji skryptu służy `+hook_config+`.
|
||||
|
||||
Przykład:
|
||||
|
||||
@@ -1137,9 +1137,9 @@ weechat.hook_config("plugins.var.python." + SCRIPT_NAME + ".*", "config_cb", "")
|
||||
[[config_options_weechat]]
|
||||
==== Odczyt opcji WeeChat
|
||||
|
||||
Funkcja `config_get` zwraca wskaźnik do opcji. Następnie, w zależności od typu opcji,
|
||||
należy wywołać `config_string`, `config_boolean`, `config_integer` lub
|
||||
`config_color`.
|
||||
Funkcja `+config_get+` zwraca wskaźnik do opcji. Następnie, w zależności od typu opcji,
|
||||
należy wywołać `+config_string+`, `+config_boolean+`, `+config_integer+` lub
|
||||
`+config_color+`.
|
||||
|
||||
[source,python]
|
||||
----
|
||||
@@ -1236,7 +1236,7 @@ Można przetwarzać wiadomości IRC za pomocą info_hashtable zwanej
|
||||
|
||||
Wynik jest tabela hashy z następującymi kluczami
|
||||
(przykładowe wartości zostały uzyskane za pomocą wiadomości:
|
||||
`@time=2015-06-27T16:40:35.000Z :nick!user@host PRIVMSG #weechat :hello!`):
|
||||
`+@time=2015-06-27T16:40:35.000Z :nick!user@host PRIVMSG #weechat :hello!+`):
|
||||
|
||||
[width="100%",cols="1,^2,10,8",options="header"]
|
||||
|===
|
||||
@@ -1244,55 +1244,55 @@ Wynik jest tabela hashy z następującymi kluczami
|
||||
|
||||
| tags | ≥ 0.4.0 |
|
||||
Tagi w wiadomości (mogą byc puste). |
|
||||
`time=2015-06-27T16:40:35.000Z`
|
||||
`+time=2015-06-27T16:40:35.000Z+`
|
||||
|
||||
| message_without_tags | ≥ 0.4.0 |
|
||||
Wiadomość bez tagów (jeśli nie ma tagów jest to to samo co wiadomość). |
|
||||
`:nick!user@host PRIVMSG #weechat :hello!`
|
||||
`+:nick!user@host PRIVMSG #weechat :hello!+`
|
||||
|
||||
| nick | ≥ 0.3.4 |
|
||||
Nick żródła. |
|
||||
`nick`
|
||||
`+nick+`
|
||||
|
||||
| user | ≥ 2.7 |
|
||||
Oryginalny użytkownik. |
|
||||
`user`
|
||||
`+user+`
|
||||
|
||||
| host | ≥ 0.3.4 |
|
||||
Host żródła (zawiera nick). |
|
||||
`nick!user@host`
|
||||
`+nick!user@host+`
|
||||
|
||||
| command | ≥ 0.3.4 |
|
||||
Komenda (_PRIVMSG_, _NOTICE_, ...). |
|
||||
`PRIVMSG`
|
||||
`+PRIVMSG+`
|
||||
|
||||
| channel | ≥ 0.3.4 |
|
||||
Docelowy kanał. |
|
||||
`#weechat`
|
||||
`+#weechat+`
|
||||
|
||||
| arguments | ≥ 0.3.4 |
|
||||
Argumenty komendy (zawierają kanał). |
|
||||
`#weechat :hello!`
|
||||
`+#weechat :hello!+`
|
||||
|
||||
| text | ≥ 1.3 |
|
||||
Tekst (na przykład wiadomość użytkownika). |
|
||||
`hello!`
|
||||
`+hello!+`
|
||||
|
||||
| pos_command | ≥ 1.3 |
|
||||
The index of _command_ in message ("-1" if _command_ was not found). |
|
||||
`47`
|
||||
`+47+`
|
||||
|
||||
| pos_arguments | ≥ 1.3 |
|
||||
The index of _arguments_ in message ("-1" if _arguments_ was not found). |
|
||||
`55`
|
||||
`+55+`
|
||||
|
||||
| pos_channel | ≥ 1.3 |
|
||||
The index of _channel_ in message ("-1" if _channel_ was not found). |
|
||||
`55`
|
||||
`+55+`
|
||||
|
||||
| pos_text | ≥ 1.3 |
|
||||
The index of _text_ in message ("-1" if _text_ was not found). |
|
||||
`65`
|
||||
`+65+`
|
||||
|===
|
||||
|
||||
[source,python]
|
||||
@@ -1384,5 +1384,5 @@ if infolist:
|
||||
----
|
||||
|
||||
[IMPORTANT]
|
||||
Nie zapomnij wywołać `infolist_free`, aby zwolnić pamięć użyta przez infolistę,
|
||||
Nie zapomnij wywołać `+infolist_free+`, aby zwolnić pamięć użyta przez infolistę,
|
||||
ponieważ WeeChat nie zwolni automatycznie tej pamięci.
|
||||
|
||||
Reference in New Issue
Block a user