-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweechat.pyi
2783 lines (2277 loc) · 91.5 KB
/
weechat.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# WeeChat Python stub file, auto-generated by generate_python_stub.py.
# DO NOT EDIT BY HAND!
#
from typing import Dict, Union
WEECHAT_RC_OK: int = 0
WEECHAT_RC_OK_EAT: int = 1
WEECHAT_RC_ERROR: int = -1
WEECHAT_CONFIG_READ_OK: int = 0
WEECHAT_CONFIG_READ_MEMORY_ERROR: int = -1
WEECHAT_CONFIG_READ_FILE_NOT_FOUND: int = -2
WEECHAT_CONFIG_WRITE_OK: int = 0
WEECHAT_CONFIG_WRITE_ERROR: int = -1
WEECHAT_CONFIG_WRITE_MEMORY_ERROR: int = -2
WEECHAT_CONFIG_OPTION_SET_OK_CHANGED: int = 2
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE: int = 1
WEECHAT_CONFIG_OPTION_SET_ERROR: int = 0
WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND: int = -1
WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET: int = 0
WEECHAT_CONFIG_OPTION_UNSET_OK_RESET: int = 1
WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED: int = 2
WEECHAT_CONFIG_OPTION_UNSET_ERROR: int = -1
WEECHAT_LIST_POS_SORT: str = "sort"
WEECHAT_LIST_POS_BEGINNING: str = "beginning"
WEECHAT_LIST_POS_END: str = "end"
WEECHAT_HOTLIST_LOW: str = "0"
WEECHAT_HOTLIST_MESSAGE: str = "1"
WEECHAT_HOTLIST_PRIVATE: str = "2"
WEECHAT_HOTLIST_HIGHLIGHT: str = "3"
WEECHAT_HOOK_PROCESS_RUNNING: int = -1
WEECHAT_HOOK_PROCESS_ERROR: int = -2
WEECHAT_HOOK_CONNECT_OK: int = 0
WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND: int = 1
WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND: int = 2
WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED: int = 3
WEECHAT_HOOK_CONNECT_PROXY_ERROR: int = 4
WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR: int = 5
WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR: int = 6
WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR: int = 7
WEECHAT_HOOK_CONNECT_MEMORY_ERROR: int = 8
WEECHAT_HOOK_CONNECT_TIMEOUT: int = 9
WEECHAT_HOOK_CONNECT_SOCKET_ERROR: int = 10
WEECHAT_HOOK_SIGNAL_STRING: str = "string"
WEECHAT_HOOK_SIGNAL_INT: str = "int"
WEECHAT_HOOK_SIGNAL_POINTER: str = "pointer"
def register(
name: str,
author: str,
version: str,
license: str,
description: str,
shutdown_function: str,
charset: str,
) -> int:
"""`register in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_register>`_"""
...
def plugin_get_name(plugin: str) -> str:
"""`plugin_get_name in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_plugin_get_name>`_
::
# example
plugin = weechat.buffer_get_pointer(weechat.current_buffer(), "plugin")
name = weechat.plugin_get_name(plugin)
"""
...
def charset_set(charset: str) -> int:
"""`charset_set in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_charset_set>`_
::
# example
weechat.charset_set("iso-8859-1")
"""
...
def iconv_to_internal(charset: str, string: str) -> str:
"""`iconv_to_internal in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_iconv_to_internal>`_
::
# example
str = weechat.iconv_to_internal("iso-8859-1", "iso string: é à")
"""
...
def iconv_from_internal(charset: str, string: str) -> str:
"""`iconv_from_internal in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_iconv_from_internal>`_
::
# example
str = weechat.iconv_from_internal("iso-8859-1", "utf-8 string: é à")
"""
...
def gettext(string: str) -> str:
"""`gettext in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_gettext>`_
::
# example
str = weechat.gettext("hello")
"""
...
def ngettext(string: str, plural: str, count: int) -> str:
"""`ngettext in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_ngettext>`_
::
# example
num_files = 2
str = weechat.ngettext("file", "files", num_files)
"""
...
def strlen_screen(string: str) -> int:
"""`strlen_screen in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_strlen_screen>`_
::
# example
length = weechat.strlen_screen("é") # 1
"""
...
def string_match(string: str, mask: str, case_sensitive: int) -> int:
"""`string_match in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_string_match>`_
::
# examples
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
"""
...
def string_match_list(string: str, masks: str, case_sensitive: int) -> int:
"""`string_match_list in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_string_match_list>`_
::
# examples
match1 = weechat.string_match("abc", "*,!abc*", 0) # == 0
match2 = weechat.string_match("abcdef", "*,!abc*", 0) # == 0
match3 = weechat.string_match("def", "*,!abc*", 0) # == 1
"""
...
def string_eval_path_home(
path: str,
pointers: Dict[str, str],
extra_vars: Dict[str, str],
options: Dict[str, str],
) -> str:
"""`string_eval_path_home in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_string_eval_path_home>`_
::
# example
path = weechat.string_eval_path_home("${weechat_config_dir}/test.conf", {}, {}, {})
# path == "/home/user/.config/weechat/test.conf"
"""
...
def string_mask_to_regex(mask: str) -> str:
"""`string_mask_to_regex in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_string_mask_to_regex>`_
::
# example
regex = weechat.string_mask_to_regex("test*mask") # "test.*mask"
"""
...
def string_has_highlight(string: str, highlight_words: str) -> int:
"""`string_has_highlight in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_string_has_highlight>`_
::
# example
highlight = weechat.string_has_highlight("my test string", "test,word2") # 1
"""
...
def string_has_highlight_regex(string: str, regex: str) -> int:
"""`string_has_highlight_regex in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_string_has_highlight_regex>`_
::
# example
highlight = weechat.string_has_highlight_regex("my test string", "test|word2") # 1
"""
...
def string_format_size(size: int) -> str:
"""`string_format_size in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_string_format_size>`_
::
# example
str = weechat.string_format_size(15200) # == "15.2 KB"
"""
...
def string_parse_size(size: str) -> int:
"""`string_parse_size in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_string_parse_size>`_
::
# example
size = weechat.string_parse_size("1.34m") # 1340000
"""
...
def string_color_code_size(string: str) -> int:
"""`string_color_code_size in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_string_color_code_size>`_
::
# examples
size = weechat.string_color_code_size("test") # size == 0
size = weechat.string_color_code_size(weechat.color("bold")) # size == 2
size = weechat.string_color_code_size(weechat.color("yellow,red")) # size == 7
"""
...
def string_remove_color(string: str, replacement: str) -> str:
"""`string_remove_color in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_string_remove_color>`_
::
# example
str = weechat.string_remove_color(my_string, "[color]")
"""
...
def string_is_command_char(string: str) -> int:
"""`string_is_command_char in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_string_is_command_char>`_
::
# examples
command_char1 = weechat.string_is_command_char("/test") # == 1
command_char2 = weechat.string_is_command_char("test") # == 0
"""
...
def string_input_for_buffer(string: str) -> str:
"""`string_input_for_buffer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_string_input_for_buffer>`_
::
# examples
str1 = weechat.string_input_for_buffer("test") # "test"
str2 = weechat.string_input_for_buffer("/test") # ""
str3 = weechat.string_input_for_buffer("//test") # "/test"
"""
...
def string_eval_expression(
expr: str,
pointers: Dict[str, str],
extra_vars: Dict[str, str],
options: Dict[str, str],
) -> str:
"""`string_eval_expression in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_string_eval_expression>`_
::
# examples
# conditions
str1 = weechat.string_eval_expression("${window.win_width} > 100", {}, {}, {"type": "condition"}) # "1"
str2 = weechat.string_eval_expression("abc =~ def", {}, {}, {"type": "condition"}) # "0"
# simple expression
str3 = weechat.string_eval_expression("${buffer.full_name}", {}, {}, {}) # "core.weechat"
# replace with regex: add brackets around URLs
options = {
"regex": "[a-zA-Z0-9_]+://[^ ]+",
"regex_replace": "[ ${re:0} ]",
}
str4 = weechat.string_eval_expression("test: https://weechat.org", {}, {}, options) # "test: [ https://weechat.org ]"
# replace with regex: hide passwords
options = {
"regex": "(password=)([^ ]+)",
"regex_replace": "${re:1}${hide:*,${re:2}}",
}
str5 = weechat.string_eval_expression("password=abc password=def", {}, {}, options) # "password=*** password=***"
"""
...
def mkdir_home(directory: str, mode: int) -> int:
"""`mkdir_home in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_mkdir_home>`_
::
# example
weechat.mkdir_home("${weechat_cache_dir}/temp", 0755)
"""
...
def mkdir(directory: str, mode: int) -> int:
"""`mkdir in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_mkdir>`_
::
# example
weechat.mkdir("/tmp/mydir", 0755)
"""
...
def mkdir_parents(directory: str, mode: int) -> int:
"""`mkdir_parents in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_mkdir_parents>`_
::
# example
weechat.mkdir_parents("/tmp/my/dir", 0755)
"""
...
def list_new() -> str:
"""`list_new in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_list_new>`_
::
# example
list = weechat.list_new()
"""
...
def list_add(list: str, data: str, where: str, user_data: str) -> str:
"""`list_add in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_list_add>`_
::
# example
item = weechat.list_add(list, "my data", weechat.WEECHAT_LIST_POS_SORT, "")
"""
...
def list_search(list: str, data: str) -> str:
"""`list_search in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_list_search>`_
::
# example
item = weechat.list_search(list, "my data")
"""
...
def list_search_pos(list: str, data: str) -> int:
"""`list_search_pos in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_list_search_pos>`_
::
# example
pos_item = weechat.list_search_pos(list, "my data")
"""
...
def list_casesearch(list: str, data: str) -> str:
"""`list_casesearch in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_list_casesearch>`_
::
# example
item = weechat.list_casesearch(list, "my data")
"""
...
def list_casesearch_pos(list: str, data: str) -> int:
"""`list_casesearch_pos in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_list_casesearch_pos>`_
::
# example
pos_item = weechat.list_casesearch_pos(list, "my data")
"""
...
def list_get(list: str, position: int) -> str:
"""`list_get in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_list_get>`_
::
# example
item = weechat.list_get(list, 0)
"""
...
def list_set(item: str, value: str) -> int:
"""`list_set in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_list_set>`_
::
# example
weechat.list_set(item, "new data")
"""
...
def list_next(item: str) -> str:
"""`list_next in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_list_next>`_
::
# example
item = weechat.list_next(item)
"""
...
def list_prev(item: str) -> str:
"""`list_prev in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_list_prev>`_
::
# example
item = weechat.list_prev(item)
"""
...
def list_string(item: str) -> str:
"""`list_string in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_list_string>`_
::
# example
weechat.prnt("", "value of item: %s" % weechat.list_string(item))
"""
...
def list_size(list: str) -> int:
"""`list_size in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_list_size>`_
::
# example
weechat.prnt("", "size of list: %d" % weechat.list_size(list))
"""
...
def list_remove(list: str, item: str) -> int:
"""`list_remove in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_list_remove>`_
::
# example
weechat.list_remove(list, item)
"""
...
def list_remove_all(list: str) -> int:
"""`list_remove_all in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_list_remove_all>`_
::
# example
weechat.list_remove_all(list)
"""
...
def list_free(list: str) -> int:
"""`list_free in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_list_free>`_
::
# example
weechat.list_free(list)
"""
...
def config_new(name: str, callback_reload: str, callback_reload_data: str) -> str:
"""`config_new in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_new>`_
::
# example
def my_config_reload_cb(data: str, config_file: str) -> int:
# ...
return weechat.WEECHAT_RC_OK
config_file = weechat.config_new("test", "my_config_reload_cb", "")
"""
...
def config_set_version(
config_file: str, version: int, callback_update: str, callback_update_data: str
) -> int:
"""`config_set_version in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_set_version>`_
::
# example
def my_config_update_cb(data: str, config_file: str, version_read: int, data_read: Dict[str, str]) -> Dict[str, str]:
# return now if version is already up-to-date
if version_read >= 2:
return {}
section = data_read.get("section")
option = data_read.get("option")
# rename section "abc" to "def"
if section and not option and section == "abc":
data_read["section"] = "def"
return data_read
# limit other changes to section "test"
if not section or not option or section != "test":
return {}
# rename option "test1" to "test2"
if option == "test1":
data_read["option"] = "test2"
return data_read
# set value to "xxx" for option "test"
if option == "test":
data_read["value"] = "xxx"
return data_read
# set value to NULL for option "test_null"
if option == "test_null":
data_read["value_null"] = "1"
return data_read
# no changes
return {}
config_file = weechat.config_new("test", "", "")
weechat.config_set_version(config_file, 2, "my_config_update_cb", "")
weechat.config_read(config_file)
"""
...
def config_new_section(
config_file: str,
name: str,
user_can_add_options: int,
user_can_delete_options: int,
callback_read: str,
callback_read_data: str,
callback_write: str,
callback_write_data: str,
callback_write_default: str,
callback_write_default_data: str,
callback_create_option: str,
callback_create_option_data: str,
callback_delete_option: str,
callback_delete_option_data: str,
) -> str:
"""`config_new_section in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_new_section>`_
::
# example
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
# ...
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
# return weechat.WEECHAT_CONFIG_OPTION_SET_ERROR
# return weechat.WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND
def my_section_write_cb(data: str, config_file: str, section_name: str) -> int:
# ...
return weechat.WEECHAT_CONFIG_WRITE_OK
# return weechat.WEECHAT_CONFIG_WRITE_ERROR
# return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR
def my_section_write_default_cb(data: str, config_file: str, section_name: str) -> int:
# ...
return weechat.WEECHAT_CONFIG_WRITE_OK
# return weechat.WEECHAT_CONFIG_WRITE_ERROR
# return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
# ...
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
# return weechat.WEECHAT_CONFIG_OPTION_SET_ERROR
# return weechat.WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND
def my_section_delete_option_cb(data: str, config_file: str, section: str, option: str) -> int:
# ...
return weechat.WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED
# return weechat.WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET
# return weechat.WEECHAT_CONFIG_OPTION_UNSET_OK_RESET
# return weechat.WEECHAT_CONFIG_OPTION_UNSET_ERROR
section = weechat.config_new_section(config_file, "section1", 1, 1,
"my_section_read_cb", "",
"my_section_write_cb", "",
"my_section_write_default_cb", "",
"my_section_create_option_cb", "",
"my_section_delete_option_cb", "")
"""
...
def config_search_section(config_file: str, section_name: str) -> str:
"""`config_search_section in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_search_section>`_
::
# example
section = weechat.config_search_section(config_file, "section")
"""
...
def config_new_option(
config_file: str,
section: str,
name: str,
type: str,
description: str,
string_values: str,
min: int,
max: int,
default_value: Union[str, None],
value: Union[str, None],
null_value_allowed: int,
callback_check_value: str,
callback_check_value_data: str,
callback_change: str,
callback_change_data: str,
callback_delete: str,
callback_delete_data: str,
) -> str:
"""`config_new_option in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_new_option>`_
::
# example
def option_str_check_value_cb(data: str, option: str, value: str) -> int:
# ...
return 1
# return 0
def option_str_change_cb(data: str, option: str) -> None:
# ...
def option_str_delete_cb(data: str, option: str) -> None:
# ...
option_bool = weechat.config_new_option(config_file, section, "option_bool", "boolean",
"My option, type boolean",
"", 0, 0, "on", "on", 0,
"", "",
"", "",
"", "")
option_int = weechat.config_new_option(config_file, section, "option_int", "integer",
"My option, type integer",
"", 0, 100, "15", "15", 0,
"", "",
"", "",
"", "")
option_str = weechat.config_new_option(config_file, section, "option_str", "string",
"My option, type string",
"", 0, 0, "test", "test", 1,
"option_str_check_value_cb", "",
"option_str_change_cb", "",
"option_str_delete_cb", "")
option_col = weechat.config_new_option(config_file, section, "option_col", "color",
"My option, type color",
"", 0, 0, "lightblue", "lightblue", 0,
"", "",
"", "",
"", "")
option_enum = weechat.config_new_option(config_file, section, "option_enum", "enum",
"My option, type enum",
"top|bottom|left|right",
0, 0, "bottom", "bottom", 0,
"", "",
"", "",
"", "")
"""
...
def config_search_option(config_file: str, section: str, option_name: str) -> str:
"""`config_search_option in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_search_option>`_
::
# example
option = weechat.config_search_option(config_file, section, "option")
"""
...
def config_string_to_boolean(text: str) -> int:
"""`config_string_to_boolean in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_string_to_boolean>`_
::
# example
if weechat.config_string_to_boolean(text):
# ...
"""
...
def config_option_reset(option: str, run_callback: int) -> int:
"""`config_option_reset in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_option_reset>`_
::
# example
rc = weechat.config_option_reset(option, 1)
if rc == weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED:
# ...
elif rc == weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE:
# ...
elif rc == weechat.WEECHAT_CONFIG_OPTION_SET_ERROR:
# ...
"""
...
def config_option_set(option: str, value: str, run_callback: int) -> int:
"""`config_option_set in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_option_set>`_
::
# example
rc = weechat.config_option_set(option, "new_value", 1)
if rc == weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED:
# ...
elif rc == weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE:
# ...
elif rc == weechat.WEECHAT_CONFIG_OPTION_SET_ERROR:
# ...
"""
...
def config_option_set_null(option: str, run_callback: int) -> int:
"""`config_option_set_null in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_option_set_null>`_
::
# example
rc = weechat.config_option_set_null(option, 1)
if rc == weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED:
# ...
elif rc == weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE:
# ...
elif rc == weechat.WEECHAT_CONFIG_OPTION_SET_ERROR:
# ...
"""
...
def config_option_unset(option: str) -> int:
"""`config_option_unset in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_option_unset>`_
::
# example
rc = weechat.config_option_unset(option)
if rc == weechat.WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET:
# ...
elif rc == weechat.WEECHAT_CONFIG_OPTION_UNSET_OK_RESET:
# ...
elif rc == weechat.WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED:
# ...
elif rc == weechat.WEECHAT_CONFIG_OPTION_UNSET_ERROR:
# ...
"""
...
def config_option_rename(option: str, new_name: str) -> int:
"""`config_option_rename in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_option_rename>`_
::
# example
weechat.config_option_rename(option, "new_name")
"""
...
def config_option_is_null(option: str) -> int:
"""`config_option_is_null in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_option_is_null>`_
::
# example
if weechat.config_option_is_null(option):
# ...
"""
...
def config_option_default_is_null(option: str) -> int:
"""`config_option_default_is_null in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_option_default_is_null>`_
::
# example
if weechat.config_option_default_is_null(option):
# ...
"""
...
def config_boolean(option: str) -> int:
"""`config_boolean in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_boolean>`_
::
# example
option = weechat.config_get("plugin.section.option")
if weechat.config_boolean(option):
# ...
"""
...
def config_boolean_default(option: str) -> int:
"""`config_boolean_default in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_boolean_default>`_
::
# example
option = weechat.config_get("plugin.section.option")
if weechat.config_boolean_default(option):
# ...
"""
...
def config_boolean_inherited(option: str) -> int:
"""`config_boolean_inherited in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_boolean_inherited>`_
::
# example
option = weechat.config_get("irc.server.libera.autoconnect")
autoconect = weechat.config_boolean_inherited(option)
"""
...
def config_integer(option: str) -> int:
"""`config_integer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_integer>`_
::
# example
option = weechat.config_get("plugin.section.option")
value = weechat.config_integer(option)
"""
...
def config_integer_default(option: str) -> int:
"""`config_integer_default in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_integer_default>`_
::
# example
option = weechat.config_get("plugin.section.option")
value = weechat.config_integer_default(option)
"""
...
def config_integer_inherited(option: str) -> int:
"""`config_integer_inherited in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_integer_inherited>`_
::
# example
option = weechat.config_get("irc.server.libera.autojoin_delay")
delay = weechat.config_integer_inherited(option)
"""
...
def config_string(option: str) -> str:
"""`config_string in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_string>`_
::
# example
option = weechat.config_get("plugin.section.option")
value = weechat.config_string(option)
"""
...
def config_string_default(option: str) -> str:
"""`config_string_default in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_string_default>`_
::
# example
option = weechat.config_get("plugin.section.option")
value = weechat.config_string_default(option)
"""
...
def config_string_inherited(option: str) -> str:
"""`config_string_inherited in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_string_inherited>`_
::
# example
option = weechat.config_get("irc.server.libera.msg_quit")
msg_quit = weechat.config_string_inherited(option)
"""
...
def config_color(option: str) -> str:
"""`config_color in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_color>`_
::
# example
option = weechat.config_get("plugin.section.option")
color = weechat.config_color(option)
"""
...
def config_color_default(option: str) -> str:
"""`config_color_default in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_color_default>`_
::
# example
option = weechat.config_get("plugin.section.option")
color = weechat.config_color_default(option)
"""
...
def config_color_inherited(option: str) -> str:
"""`config_color_inherited in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_color_inherited>`_
::
# example
option = weechat.config_get("plugin.section.option")
color = weechat.config_color_inherited(option)
"""
...
def config_enum(option: str) -> int:
"""`config_enum in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_enum>`_
::
# example
option = weechat.config_get("plugin.section.option")
value = weechat.config_enum(option)
"""
...
def config_enum_default(option: str) -> int:
"""`config_enum_default in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_enum_default>`_
::
# example
option = weechat.config_get("plugin.section.option")
value = weechat.config_enum_default(option)
"""
...
def config_enum_inherited(option: str) -> int:
"""`config_enum_inherited in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_enum_inherited>`_
::
# example
option = weechat.config_get("irc.server.libera.sasl_fail")
sasl_fail = weechat.config_enum_inherited(option)
"""
...
def config_write_option(config_file: str, option: str) -> int:
"""`config_write_option in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_write_option>`_
::
# example
def my_section_write_cb(data: str, config_file: str, section_name: str) -> int:
weechat.config_write_line(config_file, "my_section", "")
weechat.config_write_option(config_file, option)
return weechat.WEECHAT_RC_OK
"""
...
def config_write_line(config_file: str, option_name: str, value: str) -> int:
"""`config_write_line in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_write_line>`_
::
# example
def my_section_write_cb(data: str, config_file: str, section_name: str) -> int:
weechat.config_write_line(config_file, "my_section", "")
weechat.config_write_line(config_file, "option", "value")
return weechat.WEECHAT_RC_OK
"""
...
def config_write(config_file: str) -> int:
"""`config_write in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_write>`_
::
# example
rc = weechat.config_write(config_file)
if rc == weechat.WEECHAT_CONFIG_WRITE_OK:
# ...
elif rc == weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR:
# ...
elif rc == weechat.WEECHAT_CONFIG_WRITE_ERROR:
# ...
"""
...
def config_read(config_file: str) -> int:
"""`config_read in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_read>`_
::
# example
rc = weechat.config_read(config_file)
if rc == weechat.WEECHAT_CONFIG_READ_OK:
# ...
elif rc == weechat.WEECHAT_CONFIG_READ_MEMORY_ERROR:
# ...
elif rc == weechat.WEECHAT_CONFIG_READ_FILE_NOT_FOUND:
# ...
"""
...
def config_reload(config_file: str) -> int:
"""`config_reload in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_reload>`_
::
# example
rc = weechat.config_reload(config_file)
if rc == weechat.WEECHAT_CONFIG_READ_OK:
# ...
elif rc == weechat.WEECHAT_CONFIG_READ_MEMORY_ERROR:
# ...
elif rc == weechat.WEECHAT_CONFIG_READ_FILE_NOT_FOUND:
# ...
"""
...
def config_option_free(option: str) -> int:
"""`config_option_free in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_option_free>`_
::
# example
weechat.config_option_free(option)
"""
...
def config_section_free_options(section: str) -> int:
"""`config_section_free_options in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_section_free_options>`_
::
# example
weechat.config_section_free_options(section)
"""
...
def config_section_free(section: str) -> int: