mirror of
https://github.com/weechat/weechat.git
synced 2026-06-24 20:06:38 +02:00
Partial migration of Perl plugin to new API
This commit is contained in:
+109
-45
@@ -23,8 +23,29 @@
|
||||
#define __WEECHAT_SCRIPT_H 1
|
||||
|
||||
/* constants which defines return types for weechat_<lang>_exec functions */
|
||||
#define SCRIPT_EXEC_INT 1
|
||||
#define SCRIPT_EXEC_STRING 2
|
||||
#define WEECHAT_SCRIPT_EXEC_INT 1
|
||||
#define WEECHAT_SCRIPT_EXEC_STRING 2
|
||||
|
||||
#define WEECHAT_SCRIPT_MSG_NOT_INITIALIZED(__language, __function) \
|
||||
weechat_printf (NULL, \
|
||||
weechat_gettext("%s%s: unable to call function " \
|
||||
"\"%s\", script is not " \
|
||||
"initialized"), \
|
||||
weechat_prefix ("error"), __language, __function)
|
||||
#define WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS(__language, __function) \
|
||||
weechat_printf (NULL, \
|
||||
weechat_gettext("%s%s: wrong arguments for " \
|
||||
"function \"%s\""), \
|
||||
weechat_prefix ("error"), __language, __function)
|
||||
|
||||
struct t_script_hook
|
||||
{
|
||||
struct t_hook *hook; /* pointer to hook */
|
||||
char *function; /* script function called */
|
||||
void *script; /* pointer to script */
|
||||
struct t_script_hook *prev_hook; /* link to next script hook */
|
||||
struct t_script_hook *next_hook; /* link to previous hook */
|
||||
};
|
||||
|
||||
struct t_plugin_script
|
||||
{
|
||||
@@ -37,69 +58,112 @@ struct t_plugin_script
|
||||
char *shutdown_func; /* function when script is unloaded*/
|
||||
char *charset; /* script charset */
|
||||
|
||||
struct t_script_hook *hooks; /* hooks for script */
|
||||
|
||||
struct t_plugin_script *prev_script; /* link to previous script */
|
||||
struct t_plugin_script *next_script; /* link to next script */
|
||||
};
|
||||
|
||||
extern void weechat_script_auto_load (struct t_weechat_plugin *plugin, char *language,
|
||||
extern char *weechat_script_pointer_to_string (void *pointer);
|
||||
extern void *weechat_script_string_to_pointer (char *pointer_str);
|
||||
extern void weechat_script_auto_load (struct t_weechat_plugin *weechat_plugin,
|
||||
char *language,
|
||||
int (*callback)(void *data, char *filename));
|
||||
extern struct t_plugin_script *weechat_script_search (struct t_weechat_plugin *plugin,
|
||||
extern struct t_plugin_script *weechat_script_search (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **list,
|
||||
char *name);
|
||||
extern char *weechat_script_search_full_name (struct t_weechat_plugin *plugin,
|
||||
extern char *weechat_script_search_full_name (struct t_weechat_plugin *weechat_plugin,
|
||||
char *language, char *filename);
|
||||
extern struct t_plugin_script *weechat_script_add (struct t_weechat_plugin *plugin,
|
||||
extern struct t_plugin_script *weechat_script_add (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **script_list,
|
||||
char *filename, char *name,
|
||||
char *version,
|
||||
char *shutdown_func,
|
||||
char *description,
|
||||
char *charset);
|
||||
extern void weechat_script_remove (struct t_weechat_plugin *plugin,
|
||||
extern void weechat_script_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **script_list,
|
||||
struct t_plugin_script *script);
|
||||
extern void weechat_script_print (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *server, char *channel,
|
||||
char *message, ...);
|
||||
extern void weechat_script_print_server (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *message, ...);
|
||||
extern void weechat_script_print_infobar (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
int delay, char *message, ...);
|
||||
extern void weechat_script_log (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *server, char *channel,
|
||||
char *message, ...);
|
||||
extern void weechat_script_exec_command (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *server, char *channel,
|
||||
char *command);
|
||||
extern void weechat_script_remove_handler (struct t_weechat_plugin *plugin,
|
||||
extern void weechat_script_charset_set (struct t_plugin_script *script,
|
||||
char *charset);
|
||||
extern void weechat_script_printf (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_buffer *buffer,
|
||||
char *format, ...);
|
||||
extern void weechat_script_infobar_printf (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *arg1, char *arg2);
|
||||
extern void weechat_script_remove_timer_handler (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *function);
|
||||
extern void weechat_script_remove_keyboard_handler (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *function);
|
||||
extern void weechat_script_remove_event_handler (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *function);
|
||||
extern void weechat_script_remove_modifier (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *arg1, char *arg2,
|
||||
char *arg3);
|
||||
extern char *weechat_script_get_plugin_config (struct t_weechat_plugin *plugin,
|
||||
int delay, char *color_name,
|
||||
char *format, ...);
|
||||
extern void weechat_script_log_printf (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *format, ...);
|
||||
extern int weechat_script_hook_command (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *command, char *description,
|
||||
char *args, char *args_description,
|
||||
char *completion,
|
||||
int (*callback)(void *data,
|
||||
struct t_gui_buffer *buffer,
|
||||
int argc, char **argv,
|
||||
char **argv_eol),
|
||||
char *function);
|
||||
extern int weechat_script_hook_timer (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
int interval, int align_second,
|
||||
int max_calls,
|
||||
int (*callback)(void *data),
|
||||
char *function);
|
||||
extern int weechat_script_hook_fd (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
int fd, int flag_read, int flag_write,
|
||||
int flag_exception,
|
||||
int (*callback)(void *data),
|
||||
char *function);
|
||||
extern int weechat_script_hook_print (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_buffer *buffer,
|
||||
char *message, int strip_colors,
|
||||
int (*callback)(void *data,
|
||||
struct t_gui_buffer *buffer,
|
||||
time_t date,
|
||||
char *prefix,
|
||||
char *message),
|
||||
char *function);
|
||||
extern int weechat_script_hook_signal (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *signal,
|
||||
int (*callback)(void *data,
|
||||
char *signal,
|
||||
char *type_data,
|
||||
void *signal_data),
|
||||
char *function);
|
||||
extern int weechat_script_hook_config (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *type, char *option,
|
||||
int (*callback)(void *data, char *type,
|
||||
char *option,
|
||||
char *value),
|
||||
char *function);
|
||||
extern int weechat_script_hook_completion (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *completion,
|
||||
int (*callback)(void *data,
|
||||
char *completion,
|
||||
struct t_gui_buffer *buffer,
|
||||
struct t_weelist *list),
|
||||
char *function);
|
||||
extern void weechat_script_unhook (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_hook *hook);
|
||||
extern void weechat_script_command (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_gui_buffer *buffer,
|
||||
char *command);
|
||||
extern char *weechat_script_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *option);
|
||||
extern int weechat_script_set_plugin_config (struct t_weechat_plugin *plugin,
|
||||
extern int weechat_script_config_set_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *option, char *value);
|
||||
extern void weechat_script_set_charset (struct t_weechat_plugin *plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *charset);
|
||||
|
||||
#endif /* script.h */
|
||||
|
||||
Reference in New Issue
Block a user