~alivema4ever/ubuntu/trusty/weechat/lp-1299347-fix

« back to all changes in this revision

Viewing changes to src/plugins/lua/weechat-lua-api.c

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bouthenot
  • Date: 2013-01-23 18:44:36 UTC
  • mfrom: (1.1.23)
  • Revision ID: package-import@ubuntu.com-20130123184436-pillcj7jmtyyj00j
Tags: 0.4.0-1
* New upstream release.
* Bump Standards-Version to 3.9.4
* Remove UPGRADE_0.3 from doc (no more included in upstream sources).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
 
2
 * weechat-lua-api.c - lua API functions
 
3
 *
2
4
 * Copyright (C) 2006-2007 Emmanuel Bouthenot <kolter@openics.org>
3
 
 * Copyright (C) 2006-2012 Sebastien Helleu <flashcode@flashtux.org>
 
5
 * Copyright (C) 2006-2013 Sebastien Helleu <flashcode@flashtux.org>
 
6
 * Copyright (C) 2012 Simon Arlott
4
7
 *
5
8
 * This file is part of WeeChat, the extensible chat client.
6
9
 *
18
21
 * along with WeeChat.  If not, see <http://www.gnu.org/licenses/>.
19
22
 */
20
23
 
21
 
/*
22
 
 * weechat-lua-api.c: lua API functions
23
 
 */
24
 
 
25
24
#undef _
26
25
 
27
26
#include <lua.h>
87
86
 
88
87
 
89
88
/*
90
 
 * weechat_lua_api_register: startup function for all WeeChat Lua scripts
 
89
 * Registers a lua script.
91
90
 */
92
91
 
93
92
static int
163
162
}
164
163
 
165
164
/*
166
 
 * weechat_lua_api_plugin_get_name: get name of plugin (return "core" for
167
 
 *                                  WeeChat core)
 
165
 * Wrappers for functions in scripting API.
 
166
 *
 
167
 * For more info about these functions, look at their implementation in WeeChat
 
168
 * core.
168
169
 */
169
170
 
170
171
static int
183
184
    API_RETURN_STRING(result);
184
185
}
185
186
 
186
 
/*
187
 
 * weechat_lua_api_charset_set: set script charset
188
 
 */
189
 
 
190
187
static int
191
188
weechat_lua_api_charset_set (lua_State *L)
192
189
{
204
201
    API_RETURN_OK;
205
202
}
206
203
 
207
 
/*
208
 
 * weechat_lua_api_iconv_to_internal: convert string to internal WeeChat charset
209
 
 */
210
 
 
211
204
static int
212
205
weechat_lua_api_iconv_to_internal (lua_State *L)
213
206
{
226
219
    API_RETURN_STRING_FREE(result);
227
220
}
228
221
 
229
 
/*
230
 
 * weechat_lua_api_iconv_from_internal: convert string from WeeChat internal
231
 
 *                                      charset to another one
232
 
 */
233
 
 
234
222
static int
235
223
weechat_lua_api_iconv_from_internal (lua_State *L)
236
224
{
249
237
    API_RETURN_STRING_FREE(result);
250
238
}
251
239
 
252
 
/*
253
 
 * weechat_lua_api_gettext: get translated string
254
 
 */
255
 
 
256
240
static int
257
241
weechat_lua_api_gettext (lua_State *L)
258
242
{
269
253
    API_RETURN_STRING(result);
270
254
}
271
255
 
272
 
/*
273
 
 * weechat_lua_api_ngettext: get translated string with plural form
274
 
 */
275
 
 
276
256
static int
277
257
weechat_lua_api_ngettext (lua_State *L)
278
258
{
292
272
    API_RETURN_STRING(result);
293
273
}
294
274
 
295
 
/*
296
 
 * weechat_lua_api_string_match: return 1 if string matches a mask
297
 
 *                               mask can begin or end with "*", no other "*"
298
 
 *                               are allowed inside mask
299
 
 */
300
 
 
301
275
static int
302
276
weechat_lua_api_string_match (lua_State *L)
303
277
{
317
291
    API_RETURN_INT(value);
318
292
}
319
293
 
320
 
/*
321
 
 * weechat_lua_api_string_has_highlight: return 1 if string contains a
322
 
 *                                       highlight (using list of words to
323
 
 *                                       highlight)
324
 
 *                                       return 0 if no highlight is found in
325
 
 *                                       string
326
 
 */
327
 
 
328
294
static int
329
295
weechat_lua_api_string_has_highlight (lua_State *L)
330
296
{
343
309
    API_RETURN_INT(value);
344
310
}
345
311
 
346
 
/*
347
 
 * weechat_lua_api_string_has_highlight_regex: return 1 if string contains a
348
 
 *                                             highlight (using regular
349
 
 *                                             expression)
350
 
 *                                             return 0 if no highlight is
351
 
 *                                             found in string
352
 
 */
353
 
 
354
312
static int
355
313
weechat_lua_api_string_has_highlight_regex (lua_State *L)
356
314
{
369
327
    API_RETURN_INT(value);
370
328
}
371
329
 
372
 
/*
373
 
 * weechat_lua_api_string_mask_to_regex: convert a mask (string with only
374
 
 *                                       "*" as wildcard) to a regex, paying
375
 
 *                                       attention to special chars in a
376
 
 *                                       regex
377
 
 */
378
 
 
379
330
static int
380
331
weechat_lua_api_string_mask_to_regex (lua_State *L)
381
332
{
393
344
    API_RETURN_STRING_FREE(result);
394
345
}
395
346
 
396
 
/*
397
 
 * weechat_lua_api_string_remove_color: remove WeeChat color codes from string
398
 
 */
399
 
 
400
347
static int
401
348
weechat_lua_api_string_remove_color (lua_State *L)
402
349
{
415
362
    API_RETURN_STRING_FREE(result);
416
363
}
417
364
 
418
 
/*
419
 
 * weechat_lua_api_string_is_command_char: check if first char of string is a
420
 
 *                                         command char
421
 
 */
422
 
 
423
365
static int
424
366
weechat_lua_api_string_is_command_char (lua_State *L)
425
367
{
437
379
    API_RETURN_INT(value);
438
380
}
439
381
 
440
 
/*
441
 
 * weechat_lua_api_string_input_for_buffer: return string with input text
442
 
 *                                          for buffer or empty string if
443
 
 *                                          it's a command
444
 
 */
445
 
 
446
382
static int
447
383
weechat_lua_api_string_input_for_buffer (lua_State *L)
448
384
{
459
395
    API_RETURN_STRING(result);
460
396
}
461
397
 
462
 
/*
463
 
 * weechat_lua_api_mkdir_home: create a directory in WeeChat home
464
 
 */
 
398
static int
 
399
weechat_lua_api_string_eval_expression (lua_State *L)
 
400
{
 
401
    const char *expr;
 
402
    struct t_hashtable *pointers, *extra_vars;
 
403
    char *result;
 
404
 
 
405
    API_FUNC(1, "string_eval_expression", API_RETURN_EMPTY);
 
406
    if (lua_gettop (lua_current_interpreter) < 3)
 
407
        API_WRONG_ARGS(API_RETURN_EMPTY);
 
408
 
 
409
    expr = lua_tostring (lua_current_interpreter, -3);
 
410
    pointers = weechat_lua_tohashtable (lua_current_interpreter, -2,
 
411
                                        WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
 
412
                                        WEECHAT_HASHTABLE_STRING,
 
413
                                        WEECHAT_HASHTABLE_POINTER);
 
414
    extra_vars = weechat_lua_tohashtable (lua_current_interpreter, -1,
 
415
                                          WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
 
416
                                          WEECHAT_HASHTABLE_STRING,
 
417
                                          WEECHAT_HASHTABLE_STRING);
 
418
 
 
419
    result = weechat_string_eval_expression (expr, pointers, extra_vars);
 
420
 
 
421
    if (pointers)
 
422
        weechat_hashtable_free (pointers);
 
423
    if (extra_vars)
 
424
        weechat_hashtable_free (extra_vars);
 
425
 
 
426
    API_RETURN_STRING_FREE(result);
 
427
}
465
428
 
466
429
static int
467
430
weechat_lua_api_mkdir_home (lua_State *L)
482
445
    API_RETURN_OK;
483
446
}
484
447
 
485
 
/*
486
 
 * weechat_lua_api_mkdir: create a directory
487
 
 */
488
 
 
489
448
static int
490
449
weechat_lua_api_mkdir (lua_State *L)
491
450
{
505
464
    API_RETURN_OK;
506
465
}
507
466
 
508
 
/*
509
 
 * weechat_lua_api_mkdir_parents: create a directory and make parent
510
 
 *                                directories as needed
511
 
 */
512
 
 
513
467
static int
514
468
weechat_lua_api_mkdir_parents (lua_State *L)
515
469
{
529
483
    API_RETURN_OK;
530
484
}
531
485
 
532
 
/*
533
 
 * weechat_lua_api_list_new: create a new list
534
 
 */
535
 
 
536
486
static int
537
487
weechat_lua_api_list_new (lua_State *L)
538
488
{
545
495
    API_RETURN_STRING_FREE(result);
546
496
}
547
497
 
548
 
/*
549
 
 * weechat_lua_api_list_add: add a string to list
550
 
 */
551
 
 
552
498
static int
553
499
weechat_lua_api_list_add (lua_State *L)
554
500
{
572
518
    API_RETURN_STRING_FREE(result);
573
519
}
574
520
 
575
 
/*
576
 
 * weechat_lua_api_list_search: search a string in list
577
 
 */
578
 
 
579
521
static int
580
522
weechat_lua_api_list_search (lua_State *L)
581
523
{
595
537
    API_RETURN_STRING_FREE(result);
596
538
}
597
539
 
598
 
/*
599
 
 * weechat_lua_api_list_search_pos: search position of a string in list
600
 
 */
601
 
 
602
540
static int
603
541
weechat_lua_api_list_search_pos (lua_State *L)
604
542
{
617
555
    API_RETURN_INT(pos);
618
556
}
619
557
 
620
 
/*
621
 
 * weechat_lua_api_list_casesearch: search a string in list (ignore case)
622
 
 */
623
 
 
624
558
static int
625
559
weechat_lua_api_list_casesearch (lua_State *L)
626
560
{
640
574
    API_RETURN_STRING_FREE(result);
641
575
}
642
576
 
643
 
/*
644
 
 * weechat_lua_api_list_casesearch_pos: search position of a string in list
645
 
 *                                      (ignore case)
646
 
 */
647
 
 
648
577
static int
649
578
weechat_lua_api_list_casesearch_pos (lua_State *L)
650
579
{
663
592
    API_RETURN_INT(pos);
664
593
}
665
594
 
666
 
/*
667
 
 * weechat_lua_api_list_get: get item by position
668
 
 */
669
 
 
670
595
static int
671
596
weechat_lua_api_list_get (lua_State *L)
672
597
{
687
612
    API_RETURN_STRING_FREE(result);
688
613
}
689
614
 
690
 
/*
691
 
 * weechat_lua_api_list_set: set new value for item
692
 
 */
693
 
 
694
615
static int
695
616
weechat_lua_api_list_set (lua_State *L)
696
617
{
709
630
    API_RETURN_OK;
710
631
}
711
632
 
712
 
/*
713
 
 * weechat_lua_api_list_next: get next item
714
 
 */
715
 
 
716
633
static int
717
634
weechat_lua_api_list_next (lua_State *L)
718
635
{
730
647
    API_RETURN_STRING_FREE(result);
731
648
}
732
649
 
733
 
/*
734
 
 * weechat_lua_api_list_prev: get previous item
735
 
 */
736
 
 
737
650
static int
738
651
weechat_lua_api_list_prev (lua_State *L)
739
652
{
751
664
    API_RETURN_STRING_FREE(result);
752
665
}
753
666
 
754
 
/*
755
 
 * weechat_lua_api_list_string: get string value of item
756
 
 */
757
 
 
758
667
static int
759
668
weechat_lua_api_list_string (lua_State *L)
760
669
{
771
680
    API_RETURN_STRING(result);
772
681
}
773
682
 
774
 
/*
775
 
 * weechat_lua_api_list_size: get number of elements in list
776
 
 */
777
 
 
778
683
static int
779
684
weechat_lua_api_list_size (lua_State *L)
780
685
{
792
697
    API_RETURN_INT(size);
793
698
}
794
699
 
795
 
/*
796
 
 * weechat_lua_api_list_remove: remove item from list
797
 
 */
798
 
 
799
700
static int
800
701
weechat_lua_api_list_remove (lua_State *L)
801
702
{
814
715
    API_RETURN_OK;
815
716
}
816
717
 
817
 
/*
818
 
 * weechat_lua_api_list_remove_all: remove all items from list
819
 
 */
820
 
 
821
718
static int
822
719
weechat_lua_api_list_remove_all (lua_State *L)
823
720
{
834
731
    API_RETURN_OK;
835
732
}
836
733
 
837
 
/*
838
 
 * weechat_lua_api_list_free: free list
839
 
 */
840
 
 
841
734
static int
842
735
weechat_lua_api_list_free (lua_State *L)
843
736
{
854
747
    API_RETURN_OK;
855
748
}
856
749
 
857
 
/*
858
 
 * weechat_lua_api_config_reload_cb: callback for ccnfig reload
859
 
 */
860
 
 
861
750
int
862
751
weechat_lua_api_config_reload_cb (void *data,
863
752
                                  struct t_config_file *config_file)
895
784
    return WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
896
785
}
897
786
 
898
 
/*
899
 
 * weechat_lua_api_config_new: create a new configuration file
900
 
 */
901
 
 
902
787
static int
903
788
weechat_lua_api_config_new (lua_State *L)
904
789
{
923
808
    API_RETURN_STRING_FREE(result);
924
809
}
925
810
 
926
 
/*
927
 
 * weechat_lua_api_config_read_cb: callback for reading option in section
928
 
 */
929
 
 
930
811
int
931
812
weechat_lua_api_config_read_cb (void *data,
932
813
                                struct t_config_file *config_file,
971
852
    return WEECHAT_CONFIG_OPTION_SET_ERROR;
972
853
}
973
854
 
974
 
/*
975
 
 * weechat_lua_api_config_section_write_cb: callback for writing section
976
 
 */
977
 
 
978
855
int
979
856
weechat_lua_api_config_section_write_cb (void *data,
980
857
                                         struct t_config_file *config_file,
1014
891
    return WEECHAT_CONFIG_WRITE_ERROR;
1015
892
}
1016
893
 
1017
 
/*
1018
 
 * weechat_lua_api_config_section_write_default_cb: callback for writing
1019
 
 *                                                  default values for section
1020
 
 */
1021
 
 
1022
894
int
1023
895
weechat_lua_api_config_section_write_default_cb (void *data,
1024
896
                                                 struct t_config_file *config_file,
1058
930
    return WEECHAT_CONFIG_WRITE_ERROR;
1059
931
}
1060
932
 
1061
 
/*
1062
 
 * weechat_lua_api_config_section_create_option_cb: callback to create an option
1063
 
 */
1064
 
 
1065
933
int
1066
934
weechat_lua_api_config_section_create_option_cb (void *data,
1067
935
                                                 struct t_config_file *config_file,
1107
975
    return WEECHAT_CONFIG_OPTION_SET_ERROR;
1108
976
}
1109
977
 
1110
 
/*
1111
 
 * weechat_lua_api_config_section_delete_option_cb: callback to delete an option
1112
 
 */
1113
 
 
1114
978
int
1115
979
weechat_lua_api_config_section_delete_option_cb (void *data,
1116
980
                                                 struct t_config_file *config_file,
1156
1020
    return WEECHAT_CONFIG_OPTION_UNSET_ERROR;
1157
1021
}
1158
1022
 
1159
 
/*
1160
 
 * weechat_lua_api_config_new_section: create a new section in configuration file
1161
 
 */
1162
 
 
1163
1023
static int
1164
1024
weechat_lua_api_config_new_section (lua_State *L)
1165
1025
{
1215
1075
    API_RETURN_STRING_FREE(result);
1216
1076
}
1217
1077
 
1218
 
/*
1219
 
 * weechat_lua_api_config_search_section: search a section in configuration file
1220
 
 */
1221
 
 
1222
1078
static int
1223
1079
weechat_lua_api_config_search_section (lua_State *L)
1224
1080
{
1238
1094
    API_RETURN_STRING_FREE(result);
1239
1095
}
1240
1096
 
1241
 
/*
1242
 
 * weechat_lua_api_config_option_check_value_cb: callback for checking new
1243
 
 *                                               value for option
1244
 
 */
1245
 
 
1246
1097
int
1247
1098
weechat_lua_api_config_option_check_value_cb (void *data,
1248
1099
                                              struct t_config_option *option,
1282
1133
    return 0;
1283
1134
}
1284
1135
 
1285
 
/*
1286
 
 * weechat_lua_api_config_option_change_cb: callback for option changed
1287
 
 */
1288
 
 
1289
1136
void
1290
1137
weechat_lua_api_config_option_change_cb (void *data,
1291
1138
                                         struct t_config_option *option)
1315
1162
    }
1316
1163
}
1317
1164
 
1318
 
/*
1319
 
 * weechat_lua_api_config_option_delete_cb: callback when option is deleted
1320
 
 */
1321
 
 
1322
1165
void
1323
1166
weechat_lua_api_config_option_delete_cb (void *data,
1324
1167
                                         struct t_config_option *option)
1348
1191
    }
1349
1192
}
1350
1193
 
1351
 
/*
1352
 
 * weechat_lua_api_config_new_option: create a new option in section
1353
 
 */
1354
 
 
1355
1194
static int
1356
1195
weechat_lua_api_config_new_option (lua_State *L)
1357
1196
{
1410
1249
    API_RETURN_STRING_FREE(result);
1411
1250
}
1412
1251
 
1413
 
/*
1414
 
 * weechat_lua_api_config_search_option: search option in configuration file or section
1415
 
 */
1416
 
 
1417
1252
static int
1418
1253
weechat_lua_api_config_search_option (lua_State *L)
1419
1254
{
1435
1270
    API_RETURN_STRING_FREE(result);
1436
1271
}
1437
1272
 
1438
 
/*
1439
 
 * weechat_lua_api_config_string_to_boolean: return boolean value of a string
1440
 
 */
1441
 
 
1442
1273
static int
1443
1274
weechat_lua_api_config_string_to_boolean (lua_State *L)
1444
1275
{
1456
1287
    API_RETURN_INT(value);
1457
1288
}
1458
1289
 
1459
 
/*
1460
 
 * weechat_lua_api_config_option_reset: reset option with default value
1461
 
 */
1462
 
 
1463
1290
static int
1464
1291
weechat_lua_api_config_option_reset (lua_State *L)
1465
1292
{
1479
1306
    API_RETURN_INT(rc);
1480
1307
}
1481
1308
 
1482
 
/*
1483
 
 * weechat_lua_api_config_option_set: set new value for option
1484
 
 */
1485
 
 
1486
1309
static int
1487
1310
weechat_lua_api_config_option_set (lua_State *L)
1488
1311
{
1504
1327
    API_RETURN_INT(rc);
1505
1328
}
1506
1329
 
1507
 
/*
1508
 
 * weechat_lua_api_config_option_set_null: set null (undefined) value for
1509
 
 *                                         option
1510
 
 */
1511
 
 
1512
1330
static int
1513
1331
weechat_lua_api_config_option_set_null (lua_State *L)
1514
1332
{
1528
1346
    API_RETURN_INT(rc);
1529
1347
}
1530
1348
 
1531
 
/*
1532
 
 * weechat_lua_api_config_option_unset: unset an option
1533
 
 */
1534
 
 
1535
1349
static int
1536
1350
weechat_lua_api_config_option_unset (lua_State *L)
1537
1351
{
1549
1363
    API_RETURN_INT(rc);
1550
1364
}
1551
1365
 
1552
 
/*
1553
 
 * weechat_lua_api_config_option_rename: rename an option
1554
 
 */
1555
 
 
1556
1366
static int
1557
1367
weechat_lua_api_config_option_rename (lua_State *L)
1558
1368
{
1571
1381
    API_RETURN_OK;
1572
1382
}
1573
1383
 
1574
 
/*
1575
 
 * weechat_lua_api_config_option_is_null: return 1 if value of option is null
1576
 
 */
1577
 
 
1578
1384
static int
1579
1385
weechat_lua_api_config_option_is_null (lua_State *L)
1580
1386
{
1592
1398
    API_RETURN_INT(value);
1593
1399
}
1594
1400
 
1595
 
/*
1596
 
 * weechat_lua_api_config_option_default_is_null: return 1 if default value of
1597
 
 *                                                option is null
1598
 
 */
1599
 
 
1600
1401
static int
1601
1402
weechat_lua_api_config_option_default_is_null (lua_State *L)
1602
1403
{
1614
1415
    API_RETURN_INT(value);
1615
1416
}
1616
1417
 
1617
 
/*
1618
 
 * weechat_lua_api_config_boolean: return boolean value of option
1619
 
 */
1620
 
 
1621
1418
static int
1622
1419
weechat_lua_api_config_boolean (lua_State *L)
1623
1420
{
1635
1432
    API_RETURN_INT(value);
1636
1433
}
1637
1434
 
1638
 
/*
1639
 
 * weechat_lua_api_config_boolean_default: return default boolean value of option
1640
 
 */
1641
 
 
1642
1435
static int
1643
1436
weechat_lua_api_config_boolean_default (lua_State *L)
1644
1437
{
1656
1449
    API_RETURN_INT(value);
1657
1450
}
1658
1451
 
1659
 
/*
1660
 
 * weechat_lua_api_config_integer: return integer value of option
1661
 
 */
1662
 
 
1663
1452
static int
1664
1453
weechat_lua_api_config_integer (lua_State *L)
1665
1454
{
1677
1466
    API_RETURN_INT(value);
1678
1467
}
1679
1468
 
1680
 
/*
1681
 
 * weechat_lua_api_config_integer_default: return default integer value of option
1682
 
 */
1683
 
 
1684
1469
static int
1685
1470
weechat_lua_api_config_integer_default (lua_State *L)
1686
1471
{
1698
1483
    API_RETURN_INT(value);
1699
1484
}
1700
1485
 
1701
 
/*
1702
 
 * weechat_lua_api_config_string: return string value of option
1703
 
 */
1704
 
 
1705
1486
static int
1706
1487
weechat_lua_api_config_string (lua_State *L)
1707
1488
{
1718
1499
    API_RETURN_STRING(result);
1719
1500
}
1720
1501
 
1721
 
/*
1722
 
 * weechat_lua_api_config_string_default: return default string value of option
1723
 
 */
1724
 
 
1725
1502
static int
1726
1503
weechat_lua_api_config_string_default (lua_State *L)
1727
1504
{
1738
1515
    API_RETURN_STRING(result);
1739
1516
}
1740
1517
 
1741
 
/*
1742
 
 * weechat_lua_api_config_color: return color value of option
1743
 
 */
1744
 
 
1745
1518
static int
1746
1519
weechat_lua_api_config_color (lua_State *L)
1747
1520
{
1758
1531
    API_RETURN_STRING(result);
1759
1532
}
1760
1533
 
1761
 
/*
1762
 
 * weechat_lua_api_config_color_default: return default color value of option
1763
 
 */
1764
 
 
1765
1534
static int
1766
1535
weechat_lua_api_config_color_default (lua_State *L)
1767
1536
{
1778
1547
    API_RETURN_STRING(result);
1779
1548
}
1780
1549
 
1781
 
/*
1782
 
 * weechat_lua_api_config_write_option: write an option in configuration file
1783
 
 */
1784
 
 
1785
1550
static int
1786
1551
weechat_lua_api_config_write_option (lua_State *L)
1787
1552
{
1800
1565
    API_RETURN_OK;
1801
1566
}
1802
1567
 
1803
 
/*
1804
 
 * weechat_lua_api_config_write_line: write a line in configuration file
1805
 
 */
1806
 
 
1807
1568
static int
1808
1569
weechat_lua_api_config_write_line (lua_State *L)
1809
1570
{
1825
1586
    API_RETURN_OK;
1826
1587
}
1827
1588
 
1828
 
/*
1829
 
 * weechat_lua_api_config_write: write configuration file
1830
 
 */
1831
 
 
1832
1589
static int
1833
1590
weechat_lua_api_config_write (lua_State *L)
1834
1591
{
1846
1603
    API_RETURN_INT(rc);
1847
1604
}
1848
1605
 
1849
 
/*
1850
 
 * weechat_lua_api_config_read: read configuration file
1851
 
 */
1852
 
 
1853
1606
static int
1854
1607
weechat_lua_api_config_read (lua_State *L)
1855
1608
{
1867
1620
    API_RETURN_INT(rc);
1868
1621
}
1869
1622
 
1870
 
/*
1871
 
 * weechat_lua_api_config_reload: reload configuration file
1872
 
 */
1873
 
 
1874
1623
static int
1875
1624
weechat_lua_api_config_reload (lua_State *L)
1876
1625
{
1888
1637
    API_RETURN_INT(rc);
1889
1638
}
1890
1639
 
1891
 
/*
1892
 
 * weechat_lua_api_config_option_free: free an option in configuration file
1893
 
 */
1894
 
 
1895
1640
static int
1896
1641
weechat_lua_api_config_option_free (lua_State *L)
1897
1642
{
1910
1655
    API_RETURN_OK;
1911
1656
}
1912
1657
 
1913
 
/*
1914
 
 * weechat_lua_api_config_section_free_options: free all options of a section
1915
 
 *                                              in configuration file
1916
 
 */
1917
 
 
1918
1658
static int
1919
1659
weechat_lua_api_config_section_free_options (lua_State *L)
1920
1660
{
1933
1673
    API_RETURN_OK;
1934
1674
}
1935
1675
 
1936
 
/*
1937
 
 * weechat_lua_api_config_section_free: free section in configuration file
1938
 
 */
1939
 
 
1940
1676
static int
1941
1677
weechat_lua_api_config_section_free (lua_State *L)
1942
1678
{
1955
1691
    API_RETURN_OK;
1956
1692
}
1957
1693
 
1958
 
/*
1959
 
 * weechat_lua_api_config_free: free configuration file
1960
 
 */
1961
 
 
1962
1694
static int
1963
1695
weechat_lua_api_config_free (lua_State *L)
1964
1696
{
1977
1709
    API_RETURN_OK;
1978
1710
}
1979
1711
 
1980
 
/*
1981
 
 * weechat_lua_api_config_get: get config option
1982
 
 */
1983
 
 
1984
1712
static int
1985
1713
weechat_lua_api_config_get (lua_State *L)
1986
1714
{
1998
1726
    API_RETURN_STRING_FREE(result);
1999
1727
}
2000
1728
 
2001
 
/*
2002
 
 * weechat_lua_api_config_get_plugin: get value of a plugin option
2003
 
 */
2004
 
 
2005
1729
static int
2006
1730
weechat_lua_api_config_get_plugin (lua_State *L)
2007
1731
{
2020
1744
    API_RETURN_STRING(result);
2021
1745
}
2022
1746
 
2023
 
/*
2024
 
 * weechat_lua_api_config_is_set_plugin: check if a plugin option is set
2025
 
 */
2026
 
 
2027
1747
static int
2028
1748
weechat_lua_api_config_is_set_plugin (lua_State *L)
2029
1749
{
2043
1763
    API_RETURN_INT(rc);
2044
1764
}
2045
1765
 
2046
 
/*
2047
 
 * weechat_lua_api_config_set_plugin: set value of a plugin option
2048
 
 */
2049
 
 
2050
1766
static int
2051
1767
weechat_lua_api_config_set_plugin (lua_State *L)
2052
1768
{
2068
1784
    API_RETURN_INT(rc);
2069
1785
}
2070
1786
 
2071
 
/*
2072
 
 * weechat_lua_api_config_set_desc_plugin: set description of a plugin option
2073
 
 */
2074
 
 
2075
1787
static int
2076
1788
weechat_lua_api_config_set_desc_plugin (lua_State *L)
2077
1789
{
2092
1804
    API_RETURN_OK;
2093
1805
}
2094
1806
 
2095
 
/*
2096
 
 * weechat_lua_api_config_unset_plugin: unset plugin option
2097
 
 */
2098
 
 
2099
1807
static int
2100
1808
weechat_lua_api_config_unset_plugin (lua_State *L)
2101
1809
{
2115
1823
    API_RETURN_INT(rc);
2116
1824
}
2117
1825
 
2118
 
/*
2119
 
 * weechat_lua_api_key_bind: bind key(s)
2120
 
 */
2121
 
 
2122
1826
static int
2123
1827
weechat_lua_api_key_bind (lua_State *L)
2124
1828
{
2132
1836
 
2133
1837
    context = lua_tostring (lua_current_interpreter, -2);
2134
1838
    hashtable = weechat_lua_tohashtable (lua_current_interpreter, -1,
2135
 
                                         WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
 
1839
                                         WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
 
1840
                                         WEECHAT_HASHTABLE_STRING,
 
1841
                                         WEECHAT_HASHTABLE_STRING);
2136
1842
 
2137
1843
    num_keys = weechat_key_bind (context, hashtable);
2138
1844
 
2142
1848
    API_RETURN_INT(num_keys);
2143
1849
}
2144
1850
 
2145
 
/*
2146
 
 * weechat_lua_api_key_unbind: unbind key(s)
2147
 
 */
2148
 
 
2149
1851
static int
2150
1852
weechat_lua_api_key_unbind (lua_State *L)
2151
1853
{
2164
1866
    API_RETURN_INT(num_keys);
2165
1867
}
2166
1868
 
2167
 
/*
2168
 
 * weechat_lua_api_prefix: get a prefix, used for display
2169
 
 */
2170
 
 
2171
1869
static int
2172
1870
weechat_lua_api_prefix (lua_State *L)
2173
1871
{
2184
1882
    API_RETURN_STRING(result);
2185
1883
}
2186
1884
 
2187
 
/*
2188
 
 * weechat_lua_api_color: get a color code, used for display
2189
 
 */
2190
 
 
2191
1885
static int
2192
1886
weechat_lua_api_color (lua_State *L)
2193
1887
{
2204
1898
    API_RETURN_STRING(result);
2205
1899
}
2206
1900
 
2207
 
/*
2208
 
 * weechat_lua_api_print: print message in a buffer
2209
 
 */
2210
 
 
2211
1901
static int
2212
1902
weechat_lua_api_print (lua_State *L)
2213
1903
{
2228
1918
    API_RETURN_OK;
2229
1919
}
2230
1920
 
2231
 
/*
2232
 
 * weechat_lua_api_print_date_tags: print message in a buffer with optional
2233
 
 *                                  date and tags
2234
 
 */
2235
 
 
2236
1921
static int
2237
1922
weechat_lua_api_print_date_tags (lua_State *L)
2238
1923
{
2258
1943
    API_RETURN_OK;
2259
1944
}
2260
1945
 
2261
 
/*
2262
 
 * weechat_lua_api_print_y: print message in a buffer with free content
2263
 
 */
2264
 
 
2265
1946
static int
2266
1947
weechat_lua_api_print_y (lua_State *L)
2267
1948
{
2285
1966
    API_RETURN_OK;
2286
1967
}
2287
1968
 
2288
 
/*
2289
 
 * weechat_lua_api_log_print: print message in WeeChat log file
2290
 
 */
2291
 
 
2292
1969
static int
2293
1970
weechat_lua_api_log_print (lua_State *L)
2294
1971
{
2307
1984
    API_RETURN_OK;
2308
1985
}
2309
1986
 
2310
 
/*
2311
 
 * weechat_lua_api_hook_command_cb: callback for command hooked
2312
 
 */
2313
 
 
2314
1987
int
2315
1988
weechat_lua_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
2316
1989
                                 int argc, char **argv, char **argv_eol)
2352
2025
    return WEECHAT_RC_ERROR;
2353
2026
}
2354
2027
 
2355
 
/*
2356
 
 * weechat_lua_api_hook_command: hook a command
2357
 
 */
2358
 
 
2359
2028
static int
2360
2029
weechat_lua_api_hook_command (lua_State *L)
2361
2030
{
2389
2058
    API_RETURN_STRING_FREE(result);
2390
2059
}
2391
2060
 
2392
 
/*
2393
 
 * weechat_lua_api_hook_command_run_cb: callback for command_run hooked
2394
 
 */
2395
 
 
2396
2061
int
2397
2062
weechat_lua_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
2398
2063
                                     const char *command)
2431
2096
    return WEECHAT_RC_ERROR;
2432
2097
}
2433
2098
 
2434
 
/*
2435
 
 * weechat_lua_api_hook_command_run: hook a command_run
2436
 
 */
2437
 
 
2438
2099
static int
2439
2100
weechat_lua_api_hook_command_run (lua_State *L)
2440
2101
{
2459
2120
    API_RETURN_STRING_FREE(result);
2460
2121
}
2461
2122
 
2462
 
/*
2463
 
 * weechat_lua_api_hook_timer_cb: callback for timer hooked
2464
 
 */
2465
 
 
2466
2123
int
2467
2124
weechat_lua_api_hook_timer_cb (void *data, int remaining_calls)
2468
2125
{
2500
2157
    return WEECHAT_RC_ERROR;
2501
2158
}
2502
2159
 
2503
 
/*
2504
 
 * weechat_lua_api_hook_timer: hook a timer
2505
 
 */
2506
 
 
2507
2160
static int
2508
2161
weechat_lua_api_hook_timer (lua_State *L)
2509
2162
{
2533
2186
    API_RETURN_STRING_FREE(result);
2534
2187
}
2535
2188
 
2536
 
/*
2537
 
 * weechat_lua_api_hook_fd_cb: callback for fd hooked
2538
 
 */
2539
 
 
2540
2189
int
2541
2190
weechat_lua_api_hook_fd_cb (void *data, int fd)
2542
2191
{
2573
2222
    return WEECHAT_RC_ERROR;
2574
2223
}
2575
2224
 
2576
 
/*
2577
 
 * weechat_lua_api_hook_fd: hook a fd
2578
 
 */
2579
 
 
2580
2225
static int
2581
2226
weechat_lua_api_hook_fd (lua_State *L)
2582
2227
{
2608
2253
    API_RETURN_STRING_FREE(result);
2609
2254
}
2610
2255
 
2611
 
/*
2612
 
 * weechat_lua_api_hook_process_cb: callback for process hooked
2613
 
 */
2614
 
 
2615
2256
int
2616
2257
weechat_lua_api_hook_process_cb (void *data,
2617
2258
                                 const char *command, int return_code,
2651
2292
    return WEECHAT_RC_ERROR;
2652
2293
}
2653
2294
 
2654
 
/*
2655
 
 * weechat_lua_api_hook_process: hook a process
2656
 
 */
2657
 
 
2658
2295
static int
2659
2296
weechat_lua_api_hook_process (lua_State *L)
2660
2297
{
2682
2319
    API_RETURN_STRING_FREE(result);
2683
2320
}
2684
2321
 
2685
 
/*
2686
 
 * weechat_lua_api_hook_process_hashtable: hook a process with options in
2687
 
 *                                         a hashtable
2688
 
 */
2689
 
 
2690
2322
static int
2691
2323
weechat_lua_api_hook_process_hashtable (lua_State *L)
2692
2324
{
2701
2333
 
2702
2334
    command = lua_tostring (lua_current_interpreter, -5);
2703
2335
    options = weechat_lua_tohashtable (lua_current_interpreter, -4,
2704
 
                                       WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
 
2336
                                       WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
 
2337
                                       WEECHAT_HASHTABLE_STRING,
 
2338
                                       WEECHAT_HASHTABLE_STRING);
2705
2339
    timeout = lua_tonumber (lua_current_interpreter, -3);
2706
2340
    function = lua_tostring (lua_current_interpreter, -2);
2707
2341
    data = lua_tostring (lua_current_interpreter, -1);
2721
2355
    API_RETURN_STRING_FREE(result);
2722
2356
}
2723
2357
 
2724
 
/*
2725
 
 * weechat_lua_api_hook_connect_cb: callback for connect hooked
2726
 
 */
2727
 
 
2728
2358
int
2729
2359
weechat_lua_api_hook_connect_cb (void *data, int status, int gnutls_rc,
2730
 
                                 const char *error, const char *ip_address)
 
2360
                                 int sock, const char *error,
 
2361
                                 const char *ip_address)
2731
2362
{
2732
2363
    struct t_plugin_script_cb *script_callback;
2733
 
    void *func_argv[5];
2734
 
    char str_status[32], str_gnutls_rc[32];
 
2364
    void *func_argv[6];
 
2365
    char str_status[32], str_gnutls_rc[32], str_sock[32];
2735
2366
    char empty_arg[1] = { '\0' };
2736
2367
    int *rc, ret;
2737
2368
 
2741
2372
    {
2742
2373
        snprintf (str_status, sizeof (str_status), "%d", status);
2743
2374
        snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
 
2375
        snprintf (str_sock, sizeof (str_sock), "%d", sock);
2744
2376
 
2745
2377
        func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
2746
2378
        func_argv[1] = str_status;
2747
2379
        func_argv[2] = str_gnutls_rc;
2748
 
        func_argv[3] = (ip_address) ? (char *)ip_address : empty_arg;
2749
 
        func_argv[4] = (error) ? (char *)error : empty_arg;
 
2380
        func_argv[3] = str_sock;
 
2381
        func_argv[4] = (ip_address) ? (char *)ip_address : empty_arg;
 
2382
        func_argv[5] = (error) ? (char *)error : empty_arg;
2750
2383
 
2751
2384
        rc = (int *) weechat_lua_exec (script_callback->script,
2752
2385
                                       WEECHAT_SCRIPT_EXEC_INT,
2753
2386
                                       script_callback->function,
2754
 
                                       "sssss", func_argv);
 
2387
                                       "ssssss", func_argv);
2755
2388
 
2756
2389
        if (!rc)
2757
2390
            ret = WEECHAT_RC_ERROR;
2767
2400
    return WEECHAT_RC_ERROR;
2768
2401
}
2769
2402
 
2770
 
/*
2771
 
 * weechat_lua_api_hook_connect: hook a connection
2772
 
 */
2773
 
 
2774
2403
static int
2775
2404
weechat_lua_api_hook_connect (lua_State *L)
2776
2405
{
2777
2406
    const char *proxy, *address, *local_hostname, *function, *data;
2778
 
    int port, sock, ipv6;
 
2407
    int port, ipv6, retry;
2779
2408
    char *result;
2780
2409
 
2781
2410
    API_FUNC(1, "hook_connect", API_RETURN_EMPTY);
2785
2414
    proxy = lua_tostring (lua_current_interpreter, -8);
2786
2415
    address = lua_tostring (lua_current_interpreter, -7);
2787
2416
    port = lua_tonumber (lua_current_interpreter, -6);
2788
 
    sock = lua_tonumber (lua_current_interpreter, -5);
2789
 
    ipv6 = lua_tonumber (lua_current_interpreter, -4);
 
2417
    ipv6 = lua_tonumber (lua_current_interpreter, -5);
 
2418
    retry = lua_tonumber (lua_current_interpreter, -4);
2790
2419
    local_hostname = lua_tostring (lua_current_interpreter, -3);
2791
2420
    function = lua_tostring (lua_current_interpreter, -2);
2792
2421
    data = lua_tostring (lua_current_interpreter, -1);
2796
2425
                                                         proxy,
2797
2426
                                                         address,
2798
2427
                                                         port,
2799
 
                                                         sock,
2800
2428
                                                         ipv6,
 
2429
                                                         retry,
2801
2430
                                                         NULL, /* gnutls session */
2802
2431
                                                         NULL, /* gnutls callback */
2803
2432
                                                         0,    /* gnutls DH key size */
2810
2439
    API_RETURN_STRING_FREE(result);
2811
2440
}
2812
2441
 
2813
 
/*
2814
 
 * weechat_lua_api_hook_print_cb: callback for print hooked
2815
 
 */
2816
 
 
2817
2442
int
2818
2443
weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
2819
2444
                               time_t date,
2874
2499
    return WEECHAT_RC_ERROR;
2875
2500
}
2876
2501
 
2877
 
/*
2878
 
 * weechat_lua_api_hook_print: hook a print
2879
 
 */
2880
 
 
2881
2502
static int
2882
2503
weechat_lua_api_hook_print (lua_State *L)
2883
2504
{
2909
2530
    API_RETURN_STRING_FREE(result);
2910
2531
}
2911
2532
 
2912
 
/*
2913
 
 * weechat_lua_api_hook_signal_cb: callback for signal hooked
2914
 
 */
2915
 
 
2916
2533
int
2917
2534
weechat_lua_api_hook_signal_cb (void *data, const char *signal,
2918
2535
                                const char *type_data, void *signal_data)
2969
2586
    return WEECHAT_RC_ERROR;
2970
2587
}
2971
2588
 
2972
 
/*
2973
 
 * weechat_lua_api_hook_signal: hook a signal
2974
 
 */
2975
 
 
2976
2589
static int
2977
2590
weechat_lua_api_hook_signal (lua_State *L)
2978
2591
{
2997
2610
    API_RETURN_STRING_FREE(result);
2998
2611
}
2999
2612
 
3000
 
/*
3001
 
 * weechat_lua_api_hook_signal_send: send a signal
3002
 
 */
3003
 
 
3004
2613
static int
3005
2614
weechat_lua_api_hook_signal_send (lua_State *L)
3006
2615
{
3039
2648
    API_RETURN_ERROR;
3040
2649
}
3041
2650
 
3042
 
/*
3043
 
 * weechat_lua_api_hook_hsignal_cb: callback for hsignal hooked
3044
 
 */
3045
 
 
3046
2651
int
3047
2652
weechat_lua_api_hook_hsignal_cb (void *data, const char *signal,
3048
2653
                                 struct t_hashtable *hashtable)
3079
2684
    return WEECHAT_RC_ERROR;
3080
2685
}
3081
2686
 
3082
 
/*
3083
 
 * weechat_lua_api_hook_hsignal: hook a hsignal
3084
 
 */
3085
 
 
3086
2687
static int
3087
2688
weechat_lua_api_hook_hsignal (lua_State *L)
3088
2689
{
3107
2708
    API_RETURN_STRING_FREE(result);
3108
2709
}
3109
2710
 
3110
 
/*
3111
 
 * weechat_lua_api_hook_hsignal_send: send a hsignal
3112
 
 */
3113
 
 
3114
2711
static int
3115
2712
weechat_lua_api_hook_hsignal_send (lua_State *L)
3116
2713
{
3123
2720
 
3124
2721
    signal = lua_tostring (lua_current_interpreter, -2);
3125
2722
    hashtable = weechat_lua_tohashtable (lua_current_interpreter, -1,
3126
 
                                         WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
 
2723
                                         WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
 
2724
                                         WEECHAT_HASHTABLE_STRING,
 
2725
                                         WEECHAT_HASHTABLE_STRING);
3127
2726
 
3128
2727
    weechat_hook_hsignal_send (signal, hashtable);
3129
2728
 
3133
2732
    API_RETURN_OK;
3134
2733
}
3135
2734
 
3136
 
/*
3137
 
 * weechat_lua_api_hook_config_cb: callback for config option hooked
3138
 
 */
3139
 
 
3140
2735
int
3141
2736
weechat_lua_api_hook_config_cb (void *data, const char *option,
3142
2737
                                const char *value)
3173
2768
    return WEECHAT_RC_ERROR;
3174
2769
}
3175
2770
 
3176
 
/*
3177
 
 * weechat_lua_api_hook_config: hook a config option
3178
 
 */
3179
 
 
3180
2771
static int
3181
2772
weechat_lua_api_hook_config (lua_State *L)
3182
2773
{
3201
2792
    API_RETURN_STRING_FREE(result);
3202
2793
}
3203
2794
 
3204
 
/*
3205
 
 * weechat_lua_api_hook_completion_cb: callback for completion hooked
3206
 
 */
3207
 
 
3208
2795
int
3209
2796
weechat_lua_api_hook_completion_cb (void *data, const char *completion_item,
3210
2797
                                    struct t_gui_buffer *buffer,
3247
2834
    return WEECHAT_RC_ERROR;
3248
2835
}
3249
2836
 
3250
 
/*
3251
 
 * weechat_lua_api_hook_completion: hook a completion
3252
 
 */
3253
 
 
3254
2837
static int
3255
2838
weechat_lua_api_hook_completion (lua_State *L)
3256
2839
{
3277
2860
    API_RETURN_STRING_FREE(result);
3278
2861
}
3279
2862
 
3280
 
/*
3281
 
 * weechat_lua_api_hook_completion_list_add: add a word to list for a completion
3282
 
 */
3283
 
 
3284
2863
static int
3285
2864
weechat_lua_api_hook_completion_list_add (lua_State *L)
3286
2865
{
3304
2883
    API_RETURN_OK;
3305
2884
}
3306
2885
 
3307
 
/*
3308
 
 * weechat_lua_api_hook_modifier_cb: callback for modifier hooked
3309
 
 */
3310
 
 
3311
2886
char *
3312
2887
weechat_lua_api_hook_modifier_cb (void *data, const char *modifier,
3313
2888
                                  const char *modifier_data,
3335
2910
    return NULL;
3336
2911
}
3337
2912
 
3338
 
/*
3339
 
 * weechat_lua_api_hook_modifier: hook a modifier
3340
 
 */
3341
 
 
3342
2913
static int
3343
2914
weechat_lua_api_hook_modifier (lua_State *L)
3344
2915
{
3363
2934
    API_RETURN_STRING_FREE(result);
3364
2935
}
3365
2936
 
3366
 
/*
3367
 
 * weechat_lua_api_hook_modifier_exec: execute a modifier hook
3368
 
 */
3369
 
 
3370
2937
static int
3371
2938
weechat_lua_api_hook_modifier_exec (lua_State *L)
3372
2939
{
3386
2953
    API_RETURN_STRING_FREE(result);
3387
2954
}
3388
2955
 
3389
 
/*
3390
 
 * weechat_lua_api_hook_info_cb: callback for info hooked
3391
 
 */
3392
 
 
3393
2956
const char *
3394
2957
weechat_lua_api_hook_info_cb (void *data, const char *info_name,
3395
2958
                              const char *arguments)
3415
2978
    return NULL;
3416
2979
}
3417
2980
 
3418
 
/*
3419
 
 * weechat_lua_api_hook_info: hook an info
3420
 
 */
3421
 
 
3422
2981
static int
3423
2982
weechat_lua_api_hook_info (lua_State *L)
3424
2983
{
3447
3006
    API_RETURN_STRING_FREE(result);
3448
3007
}
3449
3008
 
3450
 
/*
3451
 
 * weechat_lua_api_hook_info_hashtable_cb: callback for info_hashtable hooked
3452
 
 */
3453
 
 
3454
3009
struct t_hashtable *
3455
3010
weechat_lua_api_hook_info_hashtable_cb (void *data, const char *info_name,
3456
3011
                                        struct t_hashtable *hashtable)
3476
3031
    return NULL;
3477
3032
}
3478
3033
 
3479
 
/*
3480
 
 * weechat_lua_api_hook_info_hashtable: hook an info_hashtable
3481
 
 */
3482
 
 
3483
3034
static int
3484
3035
weechat_lua_api_hook_info_hashtable (lua_State *L)
3485
3036
{
3511
3062
    API_RETURN_STRING_FREE(result);
3512
3063
}
3513
3064
 
3514
 
/*
3515
 
 * weechat_lua_api_hook_infolist_cb: callback for infolist hooked
3516
 
 */
3517
 
 
3518
3065
struct t_infolist *
3519
3066
weechat_lua_api_hook_infolist_cb (void *data, const char *info_name,
3520
3067
                                  void *pointer, const char *arguments)
3547
3094
    return NULL;
3548
3095
}
3549
3096
 
3550
 
/*
3551
 
 * weechat_lua_api_hook_infolist: hook an infolist
3552
 
 */
3553
 
 
3554
3097
static int
3555
3098
weechat_lua_api_hook_infolist (lua_State *L)
3556
3099
{
3582
3125
    API_RETURN_STRING_FREE(result);
3583
3126
}
3584
3127
 
3585
 
/*
3586
 
 * weechat_lua_api_hook_focus_cb: callback for focus hooked
3587
 
 */
3588
 
 
3589
3128
struct t_hashtable *
3590
3129
weechat_lua_api_hook_focus_cb (void *data,
3591
3130
                               struct t_hashtable *info)
3610
3149
    return NULL;
3611
3150
}
3612
3151
 
3613
 
/*
3614
 
 * weechat_lua_api_hook_focus: hook a focus
3615
 
 */
3616
 
 
3617
3152
static int
3618
3153
weechat_lua_api_hook_focus (lua_State *L)
3619
3154
{
3638
3173
    API_RETURN_STRING_FREE(result);
3639
3174
}
3640
3175
 
3641
 
/*
3642
 
 * weechat_lua_api_unhook: unhook something
3643
 
 */
3644
 
 
3645
3176
static int
3646
3177
weechat_lua_api_unhook (lua_State *L)
3647
3178
{
3660
3191
    API_RETURN_OK;
3661
3192
}
3662
3193
 
3663
 
/*
3664
 
 * weechat_lua_api_unhook_all: unhook all for script
3665
 
 */
3666
 
 
3667
3194
static int
3668
3195
weechat_lua_api_unhook_all (lua_State *L)
3669
3196
{
3674
3201
    API_RETURN_OK;
3675
3202
}
3676
3203
 
3677
 
/*
3678
 
 * weechat_lua_api_buffer_input_data_cb: callback for input data in a buffer
3679
 
 */
3680
 
 
3681
3204
int
3682
3205
weechat_lua_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
3683
3206
                                      const char *input_data)
3716
3239
    return WEECHAT_RC_ERROR;
3717
3240
}
3718
3241
 
3719
 
/*
3720
 
 * weechat_lua_api_buffer_close_cb: callback for buffer closed
3721
 
 */
3722
 
 
3723
3242
int
3724
3243
weechat_lua_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
3725
3244
{
3756
3275
    return WEECHAT_RC_ERROR;
3757
3276
}
3758
3277
 
3759
 
/*
3760
 
 * weechat_lua_api_buffer_new: create a new buffer
3761
 
 */
3762
 
 
3763
3278
static int
3764
3279
weechat_lua_api_buffer_new (lua_State *L)
3765
3280
{
3790
3305
    API_RETURN_STRING_FREE(result);
3791
3306
}
3792
3307
 
3793
 
/*
3794
 
 * weechat_lua_api_buffer_search: search a buffer
3795
 
 */
3796
 
 
3797
3308
static int
3798
3309
weechat_lua_api_buffer_search (lua_State *L)
3799
3310
{
3812
3323
    API_RETURN_STRING_FREE(result);
3813
3324
}
3814
3325
 
3815
 
/*
3816
 
 * weechat_lua_api_buffer_search_main: search main buffer (WeeChat core buffer)
3817
 
 */
3818
 
 
3819
3326
static int
3820
3327
weechat_lua_api_buffer_search_main (lua_State *L)
3821
3328
{
3828
3335
    API_RETURN_STRING_FREE(result);
3829
3336
}
3830
3337
 
3831
 
/*
3832
 
 * weechat_lua_api_current_buffer: get current buffer
3833
 
 */
3834
 
 
3835
3338
static int
3836
3339
weechat_lua_api_current_buffer (lua_State *L)
3837
3340
{
3844
3347
    API_RETURN_STRING_FREE(result);
3845
3348
}
3846
3349
 
3847
 
/*
3848
 
 * weechat_lua_api_buffer_clear: clear a buffer
3849
 
 */
3850
 
 
3851
3350
static int
3852
3351
weechat_lua_api_buffer_clear (lua_State *L)
3853
3352
{
3864
3363
    API_RETURN_OK;
3865
3364
}
3866
3365
 
3867
 
/*
3868
 
 * weechat_lua_api_buffer_close: close a buffer
3869
 
 */
3870
 
 
3871
3366
static int
3872
3367
weechat_lua_api_buffer_close (lua_State *L)
3873
3368
{
3886
3381
    API_RETURN_OK;
3887
3382
}
3888
3383
 
3889
 
/*
3890
 
 * weechat_lua_api_buffer_merge: merge a buffer to another buffer
3891
 
 */
3892
 
 
3893
3384
static int
3894
3385
weechat_lua_api_buffer_merge (lua_State *L)
3895
3386
{
3908
3399
    API_RETURN_OK;
3909
3400
}
3910
3401
 
3911
 
/*
3912
 
 * weechat_lua_api_buffer_unmerge: unmerge a buffer from a group of merged
3913
 
 *                                 buffers
3914
 
 */
3915
 
 
3916
3402
static int
3917
3403
weechat_lua_api_buffer_unmerge (lua_State *L)
3918
3404
{
3931
3417
    API_RETURN_OK;
3932
3418
}
3933
3419
 
3934
 
/*
3935
 
 * weechat_lua_api_buffer_get_integer: get a buffer property as integer
3936
 
 */
3937
 
 
3938
3420
static int
3939
3421
weechat_lua_api_buffer_get_integer (lua_State *L)
3940
3422
{
3954
3436
    API_RETURN_INT(value);
3955
3437
}
3956
3438
 
3957
 
/*
3958
 
 * weechat_lua_api_buffer_get_string: get a buffer property as string
3959
 
 */
3960
 
 
3961
3439
static int
3962
3440
weechat_lua_api_buffer_get_string (lua_State *L)
3963
3441
{
3976
3454
    API_RETURN_STRING(result);
3977
3455
}
3978
3456
 
3979
 
/*
3980
 
 * weechat_lua_api_buffer_get_pointer: get a buffer property as pointer
3981
 
 */
3982
 
 
3983
3457
static int
3984
3458
weechat_lua_api_buffer_get_pointer (lua_State *L)
3985
3459
{
3999
3473
    API_RETURN_STRING_FREE(result);
4000
3474
}
4001
3475
 
4002
 
/*
4003
 
 * weechat_lua_api_buffer_set: set a buffer property
4004
 
 */
4005
 
 
4006
3476
static int
4007
3477
weechat_lua_api_buffer_set (lua_State *L)
4008
3478
{
4021
3491
    API_RETURN_OK;
4022
3492
}
4023
3493
 
4024
 
/*
4025
 
 * weechat_lua_api_buffer_string_replace_local_var: replace local variables ($var) in a string,
4026
 
 *                                                  using value of local variables
4027
 
 */
4028
 
 
4029
3494
static int
4030
3495
weechat_lua_api_buffer_string_replace_local_var (lua_State *L)
4031
3496
{
4044
3509
    API_RETURN_STRING_FREE(result);
4045
3510
}
4046
3511
 
4047
 
/*
4048
 
 * weechat_lua_api_buffer_match_list: return 1 if buffer matches list of buffers
4049
 
 */
4050
 
 
4051
3512
static int
4052
3513
weechat_lua_api_buffer_match_list (lua_State *L)
4053
3514
{
4067
3528
    API_RETURN_INT(value);
4068
3529
}
4069
3530
 
4070
 
/*
4071
 
 * weechat_lua_api_current_window: get current window
4072
 
 */
4073
 
 
4074
3531
static int
4075
3532
weechat_lua_api_current_window (lua_State *L)
4076
3533
{
4083
3540
    API_RETURN_STRING_FREE(result);
4084
3541
}
4085
3542
 
4086
 
/*
4087
 
 * weechat_lua_api_window_search_with_buffer: search a window with buffer
4088
 
 *                                            pointer
4089
 
 */
4090
 
 
4091
3543
static int
4092
3544
weechat_lua_api_window_search_with_buffer (lua_State *L)
4093
3545
{
4105
3557
    API_RETURN_STRING_FREE(result);
4106
3558
}
4107
3559
 
4108
 
/*
4109
 
 * weechat_lua_api_window_get_integer: get a window property as integer
4110
 
 */
4111
 
 
4112
3560
static int
4113
3561
weechat_lua_api_window_get_integer (lua_State *L)
4114
3562
{
4128
3576
    API_RETURN_INT(value);
4129
3577
}
4130
3578
 
4131
 
/*
4132
 
 * weechat_lua_api_window_get_string: get a window property as string
4133
 
 */
4134
 
 
4135
3579
static int
4136
3580
weechat_lua_api_window_get_string (lua_State *L)
4137
3581
{
4150
3594
    API_RETURN_STRING(result);
4151
3595
}
4152
3596
 
4153
 
/*
4154
 
 * weechat_lua_api_window_get_pointer: get a window property as pointer
4155
 
 */
4156
 
 
4157
3597
static int
4158
3598
weechat_lua_api_window_get_pointer (lua_State *L)
4159
3599
{
4173
3613
    API_RETURN_STRING_FREE(result);
4174
3614
}
4175
3615
 
4176
 
/*
4177
 
 * weechat_lua_api_window_set_title: set window title
4178
 
 */
4179
 
 
4180
3616
static int
4181
3617
weechat_lua_api_window_set_title (lua_State *L)
4182
3618
{
4193
3629
    API_RETURN_OK;
4194
3630
}
4195
3631
 
4196
 
/*
4197
 
 * weechat_lua_api_nicklist_add_group: add a group in nicklist
4198
 
 */
4199
 
 
4200
3632
static int
4201
3633
weechat_lua_api_nicklist_add_group (lua_State *L)
4202
3634
{
4223
3655
    API_RETURN_STRING_FREE(result);
4224
3656
}
4225
3657
 
4226
 
/*
4227
 
 * weechat_lua_api_nicklist_search_group: search a group in nicklist
4228
 
 */
4229
 
 
4230
3658
static int
4231
3659
weechat_lua_api_nicklist_search_group (lua_State *L)
4232
3660
{
4248
3676
    API_RETURN_STRING_FREE(result);
4249
3677
}
4250
3678
 
4251
 
/*
4252
 
 * weechat_lua_api_nicklist_add_nick: add a nick in nicklist
4253
 
 */
4254
 
 
4255
3679
static int
4256
3680
weechat_lua_api_nicklist_add_nick (lua_State *L)
4257
3681
{
4282
3706
    API_RETURN_STRING_FREE(result);
4283
3707
}
4284
3708
 
4285
 
/*
4286
 
 * weechat_lua_api_nicklist_search_nick: search a nick in nicklist
4287
 
 */
4288
 
 
4289
3709
static int
4290
3710
weechat_lua_api_nicklist_search_nick (lua_State *L)
4291
3711
{
4307
3727
    API_RETURN_STRING_FREE(result);
4308
3728
}
4309
3729
 
4310
 
/*
4311
 
 * weechat_lua_api_nicklist_remove_group: remove a group from nicklist
4312
 
 */
4313
 
 
4314
3730
static int
4315
3731
weechat_lua_api_nicklist_remove_group (lua_State *L)
4316
3732
{
4329
3745
    API_RETURN_OK;
4330
3746
}
4331
3747
 
4332
 
/*
4333
 
 * weechat_lua_api_nicklist_remove_nick: remove a nick from nicklist
4334
 
 */
4335
 
 
4336
3748
static int
4337
3749
weechat_lua_api_nicklist_remove_nick (lua_State *L)
4338
3750
{
4351
3763
    API_RETURN_OK;
4352
3764
}
4353
3765
 
4354
 
/*
4355
 
 * weechat_lua_api_nicklist_remove_all: remove all groups/nicks from nicklist
4356
 
 */
4357
 
 
4358
3766
static int
4359
3767
weechat_lua_api_nicklist_remove_all (lua_State *L)
4360
3768
{
4371
3779
    API_RETURN_OK;
4372
3780
}
4373
3781
 
4374
 
/*
4375
 
 * weechat_lua_api_nicklist_group_get_integer: get a group property as integer
4376
 
 */
4377
 
 
4378
3782
static int
4379
3783
weechat_lua_api_nicklist_group_get_integer (lua_State *L)
4380
3784
{
4396
3800
    API_RETURN_INT(value);
4397
3801
}
4398
3802
 
4399
 
/*
4400
 
 * weechat_lua_api_nicklist_group_get_string: get a group property as string
4401
 
 */
4402
 
 
4403
3803
static int
4404
3804
weechat_lua_api_nicklist_group_get_string (lua_State *L)
4405
3805
{
4420
3820
    API_RETURN_STRING(result);
4421
3821
}
4422
3822
 
4423
 
/*
4424
 
 * weechat_lua_api_nicklist_group_get_pointer: get a group property as pointer
4425
 
 */
4426
 
 
4427
3823
static int
4428
3824
weechat_lua_api_nicklist_group_get_pointer (lua_State *L)
4429
3825
{
4445
3841
    API_RETURN_STRING_FREE(result);
4446
3842
}
4447
3843
 
4448
 
/*
4449
 
 * weechat_lua_api_nicklist_group_set: set a group property
4450
 
 */
4451
 
 
4452
3844
static int
4453
3845
weechat_lua_api_nicklist_group_set (lua_State *L)
4454
3846
{
4471
3863
    API_RETURN_OK;
4472
3864
}
4473
3865
 
4474
 
/*
4475
 
 * weechat_lua_api_nicklist_nick_get_integer: get a nick property as integer
4476
 
 */
4477
 
 
4478
3866
static int
4479
3867
weechat_lua_api_nicklist_nick_get_integer (lua_State *L)
4480
3868
{
4496
3884
    API_RETURN_INT(value);
4497
3885
}
4498
3886
 
4499
 
/*
4500
 
 * weechat_lua_api_nicklist_nick_get_string: get a nick property as string
4501
 
 */
4502
 
 
4503
3887
static int
4504
3888
weechat_lua_api_nicklist_nick_get_string (lua_State *L)
4505
3889
{
4520
3904
    API_RETURN_STRING(result);
4521
3905
}
4522
3906
 
4523
 
/*
4524
 
 * weechat_lua_api_nicklist_nick_get_pointer: get a nick property as pointer
4525
 
 */
4526
 
 
4527
3907
static int
4528
3908
weechat_lua_api_nicklist_nick_get_pointer (lua_State *L)
4529
3909
{
4545
3925
    API_RETURN_STRING_FREE(result);
4546
3926
}
4547
3927
 
4548
 
/*
4549
 
 * weechat_lua_api_nicklist_nick_set: set a nick property
4550
 
 */
4551
 
 
4552
3928
static int
4553
3929
weechat_lua_api_nicklist_nick_set (lua_State *L)
4554
3930
{
4571
3947
    API_RETURN_OK;
4572
3948
}
4573
3949
 
4574
 
/*
4575
 
 * weechat_lua_api_bar_item_search: search a bar item
4576
 
 */
4577
 
 
4578
3950
static int
4579
3951
weechat_lua_api_bar_item_search (lua_State *L)
4580
3952
{
4592
3964
    API_RETURN_STRING_FREE(result);
4593
3965
}
4594
3966
 
4595
 
/*
4596
 
 * weechat_lua_api_bar_item_build_cb: callback for building bar item
4597
 
 */
4598
 
 
4599
3967
char *
4600
3968
weechat_lua_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
4601
3969
                                   struct t_gui_window *window)
4628
3996
    return NULL;
4629
3997
}
4630
3998
 
4631
 
/*
4632
 
 * weechat_lua_api_bar_item_new: add a new bar item
4633
 
 */
4634
 
 
4635
3999
static int
4636
4000
weechat_lua_api_bar_item_new (lua_State *L)
4637
4001
{
4656
4020
    API_RETURN_STRING_FREE(result);
4657
4021
}
4658
4022
 
4659
 
/*
4660
 
 * weechat_lua_api_bar_item_update: update a bar item on screen
4661
 
 */
4662
 
 
4663
4023
static int
4664
4024
weechat_lua_api_bar_item_update (lua_State *L)
4665
4025
{
4676
4036
    API_RETURN_OK;
4677
4037
}
4678
4038
 
4679
 
/*
4680
 
 * weechat_lua_api_bar_item_remove: remove a bar item
4681
 
 */
4682
 
 
4683
4039
static int
4684
4040
weechat_lua_api_bar_item_remove (lua_State *L)
4685
4041
{
4698
4054
    API_RETURN_OK;
4699
4055
}
4700
4056
 
4701
 
/*
4702
 
 * weechat_lua_api_bar_search: search a bar
4703
 
 */
4704
 
 
4705
4057
static int
4706
4058
weechat_lua_api_bar_search (lua_State *L)
4707
4059
{
4719
4071
    API_RETURN_STRING_FREE(result);
4720
4072
}
4721
4073
 
4722
 
/*
4723
 
 * weechat_lua_api_bar_new: add a new bar
4724
 
 */
4725
 
 
4726
4074
static int
4727
4075
weechat_lua_api_bar_new (lua_State *L)
4728
4076
{
4770
4118
    API_RETURN_STRING_FREE(result);
4771
4119
}
4772
4120
 
4773
 
/*
4774
 
 * weechat_lua_api_bar_set: set a bar property
4775
 
 */
4776
 
 
4777
4121
static int
4778
4122
weechat_lua_api_bar_set (lua_State *L)
4779
4123
{
4794
4138
    API_RETURN_OK;
4795
4139
}
4796
4140
 
4797
 
/*
4798
 
 * weechat_lua_api_bar_update: update a bar on screen
4799
 
 */
4800
 
 
4801
4141
static int
4802
4142
weechat_lua_api_bar_update (lua_State *L)
4803
4143
{
4814
4154
    API_RETURN_OK;
4815
4155
}
4816
4156
 
4817
 
/*
4818
 
 * weechat_lua_api_bar_remove: remove a bar
4819
 
 */
4820
 
 
4821
4157
static int
4822
4158
weechat_lua_api_bar_remove (lua_State *L)
4823
4159
{
4834
4170
    API_RETURN_OK;
4835
4171
}
4836
4172
 
4837
 
/*
4838
 
 * weechat_lua_api_command: send command to server
4839
 
 */
4840
 
 
4841
4173
static int
4842
4174
weechat_lua_api_command (lua_State *L)
4843
4175
{
4858
4190
    API_RETURN_OK;
4859
4191
}
4860
4192
 
4861
 
/*
4862
 
 * weechat_lua_api_info_get: get info (as string)
4863
 
 */
4864
 
 
4865
4193
static int
4866
4194
weechat_lua_api_info_get (lua_State *L)
4867
4195
{
4879
4207
    API_RETURN_STRING(result);
4880
4208
}
4881
4209
 
4882
 
/*
4883
 
 * weechat_lua_api_info_get_hashtable: get info (as hashtable)
4884
 
 */
4885
 
 
4886
4210
static int
4887
4211
weechat_lua_api_info_get_hashtable (lua_State *L)
4888
4212
{
4895
4219
 
4896
4220
    info_name = lua_tostring (lua_current_interpreter, -2);
4897
4221
    table = weechat_lua_tohashtable (lua_current_interpreter, -1,
4898
 
                                     WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
 
4222
                                     WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
 
4223
                                     WEECHAT_HASHTABLE_STRING,
 
4224
                                     WEECHAT_HASHTABLE_STRING);
4899
4225
 
4900
4226
    result_hashtable = weechat_info_get_hashtable (info_name, table);
4901
4227
 
4909
4235
    return 1;
4910
4236
}
4911
4237
 
4912
 
/*
4913
 
 * weechat_lua_api_infolist_new: create new infolist
4914
 
 */
4915
 
 
4916
4238
static int
4917
4239
weechat_lua_api_infolist_new (lua_State *L)
4918
4240
{
4925
4247
    API_RETURN_STRING_FREE(result);
4926
4248
}
4927
4249
 
4928
 
/*
4929
 
 * weechat_lua_api_infolist_new_item: create new item in infolist
4930
 
 */
4931
 
 
4932
4250
static int
4933
4251
weechat_lua_api_infolist_new_item (lua_State *L)
4934
4252
{
4946
4264
    API_RETURN_STRING_FREE(result);
4947
4265
}
4948
4266
 
4949
 
/*
4950
 
 * weechat_lua_api_infolist_new_var_integer: create new integer variable in
4951
 
 *                                           infolist
4952
 
 */
4953
 
 
4954
4267
static int
4955
4268
weechat_lua_api_infolist_new_var_integer (lua_State *L)
4956
4269
{
4973
4286
    API_RETURN_STRING_FREE(result);
4974
4287
}
4975
4288
 
4976
 
/*
4977
 
 * weechat_lua_api_infolist_new_var_string: create new string variable in
4978
 
 *                                          infolist
4979
 
 */
4980
 
 
4981
4289
static int
4982
4290
weechat_lua_api_infolist_new_var_string (lua_State *L)
4983
4291
{
4999
4307
    API_RETURN_STRING_FREE(result);
5000
4308
}
5001
4309
 
5002
 
/*
5003
 
 * weechat_lua_api_infolist_new_var_pointer: create new pointer variable in
5004
 
 *                                           infolist
5005
 
 */
5006
 
 
5007
4310
static int
5008
4311
weechat_lua_api_infolist_new_var_pointer (lua_State *L)
5009
4312
{
5025
4328
    API_RETURN_STRING_FREE(result);
5026
4329
}
5027
4330
 
5028
 
/*
5029
 
 * weechat_lua_api_infolist_new_var_time: create new time variable in infolist
5030
 
 */
5031
 
 
5032
4331
static int
5033
4332
weechat_lua_api_infolist_new_var_time (lua_State *L)
5034
4333
{
5051
4350
    API_RETURN_STRING_FREE(result);
5052
4351
}
5053
4352
 
5054
 
/*
5055
 
 * weechat_lua_api_infolist_get: get list with infos
5056
 
 */
5057
 
 
5058
4353
static int
5059
4354
weechat_lua_api_infolist_get (lua_State *L)
5060
4355
{
5076
4371
    API_RETURN_STRING_FREE(result);
5077
4372
}
5078
4373
 
5079
 
/*
5080
 
 * weechat_lua_api_infolist_next: move item pointer to next item in infolist
5081
 
 */
5082
 
 
5083
4374
static int
5084
4375
weechat_lua_api_infolist_next (lua_State *L)
5085
4376
{
5097
4388
    API_RETURN_INT(value);
5098
4389
}
5099
4390
 
5100
 
/*
5101
 
 * weechat_lua_api_infolist_prev: move item pointer to previous item in infolist
5102
 
 */
5103
 
 
5104
4391
static int
5105
4392
weechat_lua_api_infolist_prev (lua_State *L)
5106
4393
{
5118
4405
    API_RETURN_INT(value);
5119
4406
}
5120
4407
 
5121
 
/*
5122
 
 * weechat_lua_api_infolist_reset_item_cursor: reset pointer to current item in
5123
 
 *                                             infolist
5124
 
 */
5125
 
 
5126
4408
static int
5127
4409
weechat_lua_api_infolist_reset_item_cursor (lua_State *L)
5128
4410
{
5139
4421
    API_RETURN_OK;
5140
4422
}
5141
4423
 
5142
 
/*
5143
 
 * weechat_lua_api_infolist_fields: get list of fields for current item of infolist
5144
 
 */
5145
 
 
5146
4424
static int
5147
4425
weechat_lua_api_infolist_fields (lua_State *L)
5148
4426
{
5159
4437
    API_RETURN_STRING(result);
5160
4438
}
5161
4439
 
5162
 
/*
5163
 
 * weechat_lua_api_infolist_integer: get integer value of a variable in infolist
5164
 
 */
5165
 
 
5166
4440
static int
5167
4441
weechat_lua_api_infolist_integer (lua_State *L)
5168
4442
{
5182
4456
    API_RETURN_INT(value);
5183
4457
}
5184
4458
 
5185
 
/*
5186
 
 * weechat_lua_api_infolist_string: get string value of a variable in infolist
5187
 
 */
5188
 
 
5189
4459
static int
5190
4460
weechat_lua_api_infolist_string (lua_State *L)
5191
4461
{
5204
4474
    API_RETURN_STRING(result);
5205
4475
}
5206
4476
 
5207
 
/*
5208
 
 * weechat_lua_api_infolist_pointer: get pointer value of a variable in infolist
5209
 
 */
5210
 
 
5211
4477
static int
5212
4478
weechat_lua_api_infolist_pointer (lua_State *L)
5213
4479
{
5227
4493
    API_RETURN_STRING_FREE(result);
5228
4494
}
5229
4495
 
5230
 
/*
5231
 
 * weechat_lua_api_infolist_time: get time value of a variable in infolist
5232
 
 */
5233
 
 
5234
4496
static int
5235
4497
weechat_lua_api_infolist_time (lua_State *L)
5236
4498
{
5257
4519
    API_RETURN_STRING_FREE(result);
5258
4520
}
5259
4521
 
5260
 
/*
5261
 
 * weechat_lua_api_infolist_free: free infolist
5262
 
 */
5263
 
 
5264
4522
static int
5265
4523
weechat_lua_api_infolist_free (lua_State *L)
5266
4524
{
5277
4535
    API_RETURN_OK;
5278
4536
}
5279
4537
 
5280
 
/*
5281
 
 * weechat_lua_api_hdata_get: get hdata
5282
 
 */
5283
 
 
5284
4538
static int
5285
4539
weechat_lua_api_hdata_get (lua_State *L)
5286
4540
{
5298
4552
    API_RETURN_STRING_FREE(result);
5299
4553
}
5300
4554
 
5301
 
/*
5302
 
 * weechat_lua_api_hdata_get_var_offset: get offset of variable in hdata
5303
 
 */
5304
 
 
5305
4555
static int
5306
4556
weechat_lua_api_hdata_get_var_offset (lua_State *L)
5307
4557
{
5320
4570
    API_RETURN_INT(value);
5321
4571
}
5322
4572
 
5323
 
/*
5324
 
 * weechat_lua_api_hdata_get_var_type_string: get type of variable as string in
5325
 
 *                                            hdata
5326
 
 */
5327
 
 
5328
4573
static int
5329
4574
weechat_lua_api_hdata_get_var_type_string (lua_State *L)
5330
4575
{
5342
4587
    API_RETURN_STRING(result);
5343
4588
}
5344
4589
 
5345
 
/*
5346
 
 * weechat_lua_api_hdata_get_var_array_size: get array size for variable in
5347
 
 *                                           hdata
5348
 
 */
5349
 
 
5350
4590
static int
5351
4591
weechat_lua_api_hdata_get_var_array_size (lua_State *L)
5352
4592
{
5368
4608
    API_RETURN_INT(value);
5369
4609
}
5370
4610
 
5371
 
/*
5372
 
 * weechat_lua_api_hdata_get_var_array_size_string: get array size for variable
5373
 
 *                                                  in hdata (as string)
5374
 
 */
5375
 
 
5376
4611
static int
5377
4612
weechat_lua_api_hdata_get_var_array_size_string (lua_State *L)
5378
4613
{
5393
4628
    API_RETURN_STRING(result);
5394
4629
}
5395
4630
 
5396
 
/*
5397
 
 * weechat_lua_api_hdata_get_var_hdata: get hdata for variable in hdata
5398
 
 */
5399
 
 
5400
4631
static int
5401
4632
weechat_lua_api_hdata_get_var_hdata (lua_State *L)
5402
4633
{
5414
4645
    API_RETURN_STRING(result);
5415
4646
}
5416
4647
 
5417
 
/*
5418
 
 * weechat_lua_api_hdata_get_list: get list pointer in hdata
5419
 
 */
5420
 
 
5421
4648
static int
5422
4649
weechat_lua_api_hdata_get_list (lua_State *L)
5423
4650
{
5437
4664
    API_RETURN_STRING_FREE(result);
5438
4665
}
5439
4666
 
5440
 
/*
5441
 
 * weechat_lua_api_hdata_check_pointer: check pointer with hdata/list
5442
 
 */
5443
 
 
5444
4667
static int
5445
4668
weechat_lua_api_hdata_check_pointer (lua_State *L)
5446
4669
{
5462
4685
    API_RETURN_INT(value);
5463
4686
}
5464
4687
 
5465
 
/*
5466
 
 * weechat_lua_api_hdata_move: move pointer to another element in list
5467
 
 */
5468
 
 
5469
4688
static int
5470
4689
weechat_lua_api_hdata_move (lua_State *L)
5471
4690
{
5488
4707
    API_RETURN_STRING_FREE(result);
5489
4708
}
5490
4709
 
5491
 
/*
5492
 
 * weechat_lua_api_hdata_char: get char value of a variable in structure using
5493
 
 *                             hdata
5494
 
 */
5495
 
 
5496
4710
static int
5497
4711
weechat_lua_api_hdata_char (lua_State *L)
5498
4712
{
5514
4728
    API_RETURN_INT(value);
5515
4729
}
5516
4730
 
5517
 
/*
5518
 
 * weechat_lua_api_hdata_integer: get integer value of a variable in structure
5519
 
 *                                using hdata
5520
 
 */
5521
 
 
5522
4731
static int
5523
4732
weechat_lua_api_hdata_integer (lua_State *L)
5524
4733
{
5540
4749
    API_RETURN_INT(value);
5541
4750
}
5542
4751
 
5543
 
/*
5544
 
 * weechat_lua_api_hdata_long: get long value of a variable in structure using
5545
 
 *                             hdata
5546
 
 */
5547
 
 
5548
4752
static int
5549
4753
weechat_lua_api_hdata_long (lua_State *L)
5550
4754
{
5566
4770
    API_RETURN_LONG(value);
5567
4771
}
5568
4772
 
5569
 
/*
5570
 
 * weechat_lua_api_hdata_string: get string value of a variable in structure
5571
 
 *                               using hdata
5572
 
 */
5573
 
 
5574
4773
static int
5575
4774
weechat_lua_api_hdata_string (lua_State *L)
5576
4775
{
5591
4790
    API_RETURN_STRING(result);
5592
4791
}
5593
4792
 
5594
 
/*
5595
 
 * weechat_lua_api_hdata_pointer: get pointer value of a variable in structure
5596
 
 *                                using hdata
5597
 
 */
5598
 
 
5599
4793
static int
5600
4794
weechat_lua_api_hdata_pointer (lua_State *L)
5601
4795
{
5617
4811
    API_RETURN_STRING_FREE(result);
5618
4812
}
5619
4813
 
5620
 
/*
5621
 
 * weechat_lua_api_hdata_time: get time value of a variable in structure using
5622
 
 *                             hdata
5623
 
 */
5624
 
 
5625
4814
static int
5626
4815
weechat_lua_api_hdata_time (lua_State *L)
5627
4816
{
5647
4836
    API_RETURN_STRING_FREE(result);
5648
4837
}
5649
4838
 
5650
 
/*
5651
 
 * weechat_lua_api_hdata_hashtable: get hashtable value of a variable in
5652
 
 *                                  structure using hdata
5653
 
 */
5654
 
 
5655
4839
static int
5656
4840
weechat_lua_api_hdata_hashtable (lua_State *L)
5657
4841
{
5673
4857
    return 1;
5674
4858
}
5675
4859
 
5676
 
/*
5677
 
 * weechat_lua_api_hdata_update: update data in a hdata
5678
 
 */
5679
 
 
5680
4860
static int
5681
4861
weechat_lua_api_hdata_update (lua_State *L)
5682
4862
{
5691
4871
    hdata = lua_tostring (lua_current_interpreter, -3);
5692
4872
    pointer = lua_tostring (lua_current_interpreter, -2);
5693
4873
    hashtable = weechat_lua_tohashtable (lua_current_interpreter, -1,
5694
 
                                         WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
 
4874
                                         WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
 
4875
                                         WEECHAT_HASHTABLE_STRING,
 
4876
                                         WEECHAT_HASHTABLE_STRING);
5695
4877
 
5696
4878
    value = weechat_hdata_update (API_STR2PTR(hdata),
5697
4879
                                  API_STR2PTR(pointer),
5703
4885
    API_RETURN_INT(value);
5704
4886
}
5705
4887
 
5706
 
/*
5707
 
 * weechat_lua_api_hdata_get_string: get hdata property as string
5708
 
 */
5709
 
 
5710
4888
static int
5711
4889
weechat_lua_api_hdata_get_string (lua_State *L)
5712
4890
{
5724
4902
    API_RETURN_STRING(result);
5725
4903
}
5726
4904
 
5727
 
/*
5728
 
 * weechat_lua_api_upgrade_new: create an upgrade file
5729
 
 */
5730
 
 
5731
4905
static int
5732
4906
weechat_lua_api_upgrade_new (lua_State *L)
5733
4907
{
5747
4921
    API_RETURN_STRING_FREE(result);
5748
4922
}
5749
4923
 
5750
 
/*
5751
 
 * weechat_lua_api_upgrade_write_object: write object in upgrade file
5752
 
 */
5753
 
 
5754
4924
static int
5755
4925
weechat_lua_api_upgrade_write_object (lua_State *L)
5756
4926
{
5772
4942
    API_RETURN_INT(rc);
5773
4943
}
5774
4944
 
5775
 
/*
5776
 
 * weechat_lua_api_upgrade_read_cb: callback for reading object in upgrade file
5777
 
 */
5778
 
 
5779
4945
int
5780
4946
weechat_lua_api_upgrade_read_cb (void *data,
5781
4947
                                 struct t_upgrade_file *upgrade_file,
5821
4987
    return WEECHAT_RC_ERROR;
5822
4988
}
5823
4989
 
5824
 
/*
5825
 
 * weechat_lua_api_upgrade_read: read upgrade file
5826
 
 */
5827
 
 
5828
4990
static int
5829
4991
weechat_lua_api_upgrade_read (lua_State *L)
5830
4992
{
5849
5011
    API_RETURN_INT(rc);
5850
5012
}
5851
5013
 
5852
 
/*
5853
 
 * weechat_lua_api_upgrade_close: close upgrade file
5854
 
 */
5855
 
 
5856
5014
static int
5857
5015
weechat_lua_api_upgrade_close (lua_State *L)
5858
5016
{
6234
5392
}
6235
5393
 
6236
5394
static int
 
5395
weechat_lua_api_constant_weechat_hook_connect_socket_error (lua_State *L)
 
5396
{
 
5397
    /* make C compiler happy */
 
5398
    (void) L;
 
5399
 
 
5400
    lua_pushnumber (lua_current_interpreter, WEECHAT_HOOK_CONNECT_SOCKET_ERROR);
 
5401
    return 1;
 
5402
}
 
5403
 
 
5404
static int
6237
5405
weechat_lua_api_constant_weechat_hook_signal_string (lua_State *L)
6238
5406
{
6239
5407
    /* make C compiler happy */
6264
5432
}
6265
5433
 
6266
5434
/*
6267
 
 * Lua subroutines
 
5435
 * Initializes lua functions and constants.
6268
5436
 */
6269
5437
 
6270
5438
const struct luaL_Reg weechat_lua_api_funcs[] = {
6282
5450
    API_DEF_FUNC(string_remove_color),
6283
5451
    API_DEF_FUNC(string_is_command_char),
6284
5452
    API_DEF_FUNC(string_input_for_buffer),
 
5453
    API_DEF_FUNC(string_eval_expression),
6285
5454
    API_DEF_FUNC(mkdir_home),
6286
5455
    API_DEF_FUNC(mkdir),
6287
5456
    API_DEF_FUNC(mkdir_parents),
6496
5665
    { "WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR", &weechat_lua_api_constant_weechat_hook_connect_gnutls_handshake_error },
6497
5666
    { "WEECHAT_HOOK_CONNECT_MEMORY_ERROR", &weechat_lua_api_constant_weechat_hook_connect_memory_error },
6498
5667
    { "WEECHAT_HOOK_CONNECT_TIMEOUT", &weechat_lua_api_constant_weechat_hook_connect_timeout },
 
5668
    { "WEECHAT_HOOK_CONNECT_SOCKET_ERROR", &weechat_lua_api_constant_weechat_hook_connect_socket_error },
6499
5669
 
6500
5670
    { "WEECHAT_HOOK_SIGNAL_STRING", &weechat_lua_api_constant_weechat_hook_signal_string },
6501
5671
    { "WEECHAT_HOOK_SIGNAL_INT", &weechat_lua_api_constant_weechat_hook_signal_int },