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/ja | |
parent | bdcb9fb5d70236ae983c173179960a9e4753d1a6 (diff) | |
download | weechat-2b7b8cb36539c73847e8ab05d5bc02eed9821815.zip |
doc: fix style of C/Python examples in docs
Diffstat (limited to 'doc/ja')
-rw-r--r-- | doc/ja/weechat_plugin_api.ja.asciidoc | 298 | ||||
-rw-r--r-- | doc/ja/weechat_scripting.ja.asciidoc | 8 |
2 files changed, 153 insertions, 153 deletions
diff --git a/doc/ja/weechat_plugin_api.ja.asciidoc b/doc/ja/weechat_plugin_api.ja.asciidoc index 1aae071ee..892017172 100644 --- a/doc/ja/weechat_plugin_api.ja.asciidoc +++ b/doc/ja/weechat_plugin_api.ja.asciidoc @@ -484,7 +484,7 @@ C 言語での使用例: [source,C] ---- -char *str = weechat_strndup ("abcdef", 3); /* result: "abc" */ +char *str = weechat_strndup ("abcdef", 3); /* result: "abc" */ /* ... */ free (str); ---- @@ -512,7 +512,7 @@ C 言語での使用例: [source,C] ---- char str[] = "AbCdé"; -weechat_string_tolower (str); /* str is now: "abcdé" */ +weechat_string_tolower (str); /* str is now: "abcdé" */ ---- [NOTE] @@ -538,7 +538,7 @@ C 言語での使用例: [source,C] ---- char str[] = "AbCdé"; -weechat_string_toupper (str); /* str is now: "ABCDé" */ +weechat_string_toupper (str); /* str is now: "ABCDé" */ ---- [NOTE] @@ -573,7 +573,7 @@ C 言語での使用例: [source,C] ---- -int diff = weechat_strcasecmp ("aaa", "CCC"); /* == -2 */ +int diff = weechat_strcasecmp ("aaa", "CCC"); /* == -2 */ ---- [NOTE] @@ -616,7 +616,7 @@ 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] @@ -652,7 +652,7 @@ C 言語での使用例: [source,C] ---- -int diff = weechat_strncasecmp ("aabb", "aacc", 2); /* == 0 */ +int diff = weechat_strncasecmp ("aabb", "aacc", 2); /* == 0 */ ---- [NOTE] @@ -697,7 +697,7 @@ 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] @@ -737,7 +737,7 @@ 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] @@ -767,7 +767,7 @@ C 言語での使用例: [source,C] ---- -char *pos = weechat_strcasestr ("aBcDeF", "de"); /* result: pointer to "DeF" */ +char *pos = weechat_strcasestr ("aBcDeF", "de"); /* result: pointer to "DeF" */ ---- [NOTE] @@ -800,7 +800,7 @@ C 言語での使用例: [source,C] ---- -int length_on_screen = weechat_strlen_screen ("é"); /* == 1 */ +int length_on_screen = weechat_strlen_screen ("é"); /* == 1 */ ---- スクリプト (Python) での使用例: @@ -811,7 +811,7 @@ int length_on_screen = weechat_strlen_screen ("é"); /* == 1 */ length = weechat.strlen_screen(string) # 例 -length = weechat.strlen_screen("é") # 1 +length = weechat.strlen_screen("é") # 1 ---- ==== weechat_string_match @@ -847,11 +847,11 @@ 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 */ ---- スクリプト (Python) での使用例: @@ -862,11 +862,11 @@ int match5 = weechat_string_match ("abcdef", "*b*d*", 0); /* == 1 */ match = weechat.string_match(string, mask, case_sensitive) # 例s -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 @@ -967,7 +967,7 @@ C 言語での使用例: [source,C] ---- -char *str = weechat_string_strip (".abc -", 0, 1, "- ."); /* result: ".abc" */ +char *str = weechat_string_strip (".abc -", 0, 1, "- ."); /* result: ".abc" */ /* ... */ free (str); ---- @@ -1063,7 +1063,7 @@ free (str_regex); regex = weechat.string_mask_to_regex(mask) # 例 -regex = weechat.string_mask_to_regex("test*mask") # "test.*mask" +regex = weechat.string_mask_to_regex("test*mask") # "test.*mask" ---- ==== weechat_string_regex_flags @@ -1186,7 +1186,7 @@ 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 */ ---- スクリプト (Python) での使用例: @@ -1197,7 +1197,7 @@ int hl = weechat_string_has_highlight ("my test string", "test,word2"); /* == 1 highlight = weechat.string_has_highlight(string, highlight_words) # 例 -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 @@ -1229,7 +1229,7 @@ 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 */ ---- スクリプト (Python) での使用例: @@ -1240,7 +1240,7 @@ int hl = weechat_string_has_highlight_regex ("my test string", "test|word2"); /* highlight = weechat.string_has_highlight_regex(string, regex) # 例 -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 @@ -1270,7 +1270,7 @@ 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); ---- @@ -1601,19 +1601,19 @@ C 言語での使用例: ---- /* examples with English locale */ -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); ---- @@ -1763,8 +1763,8 @@ 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 */ ---- スクリプト (Python) での使用例: @@ -1775,8 +1775,8 @@ int command_char2 = weechat_string_is_command_char ("test"); /* == 0 */ is_cmdchar = weechat.string_is_command_char(string) # 例s -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 @@ -1805,9 +1805,9 @@ 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" */ ---- スクリプト (Python) での使用例: @@ -1818,9 +1818,9 @@ const char *str3 = weechat_string_input_for_buffer ("//test"); /* "/test" */ str = weechat.string_input_for_buffer(string) # 例s -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 @@ -1877,9 +1877,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" */ ---- スクリプト (Python) での使用例: @@ -1890,9 +1890,9 @@ char *str3 = weechat_string_eval_expression ("abc =~ def", NULL, NULL, options); str = weechat.string_eval_expression(expr, pointers, extra_vars, options) # 例s -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]] @@ -2080,7 +2080,7 @@ C 言語での使用例: [source,C] ---- -int char_int = weechat_utf8_char_int ("être"); /* "ê" as integer */ +int char_int = weechat_utf8_char_int ("être"); /* "ê" as integer */ ---- [NOTE] @@ -2109,7 +2109,7 @@ C 言語での使用例: [source,C] ---- -int char_size = weechat_utf8_char_size ("être"); /* == 2 */ +int char_size = weechat_utf8_char_size ("être"); /* == 2 */ ---- [NOTE] @@ -2138,7 +2138,7 @@ C 言語での使用例: [source,C] ---- -int length = weechat_utf8_strlen ("chêne"); /* == 5 */ +int length = weechat_utf8_strlen ("chêne"); /* == 5 */ ---- [NOTE] @@ -2168,7 +2168,7 @@ C 言語での使用例: [source,C] ---- -int length = weechat_utf8_strnlen ("chêne", 4); /* == 3 */ +int length = weechat_utf8_strnlen ("chêne", 4); /* == 3 */ ---- [NOTE] @@ -2197,7 +2197,7 @@ C 言語での使用例: [source,C] ---- -int length_on_screen = weechat_utf8_strlen_screen ("é"); /* == 1 */ +int length_on_screen = weechat_utf8_strlen_screen ("é"); /* == 1 */ ---- [NOTE] @@ -2232,7 +2232,7 @@ C 言語での使用例: [source,C] ---- -int diff = weechat_utf8_charcmp ("aaa", "ccc"); /* == -2 */ +int diff = weechat_utf8_charcmp ("aaa", "ccc"); /* == -2 */ ---- [NOTE] @@ -2267,7 +2267,7 @@ C 言語での使用例: [source,C] ---- -int diff = weechat_utf8_charcasecmp ("aaa", "CCC"); /* == -2 */ +int diff = weechat_utf8_charcasecmp ("aaa", "CCC"); /* == -2 */ ---- [NOTE] @@ -2296,7 +2296,7 @@ C 言語での使用例: [source,C] ---- -int length_on_screen = weechat_utf8_char_size_screen ("é"); /* == 1 */ +int length_on_screen = weechat_utf8_char_size_screen ("é"); /* == 1 */ ---- [NOTE] @@ -2327,7 +2327,7 @@ 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] @@ -2357,7 +2357,7 @@ C 言語での使用例: [source,C] ---- -int pos = weechat_utf8_real_pos ("chêne", 3); /* == 4 */ +int pos = weechat_utf8_real_pos ("chêne", 3); /* == 4 */ ---- [NOTE] @@ -2387,7 +2387,7 @@ C 言語での使用例: [source,C] ---- -int pos = weechat_utf8_pos ("chêne", 4); /* == 3 */ +int pos = weechat_utf8_pos ("chêne", 4); /* == 3 */ ---- [NOTE] @@ -2417,7 +2417,7 @@ C 言語での使用例: [source,C] ---- -char *string = weechat_utf8_strndup ("chêne", 3); /* returns "chê" */ +char *string = weechat_utf8_strndup ("chêne", 3); /* returns "chê" */ /* ... */ free (string); ---- @@ -2717,7 +2717,7 @@ C 言語での使用例: [source,C] ---- -weechat_util_timeval_add (&tv, 2000); /* add 2 seconds */ +weechat_util_timeval_add (&tv, 2000); /* add 2 seconds */ ---- [NOTE] @@ -2773,10 +2773,10 @@ 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] @@ -3052,7 +3052,7 @@ C 言語での使用例: [source,C] ---- -struct t_weelist_item *item = weechat_list_get (list, 0); /* first item */ +struct t_weelist_item *item = weechat_list_get (list, 0); /* first item */ ---- スクリプト (Python) での使用例: @@ -4202,11 +4202,11 @@ my_section_delete_option_cb (void *data, struct t_config_file *config_file, /* standard section, user can not add/delete options */ 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 */ /* special section, user can add/delete options, and options need callback to be read/written */ @@ -4390,66 +4390,66 @@ C 言語での使用例: struct t_config_option *option1 = weechat_config_new_option (config_file, section, "option1", "boolean", "My option, type boolean" - NULL, /* string values */ - 0, 0, /* min, max */ - "on", /* default */ - "on", /* value */ - 0, /* null value allowed */ - NULL, NULL, /* check callback */ - NULL, NULL, /* change callback */ - NULL, NULL); /* delete callback */ + NULL, /* string values */ + 0, 0, /* min, max */ + "on", /* default */ + "on", /* value */ + 0, /* null value allowed */ + NULL, NULL, /* check callback */ + NULL, NULL, /* change callback */ + NULL, NULL); /* delete callback */ /* integer */ 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, /* check callback */ - NULL, NULL, /* change callback */ - NULL, NULL); /* delete callback */ + NULL, /* string values */ + 0, 100, /* min, max */ + "15", /* default */ + "15", /* value */ + 0, /* null value allowed */ + NULL, NULL, /* check callback */ + NULL, NULL, /* change callback */ + NULL, NULL); /* delete callback */ /* integer (with string values) */ 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", /* default */ - "bottom", /* value */ - 0, /* null value allowed */ - NULL, NULL, /* check callback */ - NULL, NULL, /* change callback */ - NULL, NULL); /* delete callback */ + "top|bottom|left|right", /* string values */ + 0, 0, /* min, max */ + "bottom", /* default */ + "bottom", /* value */ + 0, /* null value allowed */ + NULL, NULL, /* check callback */ + NULL, NULL, /* change callback */ + NULL, NULL); /* delete callback */ /* string */ struct t_config_option *option4 = weechat_config_new_option (config_file, section, "option4", "string", "My option, type string" - NULL, /* string values */ - 0, 0, /* min, max */ - "test", /* default */ - "test", /* value */ - 1, /* null value allowed */ - NULL, NULL, /* check callback */ - NULL, NULL, /* change callback */ - NULL, NULL); /* delete callback */ + NULL, /* string values */ + 0, 0, /* min, max */ + "test", /* default */ + "test", /* value */ + 1, /* null value allowed */ + NULL, NULL, /* check callback */ + NULL, NULL, /* change callback */ + NULL, NULL); /* delete callback */ /* color */ struct t_config_option *option5 = weechat_config_new_option (config_file, section, "option5", "color", "My option, type color" - NULL, /* string values */ - 0, 0, /* min, max */ - "lightblue", /* default */ - "lightblue", /* value */ - 0, /* null value allowed */ - NULL, NULL, /* check callback */ - NULL, NULL, /* change callback */ - NULL, NULL); /* delete callback */ + NULL, /* string values */ + 0, 0, /* min, max */ + "lightblue", /* default */ + "lightblue", /* value */ + 0, /* null value allowed */ + NULL, NULL, /* check callback */ + NULL, NULL, /* change callback */ + NULL, NULL); /* delete callback */ ---- スクリプト (Python) での使用例: @@ -6213,9 +6213,9 @@ if (keys) num_keys = weechat.key_bind(context, keys) # 例 -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) ---- @@ -6446,7 +6446,7 @@ weechat_printf (buffer, "Hello on this buffer"); weechat_printf (buffer, "%sThis is an error!", weechat_prefix ("error")); weechat_printf (buffer, " \tMessage without prefix but with \t some \t tabs"); 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) */ ---- スクリプト (Python) での使用例: @@ -6462,7 +6462,7 @@ weechat.prnt(buffer, "Hello on this buffer") weechat.prnt(buffer, "%sThis is an error!" % weechat.prefix("error")) weechat.prnt(buffer, " \tMessage without prefix but with \t some \t tabs") 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] @@ -7320,7 +7320,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); /* untrusted argument */ + weechat_hashtable_set (options_cmd1, "arg4", message); /* untrusted argument */ struct t_hook *my_process_hook = weechat_hook_process_hashtable ("my-notify-command", options_cmd1, 20000, @@ -7368,21 +7368,21 @@ def my_process_cb(data, command, return_code, out, err): # 例 1: 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", "") # 例 2: メッセージを渡して通知プログラムを実行 hook2 = weechat.hook_process_hashtable("my-notify-command", - { "arg1": "-from", - "arg2": nick, - "arg3": "-msg", - "arg4": message }, # untrusted argument + {"arg1": "-from", + "arg2": nick, + "arg3": "-msg", + "arg4": message}, # untrusted argument 20000, "my_process_cb", "") # 例 3: コマンドを実行するためにシェルを呼び出す (必ず安全なコマンドを実行してください) 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", "") ---- @@ -7513,7 +7513,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); ---- @@ -8695,7 +8695,7 @@ if (hashtable) rc = weechat.hook_hsignal_send(signal, hashtable) # 例 -rc = weechat.hook_hsignal_send("my_hsignal", { "key": "value" }) +rc = weechat.hook_hsignal_send("my_hsignal", {"key": "value"}) ---- [[hsignal_irc_redirect_command]] @@ -8796,8 +8796,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") ---- @@ -8865,10 +8865,10 @@ if (hashtable) [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" # ... @@ -9493,7 +9493,7 @@ hook = weechat.hook_info_hashtable(info_name, description, args_description, # 例 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", @@ -9846,7 +9846,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 @@ -10074,7 +10074,7 @@ 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 */ ---- スクリプト (Python) での使用例: @@ -10811,10 +10811,10 @@ 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 */ } ---- @@ -10828,10 +10828,10 @@ match = weechat.buffer_match_list(buffer, string) # 例 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]] @@ -12587,7 +12587,7 @@ if (hashtable_in) dict = weechat.info_get_hashtable(info_name, dict_in) # 例 -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)) ---- @@ -14679,13 +14679,13 @@ if (own_lines) count = weechat.hdata_update(hdata, pointer, hashtable) # 例: 現在のバッファに表示されている最後のメッセージの時間を 1 時間前にする -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 diff --git a/doc/ja/weechat_scripting.ja.asciidoc b/doc/ja/weechat_scripting.ja.asciidoc index ca9e2814d..5fedd5969 100644 --- a/doc/ja/weechat_scripting.ja.asciidoc +++ b/doc/ja/weechat_scripting.ja.asciidoc @@ -586,8 +586,8 @@ weechat.buffer_set(buffer, "localvar_set_no_log", "1") ---- buffer = weechat.current_buffer() -number = weechat.buffer_get_integer(buffer, "number") -name = weechat.buffer_get_string(buffer, "name") +number = weechat.buffer_get_integer(buffer, "number") +name = weechat.buffer_get_string(buffer, "name") short_name = weechat.buffer_get_string(buffer, "short_name") ---- @@ -733,7 +733,7 @@ def my_process_cb(data, command, rc, out, err): return weechat.WEECHAT_RC_OK weechat.hook_process_hashtable("url:http://weechat.org/files/src/weechat-devel.tar.gz", - { "file_out": "/tmp/weechat-devel.tar.gz" }, + {"file_out": "/tmp/weechat-devel.tar.gz"}, 30 * 1000, "my_process_cb", "") ---- @@ -876,7 +876,7 @@ _バージョン 0.3.4 の新機能_ [source,python] ---- dict = weechat.info_get_hashtable("irc_message_parse", - { "message": ":nick!user@host PRIVMSG #weechat :message here" }) + {"message": ":nick!user@host PRIVMSG #weechat :message here"}) weechat.prnt("", "dict: %s" % dict) # 出力: |