weechat-plugin.h 109 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821
  1. /*
  2. * weechat-plugin.h - header to compile WeeChat plugins
  3. *
  4. * Copyright (C) 2003-2015 Sébastien Helleu <flashcode@flashtux.org>
  5. *
  6. * This file is part of WeeChat, the extensible chat client.
  7. *
  8. * WeeChat is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * WeeChat is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #ifndef WEECHAT_WEECHAT_PLUGIN_H
  22. #define WEECHAT_WEECHAT_PLUGIN_H 1
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif /* __cplusplus */
  26. #include <sys/types.h>
  27. #include <sys/socket.h>
  28. /* some systems like GNU/Hurd do not define PATH_MAX */
  29. #ifndef PATH_MAX
  30. #define PATH_MAX 4096
  31. #endif /* PATH_MAX */
  32. struct t_config_option;
  33. struct t_gui_window;
  34. struct t_gui_buffer;
  35. struct t_gui_bar;
  36. struct t_gui_bar_item;
  37. struct t_gui_completion;
  38. struct t_infolist;
  39. struct t_infolist_item;
  40. struct t_weelist;
  41. struct t_hashtable;
  42. struct t_hdata;
  43. struct timeval;
  44. /*
  45. * IMPORTANT NOTE for WeeChat developers: if you update, add or remove
  46. * some functions in this file, then please update API version below.
  47. */
  48. /*
  49. * API version (used to check that plugin has same API and can be loaded):
  50. * please change the date with current one; for a second change at same
  51. * date, increment the 01, otherwise please keep 01.
  52. */
  53. #define WEECHAT_PLUGIN_API_VERSION "20150114-01"
  54. /* macros for defining plugin infos */
  55. #define WEECHAT_PLUGIN_NAME(__name) \
  56. char weechat_plugin_name[] = __name; \
  57. char weechat_plugin_api_version[] = WEECHAT_PLUGIN_API_VERSION;
  58. #define WEECHAT_PLUGIN_AUTHOR(__author) \
  59. char weechat_plugin_author[] = __author;
  60. #define WEECHAT_PLUGIN_DESCRIPTION(__desc) \
  61. char weechat_plugin_description[] = __desc;
  62. #define WEECHAT_PLUGIN_VERSION(__version) \
  63. char weechat_plugin_version[] = __version;
  64. #define WEECHAT_PLUGIN_LICENSE(__license) \
  65. char weechat_plugin_license[] = __license;
  66. #define WEECHAT_PLUGIN_PRIORITY(__priority) \
  67. int weechat_plugin_priority = __priority;
  68. /* return codes for plugin functions */
  69. #define WEECHAT_RC_OK 0
  70. #define WEECHAT_RC_OK_EAT 1
  71. #define WEECHAT_RC_ERROR -1
  72. /* return codes for config read functions/callbacks */
  73. #define WEECHAT_CONFIG_READ_OK 0
  74. #define WEECHAT_CONFIG_READ_MEMORY_ERROR -1
  75. #define WEECHAT_CONFIG_READ_FILE_NOT_FOUND -2
  76. /* return codes for config write functions/callbacks */
  77. #define WEECHAT_CONFIG_WRITE_OK 0
  78. #define WEECHAT_CONFIG_WRITE_ERROR -1
  79. #define WEECHAT_CONFIG_WRITE_MEMORY_ERROR -2
  80. /* null value for option */
  81. #define WEECHAT_CONFIG_OPTION_NULL "null"
  82. /* return codes for config option set */
  83. #define WEECHAT_CONFIG_OPTION_SET_OK_CHANGED 2
  84. #define WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE 1
  85. #define WEECHAT_CONFIG_OPTION_SET_ERROR 0
  86. #define WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND -1
  87. /* return codes for config option unset */
  88. #define WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET 0
  89. #define WEECHAT_CONFIG_OPTION_UNSET_OK_RESET 1
  90. #define WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED 2
  91. #define WEECHAT_CONFIG_OPTION_UNSET_ERROR -1
  92. /* list management (order of elements) */
  93. #define WEECHAT_LIST_POS_SORT "sort"
  94. #define WEECHAT_LIST_POS_BEGINNING "beginning"
  95. #define WEECHAT_LIST_POS_END "end"
  96. /* type for keys and values in hashtable */
  97. #define WEECHAT_HASHTABLE_INTEGER "integer"
  98. #define WEECHAT_HASHTABLE_STRING "string"
  99. #define WEECHAT_HASHTABLE_POINTER "pointer"
  100. #define WEECHAT_HASHTABLE_BUFFER "buffer"
  101. #define WEECHAT_HASHTABLE_TIME "time"
  102. /* types for hdata */
  103. #define WEECHAT_HDATA_OTHER 0
  104. #define WEECHAT_HDATA_CHAR 1
  105. #define WEECHAT_HDATA_INTEGER 2
  106. #define WEECHAT_HDATA_LONG 3
  107. #define WEECHAT_HDATA_STRING 4
  108. #define WEECHAT_HDATA_POINTER 5
  109. #define WEECHAT_HDATA_TIME 6
  110. #define WEECHAT_HDATA_HASHTABLE 7
  111. #define WEECHAT_HDATA_SHARED_STRING 8
  112. /* flags for hdata lists */
  113. #define WEECHAT_HDATA_LIST_CHECK_POINTERS 1
  114. /* buffer hotlist */
  115. #define WEECHAT_HOTLIST_LOW "0"
  116. #define WEECHAT_HOTLIST_MESSAGE "1"
  117. #define WEECHAT_HOTLIST_PRIVATE "2"
  118. #define WEECHAT_HOTLIST_HIGHLIGHT "3"
  119. /*
  120. * process return code (for callback):
  121. * if >= 0, then process ended and it's return code of command
  122. * if < 0, then it's running or error
  123. */
  124. #define WEECHAT_HOOK_PROCESS_RUNNING -1
  125. #define WEECHAT_HOOK_PROCESS_ERROR -2
  126. /* connect status for connection hooked */
  127. #define WEECHAT_HOOK_CONNECT_OK 0
  128. #define WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND 1
  129. #define WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND 2
  130. #define WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED 3
  131. #define WEECHAT_HOOK_CONNECT_PROXY_ERROR 4
  132. #define WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR 5
  133. #define WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR 6
  134. #define WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR 7
  135. #define WEECHAT_HOOK_CONNECT_MEMORY_ERROR 8
  136. #define WEECHAT_HOOK_CONNECT_TIMEOUT 9
  137. #define WEECHAT_HOOK_CONNECT_SOCKET_ERROR 10
  138. /* action for gnutls callback: verify or set certificate */
  139. #define WEECHAT_HOOK_CONNECT_GNUTLS_CB_VERIFY_CERT 0
  140. #define WEECHAT_HOOK_CONNECT_GNUTLS_CB_SET_CERT 1
  141. /* type of data for signal hooked */
  142. #define WEECHAT_HOOK_SIGNAL_STRING "string"
  143. #define WEECHAT_HOOK_SIGNAL_INT "int"
  144. #define WEECHAT_HOOK_SIGNAL_POINTER "pointer"
  145. /* macro to format string with variable args, using dynamic buffer size */
  146. #define weechat_va_format(__format) \
  147. va_list argptr; \
  148. int vaa_size, vaa_num; \
  149. char *vbuffer, *vaa_buffer2; \
  150. vaa_size = 1024; \
  151. vbuffer = malloc (vaa_size); \
  152. if (vbuffer) \
  153. { \
  154. while (1) \
  155. { \
  156. va_start (argptr, __format); \
  157. vaa_num = vsnprintf (vbuffer, vaa_size, __format, argptr); \
  158. va_end (argptr); \
  159. if ((vaa_num >= 0) && (vaa_num < vaa_size)) \
  160. break; \
  161. vaa_size = (vaa_num >= 0) ? vaa_num + 1 : vaa_size * 2; \
  162. vaa_buffer2 = realloc (vbuffer, vaa_size); \
  163. if (!vaa_buffer2) \
  164. { \
  165. free (vbuffer); \
  166. vbuffer = NULL; \
  167. break; \
  168. } \
  169. vbuffer = vaa_buffer2; \
  170. } \
  171. }
  172. /*
  173. * macro to return error in case of missing arguments in callback of
  174. * hook_command
  175. */
  176. #define WEECHAT_COMMAND_MIN_ARGS(__min_args, __option) \
  177. if (argc < __min_args) \
  178. { \
  179. weechat_printf_date_tags ( \
  180. NULL, 0, "no_filter", \
  181. _("%sToo few arguments for command \"%s%s%s\" " \
  182. "(help on command: /help %s)"), \
  183. weechat_prefix ("error"), \
  184. argv[0], \
  185. (__option && __option[0]) ? " " : "", \
  186. (__option && __option[0]) ? __option : "", \
  187. argv[0] + 1); \
  188. return WEECHAT_RC_ERROR; \
  189. }
  190. /* macro to return error in callback of hook_command */
  191. #define WEECHAT_COMMAND_ERROR \
  192. { \
  193. weechat_printf_date_tags ( \
  194. NULL, 0, "no_filter", \
  195. _("%sError with command \"%s\" " \
  196. "(help on command: /help %s)"), \
  197. weechat_prefix ("error"), \
  198. argv_eol[0], \
  199. argv[0] + 1); \
  200. return WEECHAT_RC_ERROR; \
  201. }
  202. struct t_weechat_plugin
  203. {
  204. /* plugin variables */
  205. char *filename; /* name of plugin on disk */
  206. void *handle; /* handle of plugin (given by dlopen)*/
  207. char *name; /* short name */
  208. char *description; /* description */
  209. char *author; /* author */
  210. char *version; /* plugin version */
  211. char *license; /* license */
  212. char *charset; /* charset used by plugin */
  213. int priority; /* plugin priority (default is 1000) */
  214. int initialized; /* plugin initialized? (init called) */
  215. int debug; /* debug level for plugin (0=off) */
  216. struct t_weechat_plugin *prev_plugin; /* link to previous plugin */
  217. struct t_weechat_plugin *next_plugin; /* link to next plugin */
  218. /*
  219. * plugin functions (API)
  220. * WeeChat developers: if you add functions in API, update value of
  221. * constant WEECHAT_PLUGIN_API_VERSION
  222. */
  223. /* plugins */
  224. const char *(*plugin_get_name) (struct t_weechat_plugin *plugin);
  225. /* strings */
  226. void (*charset_set) (struct t_weechat_plugin *plugin, const char *charset);
  227. char *(*iconv_to_internal) (const char *charset, const char *string);
  228. char *(*iconv_from_internal) (const char *charset, const char *string);
  229. const char *(*gettext) (const char *string);
  230. const char *(*ngettext) (const char *single, const char *plural, int count);
  231. char *(*strndup) (const char *string, int length);
  232. void (*string_tolower) (char *string);
  233. void (*string_toupper) (char *string);
  234. int (*strcasecmp) (const char *string1, const char *string2);
  235. int (*strcasecmp_range) (const char *string1, const char *string2,
  236. int range);
  237. int (*strncasecmp) (const char *string1, const char *string2, int max);
  238. int (*strncasecmp_range) (const char *string1, const char *string2,
  239. int max, int range);
  240. int (*strcmp_ignore_chars) (const char *string1, const char *string2,
  241. const char *chars_ignored, int case_sensitive);
  242. char *(*strcasestr) (const char *string, const char *search);
  243. int (*strlen_screen) (const char *string);
  244. int (*string_match) (const char *string, const char *mask,
  245. int case_sensitive);
  246. char *(*string_replace) (const char *string, const char *search,
  247. const char *replace);
  248. char *(*string_expand_home) (const char *path);
  249. char *(*string_remove_quotes) (const char *string, const char *quotes);
  250. char *(*string_strip) (const char *string, int left, int right,
  251. const char *chars);
  252. char *(*string_convert_escaped_chars) (const char *string);
  253. char *(*string_mask_to_regex) (const char *mask);
  254. const char *(*string_regex_flags) (const char *regex, int default_flags,
  255. int *flags);
  256. int (*string_regcomp) (void *preg, const char *regex, int default_flags);
  257. int (*string_has_highlight) (const char *string,
  258. const char *highlight_words);
  259. int (*string_has_highlight_regex) (const char *string, const char *regex);
  260. char *(*string_replace_regex) (const char *string, void *regex,
  261. const char *replace,
  262. const char reference_char,
  263. char *(*callback)(void *data, const char *text),
  264. void *callback_data);
  265. char **(*string_split) (const char *string, const char *separators,
  266. int keep_eol, int num_items_max, int *num_items);
  267. char **(*string_split_shell) (const char *string, int *num_items);
  268. void (*string_free_split) (char **split_string);
  269. char *(*string_build_with_split_string) (const char **split_string,
  270. const char *separator);
  271. char **(*string_split_command) (const char *command, char separator);
  272. void (*string_free_split_command) (char **split_command);
  273. char *(*string_format_size) (unsigned long long size);
  274. char *(*string_remove_color) (const char *string, const char *replacement);
  275. void (*string_encode_base64) (const char *from, int length, char *to);
  276. int (*string_decode_base64) (const char *from, char *to);
  277. int (*string_is_command_char) (const char *string);
  278. const char *(*string_input_for_buffer) (const char *string);
  279. char *(*string_eval_expression )(const char *expr,
  280. struct t_hashtable *pointers,
  281. struct t_hashtable *extra_vars,
  282. struct t_hashtable *options);
  283. /* UTF-8 strings */
  284. int (*utf8_has_8bits) (const char *string);
  285. int (*utf8_is_valid) (const char *string, char **error);
  286. void (*utf8_normalize) (char *string, char replacement);
  287. char *(*utf8_prev_char) (const char *string_start, const char *string);
  288. char *(*utf8_next_char) (const char *string);
  289. int (*utf8_char_int) (const char *string);
  290. int (*utf8_char_size) (const char *string);
  291. int (*utf8_strlen) (const char *string);
  292. int (*utf8_strnlen) (const char *string, int bytes);
  293. int (*utf8_strlen_screen) (const char *string);
  294. int (*utf8_charcmp) (const char *string1, const char *string2);
  295. int (*utf8_charcasecmp) (const char *string1, const char *string2);
  296. int (*utf8_char_size_screen) (const char *string);
  297. char *(*utf8_add_offset) (const char *string, int offset);
  298. int (*utf8_real_pos) (const char *string, int pos);
  299. int (*utf8_pos) (const char *string, int real_pos);
  300. char *(*utf8_strndup) (const char *string, int length);
  301. /* directories/files */
  302. int (*mkdir_home) (const char *directory, int mode);
  303. int (*mkdir) (const char *directory, int mode);
  304. int (*mkdir_parents) (const char *directory, int mode);
  305. void (*exec_on_files) (const char *directory, int hidden_files, void *data,
  306. void (*callback)(void *data, const char *filename));
  307. char *(*file_get_content) (const char *filename);
  308. /* util */
  309. int (*util_timeval_cmp) (struct timeval *tv1, struct timeval *tv2);
  310. long long (*util_timeval_diff) (struct timeval *tv1, struct timeval *tv2);
  311. void (*util_timeval_add) (struct timeval *tv, long long interval);
  312. char *(*util_get_time_string) (const time_t *date);
  313. int (*util_version_number) (const char *version);
  314. /* sorted lists */
  315. struct t_weelist *(*list_new) ();
  316. struct t_weelist_item *(*list_add) (struct t_weelist *weelist,
  317. const char *data,
  318. const char *where,
  319. void *user_data);
  320. struct t_weelist_item *(*list_search) (struct t_weelist *weelist,
  321. const char *data);
  322. int (*list_search_pos) (struct t_weelist *weelist,
  323. const char *data);
  324. struct t_weelist_item *(*list_casesearch) (struct t_weelist *weelist,
  325. const char *data);
  326. int (*list_casesearch_pos) (struct t_weelist *weelist,
  327. const char *data);
  328. struct t_weelist_item *(*list_get) (struct t_weelist *weelist,
  329. int position);
  330. void (*list_set) (struct t_weelist_item *item, const char *value);
  331. struct t_weelist_item *(*list_next) (struct t_weelist_item *item);
  332. struct t_weelist_item *(*list_prev) (struct t_weelist_item *item);
  333. const char *(*list_string) (struct t_weelist_item *item);
  334. int (*list_size) (struct t_weelist *weelist);
  335. void (*list_remove) (struct t_weelist *weelist,
  336. struct t_weelist_item *item);
  337. void (*list_remove_all) (struct t_weelist *weelist);
  338. void (*list_free) (struct t_weelist *weelist);
  339. /* hash tables */
  340. struct t_hashtable *(*hashtable_new) (int size,
  341. const char *type_keys,
  342. const char *type_values,
  343. unsigned long long (*callback_hash_key)(struct t_hashtable *hashtable,
  344. const void *key),
  345. int (*callback_keycmp)(struct t_hashtable *hashtable,
  346. const void *key1,
  347. const void *key2));
  348. struct t_hashtable_item *(*hashtable_set_with_size) (struct t_hashtable *hashtable,
  349. const void *key,
  350. int key_size,
  351. const void *value,
  352. int value_size);
  353. struct t_hashtable_item *(*hashtable_set) (struct t_hashtable *hashtable,
  354. const void *key,
  355. const void *value);
  356. void *(*hashtable_get) (struct t_hashtable *hashtable, const void *key);
  357. int (*hashtable_has_key) (struct t_hashtable *hashtable, const void *key);
  358. void (*hashtable_map) (struct t_hashtable *hashtable,
  359. void (*callback_map) (void *data,
  360. struct t_hashtable *hashtable,
  361. const void *key,
  362. const void *value),
  363. void *callback_map_data);
  364. void (*hashtable_map_string) (struct t_hashtable *hashtable,
  365. void (*callback_map) (void *data,
  366. struct t_hashtable *hashtable,
  367. const char *key,
  368. const char *value),
  369. void *callback_map_data);
  370. struct t_hashtable *(*hashtable_dup) (struct t_hashtable *hashtable);
  371. int (*hashtable_get_integer) (struct t_hashtable *hashtable,
  372. const char *property);
  373. const char *(*hashtable_get_string) (struct t_hashtable *hashtable,
  374. const char *property);
  375. void (*hashtable_set_pointer) (struct t_hashtable *hashtable,
  376. const char *property,
  377. void *pointer);
  378. int (*hashtable_add_to_infolist) (struct t_hashtable *hashtable,
  379. struct t_infolist_item *infolist_item,
  380. const char *prefix);
  381. void (*hashtable_remove) (struct t_hashtable *hashtable, const void *key);
  382. void (*hashtable_remove_all) (struct t_hashtable *hashtable);
  383. void (*hashtable_free) (struct t_hashtable *hashtable);
  384. /* config files */
  385. struct t_config_file *(*config_new) (struct t_weechat_plugin *plugin,
  386. const char *name,
  387. int (*callback_reload)(void *data,
  388. struct t_config_file *config_file),
  389. void *callback_reload_data);
  390. struct t_config_section *(*config_new_section) (struct t_config_file *config_file,
  391. const char *name,
  392. int user_can_add_options,
  393. int user_can_delete_options,
  394. int (*callback_read)(void *data,
  395. struct t_config_file *config_file,
  396. struct t_config_section *section,
  397. const char *option_name,
  398. const char *value),
  399. void *callback_read_data,
  400. int (*callback_write)(void *data,
  401. struct t_config_file *config_file,
  402. const char *section_name),
  403. void *callback_write_data,
  404. int (*callback_write_default)(void *data,
  405. struct t_config_file *config_file,
  406. const char *section_name),
  407. void *callback_write_default_data,
  408. int (*callback_create_option)(void *data,
  409. struct t_config_file *config_file,
  410. struct t_config_section *section,
  411. const char *option_name,
  412. const char *value),
  413. void *callback_create_option_data,
  414. int (*callback_delete_option)(void *data,
  415. struct t_config_file *config_file,
  416. struct t_config_section *section,
  417. struct t_config_option *option),
  418. void *callback_delete_option_data);
  419. struct t_config_section *(*config_search_section) (struct t_config_file *config_file,
  420. const char *section_name);
  421. struct t_config_option *(*config_new_option) (struct t_config_file *config_file,
  422. struct t_config_section *section,
  423. const char *name,
  424. const char *type,
  425. const char *description,
  426. const char *string_values,
  427. int min,
  428. int max,
  429. const char *default_value,
  430. const char *value,
  431. int null_value_allowed,
  432. int (*callback_check_value)(void *data,
  433. struct t_config_option *option,
  434. const char *value),
  435. void *callback_check_value_data,
  436. void (*callback_change)(void *data,
  437. struct t_config_option *option),
  438. void *callback_change_data,
  439. void (*callback_delete)(void *data,
  440. struct t_config_option *option),
  441. void *callback_delete_data);
  442. struct t_config_option *(*config_search_option) (struct t_config_file *config_file,
  443. struct t_config_section *section,
  444. const char *option_name);
  445. void (*config_search_section_option) (struct t_config_file *config_file,
  446. struct t_config_section *section,
  447. const char *option_name,
  448. struct t_config_section **section_found,
  449. struct t_config_option **option_found);
  450. void (*config_search_with_string) (const char *option_name,
  451. struct t_config_file **config_file,
  452. struct t_config_section **section,
  453. struct t_config_option **option,
  454. char **pos_option_name);
  455. int (*config_string_to_boolean) (const char *text);
  456. int (*config_option_reset) (struct t_config_option *option,
  457. int run_callback);
  458. int (*config_option_set) (struct t_config_option *option,
  459. const char *value, int run_callback);
  460. int (*config_option_set_null) (struct t_config_option *option,
  461. int run_callback);
  462. int (*config_option_unset) (struct t_config_option *option);
  463. void (*config_option_rename) (struct t_config_option *option,
  464. const char *new_name);
  465. void *(*config_option_get_pointer) (struct t_config_option *option,
  466. const char *property);
  467. int (*config_option_is_null) (struct t_config_option *option);
  468. int (*config_option_default_is_null) (struct t_config_option *option);
  469. int (*config_boolean) (struct t_config_option *option);
  470. int (*config_boolean_default) (struct t_config_option *option);
  471. int (*config_integer) (struct t_config_option *option);
  472. int (*config_integer_default) (struct t_config_option *option);
  473. const char *(*config_string) (struct t_config_option *option);
  474. const char *(*config_string_default) (struct t_config_option *option);
  475. const char *(*config_color) (struct t_config_option *option);
  476. const char *(*config_color_default) (struct t_config_option *option);
  477. int (*config_write_option) (struct t_config_file *config_file,
  478. struct t_config_option *option);
  479. int (*config_write_line) (struct t_config_file *config_file,
  480. const char *option_name,
  481. const char *value, ...);
  482. int (*config_write) (struct t_config_file *config_file);
  483. int (*config_read) (struct t_config_file *config_file);
  484. int (*config_reload) (struct t_config_file *config_file);
  485. void (*config_option_free) (struct t_config_option *option);
  486. void (*config_section_free_options) (struct t_config_section *section);
  487. void (*config_section_free) (struct t_config_section *section);
  488. void (*config_free) (struct t_config_file *config_file);
  489. struct t_config_option *(*config_get) (const char *option_name);
  490. const char *(*config_get_plugin) (struct t_weechat_plugin *plugin,
  491. const char *option_name);
  492. int (*config_is_set_plugin) (struct t_weechat_plugin *plugin,
  493. const char *option_name);
  494. int (*config_set_plugin) (struct t_weechat_plugin *plugin,
  495. const char *option_name, const char *value);
  496. void (*config_set_desc_plugin) (struct t_weechat_plugin *plugin,
  497. const char *option_name,
  498. const char *description);
  499. int (*config_unset_plugin) (struct t_weechat_plugin *plugin,
  500. const char *option_name);
  501. /* key bindings */
  502. int (*key_bind) (const char *context, struct t_hashtable *keys);
  503. int (*key_unbind) (const char *context, const char *key);
  504. /* display */
  505. const char *(*prefix) (const char *prefix);
  506. const char *(*color) (const char *color_name);
  507. void (*printf_date_tags) (struct t_gui_buffer *buffer, time_t date,
  508. const char *tags, const char *message, ...);
  509. void (*printf_y) (struct t_gui_buffer *buffer, int y,
  510. const char *message, ...);
  511. void (*log_printf) (const char *message, ...);
  512. /* hooks */
  513. struct t_hook *(*hook_command) (struct t_weechat_plugin *plugin,
  514. const char *command,
  515. const char *description,
  516. const char *args,
  517. const char *args_description,
  518. const char *completion,
  519. int (*callback)(void *data,
  520. struct t_gui_buffer *buffer,
  521. int argc, char **argv,
  522. char **argv_eol),
  523. void *callback_data);
  524. struct t_hook *(*hook_command_run) (struct t_weechat_plugin *plugin,
  525. const char *command,
  526. int (*callback)(void *data,
  527. struct t_gui_buffer *buffer,
  528. const char *command),
  529. void *callback_data);
  530. struct t_hook *(*hook_timer) (struct t_weechat_plugin *plugin,
  531. long interval,
  532. int align_second,
  533. int max_calls,
  534. int (*callback)(void *data,
  535. int remaining_calls),
  536. void *callback_data);
  537. struct t_hook *(*hook_fd) (struct t_weechat_plugin *plugin,
  538. int fd,
  539. int flag_read,
  540. int flag_write,
  541. int flag_exception,
  542. int (*callback)(void *data, int fd),
  543. void *callback_data);
  544. struct t_hook *(*hook_process) (struct t_weechat_plugin *plugin,
  545. const char *command,
  546. int timeout,
  547. int (*callback)(void *data,
  548. const char *command,
  549. int return_code,
  550. const char *out,
  551. const char *err),
  552. void *callback_data);
  553. struct t_hook *(*hook_process_hashtable) (struct t_weechat_plugin *plugin,
  554. const char *command,
  555. struct t_hashtable *options,
  556. int timeout,
  557. int (*callback)(void *data,
  558. const char *command,
  559. int return_code,
  560. const char *out,
  561. const char *err),
  562. void *callback_data);
  563. struct t_hook *(*hook_connect) (struct t_weechat_plugin *plugin,
  564. const char *proxy,
  565. const char *address,
  566. int port,
  567. int ipv6,
  568. int retry,
  569. void *gnutls_sess, void *gnutls_cb,
  570. int gnutls_dhkey_size,
  571. const char *gnutls_priorities,
  572. const char *local_hostname,
  573. int (*callback)(void *data,
  574. int status,
  575. int gnutls_rc,
  576. int sock,
  577. const char *error,
  578. const char *ip_address),
  579. void *callback_data);
  580. struct t_hook *(*hook_print) (struct t_weechat_plugin *plugin,
  581. struct t_gui_buffer *buffer,
  582. const char *tags,
  583. const char *message,
  584. int strip_colors,
  585. int (*callback)(void *data,
  586. struct t_gui_buffer *buffer,
  587. time_t date,
  588. int tags_count,
  589. const char **tags,
  590. int displayed,
  591. int highlight,
  592. const char *prefix,
  593. const char *message),
  594. void *callback_data);
  595. struct t_hook *(*hook_signal) (struct t_weechat_plugin *plugin,
  596. const char *signal,
  597. int (*callback)(void *data,
  598. const char *signal,
  599. const char *type_data,
  600. void *signal_data),
  601. void *callback_data);
  602. int (*hook_signal_send) (const char *signal, const char *type_data,
  603. void *signal_data);
  604. struct t_hook *(*hook_hsignal) (struct t_weechat_plugin *plugin,
  605. const char *signal,
  606. int (*callback)(void *data,
  607. const char *signal,
  608. struct t_hashtable *hashtable),
  609. void *callback_data);
  610. int (*hook_hsignal_send) (const char *signal,
  611. struct t_hashtable *hashtable);
  612. struct t_hook *(*hook_config) (struct t_weechat_plugin *plugin,
  613. const char *option,
  614. int (*callback)(void *data,
  615. const char *option,
  616. const char *value),
  617. void *callback_data);
  618. struct t_hook *(*hook_completion) (struct t_weechat_plugin *plugin,
  619. const char *completion_item,
  620. const char *description,
  621. int (*callback)(void *data,
  622. const char *completion_item,
  623. struct t_gui_buffer *buffer,
  624. struct t_gui_completion *completion),
  625. void *callback_data);
  626. const char *(*hook_completion_get_string) (struct t_gui_completion *completion,
  627. const char *property);
  628. void (*hook_completion_list_add) (struct t_gui_completion *completion,
  629. const char *word,
  630. int nick_completion,
  631. const char *where);
  632. struct t_hook *(*hook_modifier) (struct t_weechat_plugin *plugin,
  633. const char *modifier,
  634. char *(*callback)(void *data,
  635. const char *modifier,
  636. const char *modifier_data,
  637. const char *string),
  638. void *callback_data);
  639. char *(*hook_modifier_exec) (struct t_weechat_plugin *plugin,
  640. const char *modifier,
  641. const char *modifier_data,
  642. const char *string);
  643. struct t_hook *(*hook_info) (struct t_weechat_plugin *plugin,
  644. const char *info_name,
  645. const char *description,
  646. const char *args_description,
  647. const char *(*callback)(void *data,
  648. const char *info_name,
  649. const char *arguments),
  650. void *callback_data);
  651. struct t_hook *(*hook_info_hashtable) (struct t_weechat_plugin *plugin,
  652. const char *info_name,
  653. const char *description,
  654. const char *args_description,
  655. const char *output_description,
  656. struct t_hashtable *(*callback)(void *data,
  657. const char *info_name,
  658. struct t_hashtable *hashtable),
  659. void *callback_data);
  660. struct t_hook *(*hook_infolist) (struct t_weechat_plugin *plugin,
  661. const char *infolist_name,
  662. const char *description,
  663. const char *pointer_description,
  664. const char *args_description,
  665. struct t_infolist *(*callback)(void *data,
  666. const char *infolist_name,
  667. void *pointer,
  668. const char *arguments),
  669. void *callback_data);
  670. struct t_hook *(*hook_hdata) (struct t_weechat_plugin *plugin,
  671. const char *hdata_name,
  672. const char *description,
  673. struct t_hdata *(*callback)(void *data,
  674. const char *hdata_name),
  675. void *callback_data);
  676. struct t_hook *(*hook_focus) (struct t_weechat_plugin *plugin,
  677. const char *area,
  678. struct t_hashtable *(*callback)(void *data,
  679. struct t_hashtable *info),
  680. void *callback_data);
  681. void (*hook_set) (struct t_hook *hook, const char *property,
  682. const char *value);
  683. void (*unhook) (struct t_hook *hook);
  684. void (*unhook_all) (struct t_weechat_plugin *plugin);
  685. /* buffers */
  686. struct t_gui_buffer *(*buffer_new) (struct t_weechat_plugin *plugin,
  687. const char *name,
  688. int (*input_callback)(void *data,
  689. struct t_gui_buffer *buffer,
  690. const char *input_data),
  691. void *input_callback_data,
  692. int (*close_callback)(void *data,
  693. struct t_gui_buffer *buffer),
  694. void *close_callback_data);
  695. struct t_gui_buffer *(*buffer_search) (const char *plugin, const char *name);
  696. struct t_gui_buffer *(*buffer_search_main) ();
  697. void (*buffer_clear) (struct t_gui_buffer *buffer);
  698. void (*buffer_close) (struct t_gui_buffer *buffer);
  699. void (*buffer_merge) (struct t_gui_buffer *buffer,
  700. struct t_gui_buffer *target_buffer);
  701. void (*buffer_unmerge) (struct t_gui_buffer *buffer, int number);
  702. int (*buffer_get_integer) (struct t_gui_buffer *buffer,
  703. const char *property);
  704. const char *(*buffer_get_string) (struct t_gui_buffer *buffer,
  705. const char *property);
  706. void *(*buffer_get_pointer) (struct t_gui_buffer *buffer,
  707. const char *property);
  708. void (*buffer_set) (struct t_gui_buffer *buffer, const char *property,
  709. const char *value);
  710. void (*buffer_set_pointer) (struct t_gui_buffer *buffer,
  711. const char *property, void *pointer);
  712. char *(*buffer_string_replace_local_var) (struct t_gui_buffer *buffer,
  713. const char *string);
  714. int (*buffer_match_list) (struct t_gui_buffer *buffer, const char *string);
  715. /* windows */
  716. struct t_gui_window *(*window_search_with_buffer) (struct t_gui_buffer *buffer);
  717. int (*window_get_integer) (struct t_gui_window *window,
  718. const char *property);
  719. const char *(*window_get_string) (struct t_gui_window *window,
  720. const char *property);
  721. void *(*window_get_pointer) (struct t_gui_window *window,
  722. const char *property);
  723. void (*window_set_title) (const char *title);
  724. /* nicklist */
  725. struct t_gui_nick_group *(*nicklist_add_group) (struct t_gui_buffer *buffer,
  726. struct t_gui_nick_group *parent_group,
  727. const char *name,
  728. const char *color,
  729. int visible);
  730. struct t_gui_nick_group *(*nicklist_search_group) (struct t_gui_buffer *buffer,
  731. struct t_gui_nick_group *from_group,
  732. const char *name);
  733. struct t_gui_nick *(*nicklist_add_nick) (struct t_gui_buffer *buffer,
  734. struct t_gui_nick_group *group,
  735. const char *name,
  736. const char *color,
  737. const char *prefix,
  738. const char *prefix_color,
  739. int visible);
  740. struct t_gui_nick *(*nicklist_search_nick) (struct t_gui_buffer *buffer,
  741. struct t_gui_nick_group *from_group,
  742. const char *name);
  743. void (*nicklist_remove_group) (struct t_gui_buffer *buffer,
  744. struct t_gui_nick_group *group);
  745. void (*nicklist_remove_nick) (struct t_gui_buffer *buffer,
  746. struct t_gui_nick *nick);
  747. void (*nicklist_remove_all) (struct t_gui_buffer *buffer);
  748. void (*nicklist_get_next_item) (struct t_gui_buffer *buffer,
  749. struct t_gui_nick_group **group,
  750. struct t_gui_nick **nick);
  751. int (*nicklist_group_get_integer) (struct t_gui_buffer *buffer,
  752. struct t_gui_nick_group *group,
  753. const char *property);
  754. const char *(*nicklist_group_get_string) (struct t_gui_buffer *buffer,
  755. struct t_gui_nick_group *group,
  756. const char *property);
  757. void *(*nicklist_group_get_pointer) (struct t_gui_buffer *buffer,
  758. struct t_gui_nick_group *group,
  759. const char *property);
  760. void (*nicklist_group_set) (struct t_gui_buffer *buffer,
  761. struct t_gui_nick_group *group,
  762. const char *property, const char *value);
  763. int (*nicklist_nick_get_integer) (struct t_gui_buffer *buffer,
  764. struct t_gui_nick *nick,
  765. const char *property);
  766. const char *(*nicklist_nick_get_string) (struct t_gui_buffer *buffer,
  767. struct t_gui_nick *nick,
  768. const char *property);
  769. void *(*nicklist_nick_get_pointer) (struct t_gui_buffer *buffer,
  770. struct t_gui_nick *nick,
  771. const char *property);
  772. void (*nicklist_nick_set) (struct t_gui_buffer *buffer,
  773. struct t_gui_nick *nick,
  774. const char *property, const char *value);
  775. /* bars */
  776. struct t_gui_bar_item *(*bar_item_search) (const char *name);
  777. struct t_gui_bar_item *(*bar_item_new) (struct t_weechat_plugin *plugin,
  778. const char *name,
  779. char *(*build_callback)(void *data,
  780. struct t_gui_bar_item *item,
  781. struct t_gui_window *window,
  782. struct t_gui_buffer *buffer,
  783. struct t_hashtable *extra_info),
  784. void *build_callback_data);
  785. void (*bar_item_update) (const char *name);
  786. void (*bar_item_remove) (struct t_gui_bar_item *item);
  787. struct t_gui_bar *(*bar_search) (const char *name);
  788. struct t_gui_bar *(*bar_new) (const char *name,
  789. const char *hidden,
  790. const char *priority,
  791. const char *type,
  792. const char *condition,
  793. const char *position,
  794. const char *filling_top_bottom,
  795. const char *filling_left_right,
  796. const char *size,
  797. const char *size_max,
  798. const char *color_fg,
  799. const char *color_delim,
  800. const char *color_bg,
  801. const char *separator,
  802. const char *items);
  803. int (*bar_set) (struct t_gui_bar *bar, const char *property,
  804. const char *value);
  805. void (*bar_update) (const char *name);
  806. void (*bar_remove) (struct t_gui_bar *bar);
  807. /* command */
  808. int (*command) (struct t_weechat_plugin *plugin,
  809. struct t_gui_buffer *buffer, const char *command);
  810. /* network */
  811. int (*network_pass_proxy) (const char *proxy, int sock,
  812. const char *address, int port);
  813. int (*network_connect_to) (const char *proxy,
  814. struct sockaddr *address,
  815. socklen_t address_length);
  816. /* infos */
  817. const char *(*info_get) (struct t_weechat_plugin *plugin,
  818. const char *info_name,
  819. const char *arguments);
  820. struct t_hashtable *(*info_get_hashtable) (struct t_weechat_plugin *plugin,
  821. const char *info_name,
  822. struct t_hashtable *hashtable);
  823. /* infolists */
  824. struct t_infolist *(*infolist_new) (struct t_weechat_plugin *plugin);
  825. struct t_infolist_item *(*infolist_new_item) (struct t_infolist *infolist);
  826. struct t_infolist_var *(*infolist_new_var_integer) (struct t_infolist_item *item,
  827. const char *name,
  828. int value);
  829. struct t_infolist_var *(*infolist_new_var_string) (struct t_infolist_item *item,
  830. const char *name,
  831. const char *value);
  832. struct t_infolist_var *(*infolist_new_var_pointer) (struct t_infolist_item *item,
  833. const char *name,
  834. void *pointer);
  835. struct t_infolist_var *(*infolist_new_var_buffer) (struct t_infolist_item *item,
  836. const char *name,
  837. void *pointer,
  838. int size);
  839. struct t_infolist_var *(*infolist_new_var_time) (struct t_infolist_item *item,
  840. const char *name,
  841. time_t time);
  842. struct t_infolist_var *(*infolist_search_var) (struct t_infolist *infolist,
  843. const char *name);
  844. struct t_infolist *(*infolist_get) (struct t_weechat_plugin *plugin,
  845. const char *infolist_name,
  846. void *pointer,
  847. const char *arguments);
  848. int (*infolist_next) (struct t_infolist *infolist);
  849. int (*infolist_prev) (struct t_infolist *infolist);
  850. void (*infolist_reset_item_cursor) (struct t_infolist *infolist);
  851. const char *(*infolist_fields) (struct t_infolist *infolist);
  852. int (*infolist_integer) (struct t_infolist *infolist, const char *var);
  853. const char *(*infolist_string) (struct t_infolist *infolist, const char *var);
  854. void *(*infolist_pointer) (struct t_infolist *infolist, const char *var);
  855. void *(*infolist_buffer) (struct t_infolist *infolist, const char *var,
  856. int *size);
  857. time_t (*infolist_time) (struct t_infolist *infolist, const char *var);
  858. void (*infolist_free) (struct t_infolist *infolist);
  859. /* hdata */
  860. struct t_hdata *(*hdata_new) (struct t_weechat_plugin *plugin,
  861. const char *hdata_name, const char *var_prev,
  862. const char *var_next,
  863. int create_allowed, int delete_allowed,
  864. int (*callback_update)(void *data,
  865. struct t_hdata *hdata,
  866. void *pointer,
  867. struct t_hashtable *hashtable),
  868. void *callback_update_data);
  869. void (*hdata_new_var) (struct t_hdata *hdata, const char *name, int offset,
  870. int type, int update_allowed, const char *array_size,
  871. const char *hdata_name);
  872. void (*hdata_new_list) (struct t_hdata *hdata, const char *name,
  873. void *pointer, int flags);
  874. struct t_hdata *(*hdata_get) (struct t_weechat_plugin *plugin,
  875. const char *hdata_name);
  876. int (*hdata_get_var_offset) (struct t_hdata *hdata, const char *name);
  877. int (*hdata_get_var_type) (struct t_hdata *hdata, const char *name);
  878. const char *(*hdata_get_var_type_string) (struct t_hdata *hdata,
  879. const char *name);
  880. int (*hdata_get_var_array_size) (struct t_hdata *hdata, void *pointer,
  881. const char *name);
  882. const char *(*hdata_get_var_array_size_string) (struct t_hdata *hdata,
  883. void *pointer,
  884. const char *name);
  885. const char *(*hdata_get_var_hdata) (struct t_hdata *hdata,
  886. const char *name);
  887. void *(*hdata_get_var) (struct t_hdata *hdata, void *pointer,
  888. const char *name);
  889. void *(*hdata_get_var_at_offset) (struct t_hdata *hdata, void *pointer,
  890. int offset);
  891. void *(*hdata_get_list) (struct t_hdata *hdata, const char *name);
  892. int (*hdata_check_pointer) (struct t_hdata *hdata, void *list,
  893. void *pointer);
  894. void *(*hdata_move) (struct t_hdata *hdata, void *pointer, int count);
  895. void *(*hdata_search) (struct t_hdata *hdata, void *pointer,
  896. const char *search, int move);
  897. char (*hdata_char) (struct t_hdata *hdata, void *pointer,
  898. const char *name);
  899. int (*hdata_integer) (struct t_hdata *hdata, void *pointer,
  900. const char *name);
  901. long (*hdata_long) (struct t_hdata *hdata, void *pointer,
  902. const char *name);
  903. const char *(*hdata_string) (struct t_hdata *hdata, void *pointer,
  904. const char *name);
  905. void *(*hdata_pointer) (struct t_hdata *hdata, void *pointer,
  906. const char *name);
  907. time_t (*hdata_time) (struct t_hdata *hdata, void *pointer,
  908. const char *name);
  909. struct t_hashtable *(*hdata_hashtable) (struct t_hdata *hdata,
  910. void *pointer, const char *name);
  911. int (*hdata_set) (struct t_hdata *hdata, void *pointer, const char *name,
  912. const char *value);
  913. int (*hdata_update) (struct t_hdata *hdata, void *pointer,
  914. struct t_hashtable *hashtable);
  915. const char *(*hdata_get_string) (struct t_hdata *hdata,
  916. const char *property);
  917. /* upgrade */
  918. struct t_upgrade_file *(*upgrade_new) (const char *filename,
  919. int write);
  920. int (*upgrade_write_object) (struct t_upgrade_file *upgrade_file,
  921. int object_id,
  922. struct t_infolist *infolist);
  923. int (*upgrade_read) (struct t_upgrade_file *upgrade_file,
  924. int (*callback_read)(void *data,
  925. struct t_upgrade_file *upgrade_file,
  926. int object_id,
  927. struct t_infolist *infolist),
  928. void *callback_read_data);
  929. void (*upgrade_close) (struct t_upgrade_file *upgrade_file);
  930. };
  931. extern int weechat_plugin_init (struct t_weechat_plugin *plugin,
  932. int argc, char *argv[]);
  933. extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
  934. /* macros for easy call to plugin API */
  935. /* plugins */
  936. #define weechat_plugin_get_name(__plugin) \
  937. (weechat_plugin->plugin_get_name)(__plugin)
  938. /* strings */
  939. #define weechat_charset_set(__charset) \
  940. (weechat_plugin->charset_set)(weechat_plugin, __charset)
  941. #define weechat_iconv_to_internal(__charset, __string) \
  942. (weechat_plugin->iconv_to_internal)(__charset, __string)
  943. #define weechat_iconv_from_internal(__charset, __string) \
  944. (weechat_plugin->iconv_from_internal)(__charset, __string)
  945. #ifndef WEECHAT_H
  946. #ifndef _
  947. #define _(string) (weechat_plugin->gettext)(string)
  948. #endif /* _ */
  949. #ifndef N_
  950. #define N_(string) (string)
  951. #endif /* N_ */
  952. #ifndef NG_
  953. #define NG_(single,plural,number) \
  954. (weechat_plugin->ngettext)(single, plural, number)
  955. #endif /* NG_ */
  956. #endif /* WEECHAT_H */
  957. #define weechat_gettext(string) (weechat_plugin->gettext)(string)
  958. #define weechat_ngettext(single,plural,number) \
  959. (weechat_plugin->ngettext)(single, plural, number)
  960. #define weechat_strndup(__string, __length) \
  961. (weechat_plugin->strndup)(__string, __length)
  962. #define weechat_string_tolower(__string) \
  963. (weechat_plugin->string_tolower)(__string)
  964. #define weechat_string_toupper(__string) \
  965. (weechat_plugin->string_toupper)(__string)
  966. #define weechat_strcasecmp(__string1, __string2) \
  967. (weechat_plugin->strcasecmp)(__string1, __string2)
  968. #define weechat_strcasecmp_range(__string1, __string2, __range) \
  969. (weechat_plugin->strcasecmp_range)(__string1, __string2, __range)
  970. #define weechat_strncasecmp(__string1, __string2, __max) \
  971. (weechat_plugin->strncasecmp)(__string1, __string2, __max)
  972. #define weechat_strncasecmp_range(__string1, __string2, __max, __range) \
  973. (weechat_plugin->strncasecmp_range)(__string1, __string2, __max, \
  974. __range)
  975. #define weechat_strcmp_ignore_chars(__string1, __string2, \
  976. __chars_ignored, __case_sensitive) \
  977. (weechat_plugin->strcmp_ignore_chars)(__string1, __string2, \
  978. __chars_ignored, \
  979. __case_sensitive)
  980. #define weechat_strcasestr(__string, __search) \
  981. (weechat_plugin->strcasestr)(__string, __search)
  982. #define weechat_strlen_screen(__string) \
  983. (weechat_plugin->strlen_screen)(__string)
  984. #define weechat_string_match(__string, __mask, __case_sensitive) \
  985. (weechat_plugin->string_match)(__string, __mask, __case_sensitive)
  986. #define weechat_string_replace(__string, __search, __replace) \
  987. (weechat_plugin->string_replace)(__string, __search, __replace)
  988. #define weechat_string_expand_home(__path) \
  989. (weechat_plugin->string_expand_home)(__path)
  990. #define weechat_string_remove_quotes(__string, __quotes) \
  991. (weechat_plugin->string_remove_quotes)(__string, __quotes)
  992. #define weechat_string_strip(__string, __left, __right, __chars) \
  993. (weechat_plugin->string_strip)(__string, __left, __right, __chars)
  994. #define weechat_string_convert_escaped_chars(__string) \
  995. (weechat_plugin->string_convert_escaped_chars)(__string)
  996. #define weechat_string_mask_to_regex(__mask) \
  997. (weechat_plugin->string_mask_to_regex)(__mask)
  998. #define weechat_string_regex_flags(__regex, __default_flags, __flags) \
  999. (weechat_plugin->string_regex_flags)(__regex, __default_flags, \
  1000. __flags)
  1001. #define weechat_string_regcomp(__preg, __regex, __default_flags) \
  1002. (weechat_plugin->string_regcomp)(__preg, __regex, __default_flags)
  1003. #define weechat_string_has_highlight(__string, __highlight_words) \
  1004. (weechat_plugin->string_has_highlight)(__string, __highlight_words)
  1005. #define weechat_string_has_highlight_regex(__string, __regex) \
  1006. (weechat_plugin->string_has_highlight_regex)(__string, __regex)
  1007. #define weechat_string_replace_regex(__string, __regex, __replace, \
  1008. __reference_char, __callback, \
  1009. __callback_data) \
  1010. (weechat_plugin->string_replace_regex)(__string, __regex, \
  1011. __replace, \
  1012. __reference_char, \
  1013. __callback, \
  1014. __callback_data)
  1015. #define weechat_string_split(__string, __separator, __eol, __max, \
  1016. __num_items) \
  1017. (weechat_plugin->string_split)(__string, __separator, __eol, \
  1018. __max, __num_items)
  1019. #define weechat_string_split_shell(__string, __num_items) \
  1020. (weechat_plugin->string_split_shell)(__string, __num_items)
  1021. #define weechat_string_free_split(__split_string) \
  1022. (weechat_plugin->string_free_split)(__split_string)
  1023. #define weechat_string_build_with_split_string(__split_string, \
  1024. __separator) \
  1025. (weechat_plugin->string_build_with_split_string)(__split_string, \
  1026. __separator)
  1027. #define weechat_string_split_command(__command, __separator) \
  1028. (weechat_plugin->string_split_command)(__command, __separator)
  1029. #define weechat_string_free_split_command(__split_command) \
  1030. (weechat_plugin->string_free_split_command)(__split_command)
  1031. #define weechat_string_format_size(__size) \
  1032. (weechat_plugin->string_format_size)(__size)
  1033. #define weechat_string_remove_color(__string, __replacement) \
  1034. (weechat_plugin->string_remove_color)(__string, __replacement)
  1035. #define weechat_string_encode_base64(__from, __length, __to) \
  1036. (weechat_plugin->string_encode_base64)(__from, __length, __to)
  1037. #define weechat_string_decode_base64(__from, __to) \
  1038. (weechat_plugin->string_decode_base64)(__from, __to)
  1039. #define weechat_string_is_command_char(__string) \
  1040. (weechat_plugin->string_is_command_char)(__string)
  1041. #define weechat_string_input_for_buffer(__string) \
  1042. (weechat_plugin->string_input_for_buffer)(__string)
  1043. #define weechat_string_eval_expression(__expr, __pointers, \
  1044. __extra_vars, __options) \
  1045. (weechat_plugin->string_eval_expression)(__expr, __pointers, \
  1046. __extra_vars, __options)
  1047. /* UTF-8 strings */
  1048. #define weechat_utf8_has_8bits(__string) \
  1049. (weechat_plugin->utf8_has_8bits)(__string)
  1050. #define weechat_utf8_is_valid(__string, __error) \
  1051. (weechat_plugin->utf8_is_valid)(__string, __error)
  1052. #define weechat_utf8_normalize(__string, __char) \
  1053. (weechat_plugin->utf8_normalize)(__string, __char)
  1054. #define weechat_utf8_prev_char(__start, __string) \
  1055. (weechat_plugin->utf8_prev_char)(__start, __string)
  1056. #define weechat_utf8_next_char(__string) \
  1057. (weechat_plugin->utf8_next_char)(__string)
  1058. #define weechat_utf8_char_int(__string) \
  1059. (weechat_plugin->utf8_char_int)(__string)
  1060. #define weechat_utf8_char_size(__string) \
  1061. (weechat_plugin->utf8_char_size)(__string)
  1062. #define weechat_utf8_strlen(__string) \
  1063. (weechat_plugin->utf8_strlen)(__string)
  1064. #define weechat_utf8_strnlen(__string, __bytes) \
  1065. (weechat_plugin->utf8_strnlen)(__string, __bytes)
  1066. #define weechat_utf8_strlen_screen(__string) \
  1067. (weechat_plugin->utf8_strlen_screen)(__string)
  1068. #define weechat_utf8_charcmp(__string1, __string2) \
  1069. (weechat_plugin->utf8_charcmp)(__string1, __string2)
  1070. #define weechat_utf8_charcasecmp(__string1, __string2) \
  1071. (weechat_plugin->utf8_charcasecmp)(__string1, __string2)
  1072. #define weechat_utf8_char_size_screen(__string) \
  1073. (weechat_plugin->utf8_char_size_screen)(__string)
  1074. #define weechat_utf8_add_offset(__string, __offset) \
  1075. (weechat_plugin->utf8_add_offset)(__string, __offset)
  1076. #define weechat_utf8_real_pos(__string, __pos) \
  1077. (weechat_plugin->utf8_real_pos)(__string, __pos)
  1078. #define weechat_utf8_pos(__string, __real_pos) \
  1079. (weechat_plugin->utf8_pos)(__string, __real_pos)
  1080. #define weechat_utf8_strndup(__string, __length) \
  1081. (weechat_plugin->utf8_strndup)(__string, __length)
  1082. /* directories */
  1083. #define weechat_mkdir_home(__directory, __mode) \
  1084. (weechat_plugin->mkdir_home)(__directory, __mode)
  1085. #define weechat_mkdir(__directory, __mode) \
  1086. (weechat_plugin->mkdir)(__directory, __mode)
  1087. #define weechat_mkdir_parents(__directory, __mode) \
  1088. (weechat_plugin->mkdir_parents)(__directory, __mode)
  1089. #define weechat_exec_on_files(__directory, __hidden_files, __data, \
  1090. __callback) \
  1091. (weechat_plugin->exec_on_files)(__directory, __hidden_files, \
  1092. __data, __callback)
  1093. #define weechat_file_get_content(__filename) \
  1094. (weechat_plugin->file_get_content)(__filename)
  1095. /* util */
  1096. #define weechat_util_timeval_cmp(__time1, __time2) \
  1097. (weechat_plugin->util_timeval_cmp)(__time1, __time2)
  1098. #define weechat_util_timeval_diff(__time1, __time2) \
  1099. (weechat_plugin->util_timeval_diff)(__time1, __time2)
  1100. #define weechat_util_timeval_add(__time, __interval) \
  1101. (weechat_plugin->util_timeval_add)(__time, __interval)
  1102. #define weechat_util_get_time_string(__date) \
  1103. (weechat_plugin->util_get_time_string)(__date)
  1104. #define weechat_util_version_number(__version) \
  1105. (weechat_plugin->util_version_number)(__version)
  1106. /* sorted list */
  1107. #define weechat_list_new() \
  1108. (weechat_plugin->list_new)()
  1109. #define weechat_list_add(__list, __string, __where, __user_data) \
  1110. (weechat_plugin->list_add)(__list, __string, __where, __user_data)
  1111. #define weechat_list_search(__list, __string) \
  1112. (weechat_plugin->list_search)(__list, __string)
  1113. #define weechat_list_search_pos(__list, __string) \
  1114. (weechat_plugin->list_search_pos)(__list, __string)
  1115. #define weechat_list_casesearch(__list, __string) \
  1116. (weechat_plugin->list_casesearch)(__list, __string)
  1117. #define weechat_list_casesearch_pos(__list, __string) \
  1118. (weechat_plugin->list_casesearch_pos)(__list, __string)
  1119. #define weechat_list_get(__list, __index) \
  1120. (weechat_plugin->list_get)(__list, __index)
  1121. #define weechat_list_set(__item, __value) \
  1122. (weechat_plugin->list_set)(__item, __value)
  1123. #define weechat_list_next(__item) \
  1124. (weechat_plugin->list_next)(__item)
  1125. #define weechat_list_prev(__item) \
  1126. (weechat_plugin->list_prev)(__item)
  1127. #define weechat_list_string(__item) \
  1128. (weechat_plugin->list_string)(__item)
  1129. #define weechat_list_size(__list) \
  1130. (weechat_plugin->list_size)(__list)
  1131. #define weechat_list_remove(__list, __item) \
  1132. (weechat_plugin->list_remove)(__list, __item)
  1133. #define weechat_list_remove_all(__list) \
  1134. (weechat_plugin->list_remove_all)(__list)
  1135. #define weechat_list_free(__list) \
  1136. (weechat_plugin->list_free)(__list)
  1137. /* hash tables */
  1138. #define weechat_hashtable_new(__size, __type_keys, __type_values, \
  1139. __hash_key_cb, __keycmp_cb) \
  1140. (weechat_plugin->hashtable_new)(__size, __type_keys, __type_values, \
  1141. __hash_key_cb, __keycmp_cb)
  1142. #define weechat_hashtable_set_with_size(__hashtable, __key, __key_size, \
  1143. __value, __value_size) \
  1144. (weechat_plugin->hashtable_set_with_size)(__hashtable, __key, \
  1145. __key_size, __value, \
  1146. __value_size)
  1147. #define weechat_hashtable_set(__hashtable, __key, __value) \
  1148. (weechat_plugin->hashtable_set)(__hashtable, __key, __value)
  1149. #define weechat_hashtable_get(__hashtable, __key) \
  1150. (weechat_plugin->hashtable_get)(__hashtable, __key)
  1151. #define weechat_hashtable_has_key(__hashtable, __key) \
  1152. (weechat_plugin->hashtable_has_key)(__hashtable, __key)
  1153. #define weechat_hashtable_map(__hashtable, __cb_map, __cb_map_data) \
  1154. (weechat_plugin->hashtable_map)(__hashtable, __cb_map, \
  1155. __cb_map_data)
  1156. #define weechat_hashtable_map_string(__hashtable, __cb_map, \
  1157. __cb_map_data) \
  1158. (weechat_plugin->hashtable_map_string)(__hashtable, __cb_map, \
  1159. __cb_map_data)
  1160. #define weechat_hashtable_dup(__hashtable) \
  1161. (weechat_plugin->hashtable_dup)(__hashtable)
  1162. #define weechat_hashtable_get_integer(__hashtable, __property) \
  1163. (weechat_plugin->hashtable_get_integer)(__hashtable, __property)
  1164. #define weechat_hashtable_get_string(__hashtable, __property) \
  1165. (weechat_plugin->hashtable_get_string)(__hashtable, __property)
  1166. #define weechat_hashtable_set_pointer(__hashtable, __property, \
  1167. __pointer) \
  1168. (weechat_plugin->hashtable_set_pointer)(__hashtable, __property, \
  1169. __pointer)
  1170. #define weechat_hashtable_add_to_infolist(__hashtable, __infolist_item, \
  1171. __prefix) \
  1172. (weechat_plugin->hashtable_add_to_infolist)(__hashtable, \
  1173. __infolist_item, \
  1174. __prefix)
  1175. #define weechat_hashtable_remove(__hashtable, __key) \
  1176. (weechat_plugin->hashtable_remove)(__hashtable, __key)
  1177. #define weechat_hashtable_remove_all(__hashtable) \
  1178. (weechat_plugin->hashtable_remove_all)(__hashtable)
  1179. #define weechat_hashtable_free(__hashtable) \
  1180. (weechat_plugin->hashtable_free)(__hashtable)
  1181. /* config files */
  1182. #define weechat_config_new(__name, __callback_reload, \
  1183. __callback_reload_data) \
  1184. (weechat_plugin->config_new)(weechat_plugin, __name, \
  1185. __callback_reload, \
  1186. __callback_reload_data)
  1187. #define weechat_config_new_section(__config, __name, \
  1188. __user_can_add_options, \
  1189. __user_can_delete_options, \
  1190. __cb_read, __cb_read_data, \
  1191. __cb_write_std, __cb_write_std_data, \
  1192. __cb_write_def, __cb_write_def_data, \
  1193. __cb_create_option, \
  1194. __cb_create_option_data, \
  1195. __cb_delete_option, \
  1196. __cb_delete_option_data) \
  1197. (weechat_plugin->config_new_section)(__config, __name, \
  1198. __user_can_add_options, \
  1199. __user_can_delete_options, \
  1200. __cb_read, __cb_read_data, \
  1201. __cb_write_std, \
  1202. __cb_write_std_data, \
  1203. __cb_write_def, \
  1204. __cb_write_def_data, \
  1205. __cb_create_option, \
  1206. __cb_create_option_data, \
  1207. __cb_delete_option, \
  1208. __cb_delete_option_data)
  1209. #define weechat_config_search_section(__config, __name) \
  1210. (weechat_plugin->config_search_section)(__config, __name)
  1211. #define weechat_config_new_option(__config, __section, __name, __type, \
  1212. __desc, __string_values, __min, \
  1213. __max, __default, __value, \
  1214. __null_value_allowed, \
  1215. __callback_check, \
  1216. __callback_check_data, \
  1217. __callback_change, \
  1218. __callback_change_data, \
  1219. __callback_delete, \
  1220. __callback_delete_data) \
  1221. (weechat_plugin->config_new_option)(__config, __section, __name, \
  1222. __type, __desc, \
  1223. __string_values, \
  1224. __min, __max, __default, \
  1225. __value, \
  1226. __null_value_allowed, \
  1227. __callback_check, \
  1228. __callback_check_data, \
  1229. __callback_change, \
  1230. __callback_change_data, \
  1231. __callback_delete, \
  1232. __callback_delete_data)
  1233. #define weechat_config_search_option(__config, __section, __name) \
  1234. (weechat_plugin->config_search_option)(__config, __section, __name)
  1235. #define weechat_config_search_section_option(__config, __section, \
  1236. __name, __section_found, \
  1237. __option_found) \
  1238. (weechat_plugin->config_search_section_option)(__config, __section, \
  1239. __name, \
  1240. __section_found, \
  1241. __option_found);
  1242. #define weechat_config_search_with_string(__name, __config, __section, \
  1243. __option, __pos_option) \
  1244. (weechat_plugin->config_search_with_string)(__name, __config, \
  1245. __section, __option, \
  1246. __pos_option);
  1247. #define weechat_config_string_to_boolean(__string) \
  1248. (weechat_plugin->config_string_to_boolean)(__string)
  1249. #define weechat_config_option_reset(__option, __run_callback) \
  1250. (weechat_plugin->config_option_reset)(__option, __run_callback)
  1251. #define weechat_config_option_set(__option, __value, __run_callback) \
  1252. (weechat_plugin->config_option_set)(__option, __value, \
  1253. __run_callback)
  1254. #define weechat_config_option_set_null(__option, __run_callback) \
  1255. (weechat_plugin->config_option_set_null)(__option, __run_callback)
  1256. #define weechat_config_option_unset(__option) \
  1257. (weechat_plugin->config_option_unset)(__option)
  1258. #define weechat_config_option_rename(__option, __new_name) \
  1259. (weechat_plugin->config_option_rename)(__option, __new_name)
  1260. #define weechat_config_option_get_pointer(__option, __property) \
  1261. (weechat_plugin->config_option_get_pointer)(__option, __property)
  1262. #define weechat_config_option_is_null(__option) \
  1263. (weechat_plugin->config_option_is_null)(__option)
  1264. #define weechat_config_option_default_is_null(__option) \
  1265. (weechat_plugin->config_option_default_is_null)(__option)
  1266. #define weechat_config_boolean(__option) \
  1267. (weechat_plugin->config_boolean)(__option)
  1268. #define weechat_config_boolean_default(__option) \
  1269. (weechat_plugin->config_boolean_default)(__option)
  1270. #define weechat_config_integer(__option) \
  1271. (weechat_plugin->config_integer)(__option)
  1272. #define weechat_config_integer_default(__option) \
  1273. (weechat_plugin->config_integer_default)(__option)
  1274. #define weechat_config_string(__option) \
  1275. (weechat_plugin->config_string)(__option)
  1276. #define weechat_config_string_default(__option) \
  1277. (weechat_plugin->config_string_default)(__option)
  1278. #define weechat_config_color(__option) \
  1279. (weechat_plugin->config_color)(__option)
  1280. #define weechat_config_color_default(__option) \
  1281. (weechat_plugin->config_color_default)(__option)
  1282. #define weechat_config_write_option(__config, __option) \
  1283. (weechat_plugin->config_write_option)(__config, __option)
  1284. #define weechat_config_write_line(__config, __option, __value...) \
  1285. (weechat_plugin->config_write_line)(__config, __option, ##__value)
  1286. #define weechat_config_write(__config) \
  1287. (weechat_plugin->config_write)(__config)
  1288. #define weechat_config_read(__config) \
  1289. (weechat_plugin->config_read)(__config)
  1290. #define weechat_config_reload(__config) \
  1291. (weechat_plugin->config_reload)(__config)
  1292. #define weechat_config_option_free(__option) \
  1293. (weechat_plugin->config_option_free)(__option)
  1294. #define weechat_config_section_free_options(__section) \
  1295. (weechat_plugin->config_section_free_options)(__section)
  1296. #define weechat_config_section_free(__section) \
  1297. (weechat_plugin->config_section_free)(__section)
  1298. #define weechat_config_free(__config) \
  1299. (weechat_plugin->config_free)(__config)
  1300. #define weechat_config_get(__option) \
  1301. (weechat_plugin->config_get)(__option)
  1302. #define weechat_config_get_plugin(__option) \
  1303. (weechat_plugin->config_get_plugin)(weechat_plugin, __option)
  1304. #define weechat_config_is_set_plugin(__option) \
  1305. (weechat_plugin->config_is_set_plugin)(weechat_plugin, __option)
  1306. #define weechat_config_set_plugin(__option, __value) \
  1307. (weechat_plugin->config_set_plugin)(weechat_plugin, __option, \
  1308. __value)
  1309. #define weechat_config_set_desc_plugin(__option, __description) \
  1310. (weechat_plugin->config_set_desc_plugin)(weechat_plugin, __option, \
  1311. __description)
  1312. #define weechat_config_unset_plugin(__option) \
  1313. (weechat_plugin->config_unset_plugin)(weechat_plugin, __option)
  1314. /* key bindings */
  1315. #define weechat_key_bind(__context, __keys) \
  1316. (weechat_plugin->key_bind)(__context, __keys)
  1317. #define weechat_key_unbind(__context, __key) \
  1318. (weechat_plugin->key_unbind)(__context, __key)
  1319. /* display */
  1320. #define weechat_prefix(__prefix) \
  1321. (weechat_plugin->prefix)(__prefix)
  1322. #define weechat_color(__color_name) \
  1323. (weechat_plugin->color)(__color_name)
  1324. #define weechat_printf(__buffer, __message, __argz...) \
  1325. (weechat_plugin->printf_date_tags)(__buffer, 0, NULL, __message, \
  1326. ##__argz)
  1327. #define weechat_printf_date(__buffer, __date, __message, __argz...) \
  1328. (weechat_plugin->printf_date_tags)(__buffer, __date, NULL, \
  1329. __message, ##__argz)
  1330. #define weechat_printf_tags(__buffer, __tags, __message, __argz...) \
  1331. (weechat_plugin->printf_date_tags)(__buffer, 0, __tags, __message, \
  1332. ##__argz)
  1333. #define weechat_printf_date_tags(__buffer, __date, __tags, __message, \
  1334. __argz...) \
  1335. (weechat_plugin->printf_date_tags)(__buffer, __date, __tags, \
  1336. __message, ##__argz)
  1337. #define weechat_printf_y(__buffer, __y, __message, __argz...) \
  1338. (weechat_plugin->printf_y)(__buffer, __y, __message, ##__argz)
  1339. #define weechat_log_printf(__message, __argz...) \
  1340. (weechat_plugin->log_printf)(__message, ##__argz)
  1341. /* hooks */
  1342. #define weechat_hook_command(__command, __description, __args, \
  1343. __args_desc, __completion, __callback, \
  1344. __data) \
  1345. (weechat_plugin->hook_command)(weechat_plugin, __command, \
  1346. __description, __args, __args_desc, \
  1347. __completion, __callback, __data)
  1348. #define weechat_hook_command_run(__command, __callback, __data) \
  1349. (weechat_plugin->hook_command_run)(weechat_plugin, __command, \
  1350. __callback, __data)
  1351. #define weechat_hook_timer(__interval, __align_second, __max_calls, \
  1352. __callback, __data) \
  1353. (weechat_plugin->hook_timer)(weechat_plugin, __interval, \
  1354. __align_second, __max_calls, \
  1355. __callback, __data)
  1356. #define weechat_hook_fd(__fd, __flag_read, __flag_write, \
  1357. __flag_exception, __callback, __data) \
  1358. (weechat_plugin->hook_fd)(weechat_plugin, __fd, __flag_read, \
  1359. __flag_write, __flag_exception, \
  1360. __callback, __data)
  1361. #define weechat_hook_process(__command, __timeout, __callback, \
  1362. __callback_data) \
  1363. (weechat_plugin->hook_process)(weechat_plugin, __command, \
  1364. __timeout, __callback, \
  1365. __callback_data)
  1366. #define weechat_hook_process_hashtable(__command, __options, __timeout, \
  1367. __callback, __callback_data) \
  1368. (weechat_plugin->hook_process_hashtable)(weechat_plugin, __command, \
  1369. __options, __timeout, \
  1370. __callback, \
  1371. __callback_data)
  1372. #define weechat_hook_connect(__proxy, __address, __port, __ipv6, \
  1373. __retry, __gnutls_sess, __gnutls_cb, \
  1374. __gnutls_dhkey_size, __gnutls_priorities, \
  1375. __local_hostname, __callback, __data) \
  1376. (weechat_plugin->hook_connect)(weechat_plugin, __proxy, __address, \
  1377. __port, __ipv6, __retry, \
  1378. __gnutls_sess, __gnutls_cb, \
  1379. __gnutls_dhkey_size, \
  1380. __gnutls_priorities, \
  1381. __local_hostname, \
  1382. __callback, __data)
  1383. #define weechat_hook_print(__buffer, __tags, __msg, __strip__colors, \
  1384. __callback, __data) \
  1385. (weechat_plugin->hook_print)(weechat_plugin, __buffer, __tags, \
  1386. __msg, __strip__colors, __callback, \
  1387. __data)
  1388. #define weechat_hook_signal(__signal, __callback, __data) \
  1389. (weechat_plugin->hook_signal)(weechat_plugin, __signal, __callback, \
  1390. __data)
  1391. #define weechat_hook_signal_send(__signal, __type_data, __signal_data) \
  1392. (weechat_plugin->hook_signal_send)(__signal, __type_data, \
  1393. __signal_data)
  1394. #define weechat_hook_hsignal(__signal, __callback, __data) \
  1395. (weechat_plugin->hook_hsignal)(weechat_plugin, __signal, \
  1396. __callback, __data)
  1397. #define weechat_hook_hsignal_send(__signal, __hashtable) \
  1398. (weechat_plugin->hook_hsignal_send)(__signal, __hashtable)
  1399. #define weechat_hook_config(__option, __callback, __data) \
  1400. (weechat_plugin->hook_config)(weechat_plugin, __option, __callback, \
  1401. __data)
  1402. #define weechat_hook_completion(__completion, __description, \
  1403. __callback, __data) \
  1404. (weechat_plugin->hook_completion)(weechat_plugin, __completion, \
  1405. __description, __callback, \
  1406. __data)
  1407. #define weechat_hook_completion_get_string(__completion, __property) \
  1408. (weechat_plugin->hook_completion_get_string)(__completion, \
  1409. __property)
  1410. #define weechat_hook_completion_list_add(__completion, __word, \
  1411. __nick_completion, __where) \
  1412. (weechat_plugin->hook_completion_list_add)(__completion, __word, \
  1413. __nick_completion, \
  1414. __where)
  1415. #define weechat_hook_modifier(__modifier, __callback, __data) \
  1416. (weechat_plugin->hook_modifier)(weechat_plugin, __modifier, \
  1417. __callback, __data)
  1418. #define weechat_hook_modifier_exec(__modifier, __modifier_data, \
  1419. __string) \
  1420. (weechat_plugin->hook_modifier_exec)(weechat_plugin, __modifier, \
  1421. __modifier_data, __string)
  1422. #define weechat_hook_info(__info_name, __description, \
  1423. __args_description, __callback, __data) \
  1424. (weechat_plugin->hook_info)(weechat_plugin, __info_name, \
  1425. __description, __args_description, \
  1426. __callback, __data)
  1427. #define weechat_hook_info_hashtable(__info_name, __description, \
  1428. __args_description, \
  1429. __output_description, \
  1430. __callback, \
  1431. __data) \
  1432. (weechat_plugin->hook_info_hashtable)(weechat_plugin, __info_name, \
  1433. __description, \
  1434. __args_description, \
  1435. __output_description, \
  1436. __callback, __data)
  1437. #define weechat_hook_infolist(__infolist_name, __description, \
  1438. __pointer_description, \
  1439. __args_description, __callback, __data) \
  1440. (weechat_plugin->hook_infolist)(weechat_plugin, __infolist_name, \
  1441. __description, \
  1442. __pointer_description, \
  1443. __args_description, __callback, \
  1444. __data)
  1445. #define weechat_hook_hdata(__hdata_name, __description, __callback, \
  1446. __data) \
  1447. (weechat_plugin->hook_hdata)(weechat_plugin, __hdata_name, \
  1448. __description, __callback, __data)
  1449. #define weechat_hook_focus(__area, __callback, __data) \
  1450. (weechat_plugin->hook_focus)(weechat_plugin, __area, __callback, \
  1451. __data)
  1452. #define weechat_hook_set(__hook, __property, __value) \
  1453. (weechat_plugin->hook_set)(__hook, __property, __value)
  1454. #define weechat_unhook(__hook) \
  1455. (weechat_plugin->unhook)( __hook)
  1456. #define weechat_unhook_all() \
  1457. (weechat_plugin->unhook_all_plugin)(weechat_plugin)
  1458. /* buffers */
  1459. #define weechat_buffer_new(__name, __input_callback, \
  1460. __input_callback_data, __close_callback, \
  1461. __close_callback_data) \
  1462. (weechat_plugin->buffer_new)(weechat_plugin, __name, \
  1463. __input_callback, \
  1464. __input_callback_data, \
  1465. __close_callback, \
  1466. __close_callback_data)
  1467. #define weechat_buffer_search(__plugin, __name) \
  1468. (weechat_plugin->buffer_search)(__plugin, __name)
  1469. #define weechat_buffer_search_main() \
  1470. (weechat_plugin->buffer_search_main)()
  1471. #define weechat_current_buffer() \
  1472. (weechat_plugin->buffer_search)(NULL, NULL)
  1473. #define weechat_buffer_clear(__buffer) \
  1474. (weechat_plugin->buffer_clear)(__buffer)
  1475. #define weechat_buffer_close(__buffer) \
  1476. (weechat_plugin->buffer_close)(__buffer)
  1477. #define weechat_buffer_merge(__buffer, __target_buffer) \
  1478. (weechat_plugin->buffer_merge)(__buffer, __target_buffer)
  1479. #define weechat_buffer_unmerge(__buffer, __number) \
  1480. (weechat_plugin->buffer_unmerge)(__buffer, __number)
  1481. #define weechat_buffer_get_integer(__buffer, __property) \
  1482. (weechat_plugin->buffer_get_integer)(__buffer, __property)
  1483. #define weechat_buffer_get_string(__buffer, __property) \
  1484. (weechat_plugin->buffer_get_string)(__buffer, __property)
  1485. #define weechat_buffer_get_pointer(__buffer, __property) \
  1486. (weechat_plugin->buffer_get_pointer)(__buffer, __property)
  1487. #define weechat_buffer_set(__buffer, __property, __value) \
  1488. (weechat_plugin->buffer_set)(__buffer, __property, __value)
  1489. #define weechat_buffer_set_pointer(__buffer, __property, __pointer) \
  1490. (weechat_plugin->buffer_set_pointer)(__buffer, __property, \
  1491. __pointer)
  1492. #define weechat_buffer_string_replace_local_var(__buffer, __string) \
  1493. (weechat_plugin->buffer_string_replace_local_var)(__buffer, \
  1494. __string)
  1495. #define weechat_buffer_match_list(__buffer, __string) \
  1496. (weechat_plugin->buffer_match_list)(__buffer, __string)
  1497. /* windows */
  1498. #define weechat_window_search_with_buffer(__buffer) \
  1499. (weechat_plugin->window_search_with_buffer)(__buffer)
  1500. #define weechat_window_get_integer(__window, __property) \
  1501. (weechat_plugin->window_get_integer)(__window, __property)
  1502. #define weechat_window_get_string(__window, __property) \
  1503. (weechat_plugin->window_get_string)(__window, __property)
  1504. #define weechat_window_get_pointer(__window, __property) \
  1505. (weechat_plugin->window_get_pointer)(__window, __property)
  1506. #define weechat_current_window() \
  1507. (weechat_plugin->window_get_pointer)(NULL, "current")
  1508. #define weechat_window_set_title(__title) \
  1509. (weechat_plugin->window_set_title)(__title)
  1510. /* nicklist */
  1511. #define weechat_nicklist_add_group(__buffer, __parent_group, __name, \
  1512. __color, __visible) \
  1513. (weechat_plugin->nicklist_add_group)(__buffer, __parent_group, \
  1514. __name, __color, __visible)
  1515. #define weechat_nicklist_search_group(__buffer, __from_group, __name) \
  1516. (weechat_plugin->nicklist_search_group)(__buffer, __from_group, \
  1517. __name)
  1518. #define weechat_nicklist_add_nick(__buffer, __group, __name, __color, \
  1519. __prefix, __prefix_color, __visible) \
  1520. (weechat_plugin->nicklist_add_nick)(__buffer, __group, __name, \
  1521. __color, __prefix, \
  1522. __prefix_color, __visible)
  1523. #define weechat_nicklist_search_nick(__buffer, __from_group, __name) \
  1524. (weechat_plugin->nicklist_search_nick)(__buffer, __from_group, \
  1525. __name)
  1526. #define weechat_nicklist_remove_group(__buffer, __group) \
  1527. (weechat_plugin->nicklist_remove_group)(__buffer, __group)
  1528. #define weechat_nicklist_remove_nick(__buffer, __nick) \
  1529. (weechat_plugin->nicklist_remove_nick)(__buffer, __nick)
  1530. #define weechat_nicklist_remove_all(__buffer) \
  1531. (weechat_plugin->nicklist_remove_all)(__buffer)
  1532. #define weechat_nicklist_get_next_item(__buffer, __group, __nick) \
  1533. (weechat_plugin->nicklist_get_next_item)(__buffer, __group, __nick)
  1534. #define weechat_nicklist_group_get_integer(__buffer, __group, \
  1535. __property) \
  1536. (weechat_plugin->nicklist_group_get_integer)(__buffer, __group, \
  1537. __property)
  1538. #define weechat_nicklist_group_get_string(__buffer, __group, \
  1539. __property) \
  1540. (weechat_plugin->nicklist_group_get_string)(__buffer, __group, \
  1541. __property)
  1542. #define weechat_nicklist_group_get_pointer(__buffer, __group, \
  1543. __property) \
  1544. (weechat_plugin->nicklist_group_get_pointer)(__buffer, __group, \
  1545. __property)
  1546. #define weechat_nicklist_group_set(__buffer, __group, __property, \
  1547. __value) \
  1548. (weechat_plugin->nicklist_group_set)(__buffer, __group, __property, \
  1549. __value)
  1550. #define weechat_nicklist_nick_get_integer(__buffer, __nick, __property) \
  1551. (weechat_plugin->nicklist_nick_get_integer)(__buffer, __nick, \
  1552. __property)
  1553. #define weechat_nicklist_nick_get_string(__buffer, __nick, __property) \
  1554. (weechat_plugin->nicklist_nick_get_string)(__buffer, __nick, \
  1555. __property)
  1556. #define weechat_nicklist_nick_get_pointer(__buffer, __nick, __property) \
  1557. (weechat_plugin->nicklist_nick_get_pointer)(__buffer, __nick, \
  1558. __property)
  1559. #define weechat_nicklist_nick_set(__buffer, __nick, __property, \
  1560. __value) \
  1561. (weechat_plugin->nicklist_nick_set)(__buffer, __nick, __property, \
  1562. __value)
  1563. /* bars */
  1564. #define weechat_bar_item_search(__name) \
  1565. (weechat_plugin->bar_item_search)(__name)
  1566. #define weechat_bar_item_new(__name, __build_callback, __data) \
  1567. (weechat_plugin->bar_item_new)(weechat_plugin, __name, \
  1568. __build_callback, __data)
  1569. #define weechat_bar_item_update(__name) \
  1570. (weechat_plugin->bar_item_update)(__name)
  1571. #define weechat_bar_item_remove(__item) \
  1572. (weechat_plugin->bar_item_remove)(__item)
  1573. #define weechat_bar_search(__name) \
  1574. (weechat_plugin->bar_search)(__name)
  1575. #define weechat_bar_new(__name, __hidden, __priority, __type, \
  1576. __condition, __position, __filling_top_bottom, \
  1577. __filling_left_right, __size, __size_max, \
  1578. __color_fg, __color_delim, __color_bg, \
  1579. __separator, __items) \
  1580. (weechat_plugin->bar_new)(__name, __hidden, __priority, __type, \
  1581. __condition, __position, \
  1582. __filling_top_bottom, \
  1583. __filling_left_right, \
  1584. __size, __size_max, __color_fg, \
  1585. __color_delim, __color_bg, __separator, \
  1586. __items)
  1587. #define weechat_bar_set(__bar, __property, __value) \
  1588. (weechat_plugin->bar_set)(__bar, __property, __value)
  1589. #define weechat_bar_update(__name) \
  1590. (weechat_plugin->bar_update)(__name)
  1591. #define weechat_bar_remove(__bar) \
  1592. (weechat_plugin->bar_remove)(__bar)
  1593. /* command */
  1594. #define weechat_command(__buffer, __command) \
  1595. (weechat_plugin->command)(weechat_plugin, __buffer, __command)
  1596. /* network */
  1597. #define weechat_network_pass_proxy(__proxy, __sock, __address, __port) \
  1598. (weechat_plugin->network_pass_proxy)(__proxy, __sock, __address, \
  1599. __port)
  1600. #define weechat_network_connect_to(__proxy, __address, \
  1601. __address_length) \
  1602. (weechat_plugin->network_connect_to)(__proxy, __address, \
  1603. __address_length)
  1604. /* infos */
  1605. #define weechat_info_get(__info_name, __arguments) \
  1606. (weechat_plugin->info_get)(weechat_plugin, __info_name, \
  1607. __arguments)
  1608. #define weechat_info_get_hashtable(__info_name, __hashtable) \
  1609. (weechat_plugin->info_get_hashtable)(weechat_plugin, __info_name, \
  1610. __hashtable)
  1611. /* infolists */
  1612. #define weechat_infolist_new() \
  1613. (weechat_plugin->infolist_new)(weechat_plugin)
  1614. #define weechat_infolist_new_item(__list) \
  1615. (weechat_plugin->infolist_new_item)(__list)
  1616. #define weechat_infolist_new_var_integer(__item, __name, __value) \
  1617. (weechat_plugin->infolist_new_var_integer)(__item, __name, __value)
  1618. #define weechat_infolist_new_var_string(__item, __name, __value) \
  1619. (weechat_plugin->infolist_new_var_string)(__item, __name, __value)
  1620. #define weechat_infolist_new_var_pointer(__item, __name, __pointer) \
  1621. (weechat_plugin->infolist_new_var_pointer)(__item, __name, \
  1622. __pointer)
  1623. #define weechat_infolist_new_var_buffer(__item, __name, __buffer, \
  1624. __size) \
  1625. (weechat_plugin->infolist_new_var_buffer)(__item, __name, __buffer, \
  1626. __size)
  1627. #define weechat_infolist_new_var_time(__item, __name, __time) \
  1628. (weechat_plugin->infolist_new_var_time)(__item, __name, __time)
  1629. #define weechat_infolist_search_var(__list, __name) \
  1630. (weechat_plugin->infolist_search_var)(__list, __name)
  1631. #define weechat_infolist_get(__infolist_name, __pointer, __arguments) \
  1632. (weechat_plugin->infolist_get)(weechat_plugin, __infolist_name, \
  1633. __pointer, __arguments)
  1634. #define weechat_infolist_next(__list) \
  1635. (weechat_plugin->infolist_next)(__list)
  1636. #define weechat_infolist_prev(__list) \
  1637. (weechat_plugin->infolist_prev)(__list)
  1638. #define weechat_infolist_reset_item_cursor(__list) \
  1639. (weechat_plugin->infolist_reset_item_cursor)(__list)
  1640. #define weechat_infolist_fields(__list) \
  1641. (weechat_plugin->infolist_fields)(__list)
  1642. #define weechat_infolist_integer(__item, __var) \
  1643. (weechat_plugin->infolist_integer)(__item, __var)
  1644. #define weechat_infolist_string(__item, __var) \
  1645. (weechat_plugin->infolist_string)(__item, __var)
  1646. #define weechat_infolist_pointer(__item, __var) \
  1647. (weechat_plugin->infolist_pointer)(__item, __var)
  1648. #define weechat_infolist_buffer(__item, __var, __size) \
  1649. (weechat_plugin->infolist_buffer)(__item, __var, __size)
  1650. #define weechat_infolist_time(__item, __var) \
  1651. (weechat_plugin->infolist_time)(__item, __var)
  1652. #define weechat_infolist_free(__list) \
  1653. (weechat_plugin->infolist_free)(__list)
  1654. /* hdata */
  1655. #define weechat_hdata_new(__hdata_name, __var_prev, __var_next, \
  1656. __create_allowed, __delete_allowed, \
  1657. __callback_update, __callback_update_data) \
  1658. (weechat_plugin->hdata_new)(weechat_plugin, __hdata_name, \
  1659. __var_prev, __var_next, \
  1660. __create_allowed, __delete_allowed, \
  1661. __callback_update, \
  1662. __callback_update_data)
  1663. #define weechat_hdata_new_var(__hdata, __name, __offset, __type, \
  1664. __update_allowed, __array_size, \
  1665. __hdata_name) \
  1666. (weechat_plugin->hdata_new_var)(__hdata, __name, __offset, __type, \
  1667. __update_allowed, __array_size, \
  1668. __hdata_name)
  1669. #define WEECHAT_HDATA_VAR(__struct, __name, __type, __update_allowed, \
  1670. __array_size, __hdata_name) \
  1671. weechat_hdata_new_var (hdata, #__name, offsetof (__struct, __name), \
  1672. WEECHAT_HDATA_##__type, __update_allowed, \
  1673. __array_size, __hdata_name)
  1674. #define weechat_hdata_new_list(__hdata, __name, __pointer, __flags) \
  1675. (weechat_plugin->hdata_new_list)(__hdata, __name, __pointer, \
  1676. __flags)
  1677. #define WEECHAT_HDATA_LIST(__name, __flags) \
  1678. weechat_hdata_new_list (hdata, #__name, &(__name), __flags);
  1679. #define weechat_hdata_get(__hdata_name) \
  1680. (weechat_plugin->hdata_get)(weechat_plugin, __hdata_name)
  1681. #define weechat_hdata_get_var_offset(__hdata, __name) \
  1682. (weechat_plugin->hdata_get_var_offset)(__hdata, __name)
  1683. #define weechat_hdata_get_var_type(__hdata, __name) \
  1684. (weechat_plugin->hdata_get_var_type)(__hdata, __name)
  1685. #define weechat_hdata_get_var_type_string(__hdata, __name) \
  1686. (weechat_plugin->hdata_get_var_type_string)(__hdata, __name)
  1687. #define weechat_hdata_get_var_array_size(__hdata, __pointer, __name) \
  1688. (weechat_plugin->hdata_get_var_array_size)(__hdata, __pointer, \
  1689. __name)
  1690. #define weechat_hdata_get_var_array_size_string(__hdata, __pointer, \
  1691. __name) \
  1692. (weechat_plugin->hdata_get_var_array_size_string)(__hdata, \
  1693. __pointer, \
  1694. __name)
  1695. #define weechat_hdata_get_var_hdata(__hdata, __name) \
  1696. (weechat_plugin->hdata_get_var_hdata)(__hdata, __name)
  1697. #define weechat_hdata_get_var(__hdata, __pointer, __name) \
  1698. (weechat_plugin->hdata_get_var)(__hdata, __pointer, __name)
  1699. #define weechat_hdata_get_var_at_offset(__hdata, __pointer, __offset) \
  1700. (weechat_plugin->hdata_get_var_at_offset)(__hdata, __pointer, \
  1701. __offset)
  1702. #define weechat_hdata_get_list(__hdata, __name) \
  1703. (weechat_plugin->hdata_get_list)(__hdata, __name)
  1704. #define weechat_hdata_check_pointer(__hdata, __list, __pointer) \
  1705. (weechat_plugin->hdata_check_pointer)(__hdata, __list, __pointer)
  1706. #define weechat_hdata_move(__hdata, __pointer, __count) \
  1707. (weechat_plugin->hdata_move)(__hdata, __pointer, __count)
  1708. #define weechat_hdata_search(__hdata, __pointer, __search, __move) \
  1709. (weechat_plugin->hdata_search)(__hdata, __pointer, __search, \
  1710. __move)
  1711. #define weechat_hdata_char(__hdata, __pointer, __name) \
  1712. (weechat_plugin->hdata_char)(__hdata, __pointer, __name)
  1713. #define weechat_hdata_integer(__hdata, __pointer, __name) \
  1714. (weechat_plugin->hdata_integer)(__hdata, __pointer, __name)
  1715. #define weechat_hdata_long(__hdata, __pointer, __name) \
  1716. (weechat_plugin->hdata_long)(__hdata, __pointer, __name)
  1717. #define weechat_hdata_string(__hdata, __pointer, __name) \
  1718. (weechat_plugin->hdata_string)(__hdata, __pointer, __name)
  1719. #define weechat_hdata_pointer(__hdata, __pointer, __name) \
  1720. (weechat_plugin->hdata_pointer)(__hdata, __pointer, __name)
  1721. #define weechat_hdata_time(__hdata, __pointer, __name) \
  1722. (weechat_plugin->hdata_time)(__hdata, __pointer, __name)
  1723. #define weechat_hdata_hashtable(__hdata, __pointer, __name) \
  1724. (weechat_plugin->hdata_hashtable)(__hdata, __pointer, __name)
  1725. #define weechat_hdata_set(__hdata, __pointer, __name, __value) \
  1726. (weechat_plugin->hdata_set)(__hdata, __pointer, __name, __value)
  1727. #define weechat_hdata_update(__hdata, __pointer, __hashtable) \
  1728. (weechat_plugin->hdata_update)(__hdata, __pointer, __hashtable)
  1729. #define weechat_hdata_get_string(__hdata, __property) \
  1730. (weechat_plugin->hdata_get_string)(__hdata, __property)
  1731. /* upgrade */
  1732. #define weechat_upgrade_new(__filename, __write) \
  1733. (weechat_plugin->upgrade_new)(__filename, __write)
  1734. #define weechat_upgrade_write_object(__upgrade_file, __object_id, \
  1735. __infolist) \
  1736. (weechat_plugin->upgrade_write_object)(__upgrade_file, __object_id, \
  1737. __infolist)
  1738. #define weechat_upgrade_read(__upgrade_file, __callback_read, \
  1739. __callback_read_data) \
  1740. (weechat_plugin->upgrade_read)(__upgrade_file, __callback_read, \
  1741. __callback_read_data)
  1742. #define weechat_upgrade_close(__upgrade_file) \
  1743. (weechat_plugin->upgrade_close)(__upgrade_file)
  1744. #ifdef __cplusplus
  1745. }
  1746. #endif /* __cplusplus */
  1747. #endif /* WEECHAT_WEECHAT_PLUGIN_H */