mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 04:46:37 +02:00
Added config files management in plugins API
This commit is contained in:
@@ -45,7 +45,7 @@ struct t_config_file *last_config_file = NULL;
|
||||
*/
|
||||
|
||||
struct t_config_file *
|
||||
config_file_new (char *filename)
|
||||
config_file_new (void *plugin, char *filename)
|
||||
{
|
||||
struct t_config_file *new_config_file;
|
||||
|
||||
@@ -55,6 +55,7 @@ config_file_new (char *filename)
|
||||
new_config_file = (struct t_config_file *)malloc (sizeof (struct t_config_file));
|
||||
if (new_config_file)
|
||||
{
|
||||
new_config_file->plugin = plugin;
|
||||
new_config_file->filename = strdup (filename);
|
||||
new_config_file->file = NULL;
|
||||
new_config_file->sections = NULL;
|
||||
@@ -78,9 +79,9 @@ config_file_new (char *filename)
|
||||
|
||||
struct t_config_section *
|
||||
config_file_new_section (struct t_config_file *config_file, char *name,
|
||||
void (*callback_read)(struct t_config_file *, char *, char *),
|
||||
void (*callback_write)(struct t_config_file *),
|
||||
void (*callback_write_default)(struct t_config_file *))
|
||||
void (*callback_read)(void *, char *, char *),
|
||||
void (*callback_write)(void *),
|
||||
void (*callback_write_default)(void *))
|
||||
{
|
||||
struct t_config_section *new_section;
|
||||
|
||||
@@ -392,6 +393,42 @@ config_file_search_option (struct t_config_file *config_file,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* config_file_option_valid_for_plugin: check if an option pointer exists for a plugin
|
||||
* return 1 if option exists for plugin
|
||||
* 0 if option is not found for plugin
|
||||
*/
|
||||
|
||||
int
|
||||
config_file_option_valid_for_plugin (void *plugin,
|
||||
struct t_config_option *option)
|
||||
{
|
||||
struct t_config_file *ptr_config;
|
||||
struct t_config_section *ptr_section;
|
||||
struct t_config_option *ptr_option;
|
||||
|
||||
for (ptr_config = config_files; ptr_config;
|
||||
ptr_config = ptr_config->next_config)
|
||||
{
|
||||
if (ptr_config->plugin == (struct t_weechat_plugin *)plugin)
|
||||
{
|
||||
for (ptr_section = ptr_config->sections; ptr_section;
|
||||
ptr_section = ptr_section->next_section)
|
||||
{
|
||||
for (ptr_option = ptr_section->options; ptr_option;
|
||||
ptr_option = ptr_option->next_option)
|
||||
{
|
||||
if (ptr_option == option)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* option not found */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* config_file_string_boolean_value: return boolean value of string
|
||||
* return -1 if error
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
struct t_config_file
|
||||
{
|
||||
struct t_weechat_plugin *plugin; /* plugin which created this cfg */
|
||||
char *filename; /* config filename (without path)*/
|
||||
FILE *file; /* file pointer */
|
||||
struct t_config_section *sections; /* config sections */
|
||||
@@ -49,12 +50,11 @@ struct t_config_section
|
||||
{
|
||||
char *name; /* section name */
|
||||
void (*callback_read) /* called when unknown option */
|
||||
(struct t_config_file *, /* is read from config file */
|
||||
char *, char *);
|
||||
(void *, char *, char *); /* is read from config file */
|
||||
void (*callback_write) /* called to write special */
|
||||
(struct t_config_file *); /* options in config file */
|
||||
(void *); /* options in config file */
|
||||
void (*callback_write_default) /* called to write default */
|
||||
(struct t_config_file *); /* options in config file */
|
||||
(void *); /* options in config file */
|
||||
struct t_config_option *options; /* options in section */
|
||||
struct t_config_option *last_option; /* last option in section */
|
||||
struct t_config_section *prev_section; /* link to previous section */
|
||||
@@ -84,12 +84,12 @@ struct t_config_option
|
||||
struct t_config_option *next_option; /* link to next option */
|
||||
};
|
||||
|
||||
extern struct t_config_file *config_file_new (char *);
|
||||
extern struct t_config_file *config_file_new (void *, char *);
|
||||
extern struct t_config_section *config_file_new_section (struct t_config_file *,
|
||||
char *,
|
||||
void (*)(struct t_config_file *, char *, char *),
|
||||
void (*)(struct t_config_file *),
|
||||
void (*)(struct t_config_file *));
|
||||
void (*)(void *, char *, char *),
|
||||
void (*)(void *),
|
||||
void (*)(void *));
|
||||
extern struct t_config_section *config_file_search_section (struct t_config_file *,
|
||||
char *);
|
||||
extern struct t_config_option *config_file_new_option_boolean (struct t_config_section *,
|
||||
@@ -117,6 +117,8 @@ extern struct t_config_option *config_file_new_option_color (struct t_config_sec
|
||||
extern struct t_config_option *config_file_search_option (struct t_config_file *,
|
||||
struct t_config_section *,
|
||||
char *);
|
||||
extern int config_file_option_valid_for_plugin (void *, struct t_config_option *);
|
||||
extern int config_file_string_boolean_value (char *);
|
||||
extern int config_file_option_set (struct t_config_option *, char *);
|
||||
extern int config_file_option_reset (struct t_config_option *);
|
||||
|
||||
|
||||
@@ -324,7 +324,7 @@ config_change_nicks_colors ()
|
||||
*/
|
||||
|
||||
void
|
||||
config_weechat_read_alias (struct t_config_file *config_file,
|
||||
config_weechat_read_alias (void *config_file,
|
||||
char *option_name, char *value)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
@@ -343,7 +343,7 @@ config_weechat_read_alias (struct t_config_file *config_file,
|
||||
*/
|
||||
|
||||
void
|
||||
config_weechat_read_key (struct t_config_file *config_file,
|
||||
config_weechat_read_key (void *config_file,
|
||||
char *option_name, char *value)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
@@ -368,7 +368,7 @@ config_weechat_read_key (struct t_config_file *config_file,
|
||||
*/
|
||||
|
||||
void
|
||||
config_weechat_write_alias (struct t_config_file *config_file)
|
||||
config_weechat_write_alias (void *config_file)
|
||||
{
|
||||
struct alias *ptr_alias;
|
||||
char *string;
|
||||
@@ -396,7 +396,7 @@ config_weechat_write_alias (struct t_config_file *config_file)
|
||||
*/
|
||||
|
||||
void
|
||||
config_weechat_write_alias_default_values (struct t_config_file *config_file)
|
||||
config_weechat_write_alias_default_values (void *config_file)
|
||||
{
|
||||
config_file_write_line (config_file, "SAY", "\"msg *\"");
|
||||
config_file_write_line (config_file, "BYE", "\"quit\"");
|
||||
@@ -431,7 +431,7 @@ config_weechat_write_alias_default_values (struct t_config_file *config_file)
|
||||
*/
|
||||
|
||||
void
|
||||
config_weechat_write_keys (struct t_config_file *config_file)
|
||||
config_weechat_write_keys (void *config_file)
|
||||
{
|
||||
t_gui_key *ptr_key;
|
||||
char *expanded_name, *function_name, *string;
|
||||
@@ -493,7 +493,7 @@ config_weechat_init ()
|
||||
{
|
||||
struct t_config_section *section;
|
||||
|
||||
weechat_config = config_file_new (WEECHAT_CONFIG_FILENAME);
|
||||
weechat_config = config_file_new (NULL, WEECHAT_CONFIG_FILENAME);
|
||||
if (weechat_config)
|
||||
{
|
||||
/* look */
|
||||
|
||||
@@ -141,8 +141,8 @@ demo_print_list (void *list, char *item_name)
|
||||
case 'i':
|
||||
weechat_printf (NULL, " %s: %d",
|
||||
argv[j] + 2,
|
||||
weechat_list_int (list,
|
||||
argv[j] + 2));
|
||||
weechat_list_integer (list,
|
||||
argv[j] + 2));
|
||||
break;
|
||||
case 's':
|
||||
weechat_printf (NULL, " %s: %s",
|
||||
|
||||
+280
-136
@@ -253,6 +253,276 @@ plugin_api_exec_on_files (struct t_weechat_plugin *plugin, char *directory,
|
||||
util_exec_on_files (directory, callback);
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_config_new: create new config file structure
|
||||
*/
|
||||
|
||||
struct t_config_file *
|
||||
plugin_api_config_new (struct t_weechat_plugin *plugin, char *filename)
|
||||
{
|
||||
return config_file_new (plugin, filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_config_new_section: create new section in a config
|
||||
*/
|
||||
|
||||
struct t_config_section *
|
||||
plugin_api_config_new_section (struct t_weechat_plugin *plugin,
|
||||
void *config_file, char *name,
|
||||
void (*callback_read)(void *, char *, char *),
|
||||
void (*callback_write)(void *),
|
||||
void (*callback_write_default)(void *))
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
return config_file_new_section (config_file, name, callback_read,
|
||||
callback_write, callback_write_default);
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_config_new_option: create new option in a config section
|
||||
*/
|
||||
|
||||
struct t_config_option *
|
||||
plugin_api_config_new_option (struct t_weechat_plugin *plugin,
|
||||
void *section, char *name, char *type,
|
||||
char *description, char *string_values,
|
||||
int min, int max, char *default_value,
|
||||
void (*callback_change)())
|
||||
|
||||
{
|
||||
long number;
|
||||
char *error;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
if (string_strcasecmp (type, "boolean") == 0)
|
||||
{
|
||||
return config_file_new_option_boolean (
|
||||
section, name, description,
|
||||
(config_file_string_boolean_value (default_value) == CONFIG_BOOLEAN_TRUE) ?
|
||||
CONFIG_BOOLEAN_TRUE : CONFIG_BOOLEAN_FALSE,
|
||||
callback_change);
|
||||
}
|
||||
if (string_strcasecmp (type, "integer") == 0)
|
||||
{
|
||||
error = NULL;
|
||||
number = strtol (default_value, &error, 10);
|
||||
if (error && (error[0] == '\0'))
|
||||
{
|
||||
if (string_values && string_values[0])
|
||||
return config_file_new_option_integer_with_string (
|
||||
section, name, description, string_values, number,
|
||||
callback_change);
|
||||
return config_file_new_option_integer (
|
||||
section, name, description, min, max, number,
|
||||
callback_change);
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
if (string_strcasecmp (type, "string") == 0)
|
||||
{
|
||||
return config_file_new_option_string (
|
||||
section, name, description, min, max, default_value,
|
||||
callback_change);
|
||||
}
|
||||
if (string_strcasecmp (type, "color") == 0)
|
||||
{
|
||||
return config_file_new_option_color (
|
||||
section, name, description, min, default_value,
|
||||
callback_change);
|
||||
}
|
||||
|
||||
/* unknown option type */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_config_boolean: return boolean value of an option
|
||||
*/
|
||||
|
||||
char
|
||||
plugin_api_config_boolean (struct t_weechat_plugin *plugin, void *option)
|
||||
{
|
||||
if (plugin && config_file_option_valid_for_plugin (plugin, option)
|
||||
&& (((struct t_config_option *)option)->type == CONFIG_OPTION_BOOLEAN))
|
||||
return CONFIG_BOOLEAN((struct t_config_option *)option);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_config_integer: return integer value of an option
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_api_config_integer (struct t_weechat_plugin *plugin, void *option)
|
||||
{
|
||||
if (plugin && config_file_option_valid_for_plugin (plugin, option)
|
||||
&& (((struct t_config_option *)option)->type == CONFIG_OPTION_INTEGER))
|
||||
return CONFIG_INTEGER((struct t_config_option *)option);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_config_string: return string value of an option
|
||||
*/
|
||||
|
||||
char *
|
||||
plugin_api_config_string (struct t_weechat_plugin *plugin, void *option)
|
||||
{
|
||||
if (plugin && config_file_option_valid_for_plugin (plugin, option)
|
||||
&& (((struct t_config_option *)option)->type == CONFIG_OPTION_STRING))
|
||||
return CONFIG_STRING((struct t_config_option *)option);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_config_color: return color value of an option
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_api_config_color (struct t_weechat_plugin *plugin, void *option)
|
||||
{
|
||||
if (plugin && config_file_option_valid_for_plugin (plugin, option)
|
||||
&& (((struct t_config_option *)option)->type == CONFIG_OPTION_COLOR))
|
||||
return CONFIG_COLOR((struct t_config_option *)option);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_get_config_str_value: return string value for any option
|
||||
* This function should never be called directly
|
||||
* (only used by weechat_get_config)
|
||||
*/
|
||||
|
||||
char *
|
||||
plugin_api_get_config_str_value (struct t_config_option *option)
|
||||
{
|
||||
char buf_temp[1024], *color_name;
|
||||
|
||||
switch (option->type)
|
||||
{
|
||||
case CONFIG_OPTION_BOOLEAN:
|
||||
return (CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ?
|
||||
strdup ("on") : strdup ("off");
|
||||
case CONFIG_OPTION_INTEGER:
|
||||
if (option->string_values)
|
||||
snprintf (buf_temp, sizeof (buf_temp), "%s",
|
||||
option->string_values[CONFIG_INTEGER(option)]);
|
||||
else
|
||||
snprintf (buf_temp, sizeof (buf_temp), "%d",
|
||||
CONFIG_INTEGER(option));
|
||||
return strdup (buf_temp);
|
||||
case CONFIG_OPTION_STRING:
|
||||
return strdup (CONFIG_STRING(option));
|
||||
case CONFIG_OPTION_COLOR:
|
||||
color_name = gui_color_get_name (CONFIG_INTEGER(option));
|
||||
return (color_name) ? strdup (color_name) : strdup ("");
|
||||
}
|
||||
|
||||
/* should never be executed! */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_config_get: get value of a WeeChat config option
|
||||
*/
|
||||
|
||||
char *
|
||||
plugin_api_config_get (struct t_weechat_plugin *plugin, char *option_name)
|
||||
{
|
||||
struct t_config_option *ptr_option;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
/* search WeeChat config option */
|
||||
ptr_option = config_file_search_option (weechat_config, NULL, option_name);
|
||||
if (ptr_option)
|
||||
return plugin_api_get_config_str_value (ptr_option);
|
||||
|
||||
/* option not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_config_set: set value of a config option
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_api_config_set (struct t_weechat_plugin *plugin, char *option_name,
|
||||
char *value)
|
||||
{
|
||||
struct t_config_option *ptr_option;
|
||||
int rc;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
if (!option_name || !value)
|
||||
return 0;
|
||||
|
||||
/* search and set WeeChat config option if found */
|
||||
ptr_option = config_file_search_option (weechat_config, NULL, option_name);
|
||||
if (ptr_option)
|
||||
{
|
||||
rc = config_file_option_set (ptr_option, value);
|
||||
if ((rc == 2) && (ptr_option->callback_change))
|
||||
(void) (ptr_option->callback_change) ();
|
||||
if (rc == 0)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* failed to set config option */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_plugin_config_get: get value of a plugin config option
|
||||
*/
|
||||
|
||||
char *
|
||||
plugin_api_plugin_config_get (struct t_weechat_plugin *plugin, char *option_name)
|
||||
{
|
||||
struct t_config_option *ptr_option;
|
||||
|
||||
if (!option_name)
|
||||
return NULL;
|
||||
|
||||
ptr_option = plugin_config_search (plugin->name, option_name);
|
||||
if (ptr_option)
|
||||
return (ptr_option->value) ? strdup (ptr_option->value) : NULL;
|
||||
|
||||
/* option not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_plugin_config_set: set value of a plugin config option
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_api_plugin_config_set (struct t_weechat_plugin *plugin,
|
||||
char *option_name, char *value)
|
||||
{
|
||||
if (!option_name)
|
||||
return 0;
|
||||
|
||||
if (plugin_config_set (plugin->name, option_name, value))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_prefix: return a prefix for display with printf
|
||||
*/
|
||||
@@ -835,21 +1105,21 @@ plugin_api_list_get_add_buffer (struct t_plugin_list *list,
|
||||
|
||||
if (!plugin_list_new_var_pointer (ptr_item, "pointer", buffer))
|
||||
return 0;
|
||||
if (!plugin_list_new_var_int (ptr_item, "number", buffer->number))
|
||||
if (!plugin_list_new_var_integer (ptr_item, "number", buffer->number))
|
||||
return 0;
|
||||
if (!plugin_list_new_var_string (ptr_item, "category", buffer->category))
|
||||
return 0;
|
||||
if (!plugin_list_new_var_string (ptr_item, "name", buffer->name))
|
||||
return 0;
|
||||
if (!plugin_list_new_var_int (ptr_item, "type", buffer->type))
|
||||
if (!plugin_list_new_var_integer (ptr_item, "type", buffer->type))
|
||||
return 0;
|
||||
if (!plugin_list_new_var_int (ptr_item, "notify_level", buffer->notify_level))
|
||||
if (!plugin_list_new_var_integer (ptr_item, "notify_level", buffer->notify_level))
|
||||
return 0;
|
||||
if (!plugin_list_new_var_int (ptr_item, "num_displayed", buffer->num_displayed))
|
||||
if (!plugin_list_new_var_integer (ptr_item, "num_displayed", buffer->num_displayed))
|
||||
return 0;
|
||||
if (!plugin_list_new_var_string (ptr_item, "title", buffer->title))
|
||||
return 0;
|
||||
if (!plugin_list_new_var_int (ptr_item, "input", buffer->input))
|
||||
if (!plugin_list_new_var_integer (ptr_item, "input", buffer->input))
|
||||
return 0;
|
||||
if (!plugin_list_new_var_string (ptr_item, "input_nick", buffer->input_nick))
|
||||
return 0;
|
||||
@@ -1024,19 +1294,19 @@ plugin_api_list_fields (struct t_weechat_plugin *plugin, void *list)
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_list_int: get an integer variable value in current list item
|
||||
* plugin_api_list_integer: get an integer variable value in current list item
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_api_list_int (struct t_weechat_plugin *plugin, void *list,
|
||||
char *var)
|
||||
plugin_api_list_integer (struct t_weechat_plugin *plugin, void *list,
|
||||
char *var)
|
||||
{
|
||||
if (!plugin || !list
|
||||
|| !plugin_list_valid ((struct t_plugin_list *)list)
|
||||
|| !((struct t_plugin_list *)list)->ptr_item)
|
||||
return 0;
|
||||
|
||||
return plugin_list_get_int ((struct t_plugin_list *)list, var);
|
||||
return plugin_list_get_integer ((struct t_plugin_list *)list, var);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1098,132 +1368,6 @@ plugin_api_list_free (struct t_weechat_plugin *plugin, void *list)
|
||||
plugin_list_free ((struct t_plugin_list *)list);
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_get_config_str_value: return string value for any option
|
||||
* This function should never be called directly
|
||||
* (only used by weechat_get_config)
|
||||
*/
|
||||
|
||||
char *
|
||||
plugin_api_get_config_str_value (struct t_config_option *option)
|
||||
{
|
||||
char buf_temp[1024], *color_name;
|
||||
|
||||
switch (option->type)
|
||||
{
|
||||
case CONFIG_OPTION_BOOLEAN:
|
||||
return (CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ?
|
||||
strdup ("on") : strdup ("off");
|
||||
case CONFIG_OPTION_INTEGER:
|
||||
if (option->string_values)
|
||||
snprintf (buf_temp, sizeof (buf_temp), "%s",
|
||||
option->string_values[CONFIG_INTEGER(option)]);
|
||||
else
|
||||
snprintf (buf_temp, sizeof (buf_temp), "%d",
|
||||
CONFIG_INTEGER(option));
|
||||
return strdup (buf_temp);
|
||||
case CONFIG_OPTION_STRING:
|
||||
return strdup (CONFIG_STRING(option));
|
||||
case CONFIG_OPTION_COLOR:
|
||||
color_name = gui_color_get_name (CONFIG_INTEGER(option));
|
||||
return (color_name) ? strdup (color_name) : strdup ("");
|
||||
}
|
||||
|
||||
/* should never be executed! */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_config_get: get value of a WeeChat config option
|
||||
*/
|
||||
|
||||
char *
|
||||
plugin_api_config_get (struct t_weechat_plugin *plugin, char *option_name)
|
||||
{
|
||||
struct t_config_option *ptr_option;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
/* search WeeChat config option */
|
||||
ptr_option = config_file_search_option (weechat_config, NULL, option_name);
|
||||
if (ptr_option)
|
||||
return plugin_api_get_config_str_value (ptr_option);
|
||||
|
||||
/* option not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_config_set: set value of a config option
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_api_config_set (struct t_weechat_plugin *plugin, char *option_name,
|
||||
char *value)
|
||||
{
|
||||
struct t_config_option *ptr_option;
|
||||
int rc;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) plugin;
|
||||
|
||||
if (!option_name || !value)
|
||||
return 0;
|
||||
|
||||
/* search and set WeeChat config option if found */
|
||||
ptr_option = config_file_search_option (weechat_config, NULL, option_name);
|
||||
if (ptr_option)
|
||||
{
|
||||
rc = config_file_option_set (ptr_option, value);
|
||||
if ((rc == 2) && (ptr_option->callback_change))
|
||||
(void) (ptr_option->callback_change) ();
|
||||
if (rc == 0)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* failed to set config option */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_plugin_config_get: get value of a plugin config option
|
||||
*/
|
||||
|
||||
char *
|
||||
plugin_api_plugin_config_get (struct t_weechat_plugin *plugin, char *option_name)
|
||||
{
|
||||
struct t_config_option *ptr_option;
|
||||
|
||||
if (!option_name)
|
||||
return NULL;
|
||||
|
||||
ptr_option = plugin_config_search (plugin->name, option_name);
|
||||
if (ptr_option)
|
||||
return (ptr_option->value) ? strdup (ptr_option->value) : NULL;
|
||||
|
||||
/* option not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_plugin_config_set: set value of a plugin config option
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_api_plugin_config_set (struct t_weechat_plugin *plugin,
|
||||
char *option_name, char *value)
|
||||
{
|
||||
if (!option_name)
|
||||
return 0;
|
||||
|
||||
if (plugin_config_set (plugin->name, option_name, value))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_log: add a message in buffer log file
|
||||
*/
|
||||
@@ -1256,5 +1400,5 @@ plugin_api_log (struct t_weechat_plugin *plugin,
|
||||
gui_log_write_line (ptr_buffer, (buf2) ? buf2 : buf);
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
}*/
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -44,6 +44,27 @@ extern int plugin_api_mkdir_home (struct t_weechat_plugin *, char *);
|
||||
extern void plugin_api_exec_on_files (struct t_weechat_plugin *, char *,
|
||||
int (*)(char *));
|
||||
|
||||
/* config */
|
||||
extern struct t_config_file *config_new (struct t_weechat_plugin *, char *);
|
||||
extern struct t_config_section *config_new_section (struct t_weechat_plugin *,
|
||||
void *, char *,
|
||||
void (*)(void *, char *, char *),
|
||||
void (*)(void *),
|
||||
void (*)(void *));
|
||||
extern struct t_config_option *config_new_option (struct t_weechat_plugin *,
|
||||
void *, char *, char *,
|
||||
char *, char *, int, int,
|
||||
char *, void (*)());
|
||||
extern char config_boolean (struct t_weechat_plugin *, void *);
|
||||
extern int config_integer (struct t_weechat_plugin *, void *);
|
||||
extern char *config_string (struct t_weechat_plugin *, void *);
|
||||
extern int config_color (struct t_weechat_plugin *, void *);
|
||||
extern char *plugin_api_config_get (struct t_weechat_plugin *, char *);
|
||||
extern int plugin_api_config_set (struct t_weechat_plugin *, char *, char *);
|
||||
extern char *plugin_api_plugin_config_get (struct t_weechat_plugin *, char *);
|
||||
extern int plugin_api_plugin_config_set (struct t_weechat_plugin *, char *,
|
||||
char *);
|
||||
|
||||
/* display */
|
||||
extern char *plugin_api_prefix (struct t_weechat_plugin *, char *);
|
||||
extern char *plugin_api_color (struct t_weechat_plugin *, char *);
|
||||
@@ -109,19 +130,12 @@ extern int plugin_api_list_next (struct t_weechat_plugin *,
|
||||
extern int plugin_api_list_prev (struct t_weechat_plugin *,
|
||||
void *);
|
||||
extern char *plugin_api_list_fields (struct t_weechat_plugin *, void *);
|
||||
extern int plugin_api_list_int (struct t_weechat_plugin *, void *, char *);
|
||||
extern int plugin_api_list_integer (struct t_weechat_plugin *, void *, char *);
|
||||
extern char *plugin_api_list_string (struct t_weechat_plugin *, void *, char *);
|
||||
extern void *plugin_api_list_pointer (struct t_weechat_plugin *, void *, char *);
|
||||
extern time_t plugin_api_list_time (struct t_weechat_plugin *, void *, char *);
|
||||
extern void plugin_api_list_free (struct t_weechat_plugin *, void *);
|
||||
|
||||
/* config */
|
||||
extern char *plugin_api_config_get (struct t_weechat_plugin *, char *);
|
||||
extern int plugin_api_config_set (struct t_weechat_plugin *, char *, char *);
|
||||
extern char *plugin_api_plugin_config_get (struct t_weechat_plugin *, char *);
|
||||
extern int plugin_api_plugin_config_set (struct t_weechat_plugin *, char *,
|
||||
char *);
|
||||
|
||||
/* log */
|
||||
extern void plugin_api_log (struct t_weechat_plugin *, char *, char *,
|
||||
char *, ...);
|
||||
|
||||
@@ -289,8 +289,7 @@ plugin_config_free_all ()
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_config_read_option (struct t_config_file *config_file,
|
||||
char *option_name, char *value)
|
||||
plugin_config_read_option (void *config_file, char *option_name, char *value)
|
||||
{
|
||||
char *value2;
|
||||
|
||||
@@ -309,7 +308,7 @@ plugin_config_read_option (struct t_config_file *config_file,
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_config_write_options (struct t_config_file *config_file)
|
||||
plugin_config_write_options (void *config_file)
|
||||
{
|
||||
struct t_config_option *ptr_option;
|
||||
|
||||
@@ -329,7 +328,7 @@ plugin_config_write_options (struct t_config_file *config_file)
|
||||
void
|
||||
plugin_config_init ()
|
||||
{
|
||||
plugin_config = config_file_new (PLUGIN_CONFIG_FILENAME);
|
||||
plugin_config = config_file_new (NULL, PLUGIN_CONFIG_FILENAME);
|
||||
if (plugin_config)
|
||||
{
|
||||
config_file_new_section (plugin_config, "plugin",
|
||||
|
||||
@@ -93,12 +93,12 @@ plugin_list_new_item (struct t_plugin_list *list)
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_list_new_var_int: create a new integer variable in an item
|
||||
* plugin_list_new_var_integer: create a new integer variable in an item
|
||||
*/
|
||||
|
||||
struct t_plugin_list_var *
|
||||
plugin_list_new_var_int (struct t_plugin_list_item *item,
|
||||
char *name, int value)
|
||||
plugin_list_new_var_integer (struct t_plugin_list_item *item,
|
||||
char *name, int value)
|
||||
{
|
||||
struct t_plugin_list_var *new_var;
|
||||
|
||||
@@ -334,11 +334,11 @@ plugin_list_get_fields (struct t_plugin_list *list)
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_list_get_int: get an integer variable value in current list item
|
||||
* plugin_list_get_integer: get an integer variable value in current list item
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_list_get_int (struct t_plugin_list *list, char *var)
|
||||
plugin_list_get_integer (struct t_plugin_list *list, char *var)
|
||||
{
|
||||
struct t_plugin_list_var *ptr_var;
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ extern struct t_plugin_list *last_plugin_list;
|
||||
|
||||
extern struct t_plugin_list *plugin_list_new ();
|
||||
extern struct t_plugin_list_item *plugin_list_new_item (struct t_plugin_list *);
|
||||
extern struct t_plugin_list_var *plugin_list_new_var_int (struct t_plugin_list_item *,
|
||||
char *, int);
|
||||
extern struct t_plugin_list_var *plugin_list_new_var_integer (struct t_plugin_list_item *,
|
||||
char *, int);
|
||||
extern struct t_plugin_list_var *plugin_list_new_var_string (struct t_plugin_list_item *,
|
||||
char *, char *);
|
||||
extern struct t_plugin_list_var *plugin_list_new_var_pointer (struct t_plugin_list_item *,
|
||||
@@ -79,7 +79,7 @@ extern int plugin_list_valid (struct t_plugin_list *);
|
||||
extern struct t_plugin_list_item *plugin_list_next_item (struct t_plugin_list *);
|
||||
extern struct t_plugin_list_item *plugin_list_prev_item (struct t_plugin_list *);
|
||||
extern char *plugin_list_get_fields (struct t_plugin_list *);
|
||||
extern int plugin_list_get_int (struct t_plugin_list *, char *);
|
||||
extern int plugin_list_get_integer (struct t_plugin_list *, char *);
|
||||
extern char *plugin_list_get_string (struct t_plugin_list *, char *);
|
||||
extern void *plugin_list_get_pointer (struct t_plugin_list *, char *);
|
||||
extern time_t plugin_list_get_time (struct t_plugin_list *, char *);
|
||||
|
||||
@@ -269,7 +269,7 @@ plugin_load (char *filename)
|
||||
new_plugin->list_next = &plugin_api_list_next;
|
||||
new_plugin->list_prev = &plugin_api_list_prev;
|
||||
new_plugin->list_fields = &plugin_api_list_fields;
|
||||
new_plugin->list_int = &plugin_api_list_int;
|
||||
new_plugin->list_integer = &plugin_api_list_integer;
|
||||
new_plugin->list_string = &plugin_api_list_string;
|
||||
new_plugin->list_pointer = &plugin_api_list_pointer;
|
||||
new_plugin->list_time = &plugin_api_list_time;
|
||||
|
||||
+159
-100
@@ -72,6 +72,27 @@ struct t_weechat_plugin
|
||||
int (*mkdir_home) (struct t_weechat_plugin *, char *);
|
||||
void (*exec_on_files) (struct t_weechat_plugin *, char *,
|
||||
int (*)(char *));
|
||||
|
||||
/* config files */
|
||||
struct t_config_file *(*config_new) (struct t_weechat_plugin *, char *);
|
||||
struct t_config_section *(*config_new_section) (struct t_weechat_plugin *,
|
||||
void *, char *,
|
||||
void (*)(void *, char *, char *),
|
||||
void (*)(void *),
|
||||
void (*)(void *));
|
||||
struct t_config_option *(*config_new_option) (struct t_weechat_plugin *,
|
||||
void *, char *, char *,
|
||||
char *, char *, int, int,
|
||||
char *, void (*)());
|
||||
char (*config_boolean) (struct t_weechat_plugin *, void *);
|
||||
int (*config_integer) (struct t_weechat_plugin *, void *);
|
||||
char *(*config_string) (struct t_weechat_plugin *, void *);
|
||||
int (*config_color) (struct t_weechat_plugin *, void *);
|
||||
char *(*config_get) (struct t_weechat_plugin *, char *);
|
||||
int (*config_set) (struct t_weechat_plugin *, char *, char *);
|
||||
char *(*plugin_config_get) (struct t_weechat_plugin *, char *);
|
||||
int (*plugin_config_set) (struct t_weechat_plugin *, char *, char *);
|
||||
|
||||
|
||||
/* display */
|
||||
char *(*prefix) (struct t_weechat_plugin *, char *);
|
||||
@@ -128,18 +149,12 @@ struct t_weechat_plugin
|
||||
int (*list_next) (struct t_weechat_plugin *, void *);
|
||||
int (*list_prev) (struct t_weechat_plugin *, void *);
|
||||
char *(*list_fields) (struct t_weechat_plugin *, void *);
|
||||
int (*list_int) (struct t_weechat_plugin *, void *, char *);
|
||||
int (*list_integer) (struct t_weechat_plugin *, void *, char *);
|
||||
char *(*list_string) (struct t_weechat_plugin *, void *, char *);
|
||||
void *(*list_pointer) (struct t_weechat_plugin *, void *, char *);
|
||||
time_t (*list_time) (struct t_weechat_plugin *, void *, char *);
|
||||
void (*list_free) (struct t_weechat_plugin *, void *);
|
||||
|
||||
/* config */
|
||||
char *(*config_get) (struct t_weechat_plugin *, char *);
|
||||
int (*config_set) (struct t_weechat_plugin *, char *, char *);
|
||||
char *(*plugin_config_get) (struct t_weechat_plugin *, char *);
|
||||
int (*plugin_config_set) (struct t_weechat_plugin *, char *, char *);
|
||||
|
||||
/* log */
|
||||
void (*log) (struct t_weechat_plugin *, char *, char *, char *, ...);
|
||||
|
||||
@@ -148,114 +163,158 @@ struct t_weechat_plugin
|
||||
|
||||
/* macros for easy call to plugin API */
|
||||
|
||||
#define weechat_charset_set(chset, string) \
|
||||
weechat_plugin->charset_set(weechat_plugin, string)
|
||||
#define weechat_iconv_to_internal(chset, string) \
|
||||
weechat_plugin->iconv_to_internal(weechat_plugin, chset, string)
|
||||
#define weechat_iconv_from_internal(chset, string) \
|
||||
weechat_plugin->iconv_from_internal(weechat_plugin, chset, string)
|
||||
/* strings */
|
||||
#define weechat_charset_set(__charset) \
|
||||
weechat_plugin->charset_set(weechat_plugin, __charset)
|
||||
#define weechat_iconv_to_internal(__charset, __string) \
|
||||
weechat_plugin->iconv_to_internal(weechat_plugin, \
|
||||
__charset, __string)
|
||||
#define weechat_iconv_from_internal(__charset, __string) \
|
||||
weechat_plugin->iconv_from_internal(weechat_plugin, \
|
||||
__charset, __string)
|
||||
#ifndef __WEECHAT_H
|
||||
#define _(string) weechat_plugin->gettext(weechat_plugin, string)
|
||||
#define N_(string) (string)
|
||||
#define NG_(single,plural,number) \
|
||||
weechat_plugin->ngettext(weechat_plugin, single, plural, number)
|
||||
#endif
|
||||
#define weechat_strcasecmp(string1, string2) \
|
||||
weechat_plugin->strcasecmp(weechat_plugin, string1, string2)
|
||||
#define weechat_strncasecmp(string1, string2, max) \
|
||||
weechat_plugin->strncasecmp(weechat_plugin, string1, string2, max)
|
||||
#define weechat_string_replace(string1, search1, replace1) \
|
||||
weechat_plugin->string_replace(weechat_plugin, string1, search1, \
|
||||
replace1)
|
||||
#define weechat_string_explode(string1, separator, eol, max, \
|
||||
num_items) \
|
||||
weechat_plugin->string_explode(weechat_plugin, string1, separator, \
|
||||
eol, max, num_items)
|
||||
#define weechat_string_free_exploded(array_str) \
|
||||
weechat_plugin->string_free_exploded(weechat_plugin, array_str)
|
||||
#define weechat_strcasecmp(__string1, __string2) \
|
||||
weechat_plugin->strcasecmp(weechat_plugin, __string1, __string2)
|
||||
#define weechat_strncasecmp(__string1, __string2, __max) \
|
||||
weechat_plugin->strncasecmp(weechat_plugin, __string1, \
|
||||
__string2, __max)
|
||||
#define weechat_string_replace(__string1, __search1, __replace1) \
|
||||
weechat_plugin->string_replace(weechat_plugin, __string1, \
|
||||
__search1, __replace1)
|
||||
#define weechat_string_explode(__string1, __separator, __eol, __max, \
|
||||
__num_items) \
|
||||
weechat_plugin->string_explode(weechat_plugin, __string1, \
|
||||
__separator, __eol, __max, \
|
||||
__num_items)
|
||||
#define weechat_string_free_exploded(__array_str) \
|
||||
weechat_plugin->string_free_exploded(weechat_plugin, __array_str)
|
||||
|
||||
#define weechat_prefix(prefix_name) \
|
||||
weechat_plugin->prefix(weechat_plugin, prefix_name)
|
||||
#define weechat_color(color_name) \
|
||||
weechat_plugin->color(weechat_plugin, color_name)
|
||||
#define weechat_printf(buffer, argz...) \
|
||||
weechat_plugin->printf(weechat_plugin, buffer, ##argz)
|
||||
#define weechat_printf_date(buffer, datetime, argz...) \
|
||||
weechat_plugin->printf_date(weechat_plugin, buffer, datetime, \
|
||||
##argz)
|
||||
#define weechat2_log_printf(argz...) \
|
||||
weechat_plugin->log_printf(weechat_plugin, ##argz)
|
||||
/* directories */
|
||||
#define weechat_mkdir_home(__directory) \
|
||||
weechat_plugin->mkdir_home(weechat_plugin, __directory)
|
||||
#define weechat_exec_on_files(__directory, __callback) \
|
||||
weechat_plugin->exec_on_files(weechat_plugin, __directory, \
|
||||
__callback)
|
||||
|
||||
#define weechat_hook_command(command, description, args, args_desc, \
|
||||
completion, callback, data) \
|
||||
weechat_plugin->hook_command(weechat_plugin, command, description, \
|
||||
args, args_desc, completion, callback, \
|
||||
data)
|
||||
#define weechat_hook_timer(interval, max_calls, callback, data) \
|
||||
weechat_plugin->hook_timer(weechat_plugin, interval, max_calls, \
|
||||
callback, data)
|
||||
#define weechat_hook_fd(fd, flag_read, flag_write, flag_exception, \
|
||||
callback, data) \
|
||||
weechat_plugin->hook_fd(weechat_plugin, fd, flag_read, flag_write, \
|
||||
flag_exception, callback, data)
|
||||
#define weechat_hook_print(buffer, msg, strip_colors, callback, data) \
|
||||
weechat_plugin->hook_print(weechat_plugin, buffer, msg, \
|
||||
strip_colors, callback, data)
|
||||
#define weechat_hook_event(evnt, callback, data) \
|
||||
weechat_plugin->hook_event(weechat_plugin, evnt, callback, data)
|
||||
#define weechat_hook_config(type, option, callback, data) \
|
||||
weechat_plugin->hook_config(weechat_plugin, type, option, \
|
||||
callback, data)
|
||||
#define weechat_unhook(hook) \
|
||||
weechat_plugin->unhook(weechat_plugin, hook)
|
||||
/* config files */
|
||||
#define weechat_config_new(__filename) \
|
||||
weechat_plugin->config_new(weechat_plugin, __filename)
|
||||
#define weechat_config_new_section(__config, __name, __cb_read, \
|
||||
__cb_write_std, __cb_write_def) \
|
||||
weechat_plugin->config_new_section(weechat_plugin, \
|
||||
__config, __name, __cb_read, \
|
||||
__cb_write_std, __cb_write_def)
|
||||
#define weechat_config_new_option(__section, __name, __desc, \
|
||||
__string_values, __min, __max, \
|
||||
__default, __callback) \
|
||||
weechat_plugin->config_new_option(weechat_plugin, \
|
||||
__section, __name, __desc, \
|
||||
__string_values, __min, __max, \
|
||||
__default, __callback)
|
||||
#define weechat_config_boolean(__option) \
|
||||
weechat_plugin->config_boolean(weechat_plugin, __option)
|
||||
#define weechat_config_integer(__option) \
|
||||
weechat_plugin->config_integer(weechat_plugin, __option)
|
||||
#define weechat_config_string(__option) \
|
||||
weechat_plugin->config_string(weechat_plugin, __option)
|
||||
#define weechat_config_color(__option) \
|
||||
weechat_plugin->config_color(weechat_plugin, __option)
|
||||
#define weechat_config_get(__option) \
|
||||
weechat_plugin->config_get(weechat_plugin, __option)
|
||||
#define weechat_config_set(__option, __value) \
|
||||
weechat_plugin->config_set(weechat_plugin, __option, __value)
|
||||
#define weechat_plugin_config_get(__option) \
|
||||
weechat_plugin->plugin_config_get(weechat_plugin, __option)
|
||||
#define weechat_plugin_config_set(__option, __value) \
|
||||
weechat_plugin->plugin_config_set(weechat_plugin, __option, __value)
|
||||
|
||||
/* display */
|
||||
#define weechat_prefix(__prefix_name) \
|
||||
weechat_plugin->prefix(weechat_plugin, __prefix_name)
|
||||
#define weechat_color(__color_name) \
|
||||
weechat_plugin->color(weechat_plugin, __color_name)
|
||||
#define weechat_printf(__buffer, __argz...) \
|
||||
weechat_plugin->printf(weechat_plugin, __buffer, ##__argz)
|
||||
#define weechat_printf_date(__buffer, __datetime, __argz...) \
|
||||
weechat_plugin->printf_date(weechat_plugin, __buffer, __datetime, \
|
||||
##__argz)
|
||||
#define weechat2_log_printf(__argz...) \
|
||||
weechat_plugin->log_printf(weechat_plugin, ##__argz)
|
||||
|
||||
/* hooks */
|
||||
#define weechat_hook_command(__command, __description, __args, \
|
||||
__args_desc, __completion, __callback, \
|
||||
__data) \
|
||||
weechat_plugin->hook_command(weechat_plugin, __command, __description, \
|
||||
__args, __args_desc, __completion, \
|
||||
__callback, __data)
|
||||
#define weechat_hook_timer(__interval, __max_calls, __callback, __data) \
|
||||
weechat_plugin->hook_timer(weechat_plugin, __interval, __max_calls, \
|
||||
__callback, __data)
|
||||
#define weechat_hook_fd(__fd, __flag_read, __flag_write, \
|
||||
__flag_exception, __callback, __data) \
|
||||
weechat_plugin->hook_fd(weechat_plugin, __fd, __flag_read, \
|
||||
__flag_write, __flag_exception, __callback, \
|
||||
__data)
|
||||
#define weechat_hook_print(__buffer, __msg, __stri__colors, __callback, \
|
||||
__data) \
|
||||
weechat_plugin->hook_print(weechat_plugin, __buffer, __msg, \
|
||||
__stri__colors, __callback, __data)
|
||||
#define weechat_hook_event(__event, __callback, __data) \
|
||||
weechat_plugin->hook_event(weechat_plugin, __event, __callback, __data)
|
||||
#define weechat_hook_config(__type, __option, __callback, __data) \
|
||||
weechat_plugin->hook_config(weechat_plugin, __type, __option, \
|
||||
__callback, __data)
|
||||
#define weechat_unhook(__hook) \
|
||||
weechat_plugin->unhook(weechat_plugin, __hook)
|
||||
#define weechat_unhook_all() \
|
||||
weechat_plugin->unhook(weechat_plugin)
|
||||
|
||||
#define weechat_buffer_new(category, name, input_data_cb) \
|
||||
weechat_plugin->buffer_new(weechat_plugin, category, name, \
|
||||
input_data_cb)
|
||||
#define weechat_buffer_search(category, name) \
|
||||
weechat_plugin->buffer_search(weechat_plugin, category, name)
|
||||
/* buffers */
|
||||
#define weechat_buffer_new(__category, __name, __input_data_cb) \
|
||||
weechat_plugin->buffer_new(weechat_plugin, __category, __name, \
|
||||
__input_data_cb)
|
||||
#define weechat_buffer_search(__category, __name) \
|
||||
weechat_plugin->buffer_search(weechat_plugin, __category, __name)
|
||||
#define weechat_current_buffer \
|
||||
weechat_plugin->buffer_search(weechat_plugin, NULL, NULL)
|
||||
#define weechat_buffer_close(ptr_buffer) \
|
||||
weechat_plugin->buffer_close(weechat_plugin, ptr_buffer)
|
||||
#define weechat_buffer_set(ptr_buffer, property, value) \
|
||||
weechat_plugin->buffer_set(weechat_plugin, ptr_buffer, \
|
||||
property, value)
|
||||
#define weechat_buffer_close(__buffer) \
|
||||
weechat_plugin->buffer_close(weechat_plugin, __buffer)
|
||||
#define weechat_buffer_set(__buffer, __property, __value) \
|
||||
weechat_plugin->buffer_set(weechat_plugin, __buffer, \
|
||||
__property, __value)
|
||||
|
||||
#define weechat_command(buffer, cmd) \
|
||||
weechat_plugin->command(weechat_plugin, buffer, cmd)
|
||||
/* command */
|
||||
#define weechat_command(__buffer, __command) \
|
||||
weechat_plugin->command(weechat_plugin, __buffer, __command)
|
||||
|
||||
#define weechat_info_get(infoname) \
|
||||
weechat_plugin->info_get(weechat_plugin, infoname)
|
||||
/* infos */
|
||||
#define weechat_info_get(__name) \
|
||||
weechat_plugin->info_get(weechat_plugin, __name)
|
||||
|
||||
#define weechat_list_get(name, pointer) \
|
||||
weechat_plugin->list_get(weechat_plugin, name, pointer)
|
||||
#define weechat_list_next(ptrlist) \
|
||||
weechat_plugin->list_next(weechat_plugin, ptrlist)
|
||||
#define weechat_list_prev(ptrlist) \
|
||||
weechat_plugin->list_prev(weechat_plugin, ptrlist)
|
||||
#define weechat_list_fields(ptrlist) \
|
||||
weechat_plugin->list_fields(weechat_plugin, ptrlist)
|
||||
#define weechat_list_int(ptritem, var) \
|
||||
weechat_plugin->list_int(weechat_plugin, ptritem, var)
|
||||
#define weechat_list_string(ptritem, var) \
|
||||
weechat_plugin->list_string(weechat_plugin, ptritem, var)
|
||||
#define weechat_list_pointer(ptritem, var) \
|
||||
weechat_plugin->list_pointer(weechat_plugin, ptritem, var)
|
||||
#define weechat_list_time(ptritem, var) \
|
||||
weechat_plugin->list_time(weechat_plugin, ptritem, var)
|
||||
#define weechat_list_free(ptrlist) \
|
||||
weechat_plugin->list_free(weechat_plugin, ptrlist)
|
||||
|
||||
#define weechat_config_get(option) \
|
||||
weechat_plugin->config_get(weechat_plugin, option)
|
||||
#define weechat_config_set(option, value) \
|
||||
weechat_plugin->config_set(weechat_plugin, option, value)
|
||||
#define weechat_plugin_config_get(option) \
|
||||
weechat_plugin->plugin_config_get(weechat_plugin, option)
|
||||
#define weechat_plugin_config_set(option, value) \
|
||||
weechat_plugin->plugin_config_set(weechat_plugin, option, value)
|
||||
/* lists */
|
||||
#define weechat_list_get(__name, __pointer) \
|
||||
weechat_plugin->list_get(weechat_plugin, __name, __pointer)
|
||||
#define weechat_list_next(__list) \
|
||||
weechat_plugin->list_next(weechat_plugin, __list)
|
||||
#define weechat_list_prev(__list) \
|
||||
weechat_plugin->list_prev(weechat_plugin, __list)
|
||||
#define weechat_list_fields(__list) \
|
||||
weechat_plugin->list_fields(weechat_plugin, __list)
|
||||
#define weechat_list_integer(__item, __var) \
|
||||
weechat_plugin->list_integer(weechat_plugin, __item, __var)
|
||||
#define weechat_list_string(__item, __var) \
|
||||
weechat_plugin->list_string(weechat_plugin, __item, __var)
|
||||
#define weechat_list_pointer(__item, __var) \
|
||||
weechat_plugin->list_pointer(weechat_plugin, __item, __var)
|
||||
#define weechat_list_time(__item, __var) \
|
||||
weechat_plugin->list_time(weechat_plugin, __item, __var)
|
||||
#define weechat_list_free(__list) \
|
||||
weechat_plugin->list_free(weechat_plugin, __list)
|
||||
|
||||
#endif /* weechat-plugin.h */
|
||||
|
||||
Reference in New Issue
Block a user