Add function "config_is_set_plugin" in plugin/script API
This commit is contained in:
parent
1076183317
commit
353538e3d8
@ -4546,6 +4546,43 @@ char *value = weechat_config_get_plugin ("option");
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secPluginCApi_weechat_config_is_set_plugin">
|
||||
<title>weechat_config_is_set_plugin</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<programlisting>
|
||||
int weechat_config_is_set_plugin (const char *option_name);
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Check if option is set in plugins configuration file (plugins.conf).
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>option_name</option>: option name, WeeChat will add
|
||||
prefix "plugins.var.xxxx." (where xxxx is current plugin name).
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: 1 if option is set, 0 if option does not exist.
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>
|
||||
if (weechat_config_is_set_plugin ("option"))
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secPluginCApi_weechat_config_set_plugin">
|
||||
<title>weechat_config_set_plugin</title>
|
||||
|
||||
@ -5138,7 +5175,7 @@ struct t_hook *weechat_hook_command (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5250,7 +5287,7 @@ struct t_hook *weechat_hook_command_run (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5349,7 +5386,7 @@ struct t_hook *weechat_hook_timer (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5450,7 +5487,7 @@ struct t_hook *weechat_hook_fd (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5555,7 +5592,7 @@ struct t_hook *weechat_hook_process (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5718,7 +5755,7 @@ struct t_hook *weechat_hook_connect (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5893,7 +5930,7 @@ struct t_hook *weechat_hook_print (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -6350,7 +6387,7 @@ struct t_hook *weechat_hook_signal (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -6484,7 +6521,7 @@ struct t_hook *weechat_hook_config (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -6586,7 +6623,7 @@ struct t_hook *weechat_hook_completion (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -6836,7 +6873,7 @@ struct t_hook *weechat_hook_modifier (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -6992,7 +7029,7 @@ struct t_hook *weechat_hook_info (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -7095,7 +7132,7 @@ struct t_hook *weechat_hook_infolist (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -7250,7 +7287,7 @@ struct t_gui_buffer *weechat_buffer_new (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>input_callback_data</option>: pointer given to input
|
||||
callback when it is called by WeeeChat
|
||||
callback when it is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
@ -7285,7 +7322,7 @@ struct t_gui_buffer *weechat_buffer_new (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>close_callback_data</option>: pointer given to close
|
||||
callback when it is called by WeeeChat
|
||||
callback when it is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -7749,7 +7786,7 @@ void weechat_buffer_set (struct t_gui_buffer *buffer, const char *property,
|
||||
<entry>display</entry>
|
||||
<entry>"1", "auto"</entry>
|
||||
<entry>
|
||||
swtich to this buffer in current window (if value is
|
||||
switch to this buffer in current window (if value is
|
||||
"auto", then it's considered as auto-switch and read
|
||||
marker is not reset for current buffer)
|
||||
</entry>
|
||||
@ -7823,7 +7860,7 @@ void weechat_buffer_set (struct t_gui_buffer *buffer, const char *property,
|
||||
<entry>"-" or comma separated list of words</entry>
|
||||
<entry>
|
||||
"-" is a special value to disable any highlight on this
|
||||
buffer, or comma separated list of words to higlkight
|
||||
buffer, or comma separated list of words to highlight
|
||||
in this buffer, for example: "abc,def,ghi"
|
||||
</entry>
|
||||
</row>
|
||||
|
@ -4545,6 +4545,43 @@ char *value = weechat_config_get_plugin ("option");
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secPluginCApi_weechat_config_is_set_plugin">
|
||||
<title>weechat_config_is_set_plugin</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<programlisting>
|
||||
int weechat_config_is_set_plugin (const char *option_name);
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Check if option is set in plugins configuration file (plugins.conf).
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>option_name</option>: option name, WeeChat will add
|
||||
prefix "plugins.var.xxxx." (where xxxx is current plugin name).
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: 1 if option is set, 0 if option does not exist.
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>
|
||||
if (weechat_config_is_set_plugin ("option"))
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secPluginCApi_weechat_config_set_plugin">
|
||||
<title>weechat_config_set_plugin</title>
|
||||
|
||||
@ -5137,7 +5174,7 @@ struct t_hook *weechat_hook_command (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5249,7 +5286,7 @@ struct t_hook *weechat_hook_command_run (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5348,7 +5385,7 @@ struct t_hook *weechat_hook_timer (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5449,7 +5486,7 @@ struct t_hook *weechat_hook_fd (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5554,7 +5591,7 @@ struct t_hook *weechat_hook_process (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5717,7 +5754,7 @@ struct t_hook *weechat_hook_connect (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5892,7 +5929,7 @@ struct t_hook *weechat_hook_print (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -6349,7 +6386,7 @@ struct t_hook *weechat_hook_signal (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -6483,7 +6520,7 @@ struct t_hook *weechat_hook_config (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -6585,7 +6622,7 @@ struct t_hook *weechat_hook_completion (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -6835,7 +6872,7 @@ struct t_hook *weechat_hook_modifier (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -6991,7 +7028,7 @@ struct t_hook *weechat_hook_info (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -7094,7 +7131,7 @@ struct t_hook *weechat_hook_infolist (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -7249,7 +7286,7 @@ struct t_gui_buffer *weechat_buffer_new (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>input_callback_data</option>: pointer given to input
|
||||
callback when it is called by WeeeChat
|
||||
callback when it is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
@ -7284,7 +7321,7 @@ struct t_gui_buffer *weechat_buffer_new (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>close_callback_data</option>: pointer given to close
|
||||
callback when it is called by WeeeChat
|
||||
callback when it is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -7748,7 +7785,7 @@ void weechat_buffer_set (struct t_gui_buffer *buffer, const char *property,
|
||||
<entry>display</entry>
|
||||
<entry>"1", "auto"</entry>
|
||||
<entry>
|
||||
swtich to this buffer in current window (if value is
|
||||
switch to this buffer in current window (if value is
|
||||
"auto", then it's considered as auto-switch and read
|
||||
marker is not reset for current buffer)
|
||||
</entry>
|
||||
@ -7822,7 +7859,7 @@ void weechat_buffer_set (struct t_gui_buffer *buffer, const char *property,
|
||||
<entry>"-" or comma separated list of words</entry>
|
||||
<entry>
|
||||
"-" is a special value to disable any highlight on this
|
||||
buffer, or comma separated list of words to higlkight
|
||||
buffer, or comma separated list of words to highlight
|
||||
in this buffer, for example: "abc,def,ghi"
|
||||
</entry>
|
||||
</row>
|
||||
|
@ -4546,6 +4546,43 @@ char *value = weechat_config_get_plugin ("option");
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secPluginCApi_weechat_config_is_set_plugin">
|
||||
<title>weechat_config_is_set_plugin</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<programlisting>
|
||||
int weechat_config_is_set_plugin (const char *option_name);
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Check if option is set in plugins configuration file (plugins.conf).
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>option_name</option>: option name, WeeChat will add
|
||||
prefix "plugins.var.xxxx." (where xxxx is current plugin name).
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Return value: 1 if option is set, 0 if option does not exist.
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>
|
||||
if (weechat_config_is_set_plugin ("option"))
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secPluginCApi_weechat_config_set_plugin">
|
||||
<title>weechat_config_set_plugin</title>
|
||||
|
||||
@ -5138,7 +5175,7 @@ struct t_hook *weechat_hook_command (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5250,7 +5287,7 @@ struct t_hook *weechat_hook_command_run (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5349,7 +5386,7 @@ struct t_hook *weechat_hook_timer (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5450,7 +5487,7 @@ struct t_hook *weechat_hook_fd (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5555,7 +5592,7 @@ struct t_hook *weechat_hook_process (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5718,7 +5755,7 @@ struct t_hook *weechat_hook_connect (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -5893,7 +5930,7 @@ struct t_hook *weechat_hook_print (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -6350,7 +6387,7 @@ struct t_hook *weechat_hook_signal (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -6484,7 +6521,7 @@ struct t_hook *weechat_hook_config (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -6586,7 +6623,7 @@ struct t_hook *weechat_hook_completion (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -6836,7 +6873,7 @@ struct t_hook *weechat_hook_modifier (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -6992,7 +7029,7 @@ struct t_hook *weechat_hook_info (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -7095,7 +7132,7 @@ struct t_hook *weechat_hook_infolist (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>callback_data</option>: pointer given to callback when it
|
||||
is called by WeeeChat
|
||||
is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -7250,7 +7287,7 @@ struct t_gui_buffer *weechat_buffer_new (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>input_callback_data</option>: pointer given to input
|
||||
callback when it is called by WeeeChat
|
||||
callback when it is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
@ -7285,7 +7322,7 @@ struct t_gui_buffer *weechat_buffer_new (
|
||||
<listitem>
|
||||
<para>
|
||||
<option>close_callback_data</option>: pointer given to close
|
||||
callback when it is called by WeeeChat
|
||||
callback when it is called by WeeChat
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@ -7749,7 +7786,7 @@ void weechat_buffer_set (struct t_gui_buffer *buffer, const char *property,
|
||||
<entry>display</entry>
|
||||
<entry>"1", "auto"</entry>
|
||||
<entry>
|
||||
swtich to this buffer in current window (if value is
|
||||
switch to this buffer in current window (if value is
|
||||
"auto", then it's considered as auto-switch and read
|
||||
marker is not reset for current buffer)
|
||||
</entry>
|
||||
@ -7823,7 +7860,7 @@ void weechat_buffer_set (struct t_gui_buffer *buffer, const char *property,
|
||||
<entry>"-" or comma separated list of words</entry>
|
||||
<entry>
|
||||
"-" is a special value to disable any highlight on this
|
||||
buffer, or comma separated list of words to higlkight
|
||||
buffer, or comma separated list of words to highlight
|
||||
in this buffer, for example: "abc,def,ghi"
|
||||
</entry>
|
||||
</row>
|
||||
|
@ -124,6 +124,26 @@ plugin_api_config_get_plugin (struct t_weechat_plugin *plugin,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_config_is_set_plugin: return 1 if plugin option is set, otherwise 0
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_api_config_is_set_plugin (struct t_weechat_plugin *plugin,
|
||||
const char *option_name)
|
||||
{
|
||||
struct t_config_option *ptr_option;
|
||||
|
||||
if (!plugin || !option_name)
|
||||
return 0;
|
||||
|
||||
ptr_option = plugin_config_search (plugin->name, option_name);
|
||||
if (ptr_option)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_api_config_set_plugin: set value of a plugin config option
|
||||
*/
|
||||
|
@ -31,6 +31,8 @@ extern const char *plugin_api_ngettext (const char *single, const char *plural,
|
||||
extern struct t_config_option *plugin_api_config_get (const char *option_name);
|
||||
extern const char *plugin_api_config_get_plugin (struct t_weechat_plugin *plugin,
|
||||
const char *option_name);
|
||||
extern int plugin_api_config_is_set_plugin (struct t_weechat_plugin *plugin,
|
||||
const char *option_name);
|
||||
extern int plugin_api_config_set_plugin (struct t_weechat_plugin *plugin,
|
||||
const char *option_name,
|
||||
const char *value);
|
||||
|
@ -485,6 +485,7 @@ plugin_load (const char *filename)
|
||||
new_plugin->config_free = &config_file_free;
|
||||
new_plugin->config_get = &plugin_api_config_get;
|
||||
new_plugin->config_get_plugin = &plugin_api_config_get_plugin;
|
||||
new_plugin->config_is_set_plugin = &plugin_api_config_is_set_plugin;
|
||||
new_plugin->config_set_plugin = &plugin_api_config_set_plugin;
|
||||
new_plugin->config_unset_plugin = &plugin_api_config_unset_plugin;
|
||||
|
||||
|
@ -2691,6 +2691,44 @@ weechat_lua_api_config_get_plugin (lua_State *L)
|
||||
LUA_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_config_is_set_plugin: check if a plugin option is set
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_api_config_is_set_plugin (lua_State *L)
|
||||
{
|
||||
const char *option;
|
||||
int n, rc;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
|
||||
LUA_RETURN_INT(0);
|
||||
}
|
||||
|
||||
option = NULL;
|
||||
|
||||
n = lua_gettop (lua_current_interpreter);
|
||||
|
||||
if (n < 1)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
|
||||
LUA_RETURN_INT(0);
|
||||
}
|
||||
|
||||
option = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
rc = script_api_config_is_set_plugin (weechat_lua_plugin,
|
||||
lua_current_script,
|
||||
option);
|
||||
|
||||
LUA_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_config_set_plugin: set value of a plugin option
|
||||
*/
|
||||
@ -7047,6 +7085,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
|
||||
{ "config_free", &weechat_lua_api_config_free },
|
||||
{ "config_get", &weechat_lua_api_config_get },
|
||||
{ "config_get_plugin", &weechat_lua_api_config_get_plugin },
|
||||
{ "config_is_set_plugin", &weechat_lua_api_config_is_set_plugin },
|
||||
{ "config_set_plugin", &weechat_lua_api_config_set_plugin },
|
||||
{ "config_unset_plugin", &weechat_lua_api_config_unset_plugin },
|
||||
{ "prefix", &weechat_lua_api_prefix },
|
||||
|
@ -2257,6 +2257,40 @@ static XS (XS_weechat_api_config_get_plugin)
|
||||
PERL_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::config_is_set_plugin: check if a plugin option is set
|
||||
*/
|
||||
|
||||
static XS (XS_weechat_api_config_is_set_plugin)
|
||||
{
|
||||
char *option;
|
||||
int rc;
|
||||
dXSARGS;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
|
||||
PERL_RETURN_INT(0);
|
||||
}
|
||||
|
||||
if (items < 1)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
|
||||
PERL_RETURN_INT(0);
|
||||
}
|
||||
|
||||
option = SvPV (ST (0), PL_na);
|
||||
|
||||
rc = script_api_config_is_set_plugin (weechat_perl_plugin,
|
||||
perl_current_script,
|
||||
option);
|
||||
|
||||
PERL_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::config_set_plugin: set value of a plugin option
|
||||
*/
|
||||
@ -5646,6 +5680,7 @@ weechat_perl_api_init (pTHX)
|
||||
newXS ("weechat::config_free", XS_weechat_api_config_free, "weechat");
|
||||
newXS ("weechat::config_get", XS_weechat_api_config_get, "weechat");
|
||||
newXS ("weechat::config_get_plugin", XS_weechat_api_config_get_plugin, "weechat");
|
||||
newXS ("weechat::config_is_set_plugin", XS_weechat_api_config_is_set_plugin, "weechat");
|
||||
newXS ("weechat::config_set_plugin", XS_weechat_api_config_set_plugin, "weechat");
|
||||
newXS ("weechat::config_unset_plugin", XS_weechat_api_config_unset_plugin, "weechat");
|
||||
newXS ("weechat::prefix", XS_weechat_api_prefix, "weechat");
|
||||
|
@ -2386,6 +2386,40 @@ weechat_python_api_config_get_plugin (PyObject *self, PyObject *args)
|
||||
PYTHON_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_config_is_set_plugin: check if a plugin option is set
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
weechat_python_api_config_is_set_plugin (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *option;
|
||||
int rc;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) self;
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
|
||||
PYTHON_RETURN_INT(0);
|
||||
}
|
||||
|
||||
option = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s", &option))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
|
||||
PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
|
||||
}
|
||||
|
||||
rc = script_api_config_is_set_plugin (weechat_python_plugin,
|
||||
python_current_script,
|
||||
option);
|
||||
|
||||
PYTHON_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_config_set_plugin: set value of a plugin option
|
||||
*/
|
||||
@ -5924,6 +5958,7 @@ PyMethodDef weechat_python_funcs[] =
|
||||
{ "config_free", &weechat_python_api_config_free, METH_VARARGS, "" },
|
||||
{ "config_get", &weechat_python_api_config_get, METH_VARARGS, "" },
|
||||
{ "config_get_plugin", &weechat_python_api_config_get_plugin, METH_VARARGS, "" },
|
||||
{ "config_is_set_plugin", &weechat_python_api_config_is_set_plugin, METH_VARARGS, "" },
|
||||
{ "config_set_plugin", &weechat_python_api_config_set_plugin, METH_VARARGS, "" },
|
||||
{ "config_unset_plugin", &weechat_python_api_config_unset_plugin, METH_VARARGS, "" },
|
||||
{ "prefix", &weechat_python_api_prefix, METH_VARARGS, "" },
|
||||
|
@ -2760,6 +2760,42 @@ weechat_ruby_api_config_get_plugin (VALUE class, VALUE option)
|
||||
RUBY_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_config_is_set_plugin: check if a plugin option is set
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_config_is_set_plugin (VALUE class, VALUE option)
|
||||
{
|
||||
char *c_option;
|
||||
int rc;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
|
||||
RUBY_RETURN_INT(0);
|
||||
}
|
||||
|
||||
if (NIL_P (option))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
|
||||
RUBY_RETURN_INT(0);
|
||||
}
|
||||
|
||||
Check_Type (option, T_STRING);
|
||||
|
||||
c_option = STR2CSTR (option);
|
||||
|
||||
rc = script_api_config_is_set_plugin (weechat_ruby_plugin,
|
||||
ruby_current_script,
|
||||
c_option);
|
||||
|
||||
RUBY_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_config_set_plugin: set value of a plugin option
|
||||
*/
|
||||
@ -6837,6 +6873,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
|
||||
rb_define_module_function (ruby_mWeechat, "config_free", &weechat_ruby_api_config_free, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_get", &weechat_ruby_api_config_get, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_get_plugin", &weechat_ruby_api_config_get_plugin, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_is_set_plugin", &weechat_ruby_api_config_is_set_plugin, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_set_plugin", &weechat_ruby_api_config_set_plugin, 2);
|
||||
rb_define_module_function (ruby_mWeechat, "config_unset_plugin", &weechat_ruby_api_config_unset_plugin, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "prefix", &weechat_ruby_api_prefix, 1);
|
||||
|
@ -1535,6 +1535,33 @@ script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/*
|
||||
* script_api_config_is_set_plugin: check if a script option is set
|
||||
*/
|
||||
|
||||
int
|
||||
script_api_config_is_set_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option)
|
||||
{
|
||||
char *option_fullname;
|
||||
int return_code;
|
||||
|
||||
option_fullname = malloc ((strlen (script->name) +
|
||||
strlen (option) + 2));
|
||||
if (!option_fullname)
|
||||
return 0;
|
||||
|
||||
strcpy (option_fullname, script->name);
|
||||
strcat (option_fullname, ".");
|
||||
strcat (option_fullname, option);
|
||||
|
||||
return_code = weechat_config_is_set_plugin (option_fullname);
|
||||
free (option_fullname);
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/*
|
||||
* script_api_config_set_plugin: set value of a script config option
|
||||
* format in file is "plugin.script.option"
|
||||
|
@ -286,6 +286,9 @@ extern void script_api_command (struct t_weechat_plugin *weechat_plugin,
|
||||
extern const char *script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option);
|
||||
extern int script_api_config_is_set_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option);
|
||||
extern int script_api_config_set_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option, const char *value);
|
||||
|
@ -2583,6 +2583,42 @@ weechat_tcl_api_config_get_plugin (ClientData clientData, Tcl_Interp *interp,
|
||||
TCL_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_tcl_api_config_is_set_plugin: check if a plugin option is set
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_tcl_api_config_is_set_plugin (ClientData clientData, Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *CONST objv[])
|
||||
{
|
||||
Tcl_Obj *objp;
|
||||
char *option;
|
||||
int i, rc;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) clientData;
|
||||
|
||||
if (!tcl_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
|
||||
TCL_RETURN_INT(0);
|
||||
}
|
||||
|
||||
if (objc < 2)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_is_set_plugin");
|
||||
TCL_RETURN_INT(0);
|
||||
}
|
||||
|
||||
option = Tcl_GetStringFromObj (objv[1], &i);
|
||||
|
||||
rc = script_api_config_is_set_plugin (weechat_tcl_plugin,
|
||||
tcl_current_script,
|
||||
option);
|
||||
|
||||
TCL_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_tcl_api_config_set_plugin: set value of a plugin option
|
||||
*/
|
||||
@ -6434,6 +6470,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
|
||||
weechat_tcl_api_config_get, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp, "weechat::config_get_plugin",
|
||||
weechat_tcl_api_config_get_plugin, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp, "weechat::config_is_set_plugin",
|
||||
weechat_tcl_api_config_is_set_plugin, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp, "weechat::config_set_plugin",
|
||||
weechat_tcl_api_config_set_plugin, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp, "weechat::config_unset_plugin",
|
||||
|
@ -334,6 +334,8 @@ struct t_weechat_plugin
|
||||
struct t_config_option *(*config_get) (const char *option_name);
|
||||
const char *(*config_get_plugin) (struct t_weechat_plugin *plugin,
|
||||
const char *option_name);
|
||||
int (*config_is_set_plugin) (struct t_weechat_plugin *plugin,
|
||||
const char *option_name);
|
||||
int (*config_set_plugin) (struct t_weechat_plugin *plugin,
|
||||
const char *option_name, const char *value);
|
||||
int (*config_unset_plugin) (struct t_weechat_plugin *plugin,
|
||||
@ -908,6 +910,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
|
||||
weechat_plugin->config_get(__option)
|
||||
#define weechat_config_get_plugin(__option) \
|
||||
weechat_plugin->config_get_plugin(weechat_plugin, __option)
|
||||
#define weechat_config_is_set_plugin(__option) \
|
||||
weechat_plugin->config_is_set_plugin(weechat_plugin, __option)
|
||||
#define weechat_config_set_plugin(__option, __value) \
|
||||
weechat_plugin->config_set_plugin(weechat_plugin, __option, \
|
||||
__value)
|
||||
|
Loading…
x
Reference in New Issue
Block a user