1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 07:16:37 +02:00

Changes in plugins and scripts plugins:

- get_info("version") now returns only version
- added get_config() function to read config options
This commit is contained in:
Sebastien Helleu
2005-10-17 14:30:03 +00:00
parent b2ec60110c
commit 357d7c5a2f
8 changed files with 502 additions and 92 deletions
+136 -31
View File
@@ -644,6 +644,9 @@ plugin_load (char *filename)
new_plugin->version = strdup (version);
/* functions */
new_plugin->ascii_strcasecmp = &weechat_ascii_strcasecmp;
new_plugin->explode_string = &weechat_explode_string;
new_plugin->free_exploded_string = &weechat_free_exploded_string;
new_plugin->mkdir_home = &weechat_plugin_mkdir_home;
new_plugin->exec_on_files = &weechat_plugin_exec_on_files;
new_plugin->msg_handler_add = &weechat_plugin_msg_handler_add;
@@ -659,9 +662,7 @@ plugin_load (char *filename)
new_plugin->get_info = &weechat_plugin_get_info;
new_plugin->get_dcc_info = &weechat_plugin_get_dcc_info;
new_plugin->free_dcc_info = &weechat_plugin_free_dcc_info;
new_plugin->explode_string = &weechat_explode_string;
new_plugin->free_exploded_string = &weechat_free_exploded_string;
new_plugin->ascii_strcasecmp = &weechat_ascii_strcasecmp;
new_plugin->get_config = &weechat_plugin_get_config;
/* handlers */
new_plugin->msg_handlers = NULL;
@@ -918,6 +919,51 @@ plugin_end ()
/*************************** Public plugin interface **************************/
/*
* weechat_ascii_strcasecmp: locale and case independent string comparison
*/
int
weechat_ascii_strcasecmp (t_weechat_plugin *plugin,
char *string1, char *string2)
{
/* make gcc happy */
(void) plugin;
return ascii_strcasecmp (string1, string2);
}
/*
* weechat_explode_string: explode a string
*/
char **
weechat_explode_string (t_weechat_plugin *plugin, char *string,
char *separators, int num_items_max,
int *num_items)
{
/* make gcc happy */
(void) plugin;
if (!plugin || !string || !separators || !num_items)
return NULL;
return explode_string (string, separators, num_items_max, num_items);
}
/*
* weechat_free_exploded_string: free exploded string
*/
void
weechat_free_exploded_string (t_weechat_plugin *plugin, char **exploded_string)
{
/* make gcc happy */
(void) plugin;
free_exploded_string (exploded_string);
}
/*
* weechat_plugin_mkdir_home: create a directory for script in WeeChat home
*/
@@ -1151,7 +1197,7 @@ weechat_plugin_get_info (t_weechat_plugin *plugin, char *info, char *server, cha
if (ascii_strcasecmp (info, "version") == 0)
{
return strdup (PACKAGE_STRING);
return strdup (PACKAGE_VERSION);
}
else if (ascii_strcasecmp (info, "nick") == 0)
{
@@ -1291,46 +1337,105 @@ weechat_plugin_free_dcc_info (t_weechat_plugin *plugin, t_plugin_dcc_info *dcc_i
}
/*
* weechat_explode_string: explode a string
* weechat_plugin_get_config_str_value: return string value for any option
* This function should never be called directly
* (only used by weechat_get_config)
*/
char **
weechat_explode_string (t_weechat_plugin *plugin, char *string,
char *separators, int num_items_max,
int *num_items)
char *
weechat_plugin_get_config_str_value (t_config_option *option, void *value)
{
/* make gcc happy */
(void) plugin;
char buf_temp[1024], *color_name;
if (!plugin || !string || !separators || !num_items)
return NULL;
if (!value)
{
if (option->option_type == OPTION_TYPE_STRING)
value = option->ptr_string;
else
value = option->ptr_int;
}
return explode_string (string, separators, num_items_max, num_items);
switch (option->option_type)
{
case OPTION_TYPE_BOOLEAN:
return (*((int *)value)) ?
strdup ("on") : strdup ("off");
break;
case OPTION_TYPE_INT:
snprintf (buf_temp, sizeof (buf_temp), "%d",
*((int *)value));
return strdup (buf_temp);
break;
case OPTION_TYPE_INT_WITH_STRING:
return option->array_values[*((int *)value)];
break;
case OPTION_TYPE_COLOR:
color_name = gui_get_color_by_value (*((int *)value));
return (color_name) ? strdup (color_name) : strdup ("");
break;
case OPTION_TYPE_STRING:
return (*((char **)value)) ? strdup (*((char **)value)) : strdup ("");
break;
}
/* should never be executed! */
return NULL;
}
/*
* weechat_free_exploded_string: free exploded string
* weechat_get_config: get value of a config option
*/
void
weechat_free_exploded_string (t_weechat_plugin *plugin, char **exploded_string)
char *
weechat_plugin_get_config (t_weechat_plugin *plugin, char *option)
{
int i, j;
t_irc_server *ptr_server;
char option_name[256];
void *ptr_option_value;
/* make gcc happy */
(void) plugin;
free_exploded_string (exploded_string);
}
/*
* weechat_ascii_strcasecmp: locale and case independent string comparison
*/
int
weechat_ascii_strcasecmp (t_weechat_plugin *plugin,
char *string1, char *string2)
{
/* make gcc happy */
(void) plugin;
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
if ((!option) ||
((option) && (option[0])
&& (strstr (weechat_options[i][j].option_name, option) != NULL)))
{
return weechat_plugin_get_config_str_value (&weechat_options[i][j], NULL);
}
}
}
}
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
{
snprintf (option_name, sizeof (option_name), "%s.%s",
ptr_server->name,
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
if ((!option) ||
((option) && (option[0])
&& (strstr (option_name, option) != NULL)))
{
ptr_option_value = config_get_server_option_ptr (ptr_server,
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
if (ptr_option_value)
{
return weechat_plugin_get_config_str_value (&weechat_options[CONFIG_SECTION_SERVER][i],
ptr_option_value);
}
}
}
}
return ascii_strcasecmp (string1, string2);
/* option not found */
return NULL;
}
+39
View File
@@ -451,6 +451,44 @@ static XS (XS_weechat_get_dcc_info)
XSRETURN (dcc_count);
}
/*
* weechat::get_config: get value of a config option
*/
static XS (XS_weechat_get_config)
{
char *option, *value;
unsigned int integer;
dXSARGS;
/* make gcc happy */
(void) cv;
if (items != 1)
{
perl_plugin->printf_server (perl_plugin,
"Perl error: wrong parameters for "
"\"get_config\" function");
XSRETURN_NO;
}
option = SvPV (ST (0), integer);
if (option)
{
value = perl_plugin->get_config (perl_plugin, option);
if (value)
{
XST_mPV (0, value);
free (value);
}
else
XST_mPV (0, "");
}
XSRETURN (1);
}
/*
* weechat_perl_xs_init: initialize subroutines
*/
@@ -468,6 +506,7 @@ weechat_perl_xs_init (pTHX)
newXS ("weechat::add_command_handler", XS_weechat_add_command_handler, "weechat");
newXS ("weechat::get_info", XS_weechat_get_info, "weechat");
newXS ("weechat::get_dcc_info", XS_weechat_get_dcc_info, "weechat");
newXS ("weechat::get_config", XS_weechat_get_config, "weechat");
}
/*
@@ -456,6 +456,44 @@ weechat_python_get_dcc_info (PyObject *self, PyObject *args)
return list;
}
/*
* weechat.get_config: get value of a config option
*/
static PyObject *
weechat_python_get_config (PyObject *self, PyObject *args)
{
char *option, *value;
PyObject *object;
/* make gcc happy */
(void) self;
if (!PyArg_ParseTuple (args, "s", &option))
{
python_plugin->printf_server (python_plugin,
"Python error: wrong parameters for "
"\"get_config\" function");
return NULL;
}
if (option)
{
value = python_plugin->get_config (python_plugin, option);
if (value)
{
object = Py_BuildValue ("s", value);
free (value);
return object;
}
else
return Py_BuildValue ("s", "");
}
return Py_BuildValue ("i", 1);
}
/*
* Python subroutines
@@ -471,6 +509,7 @@ PyMethodDef weechat_funcs[] = {
{ "add_command_handler", weechat_python_add_command_handler, METH_VARARGS, "" },
{ "get_info", weechat_python_get_info, METH_VARARGS, "" },
{ "get_dcc_info", weechat_python_get_dcc_info, METH_VARARGS, "" },
{ "get_config", weechat_python_get_config, METH_VARARGS, "" },
{ NULL, NULL, 0, NULL }
};
+37 -15
View File
@@ -99,10 +99,29 @@ struct t_weechat_plugin
char *description; /* plugin description */
char *version; /* plugin version */
/* plugin handlers */
t_plugin_msg_handler *msg_handlers; /* IRC message handlers */
t_plugin_msg_handler *last_msg_handler;
t_plugin_cmd_handler *cmd_handlers; /* command handlers */
t_plugin_cmd_handler *last_cmd_handler;
/* links to previous/next plugins */
t_weechat_plugin *prev_plugin; /* link to previous plugin */
t_weechat_plugin *next_plugin; /* link to next plugin */
/* plugin functions (interface) */
/* IMPORTANT NOTE for WeeChat developers: always add new interface functions
at the END of functions, for keeping backward compatibility with
existing plugins */
int (*ascii_strcasecmp) (t_weechat_plugin *, char *, char *);
char **(*explode_string) (t_weechat_plugin *, char *, char *, int, int *);
void (*free_exploded_string) (t_weechat_plugin *, char **);
int (*mkdir_home) (t_weechat_plugin *, char *);
void (*exec_on_files) (t_weechat_plugin *, char *,
int (*)(t_weechat_plugin *, char *));
t_plugin_msg_handler *(*msg_handler_add) (t_weechat_plugin *, char *,
t_plugin_handler_func *,
char *, void *);
@@ -114,31 +133,30 @@ struct t_weechat_plugin
char *, void *);
void (*cmd_handler_remove) (t_weechat_plugin *, t_plugin_cmd_handler *);
void (*cmd_handler_remove_all) (t_weechat_plugin *);
void (*printf) (t_weechat_plugin *, char *, char *, char *, ...);
void (*printf_server) (t_weechat_plugin *, char *, ...);
void (*infobar_printf) (t_weechat_plugin *, int, char *, ...);
void (*exec_command) (t_weechat_plugin *, char *, char *, char *);
char *(*get_info) (t_weechat_plugin *, char *, char *, char *);
t_plugin_dcc_info *(*get_dcc_info) (t_weechat_plugin *);
void (*free_dcc_info) (t_weechat_plugin *, t_plugin_dcc_info *);
char **(*explode_string) (t_weechat_plugin *, char *, char *, int, int *);
void (*free_exploded_string) (t_weechat_plugin *, char **);
int (*ascii_strcasecmp) (t_weechat_plugin *, char *, char *);
/* plugin handlers */
t_plugin_msg_handler *msg_handlers; /* IRC message handlers */
t_plugin_msg_handler *last_msg_handler;
t_plugin_cmd_handler *cmd_handlers; /* command handlers */
t_plugin_cmd_handler *last_cmd_handler;
/* links to previous/next plugins */
t_weechat_plugin *prev_plugin; /* link to previous plugin */
t_weechat_plugin *next_plugin; /* link to next plugin */
char *(*get_config) (t_weechat_plugin *, char *);
/* WeeChat developers: ALWAYS add new functions at the end */
};
/* general useful functions */
extern int weechat_ascii_strcasecmp (t_weechat_plugin *,char *, char *);
extern char **weechat_explode_string (t_weechat_plugin *, char *, char *, int, int *);
extern void weechat_free_exploded_string (t_weechat_plugin *, char **);
extern int weechat_plugin_mkdir_home (t_weechat_plugin *, char *);
extern void weechat_plugin_exec_on_files (t_weechat_plugin *, char *,
int (*)(t_weechat_plugin *, char *));
/* handler functions */
extern t_plugin_msg_handler *weechat_plugin_msg_handler_add (t_weechat_plugin *, char *,
t_plugin_handler_func *,
char *, void *);
@@ -150,15 +168,19 @@ extern t_plugin_cmd_handler *weechat_plugin_cmd_handler_add (t_weechat_plugin *,
char *, void *);
extern void weechat_plugin_cmd_handler_remove (t_weechat_plugin *, t_plugin_cmd_handler *);
extern void weechat_plugin_cmd_handler_remove_all (t_weechat_plugin *);
/* display functions */
extern void weechat_plugin_printf (t_weechat_plugin *, char *, char *, char *, ...);
extern void weechat_plugin_printf_server (t_weechat_plugin *, char *, ...);
extern void weechat_plugin_infobar_printf (t_weechat_plugin *, int, char *, ...);
/* IRC functions */
extern void weechat_plugin_exec_command (t_weechat_plugin *, char *, char *, char *);
extern char *weechat_plugin_get_info (t_weechat_plugin *, char *, char *, char *);
extern t_plugin_dcc_info *weechat_plugin_get_dcc_info (t_weechat_plugin *);
extern void weechat_plugin_free_dcc_info (t_weechat_plugin *, t_plugin_dcc_info *);
extern char **weechat_explode_string (t_weechat_plugin *, char *, char *, int, int *);
extern void weechat_free_exploded_string (t_weechat_plugin *, char **);
extern int weechat_ascii_strcasecmp (t_weechat_plugin *,char *, char *);
/* other functions */
extern char *weechat_plugin_get_config (t_weechat_plugin *, char *);
#endif /* weechat-plugin.h */
+136 -31
View File
@@ -644,6 +644,9 @@ plugin_load (char *filename)
new_plugin->version = strdup (version);
/* functions */
new_plugin->ascii_strcasecmp = &weechat_ascii_strcasecmp;
new_plugin->explode_string = &weechat_explode_string;
new_plugin->free_exploded_string = &weechat_free_exploded_string;
new_plugin->mkdir_home = &weechat_plugin_mkdir_home;
new_plugin->exec_on_files = &weechat_plugin_exec_on_files;
new_plugin->msg_handler_add = &weechat_plugin_msg_handler_add;
@@ -659,9 +662,7 @@ plugin_load (char *filename)
new_plugin->get_info = &weechat_plugin_get_info;
new_plugin->get_dcc_info = &weechat_plugin_get_dcc_info;
new_plugin->free_dcc_info = &weechat_plugin_free_dcc_info;
new_plugin->explode_string = &weechat_explode_string;
new_plugin->free_exploded_string = &weechat_free_exploded_string;
new_plugin->ascii_strcasecmp = &weechat_ascii_strcasecmp;
new_plugin->get_config = &weechat_plugin_get_config;
/* handlers */
new_plugin->msg_handlers = NULL;
@@ -918,6 +919,51 @@ plugin_end ()
/*************************** Public plugin interface **************************/
/*
* weechat_ascii_strcasecmp: locale and case independent string comparison
*/
int
weechat_ascii_strcasecmp (t_weechat_plugin *plugin,
char *string1, char *string2)
{
/* make gcc happy */
(void) plugin;
return ascii_strcasecmp (string1, string2);
}
/*
* weechat_explode_string: explode a string
*/
char **
weechat_explode_string (t_weechat_plugin *plugin, char *string,
char *separators, int num_items_max,
int *num_items)
{
/* make gcc happy */
(void) plugin;
if (!plugin || !string || !separators || !num_items)
return NULL;
return explode_string (string, separators, num_items_max, num_items);
}
/*
* weechat_free_exploded_string: free exploded string
*/
void
weechat_free_exploded_string (t_weechat_plugin *plugin, char **exploded_string)
{
/* make gcc happy */
(void) plugin;
free_exploded_string (exploded_string);
}
/*
* weechat_plugin_mkdir_home: create a directory for script in WeeChat home
*/
@@ -1151,7 +1197,7 @@ weechat_plugin_get_info (t_weechat_plugin *plugin, char *info, char *server, cha
if (ascii_strcasecmp (info, "version") == 0)
{
return strdup (PACKAGE_STRING);
return strdup (PACKAGE_VERSION);
}
else if (ascii_strcasecmp (info, "nick") == 0)
{
@@ -1291,46 +1337,105 @@ weechat_plugin_free_dcc_info (t_weechat_plugin *plugin, t_plugin_dcc_info *dcc_i
}
/*
* weechat_explode_string: explode a string
* weechat_plugin_get_config_str_value: return string value for any option
* This function should never be called directly
* (only used by weechat_get_config)
*/
char **
weechat_explode_string (t_weechat_plugin *plugin, char *string,
char *separators, int num_items_max,
int *num_items)
char *
weechat_plugin_get_config_str_value (t_config_option *option, void *value)
{
/* make gcc happy */
(void) plugin;
char buf_temp[1024], *color_name;
if (!plugin || !string || !separators || !num_items)
return NULL;
if (!value)
{
if (option->option_type == OPTION_TYPE_STRING)
value = option->ptr_string;
else
value = option->ptr_int;
}
return explode_string (string, separators, num_items_max, num_items);
switch (option->option_type)
{
case OPTION_TYPE_BOOLEAN:
return (*((int *)value)) ?
strdup ("on") : strdup ("off");
break;
case OPTION_TYPE_INT:
snprintf (buf_temp, sizeof (buf_temp), "%d",
*((int *)value));
return strdup (buf_temp);
break;
case OPTION_TYPE_INT_WITH_STRING:
return option->array_values[*((int *)value)];
break;
case OPTION_TYPE_COLOR:
color_name = gui_get_color_by_value (*((int *)value));
return (color_name) ? strdup (color_name) : strdup ("");
break;
case OPTION_TYPE_STRING:
return (*((char **)value)) ? strdup (*((char **)value)) : strdup ("");
break;
}
/* should never be executed! */
return NULL;
}
/*
* weechat_free_exploded_string: free exploded string
* weechat_get_config: get value of a config option
*/
void
weechat_free_exploded_string (t_weechat_plugin *plugin, char **exploded_string)
char *
weechat_plugin_get_config (t_weechat_plugin *plugin, char *option)
{
int i, j;
t_irc_server *ptr_server;
char option_name[256];
void *ptr_option_value;
/* make gcc happy */
(void) plugin;
free_exploded_string (exploded_string);
}
/*
* weechat_ascii_strcasecmp: locale and case independent string comparison
*/
int
weechat_ascii_strcasecmp (t_weechat_plugin *plugin,
char *string1, char *string2)
{
/* make gcc happy */
(void) plugin;
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
if ((!option) ||
((option) && (option[0])
&& (strstr (weechat_options[i][j].option_name, option) != NULL)))
{
return weechat_plugin_get_config_str_value (&weechat_options[i][j], NULL);
}
}
}
}
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
{
snprintf (option_name, sizeof (option_name), "%s.%s",
ptr_server->name,
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
if ((!option) ||
((option) && (option[0])
&& (strstr (option_name, option) != NULL)))
{
ptr_option_value = config_get_server_option_ptr (ptr_server,
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
if (ptr_option_value)
{
return weechat_plugin_get_config_str_value (&weechat_options[CONFIG_SECTION_SERVER][i],
ptr_option_value);
}
}
}
}
return ascii_strcasecmp (string1, string2);
/* option not found */
return NULL;
}
@@ -451,6 +451,44 @@ static XS (XS_weechat_get_dcc_info)
XSRETURN (dcc_count);
}
/*
* weechat::get_config: get value of a config option
*/
static XS (XS_weechat_get_config)
{
char *option, *value;
unsigned int integer;
dXSARGS;
/* make gcc happy */
(void) cv;
if (items != 1)
{
perl_plugin->printf_server (perl_plugin,
"Perl error: wrong parameters for "
"\"get_config\" function");
XSRETURN_NO;
}
option = SvPV (ST (0), integer);
if (option)
{
value = perl_plugin->get_config (perl_plugin, option);
if (value)
{
XST_mPV (0, value);
free (value);
}
else
XST_mPV (0, "");
}
XSRETURN (1);
}
/*
* weechat_perl_xs_init: initialize subroutines
*/
@@ -468,6 +506,7 @@ weechat_perl_xs_init (pTHX)
newXS ("weechat::add_command_handler", XS_weechat_add_command_handler, "weechat");
newXS ("weechat::get_info", XS_weechat_get_info, "weechat");
newXS ("weechat::get_dcc_info", XS_weechat_get_dcc_info, "weechat");
newXS ("weechat::get_config", XS_weechat_get_config, "weechat");
}
/*
@@ -456,6 +456,44 @@ weechat_python_get_dcc_info (PyObject *self, PyObject *args)
return list;
}
/*
* weechat.get_config: get value of a config option
*/
static PyObject *
weechat_python_get_config (PyObject *self, PyObject *args)
{
char *option, *value;
PyObject *object;
/* make gcc happy */
(void) self;
if (!PyArg_ParseTuple (args, "s", &option))
{
python_plugin->printf_server (python_plugin,
"Python error: wrong parameters for "
"\"get_config\" function");
return NULL;
}
if (option)
{
value = python_plugin->get_config (python_plugin, option);
if (value)
{
object = Py_BuildValue ("s", value);
free (value);
return object;
}
else
return Py_BuildValue ("s", "");
}
return Py_BuildValue ("i", 1);
}
/*
* Python subroutines
@@ -471,6 +509,7 @@ PyMethodDef weechat_funcs[] = {
{ "add_command_handler", weechat_python_add_command_handler, METH_VARARGS, "" },
{ "get_info", weechat_python_get_info, METH_VARARGS, "" },
{ "get_dcc_info", weechat_python_get_dcc_info, METH_VARARGS, "" },
{ "get_config", weechat_python_get_config, METH_VARARGS, "" },
{ NULL, NULL, 0, NULL }
};
+37 -15
View File
@@ -99,10 +99,29 @@ struct t_weechat_plugin
char *description; /* plugin description */
char *version; /* plugin version */
/* plugin handlers */
t_plugin_msg_handler *msg_handlers; /* IRC message handlers */
t_plugin_msg_handler *last_msg_handler;
t_plugin_cmd_handler *cmd_handlers; /* command handlers */
t_plugin_cmd_handler *last_cmd_handler;
/* links to previous/next plugins */
t_weechat_plugin *prev_plugin; /* link to previous plugin */
t_weechat_plugin *next_plugin; /* link to next plugin */
/* plugin functions (interface) */
/* IMPORTANT NOTE for WeeChat developers: always add new interface functions
at the END of functions, for keeping backward compatibility with
existing plugins */
int (*ascii_strcasecmp) (t_weechat_plugin *, char *, char *);
char **(*explode_string) (t_weechat_plugin *, char *, char *, int, int *);
void (*free_exploded_string) (t_weechat_plugin *, char **);
int (*mkdir_home) (t_weechat_plugin *, char *);
void (*exec_on_files) (t_weechat_plugin *, char *,
int (*)(t_weechat_plugin *, char *));
t_plugin_msg_handler *(*msg_handler_add) (t_weechat_plugin *, char *,
t_plugin_handler_func *,
char *, void *);
@@ -114,31 +133,30 @@ struct t_weechat_plugin
char *, void *);
void (*cmd_handler_remove) (t_weechat_plugin *, t_plugin_cmd_handler *);
void (*cmd_handler_remove_all) (t_weechat_plugin *);
void (*printf) (t_weechat_plugin *, char *, char *, char *, ...);
void (*printf_server) (t_weechat_plugin *, char *, ...);
void (*infobar_printf) (t_weechat_plugin *, int, char *, ...);
void (*exec_command) (t_weechat_plugin *, char *, char *, char *);
char *(*get_info) (t_weechat_plugin *, char *, char *, char *);
t_plugin_dcc_info *(*get_dcc_info) (t_weechat_plugin *);
void (*free_dcc_info) (t_weechat_plugin *, t_plugin_dcc_info *);
char **(*explode_string) (t_weechat_plugin *, char *, char *, int, int *);
void (*free_exploded_string) (t_weechat_plugin *, char **);
int (*ascii_strcasecmp) (t_weechat_plugin *, char *, char *);
/* plugin handlers */
t_plugin_msg_handler *msg_handlers; /* IRC message handlers */
t_plugin_msg_handler *last_msg_handler;
t_plugin_cmd_handler *cmd_handlers; /* command handlers */
t_plugin_cmd_handler *last_cmd_handler;
/* links to previous/next plugins */
t_weechat_plugin *prev_plugin; /* link to previous plugin */
t_weechat_plugin *next_plugin; /* link to next plugin */
char *(*get_config) (t_weechat_plugin *, char *);
/* WeeChat developers: ALWAYS add new functions at the end */
};
/* general useful functions */
extern int weechat_ascii_strcasecmp (t_weechat_plugin *,char *, char *);
extern char **weechat_explode_string (t_weechat_plugin *, char *, char *, int, int *);
extern void weechat_free_exploded_string (t_weechat_plugin *, char **);
extern int weechat_plugin_mkdir_home (t_weechat_plugin *, char *);
extern void weechat_plugin_exec_on_files (t_weechat_plugin *, char *,
int (*)(t_weechat_plugin *, char *));
/* handler functions */
extern t_plugin_msg_handler *weechat_plugin_msg_handler_add (t_weechat_plugin *, char *,
t_plugin_handler_func *,
char *, void *);
@@ -150,15 +168,19 @@ extern t_plugin_cmd_handler *weechat_plugin_cmd_handler_add (t_weechat_plugin *,
char *, void *);
extern void weechat_plugin_cmd_handler_remove (t_weechat_plugin *, t_plugin_cmd_handler *);
extern void weechat_plugin_cmd_handler_remove_all (t_weechat_plugin *);
/* display functions */
extern void weechat_plugin_printf (t_weechat_plugin *, char *, char *, char *, ...);
extern void weechat_plugin_printf_server (t_weechat_plugin *, char *, ...);
extern void weechat_plugin_infobar_printf (t_weechat_plugin *, int, char *, ...);
/* IRC functions */
extern void weechat_plugin_exec_command (t_weechat_plugin *, char *, char *, char *);
extern char *weechat_plugin_get_info (t_weechat_plugin *, char *, char *, char *);
extern t_plugin_dcc_info *weechat_plugin_get_dcc_info (t_weechat_plugin *);
extern void weechat_plugin_free_dcc_info (t_weechat_plugin *, t_plugin_dcc_info *);
extern char **weechat_explode_string (t_weechat_plugin *, char *, char *, int, int *);
extern void weechat_free_exploded_string (t_weechat_plugin *, char **);
extern int weechat_ascii_strcasecmp (t_weechat_plugin *,char *, char *);
/* other functions */
extern char *weechat_plugin_get_config (t_weechat_plugin *, char *);
#endif /* weechat-plugin.h */