diff options
Diffstat (limited to 'typings/weechat.pyi')
-rw-r--r-- | typings/weechat.pyi | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/typings/weechat.pyi b/typings/weechat.pyi index 49191fa..db2b5ce 100644 --- a/typings/weechat.pyi +++ b/typings/weechat.pyi @@ -1362,6 +1362,32 @@ def hook_process_hashtable(command: str, options: Dict[str, str], timeout: int, ... +def hook_url(url: str, options: Dict[str, str], timeout: int, callback: str, callback_data: str) -> str: + """`hook_url in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_url>`_ + :: + + # example + def my_url_cb(data: str, url: str, options: Dict[str, str], output: Dict[str, str]) -> int: + weechat.prnt("", "output: %s" % output) + return weechat.WEECHAT_RC_OK + + # example 1: output to a file + hook1 = weechat.hook_url("https://weechat.org/", + {"file_out": "/tmp/weechat.org.html"}, + 20000, "my_url_cb", "") + + # example 2: custom HTTP headers, output sent to callback + options = { + "httpheader": "\n".join([ + "Header1: value1", + "Header2: value2", + ]), + } + hook2 = weechat.hook_url("http://localhost:8080/", options, 20000, "my_url_cb", "") + """ + ... + + def hook_connect(proxy: str, address: str, port: int, ipv6: int, retry: int, local_hostname: str, callback: str, callback_data: str) -> str: """`hook_connect in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_connect>`_ @@ -2661,7 +2687,9 @@ def hdata_compare(hdata: str, pointer1: str, pointer2: str, name: str, case_sens hdata = weechat.hdata_get("buffer") buffer1 = weechat.buffer_search("irc", "libera.#weechat") buffer2 = weechat.buffer_search("irc", "libera.#weechat-fr") - weechat.prnt("", "number comparison = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "number", 0)) + weechat.prnt("", "comparison of buffer number = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "number", 0)) + weechat.prnt("", "comparison of number of lines = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "own_lines.lines_count", 0)) + weechat.prnt("", "comparison of local variable = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "local_variables.myvar", 0)) """ ... |