diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2014-07-05 16:45:48 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2014-07-05 16:45:48 +0200 |
commit | 2b7b8cb36539c73847e8ab05d5bc02eed9821815 (patch) | |
tree | 0d2917c968b21737b65b55d6257c618f1d4a33ab /doc/it/weechat_plugin_api.it.asciidoc | |
parent | bdcb9fb5d70236ae983c173179960a9e4753d1a6 (diff) | |
download | weechat-2b7b8cb36539c73847e8ab05d5bc02eed9821815.zip |
doc: fix style of C/Python examples in docs
Diffstat (limited to 'doc/it/weechat_plugin_api.it.asciidoc')
-rw-r--r-- | doc/it/weechat_plugin_api.it.asciidoc | 298 |
1 files changed, 149 insertions, 149 deletions
diff --git a/doc/it/weechat_plugin_api.it.asciidoc b/doc/it/weechat_plugin_api.it.asciidoc index 8c2bf762e..107da59ef 100644 --- a/doc/it/weechat_plugin_api.it.asciidoc +++ b/doc/it/weechat_plugin_api.it.asciidoc @@ -500,7 +500,7 @@ Esempio in C: [source,C] ---- -char *str = weechat_strndup ("abcdef", 3); /* result: "abc" */ +char *str = weechat_strndup ("abcdef", 3); /* result: "abc" */ /* ... */ free (str); ---- @@ -528,7 +528,7 @@ Esempio in C: [source,C] ---- char str[] = "AbCdé"; -weechat_string_tolower (str); /* str ora è: "abcdé" */ +weechat_string_tolower (str); /* str ora è: "abcdé" */ ---- [NOTE] @@ -554,7 +554,7 @@ Esempio in C: [source,C] ---- char str[] = "AbCdé"; -weechat_string_toupper (str); /* str ora è: "ABCDé" */ +weechat_string_toupper (str); /* str ora è: "ABCDé" */ ---- [NOTE] @@ -589,7 +589,7 @@ Esempio in C: [source,C] ---- -int diff = weechat_strcasecmp ("aaa", "CCC"); /* == -2 */ +int diff = weechat_strcasecmp ("aaa", "CCC"); /* == -2 */ ---- [NOTE] @@ -632,7 +632,7 @@ Esempio in C: [source,C] ---- -int diff = weechat_strcasecmp_range ("nick{away}", "NICK[away]", 29); /* == 0 */ +int diff = weechat_strcasecmp_range ("nick{away}", "NICK[away]", 29); /* == 0 */ ---- [NOTE] @@ -669,7 +669,7 @@ Esempio in C: [source,C] ---- -int diff = weechat_strncasecmp ("aabb", "aacc", 2); /* == 0 */ +int diff = weechat_strncasecmp ("aabb", "aacc", 2); /* == 0 */ ---- [NOTE] @@ -713,7 +713,7 @@ Esempio in C: [source,C] ---- -int diff = weechat_strncasecmp_range ("nick{away}", "NICK[away]", 6, 29); /* == 0 */ +int diff = weechat_strncasecmp_range ("nick{away}", "NICK[away]", 6, 29); /* == 0 */ ---- [NOTE] @@ -753,7 +753,7 @@ Esempio in C: [source,C] ---- -int diff = weechat_strcmp_ignore_chars ("a-b", "--a-e", "-", 1); /* == -3 */ +int diff = weechat_strcmp_ignore_chars ("a-b", "--a-e", "-", 1); /* == -3 */ ---- [NOTE] @@ -784,7 +784,7 @@ Esempio in C: [source,C] ---- -char *pos = weechat_strcasestr ("aBcDeF", "de"); /* risultato: puntatore a "DeF" */ +char *pos = weechat_strcasestr ("aBcDeF", "de"); /* risultato: puntatore a "DeF" */ ---- [NOTE] @@ -820,7 +820,7 @@ Esempio in C: [source,C] ---- -int length_on_screen = weechat_strlen_screen ("é"); /* == 1 */ +int length_on_screen = weechat_strlen_screen ("é"); /* == 1 */ ---- Script (Python): @@ -831,7 +831,7 @@ Script (Python): length = weechat.strlen_screen(string) # esempio -length = weechat.strlen_screen("é") # 1 +length = weechat.strlen_screen("é") # 1 ---- ==== weechat_string_match @@ -870,11 +870,11 @@ Esempio in C: [source,C] ---- -int match1 = weechat_string_match ("abcdef", "abc*", 0); /* == 1 */ -int match2 = weechat_string_match ("abcdef", "*dd*", 0); /* == 0 */ -int match3 = weechat_string_match ("abcdef", "*def", 0); /* == 1 */ -int match4 = weechat_string_match ("abcdef", "*de*", 0); /* == 1 */ -int match5 = weechat_string_match ("abcdef", "*b*d*", 0); /* == 1 */ +int match1 = weechat_string_match ("abcdef", "abc*", 0); /* == 1 */ +int match2 = weechat_string_match ("abcdef", "*dd*", 0); /* == 0 */ +int match3 = weechat_string_match ("abcdef", "*def", 0); /* == 1 */ +int match4 = weechat_string_match ("abcdef", "*de*", 0); /* == 1 */ +int match5 = weechat_string_match ("abcdef", "*b*d*", 0); /* == 1 */ ---- Script (Python): @@ -885,11 +885,11 @@ Script (Python): match = weechat.string_match(string, mask, case_sensitive) # esempio -match1 = weechat.string_match("abcdef", "abc*", 0) # 1 -match2 = weechat.string_match("abcdef", "*dd*", 0) # 0 -match3 = weechat.string_match("abcdef", "*def", 0) # 1 -match4 = weechat.string_match("abcdef", "*de*", 0) # 1 -match5 = weechat.string_match("abcdef", "*b*d*", 0) # 1 +match1 = weechat.string_match("abcdef", "abc*", 0) # 1 +match2 = weechat.string_match("abcdef", "*dd*", 0) # 0 +match3 = weechat.string_match("abcdef", "*def", 0) # 1 +match4 = weechat.string_match("abcdef", "*de*", 0) # 1 +match5 = weechat.string_match("abcdef", "*b*d*", 0) # 1 ---- ==== weechat_string_expand_home @@ -990,7 +990,7 @@ Esempio in C: [source,C] ---- -char *str = weechat_string_strip (".abc -", 0, 1, "- ."); /* risultato: ".abc" */ +char *str = weechat_string_strip (".abc -", 0, 1, "- ."); /* risultato: ".abc" */ /* ... */ free (str); ---- @@ -1090,7 +1090,7 @@ Script (Python): regex = weechat.string_mask_to_regex(mask) # esempio -regex = weechat.string_mask_to_regex("test*mask") # "test.*mask" +regex = weechat.string_mask_to_regex("test*mask") # "test.*mask" ---- ==== weechat_string_regex_flags @@ -1224,7 +1224,7 @@ Esempio in C: [source,C] ---- -int hl = weechat_string_has_highlight ("my test string", "test,word2"); /* == 1 */ +int hl = weechat_string_has_highlight ("my test string", "test,word2"); /* == 1 */ ---- Script (Python): @@ -1235,7 +1235,7 @@ Script (Python): highlight = weechat.string_has_highlight(string, highlight_words) # esempio -highlight = weechat.string_has_highlight("my test string", "test,word2") # 1 +highlight = weechat.string_has_highlight("my test string", "test,word2") # 1 ---- ==== weechat_string_has_highlight_regex @@ -1269,7 +1269,7 @@ Esempio in C: [source,C] ---- -int hl = weechat_string_has_highlight_regex ("my test string", "test|word2"); /* == 1 */ +int hl = weechat_string_has_highlight_regex ("my test string", "test|word2"); /* == 1 */ ---- Script (Python): @@ -1280,7 +1280,7 @@ Script (Python): highlight = weechat.string_has_highlight_regex(string, regex) # esempio -highlight = weechat.string_has_highlight_regex("my test string", "test|word2") # 1 +highlight = weechat.string_has_highlight_regex("my test string", "test|word2") # 1 ---- ==== weechat_string_replace @@ -1310,7 +1310,7 @@ Esempio in C: [source,C] ---- -char *str = weechat_string_replace ("test", "s", "x"); /* result: "text" */ +char *str = weechat_string_replace ("test", "s", "x"); /* result: "text" */ /* ... */ free (str); ---- @@ -1650,19 +1650,19 @@ Esempi in C: ---- /* esempi in lingua inglese */ -char *str = weechat_string_format_size (0); /* str == "0 byte" */ +char *str = weechat_string_format_size (0); /* str == "0 byte" */ /* ... */ free (str); -char *str = weechat_string_format_size (200); /* str == "200 bytes" */ +char *str = weechat_string_format_size (200); /* str == "200 bytes" */ /* ... */ free (str); -char *str = weechat_string_format_size (1536); /* str == "1.5 KB" */ +char *str = weechat_string_format_size (1536); /* str == "1.5 KB" */ /* ... */ free (str); -char *str = weechat_string_format_size (2097152); /* str == "2 MB" */ +char *str = weechat_string_format_size (2097152); /* str == "2 MB" */ /* ... */ free (str); ---- @@ -1812,8 +1812,8 @@ Esempi in C: [source,C] ---- -int command_char1 = weechat_string_is_command_char ("/test"); /* == 1 */ -int command_char2 = weechat_string_is_command_char ("test"); /* == 0 */ +int command_char1 = weechat_string_is_command_char ("/test"); /* == 1 */ +int command_char2 = weechat_string_is_command_char ("test"); /* == 0 */ ---- Script (Python): @@ -1824,8 +1824,8 @@ Script (Python): is_cmdchar = weechat.string_is_command_char(string) # esempi -command_char1 = weechat.string_is_command_char("/test") # == 1 -command_char2 = weechat.string_is_command_char("test") # == 0 +command_char1 = weechat.string_is_command_char("/test") # == 1 +command_char2 = weechat.string_is_command_char("test") # == 0 ---- ==== weechat_string_input_for_buffer @@ -1854,9 +1854,9 @@ Esempi in C: [source,C] ---- -const char *str1 = weechat_string_input_for_buffer ("test"); /* "test" */ -const char *str2 = weechat_string_input_for_buffer ("/test"); /* NULL */ -const char *str3 = weechat_string_input_for_buffer ("//test"); /* "/test" */ +const char *str1 = weechat_string_input_for_buffer ("test"); /* "test" */ +const char *str2 = weechat_string_input_for_buffer ("/test"); /* NULL */ +const char *str3 = weechat_string_input_for_buffer ("//test"); /* "/test" */ ---- Script (Python): @@ -1867,9 +1867,9 @@ Script (Python): str = weechat.string_input_for_buffer(string) # esempi -str1 = weechat.string_input_for_buffer("test") # "test" -str2 = weechat.string_input_for_buffer("/test") # "" -str3 = weechat.string_input_for_buffer("//test") # "/test" +str1 = weechat.string_input_for_buffer("test") # "test" +str2 = weechat.string_input_for_buffer("/test") # "" +str3 = weechat.string_input_for_buffer("//test") # "/test" ---- ==== weechat_string_eval_expression @@ -1931,9 +1931,9 @@ struct t_hashtable *options = weechat_hashtable_new (8, NULL); if (options) weechat_hashtable_set (options, "type", "condition"); -char *str1 = weechat_string_eval_expression ("${buffer.full_name}", NULL, NULL, NULL); /* "core.weechat" */ -char *str2 = weechat_string_eval_expression ("${window.win_width} > 100", NULL, NULL, options); /* "1" */ -char *str3 = weechat_string_eval_expression ("abc =~ def", NULL, NULL, options); /* "0" */ +char *str1 = weechat_string_eval_expression ("${buffer.full_name}", NULL, NULL, NULL); /* "core.weechat" */ +char *str2 = weechat_string_eval_expression ("${window.win_width} > 100", NULL, NULL, options); /* "1" */ +char *str3 = weechat_string_eval_expression ("abc =~ def", NULL, NULL, options); /* "0" */ ---- Script (Python): @@ -1944,9 +1944,9 @@ Script (Python): str = weechat.string_eval_expression(expr, pointers, extra_vars, options) # esempi -str1 = weechat.string_eval_expression("${buffer.full_name}", {}, {}, {}) # "core.weechat" -str2 = weechat.string_eval_expression("${window.win_width} > 100", {}, {}, {"type": "condition"}) # "1" -str3 = weechat.string_eval_expression("abc =~ def", {}, {}, {"type": "condition"}) # "0" +str1 = weechat.string_eval_expression("${buffer.full_name}", {}, {}, {}) # "core.weechat" +str2 = weechat.string_eval_expression("${window.win_width} > 100", {}, {}, {"type": "condition"}) # "1" +str3 = weechat.string_eval_expression("abc =~ def", {}, {}, {"type": "condition"}) # "0" ---- [[utf-8]] @@ -2137,7 +2137,7 @@ Esempio in C: [source,C] ---- -int char_int = weechat_utf8_char_int ("être"); /* "ê" come intero */ +int char_int = weechat_utf8_char_int ("être"); /* "ê" come intero */ ---- [NOTE] @@ -2166,7 +2166,7 @@ Esempio in C: [source,C] ---- -int char_size = weechat_utf8_char_size ("être"); /* == 2 */ +int char_size = weechat_utf8_char_size ("être"); /* == 2 */ ---- [NOTE] @@ -2195,7 +2195,7 @@ Esempio in C: [source,C] ---- -int length = weechat_utf8_strlen ("chêne"); /* == 5 */ +int length = weechat_utf8_strlen ("chêne"); /* == 5 */ ---- [NOTE] @@ -2226,7 +2226,7 @@ Esempio in C: [source,C] ---- -int length = weechat_utf8_strnlen ("chêne", 4); /* == 3 */ +int length = weechat_utf8_strnlen ("chêne", 4); /* == 3 */ ---- [NOTE] @@ -2257,7 +2257,7 @@ Esempio in C: [source,C] ---- -int length_on_screen = weechat_utf8_strlen_screen ("é"); /* == 1 */ +int length_on_screen = weechat_utf8_strlen_screen ("é"); /* == 1 */ ---- [NOTE] @@ -2292,7 +2292,7 @@ Esempio in C: [source,C] ---- -int diff = weechat_utf8_charcmp ("aaa", "ccc"); /* == -2 */ +int diff = weechat_utf8_charcmp ("aaa", "ccc"); /* == -2 */ ---- [NOTE] @@ -2327,7 +2327,7 @@ Esempio in C: [source,C] ---- -int diff = weechat_utf8_charcasecmp ("aaa", "CCC"); /* == -2 */ +int diff = weechat_utf8_charcasecmp ("aaa", "CCC"); /* == -2 */ ---- [NOTE] @@ -2358,7 +2358,7 @@ Esempio in C: [source,C] ---- -int length_on_screen = weechat_utf8_char_size_screen ("é"); /* == 1 */ +int length_on_screen = weechat_utf8_char_size_screen ("é"); /* == 1 */ ---- [NOTE] @@ -2389,7 +2389,7 @@ Esempio in C: [source,C] ---- char *str = "chêne"; -char *str2 = weechat_utf8_add_offset (str, 3); /* points to "ne" */ +char *str2 = weechat_utf8_add_offset (str, 3); /* points to "ne" */ ---- [NOTE] @@ -2419,7 +2419,7 @@ Esempio in C: [source,C] ---- -int pos = weechat_utf8_real_pos ("chêne", 3); /* == 4 */ +int pos = weechat_utf8_real_pos ("chêne", 3); /* == 4 */ ---- [NOTE] @@ -2449,7 +2449,7 @@ Esempio in C: [source,C] ---- -int pos = weechat_utf8_pos ("chêne", 4); /* == 3 */ +int pos = weechat_utf8_pos ("chêne", 4); /* == 3 */ ---- [NOTE] @@ -2479,7 +2479,7 @@ Esempio in C: [source,C] ---- -char *string = weechat_utf8_strndup ("chêne", 3); /* restituisce "chê" */ +char *string = weechat_utf8_strndup ("chêne", 3); /* restituisce "chê" */ /* ... */ free (string); ---- @@ -2780,7 +2780,7 @@ Esempio in C: [source,C] ---- -weechat_util_timeval_add (&tv, 2000); /* aggiunge 2 secondi */ +weechat_util_timeval_add (&tv, 2000); /* aggiunge 2 secondi */ ---- [NOTE] @@ -2838,10 +2838,10 @@ Esempio in C: [source,C] ---- -version_number = weechat_util_version_number ("0.3.8"); /* == 0x00030800 */ -version_number = weechat_util_version_number ("0.3.9-dev"); /* == 0x00030900 */ -version_number = weechat_util_version_number ("0.3.9-rc1"); /* == 0x00030900 */ -version_number = weechat_util_version_number ("0.3.9"); /* == 0x00030900 */ +version_number = weechat_util_version_number ("0.3.8"); /* == 0x00030800 */ +version_number = weechat_util_version_number ("0.3.9-dev"); /* == 0x00030900 */ +version_number = weechat_util_version_number ("0.3.9-rc1"); /* == 0x00030900 */ +version_number = weechat_util_version_number ("0.3.9"); /* == 0x00030900 */ ---- [NOTE] @@ -3118,7 +3118,7 @@ Esempio in C: [source,C] ---- -struct t_weelist_item *item = weechat_list_get (list, 0); /* primo elemento */ +struct t_weelist_item *item = weechat_list_get (list, 0); /* primo elemento */ ---- Script (Python): @@ -4283,11 +4283,11 @@ my_section_delete_option_cb (void *data, struct t_config_file *config_file, /* sezione standard, l'utente non può aggiungere/rimuovere opzioni */ struct t_config_section *new_section1 = weechat_config_new_section (config_file, "section1", 0, 0, - NULL, NULL, /* read callback */ - NULL, NULL, /* write callback */ - NULL, NULL, /* write default callback */ - NULL, NULL, /* create option callback */ - NULL, NULL); /* delete option callback */ + NULL, NULL, /* read callback */ + NULL, NULL, /* write callback */ + NULL, NULL, /* write default callback */ + NULL, NULL, /* create option callback */ + NULL, NULL); /* delete option callback */ /* sezione speciale, l'utente può aggiungere/eliminare opzioni, e le opzioni necessitano di un callback per essere lette/scritte */ @@ -4471,66 +4471,66 @@ Esempio in C: struct t_config_option *option1 = weechat_config_new_option (config_file, section, "option1", "boolean", "My option, type boolean" - NULL, /* valori stringa */ - 0, 0, /* min, max */ - "on", /* predefinito */ - "on", /* valore */ - 0, /* null value allowed */ - NULL, NULL, /* verifica callback */ - NULL, NULL, /* modifica callback */ - NULL, NULL); /* elimina callback */ + NULL, /* valori stringa */ + 0, 0, /* min, max */ + "on", /* predefinito */ + "on", /* valore */ + 0, /* null value allowed */ + NULL, NULL, /* verifica callback */ + NULL, NULL, /* modifica callback */ + NULL, NULL); /* elimina callback */ /* intero */ struct t_config_option *option2 = weechat_config_new_option (config_file, section, "option2", "integer", "My option, type integer" - NULL, /* string values */ - 0, 100, /* min, max */ - "15", /* default */ - "15", /* value */ - 0, /* null value allowed */ - NULL, NULL, /* verifica callback */ - NULL, NULL, /* modifica callback */ - NULL, NULL); /* elimina callback */ + NULL, /* string values */ + 0, 100, /* min, max */ + "15", /* default */ + "15", /* value */ + 0, /* null value allowed */ + NULL, NULL, /* verifica callback */ + NULL, NULL, /* modifica callback */ + NULL, NULL); /* elimina callback */ /* intero (con valori stringa) */ struct t_config_option *option3 = weechat_config_new_option (config_file, section, "option3", "integer", "My option, type integer (with string values)" - "top|bottom|left|right", /* string values */ - 0, 0, /* min, max */ - "bottom", /* predefinito */ - "bottom", /* valoree */ - 0, /* null value allowed */ - NULL, NULL, /* verifica callback */ - NULL, NULL, /* modifica callback */ - NULL, NULL); /* elimina callback */ + "top|bottom|left|right", /* string values */ + 0, 0, /* min, max */ + "bottom", /* predefinito */ + "bottom", /* valoree */ + 0, /* null value allowed */ + NULL, NULL, /* verifica callback */ + NULL, NULL, /* modifica callback */ + NULL, NULL); /* elimina callback */ /* stringa */ struct t_config_option *option4 = weechat_config_new_option (config_file, section, "option4", "string", "My option, type string" - NULL, /* valori stringa */ - 0, 0, /* min, max */ - "test", /* predefinito */ - "test", /* valore */ - 1, /* valore null consentito */ - NULL, NULL, /* verifica callback */ - NULL, NULL, /* modifica callback */ - NULL, NULL); /* elimina callback */ + NULL, /* valori stringa */ + 0, 0, /* min, max */ + "test", /* predefinito */ + "test", /* valore */ + 1, /* valore null consentito */ + NULL, NULL, /* verifica callback */ + NULL, NULL, /* modifica callback */ + NULL, NULL); /* elimina callback */ /* colore */ struct t_config_option *option5 = weechat_config_new_option (config_file, section, "option5", "color", "My option, type color" - NULL, /* valori stringa */ - 0, 0, /* min, max */ - "lightblue", /* predefinito */ - "lightblue", /* valore */ - 0, /* valore null consentito */ - NULL, NULL, /* verifica callback */ - NULL, NULL, /* modifica callback */ - NULL, NULL); /* elimina callback */ + NULL, /* valori stringa */ + 0, 0, /* min, max */ + "lightblue", /* predefinito */ + "lightblue", /* valore */ + 0, /* valore null consentito */ + NULL, NULL, /* verifica callback */ + NULL, NULL, /* modifica callback */ + NULL, NULL); /* elimina callback */ ---- Script (Python): @@ -6309,9 +6309,9 @@ Script (Python): num_keys = weechat.key_bind(context, keys) # esempio -keys = { "@chat(python.test):button1": "hsignal:test_mouse", - "@chat(python.test):wheelup": "/mycommand up", - "@chat(python.test):wheeldown": "/mycommand down" } +keys = {"@chat(python.test):button1": "hsignal:test_mouse", + "@chat(python.test):wheelup": "/mycommand up", + "@chat(python.test):wheeldown": "/mycommand down"} weechat.key_bind("mouse", keys) ---- @@ -6549,7 +6549,7 @@ weechat_printf (buffer, "Benvenuto su questo buffer"); weechat_printf (buffer, "%sQuesto è un errore!", weechat_prefix ("error")); weechat_printf (buffer, " \tMessaggio senza prefisso ma con \t alcune \t tabulazioni"); weechat_printf (buffer, "\t\tMessage without time/alignment"); -weechat_printf (buffer, "\t\t"); /* empty line (without time) */ +weechat_printf (buffer, "\t\t"); /* empty line (without time) */ ---- Script (Python): @@ -6566,7 +6566,7 @@ weechat.prnt(buffer, "Benvenuto su questo buffer") weechat.prnt(buffer, "%sQuesto è un errore!" % weechat.prefix("error")) weechat.prnt(buffer, " \tMessaggio senza prefisso ma con \t alcune \t tabulazioni") weechat.prnt(buffer, "\t\tMessage without time/alignment") -weechat.prnt(buffer, "\t\t") # empty line (without time) +weechat.prnt(buffer, "\t\t") # empty line (without time) ---- [NOTE] @@ -7455,7 +7455,7 @@ if (options_cmd1) weechat_hashtable_set (options_cmd1, "arg1", "-from"); weechat_hashtable_set (options_cmd1, "arg2", nick); weechat_hashtable_set (options_cmd1, "arg3", "-msg"); - weechat_hashtable_set (options_cmd1, "arg4", message); /* unsafe argument */ + weechat_hashtable_set (options_cmd1, "arg4", message); /* unsafe argument */ struct t_hook *my_process_hook = weechat_hook_process_hashtable ("my-notify-command", options_cmd1, 20000, @@ -7503,21 +7503,21 @@ def my_process_cb(data, command, return_code, out, err): # example 1: download URL hook1 = weechat.hook_process_hashtable("url:http://weechat.org/", - { "file_out": "/tmp/weechat.org.html" }, + {"file_out": "/tmp/weechat.org.html"}, 20000, "my_process_cb", "") # example 2: execute a notify program with a message from someone hook2 = weechat.hook_process_hashtable("my-notify-command", - { "arg1": "-from", - "arg2": nick, - "arg3": "-msg", - "arg4": message }, # unsafe argument + {"arg1": "-from", + "arg2": nick, + "arg3": "-msg", + "arg4": message}, # unsafe argument 20000, "my_process_cb", "") # example 3: call shell to execute a command (command must be SAFE) hook3 = weechat.hook_process_hashtable("sh", - { "arg1": "-c", - "arg2": "ls -l /tmp | grep something" }, + {"arg1": "-c", + "arg2": "ls -l /tmp | grep something"}, 20000, "my_process_cb", "") ---- @@ -7652,7 +7652,7 @@ my_connect_cb (void *data, int status, int gnutls_rc, int sock, struct t_hook *my_connect_hook = weechat_hook_connect (NULL, "my.server.org", 1234, 1, 0, - NULL, NULL, 0, /* GnuTLS */ + NULL, NULL, 0, /* GnuTLS */ NULL, &my_connect_cb, NULL); ---- @@ -8931,7 +8931,7 @@ Script (Python): rc = weechat.hook_hsignal_send(signal, hashtable) # esempio -rc = weechat.hook_hsignal_send("my_hsignal", { "key": "value" }) +rc = weechat.hook_hsignal_send("my_hsignal", {"key": "value"}) ---- [[hsignal_irc_redirect_command]] @@ -9034,8 +9034,8 @@ def test_whois_cb(data, signal, hashtable): weechat.hook_hsignal ("irc_redirection_test_whois", "test_whois_cb", "") weechat.hook_hsignal_send("irc_redirect_command", - { "server": "freenode", "pattern": "whois", "signal": "test", - "string": "FlashCode" }) + {"server": "freenode", "pattern": "whois", "signal": "test", + "string": "FlashCode"}) weechat.hook_signal_send("irc_input_send", weechat.WEECHAT_HOOK_SIGNAL_STRING, "freenode;;2;;/whois FlashCode") ---- @@ -9104,10 +9104,10 @@ Script (Python): [source,python] ---- weechat.hook_hsignal_send("irc_redirect_pattern", - { "pattern": "my_whois", "timeout": "30", - "cmd_start": "311:1", - "cmd_stop": "318:1,401:1,402:1,431:1,461", - "cmd_extra": "318:1" }) + {"pattern": "my_whois", "timeout": "30", + "cmd_start": "311:1", + "cmd_stop": "318:1,401:1,402:1,431:1,461", + "cmd_extra": "318:1"}) # now redirect irc whois command with hsignal irc_redirect_command # using pattern "my_whois" # ... @@ -9751,7 +9751,7 @@ hook = weechat.hook_info_hashtable(info_name, description, args_description, # esempio def my_info_hashtable_cb(data, info_name, hashtable): - return { "test_key": "test_value" } + return {"test_key": "test_value"} hook = weechat.hook_info_hashtable("my_info_hashtable", "Some info", "Info about input hashtable", @@ -10118,7 +10118,7 @@ def my_process_cb(data, command, return_code, out, err): # ... return weechat.WEECHAT_RC_OK -hook = weechat.hook_process_hashtable("/path/to/command", { "stdin": "1" }, +hook = weechat.hook_process_hashtable("/path/to/command", {"stdin": "1"}, 20000, "my_process_cb", "") weechat.hook_set(hook, "stdin", "data sent to stdin of child process") weechat.hook_set(hook, "stdin_close", "") # optional @@ -10351,7 +10351,7 @@ Esempio in C: [source,C] ---- struct t_gui_buffer *buffer1 = weechat_buffer_search ("irc", "freenode.#weechat"); -struct t_gui_buffer *buffer2 = weechat_buffer_search ("==", "irc.freenode.#test"); /* WeeChat ≥ 1.0 */ +struct t_gui_buffer *buffer2 = weechat_buffer_search ("==", "irc.freenode.#test"); /* WeeChat ≥ 1.0 */ ---- Script (Python): @@ -11134,10 +11134,10 @@ Esempio in C: struct t_gui_buffer *buffer = weechat_buffer_search ("irc", "freenode.#weechat"); if (buffer) { - weechat_printf (NULL, "%d", weechat_buffer_match_list (buffer, "*")); /* 1 */ - weechat_printf (NULL, "%d", weechat_buffer_match_list (buffer, "*,!*#weechat*")); /* 0 */ - weechat_printf (NULL, "%d", weechat_buffer_match_list (buffer, "irc.freenode.*")); /* 1 */ - weechat_printf (NULL, "%d", weechat_buffer_match_list (buffer, "irc.oftc.*,python.*")); /* 0 */ + weechat_printf (NULL, "%d", weechat_buffer_match_list (buffer, "*")); /* 1 */ + weechat_printf (NULL, "%d", weechat_buffer_match_list (buffer, "*,!*#weechat*")); /* 0 */ + weechat_printf (NULL, "%d", weechat_buffer_match_list (buffer, "irc.freenode.*")); /* 1 */ + weechat_printf (NULL, "%d", weechat_buffer_match_list (buffer, "irc.oftc.*,python.*")); /* 0 */ } ---- @@ -11151,10 +11151,10 @@ match = weechat.buffer_match_list(buffer, string) # esempio buffer = weechat.buffer_search("irc", "freenode.#weechat") if buffer: - weechat.prnt("", "%d" % weechat.buffer_match_list(buffer, "*")) # 1 - weechat.prnt("", "%d" % weechat.buffer_match_list(buffer, "*,!*#weechat*")) # 0 - weechat.prnt("", "%d" % weechat.buffer_match_list(buffer, "irc.freenode.*")) # 1 - weechat.prnt("", "%d" % weechat.buffer_match_list(buffer, "irc.oftc.*,python.*")) # 0 + weechat.prnt("", "%d" % weechat.buffer_match_list(buffer, "*")) # 1 + weechat.prnt("", "%d" % weechat.buffer_match_list(buffer, "*,!*#weechat*")) # 0 + weechat.prnt("", "%d" % weechat.buffer_match_list(buffer, "irc.freenode.*")) # 1 + weechat.prnt("", "%d" % weechat.buffer_match_list(buffer, "irc.oftc.*,python.*")) # 0 ---- [[windows]] @@ -12952,7 +12952,7 @@ Script (Python): dict = weechat.info_get_hashtable(info_name, dict_in) # esempio -dict_in = { "message": ":nick!user@host PRIVMSG #weechat :message here" } +dict_in = {"message": ":nick!user@host PRIVMSG #weechat :message here"} weechat.prnt("", "message parsed: %s" % weechat.info_get_hashtable("irc_message_parse", dict_in)) ---- @@ -15109,13 +15109,13 @@ Script (Python): count = weechat.hdata_update(hdata, pointer, hashtable) # example: subtract one hour on last message displayed in current buffer -own_lines = weechat.hdata_pointer(weechat.hdata_get('buffer'), weechat.current_buffer(), 'own_lines') +own_lines = weechat.hdata_pointer(weechat.hdata_get("buffer"), weechat.current_buffer(), "own_lines") if own_lines: - line = weechat.hdata_pointer(weechat.hdata_get('lines'), own_lines, 'last_line') + line = weechat.hdata_pointer(weechat.hdata_get("lines"), own_lines, "last_line") if line: - line_data = weechat.hdata_pointer(weechat.hdata_get('line'), line, 'data') - hdata = weechat.hdata_get('line_data') - weechat.hdata_update(hdata, line_data, { 'date': str(weechat.hdata_time(hdata, line_data, 'date') - 3600) }) + line_data = weechat.hdata_pointer(weechat.hdata_get("line"), line, "data") + hdata = weechat.hdata_get("line_data") + weechat.hdata_update(hdata, line_data, {"date": str(weechat.hdata_time(hdata, line_data, "date") - 3600)}) ---- ==== weechat_hdata_get_string |