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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
|
#
# 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, "?")
"""
...
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:
"""`config_section_free in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_section_free>`_
::
# example
weechat.config_section_free(section)
"""
...
def config_free(config_file: str) -> int:
"""`config_free in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_free>`_
::
# example
weechat.config_free(config_file)
"""
...
def config_get(option_name: str) -> str:
"""`config_get in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_get>`_
::
# example
option = weechat.config_get("weechat.look.item_time_format")
"""
...
def config_get_plugin(option_name: str) -> str:
"""`config_get_plugin in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_get_plugin>`_
::
# example
value = weechat.config_get_plugin("option")
"""
...
def config_is_set_plugin(option_name: str) -> int:
"""`config_is_set_plugin in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_is_set_plugin>`_
::
# example
if weechat.config_is_set_plugin("option"):
# option is set
# ...
else:
# option does not exist
# ...
"""
...
def config_set_plugin(option_name: str, value: str) -> int:
"""`config_set_plugin in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_set_plugin>`_
::
# example
rc = weechat.config_set_plugin("option", "test_value")
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_OPTION_NOT_FOUND:
# ...
elif rc == weechat.WEECHAT_CONFIG_OPTION_SET_ERROR:
# ...
"""
...
def config_set_desc_plugin(option_name: str, description: str) -> int:
"""`config_set_desc_plugin in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_set_desc_plugin>`_
::
# example
version = weechat.info_get("version_number", "") or 0
if int(version) >= 0x00030500:
weechat.config_set_desc_plugin("option", "description of option")
"""
...
def config_unset_plugin(option_name: str) -> int:
"""`config_unset_plugin in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_config_unset_plugin>`_
::
# example
rc = weechat.config_unset_plugin("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 key_bind(context: str, keys: Dict[str, str]) -> int:
"""`key_bind in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_key_bind>`_
::
# example
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)
"""
...
def key_unbind(context: str, key: str) -> int:
"""`key_unbind in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_key_unbind>`_
::
# examples
# remove a single key
weechat.key_unbind("mouse", "@chat(plugin.buffer):button1")
# remove all keys with area "chat(python.test)"
weechat.key_unbind("mouse", "area:chat(python.test)")
"""
...
def prefix(prefix: str) -> str:
"""`prefix in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_prefix>`_
::
# example
weechat.prnt("", "%sThis is an error..." % weechat.prefix("error"))
"""
...
def color(color_name: str) -> str:
"""`color in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_color>`_
::
# example
weechat.prnt("", "Color: %sblue %sdefault color %syellow on red"
% (weechat.color("blue"), weechat.color("chat"), weechat.color("yellow,red")))
"""
...
def prnt(buffer: str, message: str) -> int:
"""`prnt in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_prnt>`_
::
# example
weechat.prnt("", "Hello on WeeChat buffer")
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)
"""
...
def prnt_date_tags(buffer: str, date: int, tags: str, message: str) -> int:
"""`prnt_date_tags in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_prnt_date_tags>`_
::
# example
time = int(time.time())
weechat.prnt_date_tags("", time - 120, "notify_message",
"Message 2 minutes ago, with a tag 'notify_message'")
"""
...
def prnt_datetime_tags(buffer: str, date: int, date_usec: int, tags: str, message: str) -> int:
"""`prnt_datetime_tags in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_prnt_datetime_tags>`_
::
# example
now = time.time()
time_sec = int(now)
time_usec = int((now * 1000000) % 1000000)
weechat.prnt_datetime_tags("", time_sec - 120, time_usec, "notify_message",
"Message 2 minutes ago, with a tag 'notify_message'")
"""
...
def prnt_y(buffer: str, y: int, message: str) -> int:
"""`prnt_y in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_prnt_y>`_
::
# example
weechat.prnt_y("", 2, "My message on third line")
"""
...
def prnt_y_date_tags(buffer: str, y: int, date: int, tags: str, message: str) -> int:
"""`prnt_y_date_tags in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_prnt_y_date_tags>`_
::
# example
weechat.prnt_y_date_tags("", 2, 0, "my_tag", "My message on third line with a tag")
"""
...
def prnt_y_datetime_tags(buffer: str, y: int, date: int, date_usec: int, tags: str, message: str) -> int:
"""`prnt_y_datetime_tags in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_prnt_y_datetime_tags>`_
::
# example
weechat.prnt_y_datetime_tags("", 2, 0, 0, "my_tag", "My message on third line with a tag")
"""
...
def log_print(message: str) -> int:
"""`log_print in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_log_print>`_
::
# example
weechat.log_print("My message in log file")
"""
...
def hook_command(command: str, description: str, args: str, args_description: str,
completion: str, callback: str, callback_data: str) -> str:
"""`hook_command in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_command>`_
::
# example
def my_command_cb(data: str, buffer: str, args: str) -> int:
# ...
return weechat.WEECHAT_RC_OK
hook = weechat.hook_command("myfilter", "description of myfilter",
"[list] | [enable|disable|toggle [name]] | [add name plugin.buffer tags regex] | [del name|-all]",
"description of arguments...",
"list"
" || enable %(filters_names)"
" || disable %(filters_names)"
" || toggle %(filters_names)"
" || add %(filters_names) %(buffers_plugins_names)|*"
" || del %(filters_names)|-all",
"my_command_cb", "")
"""
...
def hook_completion(completion_item: str, description: str, callback: str, callback_data: str) -> str:
"""`hook_completion in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_completion>`_
::
# example
def my_completion_cb(data: str, completion_item: str, buffer: str, completion: str) -> int:
weechat.completion_list_add(completion, "word1", 0, weechat.WEECHAT_LIST_POS_SORT)
weechat.completion_list_add(completion, "test_word2", 0, weechat.WEECHAT_LIST_POS_SORT)
return weechat.WEECHAT_RC_OK
hook = weechat.hook_completion("plugin_item", "my custom completion!",
"my_completion_cb", "")
"""
...
def hook_command_run(command: str, callback: str, callback_data: str) -> str:
"""`hook_command_run in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_command_run>`_
::
# example
def my_command_run_cb(data: str, buffer: str, command: str) -> int:
weechat.prnt("", "I'm eating the completion!")
return weechat.WEECHAT_RC_OK_EAT
hook = weechat.hook_command_run("/input complete*", "my_command_run_cb", "")
"""
...
def hook_timer(interval: int, align_second: int, max_calls: int, callback: str, callback_data: str) -> str:
"""`hook_timer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_timer>`_
::
# example
def my_timer_cb(data: str, remaining_calls: int) -> int:
# ...
return weechat.WEECHAT_RC_OK
# timer called each 20 seconds
hook = weechat.hook_timer(20 * 1000, 0, 0, "my_timer_cb", "")
"""
...
def hook_fd(fd: int, flag_read: int, flag_write: int, flag_exception: int, callback: str, callback_data: str) -> str:
"""`hook_fd in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_fd>`_
::
# example
def my_fd_cb(data: str, fd: int) -> int:
# ...
return weechat.WEECHAT_RC_OK
sock = ...
hook = weechat.hook_fd(sock, 1, 0, 0, "my_fd_cb", "")
"""
...
def hook_process(command: str, timeout: int, callback: str, callback_data: str) -> str:
"""`hook_process in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_process>`_
::
# example with an external command
def my_process_cb(data: str, command: str, return_code: int, out: str, err: str) -> int:
if return_code == weechat.WEECHAT_HOOK_PROCESS_ERROR:
weechat.prnt("", "Error with command '%s'" % command)
return weechat.WEECHAT_RC_OK
if return_code >= 0:
weechat.prnt("", "return_code = %d" % return_code)
if out:
weechat.prnt("", "stdout: %s" % out)
if err:
weechat.prnt("", "stderr: %s" % err)
return weechat.WEECHAT_RC_OK
hook = weechat.hook_process("ls", 5000, "my_process_cb", "")
# example with a script function
def get_status(data: str) -> str:
# do something blocking...
# ...
return "this is the result"
def my_process_cb(data: str, command: str, return_code: int, out: str, err: str) -> int:
if return_code == weechat.WEECHAT_HOOK_PROCESS_ERROR:
weechat.prnt("", "Error with command '%s'" % command)
return weechat.WEECHAT_RC_OK
if return_code >= 0:
weechat.prnt("", "return_code = %d" % return_code)
if out:
weechat.prnt("", "stdout: %s" % out)
if err:
weechat.prnt("", "stderr: %s" % err)
return weechat.WEECHAT_RC_OK
hook = weechat.hook_process("func:get_status", 5000, "my_process_cb", "")
"""
...
def hook_process_hashtable(command: str, options: Dict[str, str], timeout: int, callback: str, callback_data: str) -> str:
"""`hook_process_hashtable in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_process_hashtable>`_
::
# example
def my_process_cb(data: str, command: str, return_code: int, out: str, err: str) -> int:
if return_code == weechat.WEECHAT_HOOK_PROCESS_ERROR:
weechat.prnt("", "Error with command '%s'" % command)
return weechat.WEECHAT_RC_OK
if return_code >= 0:
weechat.prnt("", "return_code = %d" % return_code)
if out:
weechat.prnt("", "stdout: %s" % out)
if err:
weechat.prnt("", "stderr: %s" % err)
return weechat.WEECHAT_RC_OK
# example 1: download URL
hook1 = weechat.hook_process_hashtable("url:https://weechat.org/",
{"file_out": "/tmp/weechat.org.html"},
20000, "my_process_cb", "")
# example 2: open URL with custom HTTP headers
options = {
"httpheader": "\n".join([
"Header1: value1",
"Header2: value2",
]),
}
hook2 = weechat.hook_process_hashtable("url:http://localhost:8080/",
options,
20000, "my_process_cb", "")
# example 3: execute a notify program with a message from someone
hook3 = weechat.hook_process_hashtable("my-notify-command",
{"arg1": "-from",
"arg2": nick,
"arg3": "-msg",
"arg4": message}, # untrusted argument
20000, "my_process_cb", "")
# example 4: call shell to execute a command (command must be SAFE)
hook4 = weechat.hook_process_hashtable("sh",
{"arg1": "-c",
"arg2": "ls -l /tmp | grep something"},
20000, "my_process_cb", "")
"""
...
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>`_
::
# example
def my_connect_cb(data: str, status: int, gnutls_rc: int, sock: int, error: str, ip_address: str) -> int:
if status == WEECHAT_HOOK_CONNECT_OK:
# ...
elif status == WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND:
# ...
elif status == WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND:
# ...
elif status == WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED:
# ...
elif status == WEECHAT_HOOK_CONNECT_PROXY_ERROR:
# ...
elif status == WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR:
# ...
elif status == WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR:
# ...
elif status == WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR:
# ...
elif status == WEECHAT_HOOK_CONNECT_MEMORY_ERROR:
# ...
elif status == WEECHAT_HOOK_CONNECT_TIMEOUT:
# ...
elif status == WEECHAT_HOOK_CONNECT_SOCKET_ERROR:
# ...
return weechat.WEECHAT_RC_OK
hook = weechat.hook_connect("", "my.server.org", 1234, 1, 0, "",
"my_connect_cb", "")
"""
...
def hook_line(buffer_type: str, buffer_name: str, tags: str, callback: str, callback_data: str) -> str:
"""`hook_line in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_line>`_
::
# example
def my_line_cb(data: str, line: Dict[str, str]) -> Dict[str, str]:
# force a highlight on the line
return {"highlight": "1"}
# catch lines with tag "irc_join"
hook = weechat.hook_line("", "", "irc_join", "my_line_cb", "")
"""
...
def hook_print(buffer: str, tags: str, message: str, strip_colors: int, callback: str, callback_data: str) -> str:
"""`hook_print in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_print>`_
::
# example
def my_print_cb(data: str, buffer: str, date: str, tags: str, displayed: int, highlight: int, prefix: str, message: str) -> int:
if highlight:
# ...
return weechat.WEECHAT_RC_OK
# catch all messages, on all buffers, without color
hook = weechat.hook_print("", "", "", 1, "my_print_cb", "")
"""
...
def hook_signal(signal: str, callback: str, callback_data: str) -> str:
"""`hook_signal in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_signal>`_
::
# example
def my_signal_cb(data: str, signal: str, signal_data: str) -> int:
# ...
return weechat.WEECHAT_RC_OK
# catch signals "quit" and "upgrade"
hook = weechat.hook_signal("quit;upgrade", "my_signal_cb", "")
"""
...
def hook_signal_send(signal: str, type_data: str, signal_data: str) -> int:
"""`hook_signal_send in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_signal_send>`_
::
# example
rc = weechat.hook_signal_send("my_signal", weechat.WEECHAT_HOOK_SIGNAL_STRING, my_string)
"""
...
def hook_hsignal(signal: str, callback: str, callback_data: str) -> str:
"""`hook_hsignal in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_hsignal>`_
::
# example
def my_hsignal_cb(data: str, signal: str, hashtable: Dict[str, str]) -> int:
# ...
return weechat.WEECHAT_RC_OK
hook = weechat.hook_hsignal("test", "my_hsignal_cb", "")
"""
...
def hook_hsignal_send(signal: str, hashtable: Dict[str, str]) -> int:
"""`hook_hsignal_send in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_hsignal_send>`_
::
# example
rc = weechat.hook_hsignal_send("my_hsignal", {"key": "value"})
"""
...
def hook_config(option: str, callback: str, callback_data: str) -> str:
"""`hook_config in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_config>`_
::
# example
def my_config_cb(data: str, option: str, value: str) -> int:
# ...
return weechat.WEECHAT_RC_OK
# catch changes to option "weechat.look.item_time_format"
hook = weechat.hook_config("weechat.look.item_time_format", "my_config_cb", "")
"""
...
def hook_modifier(modifier: str, callback: str, callback_data: str) -> str:
"""`hook_modifier in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_modifier>`_
::
# example
def my_modifier_cb(data: str, modifier: str, modifier_data: str, string: str) -> str:
return "%s xxx" % string
hook = weechat.hook_modifier("weechat_print", "my_modifier_cb", "")
"""
...
def hook_modifier_exec(modifier: str, modifier_data: str, string: str) -> str:
"""`hook_modifier_exec in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_modifier_exec>`_
::
# example
weechat.hook_modifier_exec("my_modifier", my_data, my_string)
"""
...
def hook_info(info_name: str, description: str, args_description: str,
callback: str, callback_data: str) -> str:
"""`hook_info in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_info>`_
::
# example
def my_info_cb(data: str, info_name: str, arguments: str) -> str:
return "some_info"
hook = weechat.hook_info("my_info", "Some info", "Info about arguments",
"my_info_cb", "")
"""
...
def hook_info_hashtable(info_name: str, description: str, args_description: str,
output_description: str, callback: str, callback_data: str) -> str:
"""`hook_info_hashtable in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_info_hashtable>`_
::
# example
def my_info_hashtable_cb(data: str, info_name: str, hashtable: Dict[str, str]) -> Dict[str, str]:
return {"test_key": "test_value"}
hook = weechat.hook_info_hashtable("my_info_hashtable", "Some info",
"Info about input hashtable",
"Info about output hashtable",
"my_info_hashtable_cb", "")
"""
...
def hook_infolist(infolist_name: str, description: str, pointer_description: str,
args_description: str, callback: str, callback_data: str) -> str:
"""`hook_infolist in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_infolist>`_
::
# example
def my_infolist_cb(data: str, infolist_name: str, pointer: str, arguments: str) -> str:
# build infolist
# ...
return my_infolist
hook = weechat.hook_infolist("my_infolist", "Infolist with some data",
"Info about pointer", "Info about arguments",
"my_infolist_cb", "")
"""
...
def hook_focus(area: str, callback: str, callback_data: str) -> str:
"""`hook_focus in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_focus>`_
::
# example
def my_focus_nicklist_cb(data: str, info: Dict[str, str]) -> Dict[str, str]:
# build dict
# ...
return my_dict
hook = weechat.hook_focus("buffer_nicklist", "my_focus_nicklist_cb", "")
"""
...
def hook_set(hook: str, property: str, value: str) -> int:
"""`hook_set in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hook_set>`_
::
# example
def my_process_cb(data: str, command: str, return_code: int, out: str, err: str) -> int:
# ...
return weechat.WEECHAT_RC_OK
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
"""
...
def unhook(hook: str) -> int:
"""`unhook in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_unhook>`_
::
# example
weechat.unhook(my_hook)
"""
...
def unhook_all() -> int:
"""`unhook_all in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_unhook_all>`_
::
# example
weechat.unhook_all()
"""
...
def buffer_new(name: str, input_callback: str, input_callback_data: str,
close_callback: str, close_callback_data: str) -> str:
"""`buffer_new in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_buffer_new>`_
::
# example
def my_input_cb(data: str, buffer: str, input_data: str) -> int:
weechat.prnt(buffer, "Text: %s" % input_data)
return weechat.WEECHAT_RC_OK
def my_close_cb(data: str, buffer: str) -> int:
weechat.prnt("", "Buffer '%s' will be closed!" % weechat.buffer_get_string(buffer, "name"))
return weechat.WEECHAT_RC_OK
buffer = weechat.buffer_new("my_buffer", "my_input_cb", "", "my_close_cb", "")
"""
...
def buffer_new_props(name: str, properties: Dict[str, str],
input_callback: str, input_callback_data: str,
close_callback: str, close_callback_data: str) -> str:
"""`buffer_new_props in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_buffer_new_props>`_
::
# example
def my_input_cb(data: str, buffer: str, input_data: str) -> int:
weechat.prnt(buffer, "Text: %s" % input_data)
return weechat.WEECHAT_RC_OK
def my_close_cb(data: str, buffer: str) -> int:
weechat.prnt("", "Buffer '%s' will be closed!" % weechat.buffer_get_string(buffer, "name"))
return weechat.WEECHAT_RC_OK
properties = {
"type": "free", # buffer with free content
"localvar_set_no_log": "1", # no logging on this buffer
"key_bind_meta-c": "/my_command", # bind key alt-c on this buffer
}
buffer = weechat.buffer_new_props("my_buffer", properties, "my_input_cb", "", "my_close_cb", "")
"""
...
def current_buffer() -> str:
"""`current_buffer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_current_buffer>`_
::
# example
weechat.prnt(weechat.current_buffer(), "Text on current buffer")
"""
...
def buffer_search(plugin: str, name: str) -> str:
"""`buffer_search in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_buffer_search>`_
::
# example
buffer = weechat.buffer_search("my_plugin", "my_buffer")
"""
...
def buffer_search_main() -> str:
"""`buffer_search_main in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_buffer_search_main>`_
::
# example
buffer = weechat.buffer_search_main()
"""
...
def buffer_clear(buffer: str) -> int:
"""`buffer_clear in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_buffer_clear>`_
::
# example
buffer = weechat.buffer_search("my_plugin", "my_buffer")
if buffer:
weechat.buffer_clear(buffer)
"""
...
def buffer_close(buffer: str) -> int:
"""`buffer_close in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_buffer_close>`_
::
# example
buffer = weechat.buffer_new("my_buffer", "my_input_cb", "", "my_close_cb", "")
# ...
weechat.buffer_close(buffer)
"""
...
def buffer_merge(buffer: str, target_buffer: str) -> int:
"""`buffer_merge in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_buffer_merge>`_
::
# example
# merge current buffer with WeeChat "core" buffer
weechat.buffer_merge(weechat.current_buffer(), weechat.buffer_search_main())
"""
...
def buffer_unmerge(buffer: str, number: int) -> int:
"""`buffer_unmerge in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_buffer_unmerge>`_
::
# example
weechat.buffer_unmerge(weechat.current_buffer(), 1)
"""
...
def buffer_get_integer(buffer: str, property: str) -> int:
"""`buffer_get_integer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_buffer_get_integer>`_
::
# example
weechat.prnt("", "my buffer number is: %d" % weechat.buffer_get_integer(my_buffer, "number"))
"""
...
def buffer_get_string(buffer: str, property: str) -> str:
"""`buffer_get_string in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_buffer_get_string>`_
::
# example
weechat.prnt("", "name / short name of buffer are: %s / %s"
% (weechat.buffer_get_string(my_buffer, "name"),
weechat.buffer_get_string(my_buffer, "short_name")))
"""
...
def buffer_get_pointer(buffer: str, property: str) -> str:
"""`buffer_get_pointer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_buffer_get_pointer>`_
::
# example
weechat.prnt("", "plugin pointer of my buffer: %s" % weechat.buffer_get_pointer(my_buffer, "plugin"))
"""
...
def buffer_set(buffer: str, property: str, value: str) -> int:
"""`buffer_set in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_buffer_set>`_
::
# examples
# disable hotlist (for all buffers)
weechat.buffer_set("", "hotlist", "-")
# enable again hotlist
weechat.buffer_set("", "hotlist", "+")
# change buffer name
weechat.buffer_set(my_buffer, "name", "my_new_name")
# add new local variable "toto" with value "abc"
weechat.buffer_set(my_buffer, "localvar_set_toto", "abc")
# remove local variable "toto"
weechat.buffer_set(my_buffer, "localvar_del_toto", "")
"""
...
def buffer_string_replace_local_var(buffer: str, string: str) -> str:
"""`buffer_string_replace_local_var in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_buffer_string_replace_local_var>`_
::
# example
weechat.buffer_set(my_buffer, "localvar_set_toto", "abc")
str = weechat.buffer_string_replace_local_var(my_buffer, "test with $toto")
# str contains "test with abc"
"""
...
def buffer_match_list(buffer: str, string: str) -> int:
"""`buffer_match_list in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_buffer_match_list>`_
::
# example
buffer = weechat.buffer_search("irc", "libera.#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.libera.*")) # 1
weechat.prnt("", "%d" % weechat.buffer_match_list(buffer, "irc.oftc.*,python.*")) # 0
"""
...
def current_window() -> str:
"""`current_window in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_current_window>`_
::
# example
current_window = weechat.current_window()
"""
...
def window_search_with_buffer(buffer: str) -> str:
"""`window_search_with_buffer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_window_search_with_buffer>`_
::
# example
weechat.prnt("", "window displaying core buffer: %s"
% weechat.window_search_with_buffer(weechat.buffer_search_main()))
"""
...
def window_get_integer(window: str, property: str) -> int:
"""`window_get_integer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_window_get_integer>`_
::
# example
weechat.prnt("", "current window is at position (x,y): (%d,%d)"
% (weechat.window_get_integer(weechat.current_window(), "win_x"),
weechat.window_get_integer(weechat.current_window(), "win_y")))
"""
...
def window_get_string(window: str, property: str) -> str:
"""`window_get_string in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_window_get_string>`_
"""
...
def window_get_pointer(window: str, property: str) -> str:
"""`window_get_pointer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_window_get_pointer>`_
::
# example
weechat.prnt("", "buffer displayed in current window: %s"
% weechat.window_get_pointer(weechat.current_window(), "buffer"))
"""
...
def window_set_title(title: str) -> int:
"""`window_set_title in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_window_set_title>`_
::
# example
weechat.window_set_title("new title here")
"""
...
def nicklist_add_group(buffer: str, parent_group: str, name: str, color: str, visible: int) -> str:
"""`nicklist_add_group in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_nicklist_add_group>`_
::
# example
group = weechat.nicklist_add_group(my_buffer, my_parent_group, "test_group",
"weechat.color.nicklist_group", 1)
"""
...
def nicklist_search_group(buffer: str, from_group: str, name: str) -> str:
"""`nicklist_search_group in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_nicklist_search_group>`_
::
# example
group = weechat.nicklist_search_group(my_buffer, "", "test_group")
"""
...
def nicklist_add_nick(buffer: str, group: str, name: str, color: str, prefix: str, prefix_color: str, visible: int) -> str:
"""`nicklist_add_nick in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_nicklist_add_nick>`_
::
# example
if nick_away:
color = "weechat.color.nicklist_away"
else:
color = "bar_fg"
nick = weechat.nicklist_add_nick(my_buffer, my_group, "test_nick", color, "@", "lightgreen", 1)
"""
...
def nicklist_search_nick(buffer: str, from_group: str, name: str) -> str:
"""`nicklist_search_nick in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_nicklist_search_nick>`_
::
# example
nick = weechat.nicklist_search_nick(my_buffer, "", "test_nick")
"""
...
def nicklist_remove_group(buffer: str, group: str) -> int:
"""`nicklist_remove_group in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_nicklist_remove_group>`_
::
# example
weechat.nicklist_remove_group(my_buffer, my_group)
"""
...
def nicklist_remove_nick(buffer: str, nick: str) -> int:
"""`nicklist_remove_nick in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_nicklist_remove_nick>`_
::
# example
weechat.nicklist_remove_nick(my_buffer, my_nick)
"""
...
def nicklist_remove_all(buffer: str) -> int:
"""`nicklist_remove_all in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_nicklist_remove_all>`_
::
# example
weechat.nicklist_remove_all(my_buffer)
"""
...
def nicklist_group_get_integer(buffer: str, group: str, property: str) -> int:
"""`nicklist_group_get_integer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_nicklist_group_get_integer>`_
::
# example
visible = weechat.nicklist_group_get_integer(buffer, group, "visible")
"""
...
def nicklist_group_get_string(buffer: str, group: str, property: str) -> str:
"""`nicklist_group_get_string in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_nicklist_group_get_string>`_
::
# example
color = weechat.nicklist_group_get_string(buffer, group, "color")
"""
...
def nicklist_group_get_pointer(buffer: str, group: str, property: str) -> str:
"""`nicklist_group_get_pointer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_nicklist_group_get_pointer>`_
::
# example
parent = weechat.nicklist_group_get_pointer(buffer, group, "parent")
"""
...
def nicklist_group_set(buffer: str, group: str, property: str, value: str) -> int:
"""`nicklist_group_set in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_nicklist_group_set>`_
::
# examples
# change group color to "bar_fg"
weechat.nicklist_group_set(buffer, group, "color", "bar_fg")
# change group color to yellow
weechat.nicklist_group_set(buffer, group, "color", "yellow")
# hide group in nicklist
weechat.nicklist_group_set(buffer, group, "visible", "0")
"""
...
def nicklist_nick_get_integer(buffer: str, nick: str, property: str) -> int:
"""`nicklist_nick_get_integer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_nicklist_nick_get_integer>`_
::
# example
visible = weechat.nicklist_nick_get_integer(buffer, nick, "visible")
"""
...
def nicklist_nick_get_string(buffer: str, nick: str, property: str) -> str:
"""`nicklist_nick_get_string in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_nicklist_nick_get_string>`_
::
# example
color = weechat.nicklist_nick_get_string(buffer, nick, "color")
"""
...
def nicklist_nick_get_pointer(buffer: str, nick: str, property: str) -> str:
"""`nicklist_nick_get_pointer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_nicklist_nick_get_pointer>`_
::
# example
group = weechat.nicklist_nick_get_pointer(buffer, nick, "group")
"""
...
def nicklist_nick_set(buffer: str, nick: str, property: str, value: str) -> int:
"""`nicklist_nick_set in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_nicklist_nick_set>`_
::
# examples
# change nick color to cyan
weechat.nicklist_nick_set(buffer, nick, "color", "cyan")
# change prefix to "+"
weechat.nicklist_nick_set(buffer, nick, "prefix", "+")
# change prefix color to yellow
weechat.nicklist_nick_set(buffer, nick, "prefix_color", "yellow")
# hide nick in nicklist
weechat.nicklist_nick_set(buffer, nick, "visible", "0")
"""
...
def bar_item_search(name: str) -> str:
"""`bar_item_search in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_bar_item_search>`_
::
# example
bar_item = weechat.bar_item_search("myitem")
"""
...
def bar_item_new(name: str, build_callback: str, build_callback_data: str) -> str:
"""`bar_item_new in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_bar_item_new>`_
::
# example (callback without "buffer" and "extra_info")
def my_build_callback(data: str, item: str, window: str) -> str:
return "my content"
bar_item = weechat.bar_item_new("myitem", "my_build_callback", "")
# example (callback with all arguments, for WeeChat ≥ 0.4.2)
def my_build_callback2(data: str, item: str, window: str, buffer: str, extra_info: Dict[str, str]) -> str:
return "my content"
bar_item2 = weechat.bar_item_new("(extra)myitem2", "my_build_callback2", "") # WeeChat ≥ 0.4.2
"""
...
def bar_item_update(name: str) -> int:
"""`bar_item_update in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_bar_item_update>`_
::
# example
weechat.bar_item_update("myitem")
"""
...
def bar_item_remove(item: str) -> int:
"""`bar_item_remove in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_bar_item_remove>`_
::
# example
weechat.bar_item_remove(myitem)
"""
...
def bar_search(name: str) -> str:
"""`bar_search in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_bar_search>`_
::
# example
bar = weechat.bar_search("mybar")
"""
...
def bar_new(name: str, hidden: str, priority: str, type: str, condition: str, position: str,
filling_top_bottom: str, filling_left_right: str, size: str, size_max: str,
color_fg: str, color_delim: str, color_bg: str, color_bg_inactive: str,
separator: str, items: str) -> str:
"""`bar_new in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_bar_new>`_
::
# example
bar = weechat.bar_new("mybar", "off", "100", "window", "", "top", "horizontal", "vertical",
"0", "5", "default", "cyan", "blue", "darkgray", "off", "time,buffer_number+buffer_name")
"""
...
def bar_set(bar: str, property: str, value: str) -> int:
"""`bar_set in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_bar_set>`_
::
# example
weechat.bar_set(my_bar, "position", "bottom")
"""
...
def bar_update(name: str) -> int:
"""`bar_update in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_bar_update>`_
::
# example
weechat.bar_update("mybar")
"""
...
def bar_remove(bar: str) -> int:
"""`bar_remove in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_bar_remove>`_
::
# example
weechat.bar_remove(my_bar)
"""
...
def command(buffer: str, command: str) -> int:
"""`command in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_command>`_
::
# example
rc = weechat.command(weechat.buffer_search("irc", "libera.#weechat"), "/whois FlashCode")
"""
...
def command_options(buffer: str, command: str, options: Dict[str, str]) -> int:
"""`command_options in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_command_options>`_
::
# example: allow any command except /exec
rc = weechat.command("", "/some_command arguments", {"commands": "*,!exec"})
"""
...
def completion_new(buffer: str) -> str:
"""`completion_new in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_completion_new>`_
::
# example
completion = weechat.completion_new(weechat.buffer_search_main())
"""
...
def completion_search(completion: str, data: str, position: int, direction: int) -> int:
"""`completion_search in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_completion_search>`_
::
# example
completion = weechat.completion_new(weechat.buffer_search_main())
if weechat.completion_search(completion, "/help filt", 10, 1):
# ...
"""
...
def completion_get_string(completion: str, property: str) -> str:
"""`completion_get_string in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_completion_get_string>`_
::
# example
def my_completion_cb(data: str, completion_item: str, buffer: str, completion: str) -> int:
# get arguments of command
args = weechat.completion_get_string(completion, "args")
# completion depending on args
# ...
return weechat.WEECHAT_RC_OK
"""
...
def completion_list_add(completion: str, word: str, nick_completion: int, where: str) -> int:
"""`completion_list_add in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_completion_list_add>`_
::
# example: see function hook_completion
"""
...
def completion_free(completion: str) -> int:
"""`completion_free in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_completion_free>`_
::
# example
weechat.completion_free(completion)
"""
...
def info_get(info_name: str, arguments: str) -> str:
"""`info_get in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_info_get>`_
::
# example
weechat.prnt("", "Current WeeChat version is: %s (compiled on %s)"
% (weechat.info_get("version", ""), weechat.info_get("date", ""))
weechat.prnt("", "WeeChat config directory is: %s" % weechat.info_get("weechat_config_dir", ""))
"""
...
def info_get_hashtable(info_name: str, dict_in: Dict[str, str]) -> Dict[str, str]:
"""`info_get_hashtable in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_info_get_hashtable>`_
::
# example
dict_in = {"message": ":nick!user@host PRIVMSG #weechat :message here"}
weechat.prnt("", "message parsed: %s"
% weechat.info_get_hashtable("irc_message_parse", dict_in))
"""
...
def infolist_new() -> str:
"""`infolist_new in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_new>`_
::
# example
infolist = weechat.infolist_new()
"""
...
def infolist_new_item(infolist: str) -> str:
"""`infolist_new_item in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_new_item>`_
::
# example
item = weechat.infolist_new_item(infolist)
"""
...
def infolist_new_var_integer(item: str, name: str, value: int) -> str:
"""`infolist_new_var_integer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_new_var_integer>`_
::
# example
var = weechat.infolist_new_var_integer(item, "my_integer", 123)
"""
...
def infolist_new_var_string(item: str, name: str, value: str) -> str:
"""`infolist_new_var_string in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_new_var_string>`_
::
# example
var = weechat.infolist_new_var_string(item, "my_string", "value")
"""
...
def infolist_new_var_pointer(item: str, name: str, pointer: str) -> str:
"""`infolist_new_var_pointer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_new_var_pointer>`_
::
# example
var = weechat.infolist_new_var_pointer(item, "my_pointer", pointer)
"""
...
def infolist_new_var_time(item: str, name: str, time: int) -> str:
"""`infolist_new_var_time in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_new_var_time>`_
::
# example
var = weechat.infolist_new_var_time(item, "my_time", int(time.time()))
"""
...
def infolist_get(infolist_name: str, pointer: str, arguments: str) -> str:
"""`infolist_get in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_get>`_
::
# example
infolist = weechat.infolist_get("irc_server", "", "")
"""
...
def infolist_next(infolist: str) -> int:
"""`infolist_next in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_next>`_
::
# example
rc = weechat.infolist_next(infolist)
if rc:
# read variables in item...
else:
# no more item available
"""
...
def infolist_prev(infolist: str) -> int:
"""`infolist_prev in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_prev>`_
::
# example
rc = weechat.infolist_prev(infolist)
if rc:
# read variables in item...
else:
# no more item available
"""
...
def infolist_reset_item_cursor(infolist: str) -> int:
"""`infolist_reset_item_cursor in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_reset_item_cursor>`_
::
# example
weechat.infolist_reset_item_cursor(infolist)
"""
...
def infolist_search_var(infolist: str, name: str) -> str:
"""`infolist_search_var in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_search_var>`_
::
# example
if weechat.infolist_search_var(infolist, "name"):
# variable "name" exists
# ...
"""
...
def infolist_fields(infolist: str) -> str:
"""`infolist_fields in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_fields>`_
::
# example
fields = weechat.infolist_fields(infolist)
# fields contains something like:
# "i:my_integer,s:my_string,p:my_pointer,b:my_buffer,t:my_time"
"""
...
def infolist_integer(infolist: str, var: str) -> int:
"""`infolist_integer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_integer>`_
::
# example
weechat.prnt("", "integer = %d" % weechat.infolist_integer(infolist, "my_integer"))
"""
...
def infolist_string(infolist: str, var: str) -> str:
"""`infolist_string in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_string>`_
::
# example
weechat.prnt("", "string = %s" % weechat.infolist_string(infolist, "my_string"))
"""
...
def infolist_pointer(infolist: str, var: str) -> str:
"""`infolist_pointer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_pointer>`_
::
# example
weechat.prnt("", "pointer = 0x%s" % weechat.infolist_pointer(infolist, "my_pointer"))
"""
...
def infolist_time(infolist: str, var: str) -> int:
"""`infolist_time in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_time>`_
::
# example
weechat.prnt("", "time = %d" % weechat.infolist_time(infolist, "my_time"))
"""
...
def infolist_free(infolist: str) -> int:
"""`infolist_free in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_infolist_free>`_
::
# example
weechat.infolist_free(infolist)
"""
...
def hdata_get(hdata_name: str) -> str:
"""`hdata_get in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_get>`_
::
# example
hdata = weechat.hdata_get("irc_server")
"""
...
def hdata_get_var_offset(hdata: str, name: str) -> int:
"""`hdata_get_var_offset in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_get_var_offset>`_
::
# example
offset = weechat.hdata_get_var_offset(hdata, "name")
"""
...
def hdata_get_var_type_string(hdata: str, name: str) -> str:
"""`hdata_get_var_type_string in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_get_var_type_string>`_
::
# example
weechat.prnt("", "type = %s" % weechat.hdata_get_var_type_string("name"))
"""
...
def hdata_get_var_array_size(hdata: str, pointer: str, name: str) -> int:
"""`hdata_get_var_array_size in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_get_var_array_size>`_
::
# example
array_size = weechat.hdata_get_var_array_size(hdata, pointer, "name")
"""
...
def hdata_get_var_array_size_string(hdata: str, pointer: str, name: str) -> str:
"""`hdata_get_var_array_size_string in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_get_var_array_size_string>`_
::
# example
array_size = weechat.hdata_get_var_array_size_string(hdata, pointer, "name")
"""
...
def hdata_get_var_hdata(hdata: str, name: str) -> str:
"""`hdata_get_var_hdata in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_get_var_hdata>`_
::
# example
weechat.prnt("", "hdata = %s" % weechat.hdata_get_var_hdata(hdata, "name"))
"""
...
def hdata_get_list(hdata: str, name: str) -> str:
"""`hdata_get_list in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_get_list>`_
::
# example
hdata = weechat.hdata_get("buffer")
buffers = weechat.hdata_get_list(hdata, "gui_buffers")
"""
...
def hdata_check_pointer(hdata: str, list: str, pointer: str) -> int:
"""`hdata_check_pointer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_check_pointer>`_
::
# example
hdata = weechat.hdata_get("buffer")
if weechat.hdata_check_pointer(hdata, weechat.hdata_get_list(hdata, "gui_buffers"), ptr_buffer):
# valid pointer
# ...
else:
# invalid pointer
# ...
"""
...
def hdata_move(hdata: str, pointer: str, count: int) -> str:
"""`hdata_move in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_move>`_
::
# example
hdata = weechat.hdata_get("buffer")
buffer = weechat.buffer_search_main()
# move to next buffer, 2 times
buffer = weechat.hdata_move(hdata, buffer, 2)
# move to previous buffer
if buffer:
buffer = weechat.hdata_move(hdata, buffer, -1)
"""
...
def hdata_search(hdata: str, pointer: str, search: str,
pointers: Dict[str, str], extra_vars: Dict[str, str], options: Dict[str, str],
count: int) -> str:
"""`hdata_search in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_search>`_
::
# example
hdata = weechat.hdata_get("irc_server")
servers = weechat.hdata_get_list(hdata, "irc_servers")
# search irc server with name "libera"
server = weechat.hdata_search(hdata, servers, "${irc_server.name} == ${server_name}",
{}, {"server_name": "libera"}, {}, 1)
if server:
# ...
"""
...
def hdata_char(hdata: str, pointer: str, name: str) -> int:
"""`hdata_char in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_char>`_
::
# example
weechat.prnt("", "letter = %c" % weechat.hdata_char(hdata, pointer, "letter"))
"""
...
def hdata_integer(hdata: str, pointer: str, name: str) -> int:
"""`hdata_integer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_integer>`_
::
# example
hdata = weechat.hdata_get("buffer")
buffer = weechat.buffer_search_main()
weechat.prnt("", "number = %d" % weechat.hdata_integer(hdata, buffer, "number"))
"""
...
def hdata_long(hdata: str, pointer: str, name: str) -> int:
"""`hdata_long in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_long>`_
::
# example
weechat.prnt("", "longvar = %d" % weechat.hdata_long(hdata, pointer, "longvar"))
"""
...
def hdata_string(hdata: str, pointer: str, name: str) -> str:
"""`hdata_string in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_string>`_
::
# example
hdata = weechat.hdata_get("buffer")
buffer = weechat.buffer_search_main()
weechat.prnt("", "name = %s" % weechat.hdata_string(hdata, buffer, "name"))
"""
...
def hdata_pointer(hdata: str, pointer: str, name: str) -> str:
"""`hdata_pointer in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_pointer>`_
::
# example
hdata = weechat.hdata_get("buffer")
buffer = weechat.buffer_search_main()
weechat.prnt("", "lines = %x" % weechat.hdata_pointer(hdata, buffer, "lines"))
"""
...
def hdata_time(hdata: str, pointer: str, name: str) -> int:
"""`hdata_time in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_time>`_
::
# example
buf = weechat.buffer_search_main()
ptr = weechat.hdata_pointer(weechat.hdata_get("buffer"), buf, "lines")
if ptr:
ptr = weechat.hdata_pointer(weechat.hdata_get("lines"), ptr, "first_line")
if ptr:
ptr = weechat.hdata_pointer(weechat.hdata_get("line"), ptr, "data")
if ptr:
date = weechat.hdata_time(weechat.hdata_get("line_data"), ptr, "date")
weechat.prnt("", "time of first line displayed = %s" % time.strftime("%F %T", time.localtime(int(date))))
"""
...
def hdata_hashtable(hdata: str, pointer: str, name: str) -> Dict[str, str]:
"""`hdata_hashtable in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_hashtable>`_
::
# example
hdata = weechat.hdata_get("buffer")
buffer = weechat.buffer_search_main()
hash = weechat.hdata_hashtable(hdata, buffer, "local_variables")
weechat.prnt("", "local variables in core buffer:")
for key in hash:
weechat.prnt("", " %s == %s" % (key, hash[key]))
"""
...
def hdata_compare(hdata: str, pointer1: str, pointer2: str, name: str, case_sensitive: int) -> int:
"""`hdata_compare in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_compare>`_
::
# example
hdata = weechat.hdata_get("buffer")
buffer1 = weechat.buffer_search("irc", "libera.#weechat")
buffer2 = weechat.buffer_search("irc", "libera.#weechat-fr")
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))
"""
...
def hdata_update(hdata: str, pointer: str, hashtable: Dict[str, str]) -> int:
"""`hdata_update in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_update>`_
::
# 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")
if own_lines:
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)})
"""
...
def hdata_get_string(hdata: str, property: str) -> str:
"""`hdata_get_string in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_hdata_get_string>`_
::
# example
weechat.prnt("", "variables in hdata: %s" % weechat.hdata_get_string(hdata, "var_keys"))
weechat.prnt("", "lists in hdata: %s" % weechat.hdata_get_string(hdata, "list_keys"))
"""
...
def upgrade_new(filename: str, callback_read: str, callback_read_data: str) -> str:
"""`upgrade_new in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_upgrade_new>`_
::
# example
upgrade_file = weechat.upgrade_new("my_file", "", "")
"""
...
def upgrade_write_object(upgrade_file: str, object_id: int, infolist: str) -> int:
"""`upgrade_write_object in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_upgrade_write_object>`_
::
# example
weechat.upgrade_write_object(upgrade_file, 1, infolist)
"""
...
def upgrade_read(upgrade_file: str) -> int:
"""`upgrade_read in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_upgrade_read>`_
::
# example
weechat.upgrade_read(upgrade_file)
"""
...
def upgrade_close(upgrade_file: str) -> int:
"""`upgrade_close in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_upgrade_close>`_
::
# example
weechat.upgrade_close(upgrade_file)
"""
...
|