1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 07:46:38 +02:00

api: add argument "recurse_subdirs" in function exec_on_files()

This commit is contained in:
Sébastien Helleu
2017-07-04 21:58:48 +02:00
parent 275389864b
commit ff448b9096
13 changed files with 53 additions and 21 deletions
+1 -1
View File
@@ -419,7 +419,7 @@ plugin_script_auto_load (struct t_weechat_plugin *weechat_plugin,
snprintf (dir_name, dir_length,
"%s/%s/autoload", dir_home, weechat_plugin->name);
weechat_exec_on_files (dir_name, 0, callback, NULL);
weechat_exec_on_files (dir_name, 0, 0, callback, NULL);
free (dir_name);
}
+2 -1
View File
@@ -1025,6 +1025,7 @@ plugin_auto_load (int argc, char **argv)
util_exec_on_files ((plugin_path2) ?
plugin_path2 : ((plugin_path) ?
plugin_path : CONFIG_STRING(config_plugin_path)),
1,
0,
&plugin_auto_load_file, &plugin_args);
if (plugin_path)
@@ -1039,7 +1040,7 @@ plugin_auto_load (int argc, char **argv)
if (dir_name)
{
snprintf (dir_name, length, "%s/plugins", WEECHAT_LIBDIR);
util_exec_on_files (dir_name, 0,
util_exec_on_files (dir_name, 1, 0,
&plugin_auto_load_file, &plugin_args);
free (dir_name);
}
+2 -2
View File
@@ -214,14 +214,14 @@ script_completion_scripts_files_cb (const void *pointer, void *data,
/* look for files in "~/.weechat/<language>/" */
snprintf (directory, length,
"%s/%s", weechat_home, script_language[i]);
weechat_exec_on_files (directory, 0,
weechat_exec_on_files (directory, 0, 0,
&script_completion_exec_file_cb,
pointers);
/* look for files in "~/.weechat/<language>/autoload/" */
snprintf (directory, length,
"%s/%s/autoload", weechat_home, script_language[i]);
weechat_exec_on_files (directory, 0,
weechat_exec_on_files (directory, 0, 0,
&script_completion_exec_file_cb,
pointers);
}
+7 -4
View File
@@ -67,7 +67,7 @@ struct timeval;
* please change the date with current one; for a second change at same
* date, increment the 01, otherwise please keep 01.
*/
#define WEECHAT_PLUGIN_API_VERSION "20170530-02"
#define WEECHAT_PLUGIN_API_VERSION "20170704-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@@ -362,7 +362,8 @@ struct t_weechat_plugin
int (*mkdir_home) (const char *directory, int mode);
int (*mkdir) (const char *directory, int mode);
int (*mkdir_parents) (const char *directory, int mode);
void (*exec_on_files) (const char *directory, int hidden_files,
void (*exec_on_files) (const char *directory, int recurse_subdirs,
int hidden_files,
void (*callback)(void *data, const char *filename),
void *callback_data);
char *(*file_get_content) (const char *filename);
@@ -1279,9 +1280,11 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
(weechat_plugin->mkdir)(__directory, __mode)
#define weechat_mkdir_parents(__directory, __mode) \
(weechat_plugin->mkdir_parents)(__directory, __mode)
#define weechat_exec_on_files(__directory, __hidden_files, __callback, \
#define weechat_exec_on_files(__directory, __recurse_subdirs, \
__hidden_files, __callback, \
__callback_data) \
(weechat_plugin->exec_on_files)(__directory, __hidden_files, \
(weechat_plugin->exec_on_files)(__directory, __recurse_subdirs, \
__hidden_files, \
__callback, __callback_data)
#define weechat_file_get_content(__filename) \
(weechat_plugin->file_get_content)(__filename)