aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-07-07 21:21:56 +0200
committerTom Smeding <tom.smeding@gmail.com>2020-07-07 21:21:56 +0200
commit1098c82714bb8fc8edc331509847d249811a791d (patch)
tree6dbb7947ff2ccbed54e051c555ad35eaebbdb40b
parent34d7ffdf32a59019fc750bb3f365cb7b5f229fc6 (diff)
weechat-plugin.h up
-rw-r--r--weechat/weechat-plugin.h123
1 files changed, 99 insertions, 24 deletions
diff --git a/weechat/weechat-plugin.h b/weechat/weechat-plugin.h
index 8dfcff4..ca9f783 100644
--- a/weechat/weechat-plugin.h
+++ b/weechat/weechat-plugin.h
@@ -1,7 +1,7 @@
/*
* weechat-plugin.h - header to compile WeeChat plugins
*
- * Copyright (C) 2003-2017 Sébastien Helleu <flashcode@flashtux.org>
+ * Copyright (C) 2003-2020 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -16,11 +16,11 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
+ * along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef WEECHAT_WEECHAT_PLUGIN_H
-#define WEECHAT_WEECHAT_PLUGIN_H 1
+#define WEECHAT_WEECHAT_PLUGIN_H
#ifdef __cplusplus
extern "C" {
@@ -67,7 +67,7 @@ struct timeval;
* please change the date with current one; for a second change at same
* date, increment the 01, otherwise please keep 01.
*/
-#define WEECHAT_PLUGIN_API_VERSION "20170530-02"
+#define WEECHAT_PLUGIN_API_VERSION "20200301-03"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@@ -89,6 +89,12 @@ struct timeval;
#define WEECHAT_RC_OK_EAT 1
#define WEECHAT_RC_ERROR -1
+/* flags for string_split function */
+#define WEECHAT_STRING_SPLIT_STRIP_LEFT (1 << 0)
+#define WEECHAT_STRING_SPLIT_STRIP_RIGHT (1 << 1)
+#define WEECHAT_STRING_SPLIT_COLLAPSE_SEPS (1 << 2)
+#define WEECHAT_STRING_SPLIT_KEEP_EOL (1 << 3)
+
/* return codes for config read functions/callbacks */
#define WEECHAT_CONFIG_READ_OK 0
#define WEECHAT_CONFIG_READ_MEMORY_ERROR -1
@@ -255,6 +261,10 @@ struct t_weechat_plugin
int priority; /* plugin priority (default is 1000) */
int initialized; /* plugin initialized? (init called) */
int debug; /* debug level for plugin (0=off) */
+ int upgrading; /* 1 if the plugin must load upgrade */
+ /* info on startup (if weechat is */
+ /* run with --upgrade) */
+ struct t_hashtable *variables; /* plugin custom variables */
struct t_weechat_plugin *prev_plugin; /* link to previous plugin */
struct t_weechat_plugin *next_plugin; /* link to next plugin */
@@ -288,6 +298,8 @@ struct t_weechat_plugin
int (*strlen_screen) (const char *string);
int (*string_match) (const char *string, const char *mask,
int case_sensitive);
+ int (*string_match_list) (const char *string, const char **masks,
+ int case_sensitive);
char *(*string_replace) (const char *string, const char *search,
const char *replace);
char *(*string_expand_home) (const char *path);
@@ -313,7 +325,8 @@ struct t_weechat_plugin
const char *text),
void *callback_data);
char **(*string_split) (const char *string, const char *separators,
- int keep_eol, int num_items_max, int *num_items);
+ const char *strip_items, int flags,
+ int num_items_max, int *num_items);
char **(*string_split_shell) (const char *string, int *num_items);
void (*string_free_split) (char **split_string);
char *(*string_build_with_split_string) (const char **split_string,
@@ -322,8 +335,9 @@ struct t_weechat_plugin
void (*string_free_split_command) (char **split_command);
char *(*string_format_size) (unsigned long long size);
char *(*string_remove_color) (const char *string, const char *replacement);
- void (*string_encode_base64) (const char *from, int length, char *to);
- int (*string_decode_base64) (const char *from, char *to);
+ int (*string_base_encode) (int base, const char *from, int length,
+ char *to);
+ int (*string_base_decode) (int base, const char *from, char *to);
char *(*string_hex_dump) (const char *data, int data_size,
int bytes_per_line, const char *prefix,
const char *suffix);
@@ -358,11 +372,21 @@ struct t_weechat_plugin
int (*utf8_pos) (const char *string, int real_pos);
char *(*utf8_strndup) (const char *string, int length);
+ /* crypto */
+ int (*crypto_hash) (const void *data, int data_size,
+ const char *hash_algo, void *hash, int *hash_size);
+ int (*crypto_hash_pbkdf2) (const void *data, int data_size,
+ const char *hash_algo,
+ const void *salt, int salt_size,
+ int iterations,
+ void *hash, int *hash_size);
+
/* directories/files */
int (*mkdir_home) (const char *directory, int mode);
int (*mkdir) (const char *directory, int mode);
int (*mkdir_parents) (const char *directory, int mode);
- void (*exec_on_files) (const char *directory, int hidden_files,
+ void (*exec_on_files) (const char *directory, int recurse_subdirs,
+ int hidden_files,
void (*callback)(void *data, const char *filename),
void *callback_data);
char *(*file_get_content) (const char *filename);
@@ -394,6 +418,7 @@ struct t_weechat_plugin
struct t_weelist_item *(*list_next) (struct t_weelist_item *item);
struct t_weelist_item *(*list_prev) (struct t_weelist_item *item);
const char *(*list_string) (struct t_weelist_item *item);
+ void *(*list_user_data) (struct t_weelist_item *item);
int (*list_size) (struct t_weelist *weelist);
void (*list_remove) (struct t_weelist *weelist,
struct t_weelist_item *item);
@@ -466,6 +491,9 @@ struct t_weechat_plugin
int (*hashtable_add_to_infolist) (struct t_hashtable *hashtable,
struct t_infolist_item *infolist_item,
const char *prefix);
+ int (*hashtable_add_from_infolist) (struct t_hashtable *hashtable,
+ struct t_infolist *infolist,
+ const char *prefix);
void (*hashtable_remove) (struct t_hashtable *hashtable, const void *key);
void (*hashtable_remove_all) (struct t_hashtable *hashtable);
void (*hashtable_free) (struct t_hashtable *hashtable);
@@ -704,6 +732,15 @@ struct t_weechat_plugin
const char *ip_address),
const void *callback_pointer,
void *callback_data);
+ struct t_hook *(*hook_line) (struct t_weechat_plugin *plugin,
+ const char *buffer_type,
+ const char *buffer_name,
+ const char *tags,
+ struct t_hashtable *(*callback)(const void *pointer,
+ void *data,
+ struct t_hashtable *line),
+ const void *callback_pointer,
+ void *callback_data);
struct t_hook *(*hook_print) (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer,
const char *tags,
@@ -783,10 +820,10 @@ struct t_weechat_plugin
const char *info_name,
const char *description,
const char *args_description,
- const char *(*callback)(const void *pointer,
- void *data,
- const char *info_name,
- const char *arguments),
+ char *(*callback)(const void *pointer,
+ void *data,
+ const char *info_name,
+ const char *arguments),
const void *callback_pointer,
void *callback_data);
struct t_hook *(*hook_info_hashtable) (struct t_weechat_plugin *plugin,
@@ -968,6 +1005,9 @@ struct t_weechat_plugin
/* command */
int (*command) (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer, const char *command);
+ int (*command_options) (struct t_weechat_plugin *plugin,
+ struct t_gui_buffer *buffer, const char *command,
+ struct t_hashtable *options);
/* network */
int (*network_pass_proxy) (const char *proxy, int sock,
@@ -977,9 +1017,8 @@ struct t_weechat_plugin
socklen_t address_length);
/* infos */
- const char *(*info_get) (struct t_weechat_plugin *plugin,
- const char *info_name,
- const char *arguments);
+ char *(*info_get) (struct t_weechat_plugin *plugin, const char *info_name,
+ const char *arguments);
struct t_hashtable *(*info_get_hashtable) (struct t_weechat_plugin *plugin,
const char *info_name,
struct t_hashtable *hashtable);
@@ -1157,6 +1196,9 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
(weechat_plugin->strlen_screen)(__string)
#define weechat_string_match(__string, __mask, __case_sensitive) \
(weechat_plugin->string_match)(__string, __mask, __case_sensitive)
+#define weechat_string_match_list(__string, __masks, __case_sensitive) \
+ (weechat_plugin->string_match_list)(__string, __masks, \
+ __case_sensitive)
#define weechat_string_replace(__string, __search, __replace) \
(weechat_plugin->string_replace)(__string, __search, __replace)
#define weechat_string_expand_home(__path) \
@@ -1190,9 +1232,10 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__reference_char, \
__callback, \
__callback_data)
-#define weechat_string_split(__string, __separator, __eol, __max, \
- __num_items) \
- (weechat_plugin->string_split)(__string, __separator, __eol, \
+#define weechat_string_split(__string, __separators, __strip_items, \
+ __flags, __max, __num_items) \
+ (weechat_plugin->string_split)(__string, __separators, \
+ __strip_items, __flags, \
__max, __num_items)
#define weechat_string_split_shell(__string, __num_items) \
(weechat_plugin->string_split_shell)(__string, __num_items)
@@ -1210,10 +1253,11 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
(weechat_plugin->string_format_size)(__size)
#define weechat_string_remove_color(__string, __replacement) \
(weechat_plugin->string_remove_color)(__string, __replacement)
-#define weechat_string_encode_base64(__from, __length, __to) \
- (weechat_plugin->string_encode_base64)(__from, __length, __to)
-#define weechat_string_decode_base64(__from, __to) \
- (weechat_plugin->string_decode_base64)(__from, __to)
+#define weechat_string_base_encode(__base, __from, __length, __to) \
+ (weechat_plugin->string_base_encode)(__base, __from, __length, \
+ __to)
+#define weechat_string_base_decode(__base, __from, __to) \
+ (weechat_plugin->string_base_decode)(__base, __from, __to)
#define weechat_string_hex_dump(__data, __data_size, __bytes_per_line, \
__prefix, __suffix) \
(weechat_plugin->string_hex_dump)(__data, __data_size, \
@@ -1272,6 +1316,20 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
#define weechat_utf8_strndup(__string, __length) \
(weechat_plugin->utf8_strndup)(__string, __length)
+/* crypto */
+#define weechat_crypto_hash(__data, __data_size, __hash_algo, \
+ __hash, __hash_size) \
+ (weechat_plugin->crypto_hash)(__data, __data_size, __hash_algo, \
+ __hash, __hash_size)
+#define weechat_crypto_hash_pbkdf2(__data, __data_size, __hash_algo, \
+ __salt, __salt_size, __iterations, \
+ __hash, __hash_size) \
+ (weechat_plugin->crypto_hash_pbkdf2)(__data, __data_size, \
+ __hash_algo, \
+ __salt, __salt_size, \
+ __iterations, \
+ __hash, __hash_size)
+
/* directories */
#define weechat_mkdir_home(__directory, __mode) \
(weechat_plugin->mkdir_home)(__directory, __mode)
@@ -1279,9 +1337,11 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
(weechat_plugin->mkdir)(__directory, __mode)
#define weechat_mkdir_parents(__directory, __mode) \
(weechat_plugin->mkdir_parents)(__directory, __mode)
-#define weechat_exec_on_files(__directory, __hidden_files, __callback, \
+#define weechat_exec_on_files(__directory, __recurse_subdirs, \
+ __hidden_files, __callback, \
__callback_data) \
- (weechat_plugin->exec_on_files)(__directory, __hidden_files, \
+ (weechat_plugin->exec_on_files)(__directory, __recurse_subdirs, \
+ __hidden_files, \
__callback, __callback_data)
#define weechat_file_get_content(__filename) \
(weechat_plugin->file_get_content)(__filename)
@@ -1321,6 +1381,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
(weechat_plugin->list_prev)(__item)
#define weechat_list_string(__item) \
(weechat_plugin->list_string)(__item)
+#define weechat_list_user_data(__item) \
+ (weechat_plugin->list_user_data)(__item)
#define weechat_list_size(__list) \
(weechat_plugin->list_size)(__list)
#define weechat_list_remove(__list, __item) \
@@ -1397,6 +1459,11 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
(weechat_plugin->hashtable_add_to_infolist)(__hashtable, \
__infolist_item, \
__prefix)
+#define weechat_hashtable_add_from_infolist(__hashtable, __infolist, \
+ __prefix) \
+ (weechat_plugin->hashtable_add_from_infolist)(__hashtable, \
+ __infolist, \
+ __prefix)
#define weechat_hashtable_remove(__hashtable, __key) \
(weechat_plugin->hashtable_remove)(__hashtable, __key)
#define weechat_hashtable_remove_all(__hashtable) \
@@ -1633,6 +1700,11 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__gnutls_priorities, \
__local_hostname, \
__callback, __pointer, __data)
+#define weechat_hook_line(_buffer_type, __buffer_name, __tags, \
+ __callback, __pointer, __data) \
+ (weechat_plugin->hook_line)(weechat_plugin, _buffer_type, \
+ __buffer_name, __tags, __callback, \
+ __pointer, __data)
#define weechat_hook_print(__buffer, __tags, __msg, __strip__colors, \
__callback, __pointer, __data) \
(weechat_plugin->hook_print)(weechat_plugin, __buffer, __tags, \
@@ -1866,6 +1938,9 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
/* command */
#define weechat_command(__buffer, __command) \
(weechat_plugin->command)(weechat_plugin, __buffer, __command)
+#define weechat_command_options(__buffer, __command, __options) \
+ (weechat_plugin->command_options)(weechat_plugin, __buffer, \
+ __command, __options)
/* network */
#define weechat_network_pass_proxy(__proxy, __sock, __address, __port) \