1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Pass plugin name to api layer

This commit is contained in:
James Booth 2016-06-30 22:54:46 +01:00
parent 29eb843d56
commit 56480ce9ea
4 changed files with 14 additions and 14 deletions

View File

@ -106,7 +106,7 @@ api_cons_bad_cmd_usage(const char *const cmd)
}
void
api_register_command(const char *command_name, int min_args, int max_args,
api_register_command(const char *const plugin_name, const char *command_name, int min_args, int max_args,
const char **synopsis, const char *description, const char *arguments[][2], const char **examples, void *callback,
void(*callback_func)(PluginCommand *command, gchar **args))
{
@ -144,7 +144,7 @@ api_register_command(const char *command_name, int min_args, int max_args,
}
void
api_register_timed(void *callback, int interval_seconds,
api_register_timed(const char *const plugin_name, void *callback, int interval_seconds,
void (*callback_func)(PluginTimedFunction *timed_function))
{
PluginTimedFunction *timed_function = malloc(sizeof(PluginTimedFunction));
@ -157,7 +157,7 @@ api_register_timed(void *callback, int interval_seconds,
}
void
api_completer_add(const char *key, char **items)
api_completer_add(const char *const plugin_name, const char *key, char **items)
{
autocompleters_add(key, items);
}

View File

@ -50,13 +50,13 @@ gboolean api_current_win_is_console(void);
char* api_get_current_nick(void);
char** api_get_current_occupants(void);
void api_register_command(const char *command_name, int min_args, int max_args,
void api_register_command(const char *const plugin_name, const char *command_name, int min_args, int max_args,
const char **synopsis, const char *description, const char *arguments[][2], const char **examples,
void *callback, void(*callback_func)(PluginCommand *command, gchar **args));
void api_register_timed(void *callback, int interval_seconds,
void api_register_timed(const char *const plugin_name, void *callback, int interval_seconds,
void (*callback_func)(PluginTimedFunction *timed_function));
void api_completer_add(const char *key, char **items);
void api_completer_add(const char *const plugin_name, const char *key, char **items);
void api_completer_remove(const char *key, char **items);
void api_completer_clear(const char *key);

View File

@ -89,7 +89,7 @@ c_api_register_command(const char *filename, const char *command_name, int min_a
CommandWrapper *wrapper = malloc(sizeof(CommandWrapper));
wrapper->func = callback;
api_register_command(command_name, min_args, max_args, synopsis,
api_register_command(plugin_name, command_name, min_args, max_args, synopsis,
description, arguments, examples, wrapper, c_command_callback);
}
@ -101,7 +101,7 @@ c_api_register_timed(const char *filename, void(*callback)(void), int interval_s
TimedWrapper *wrapper = malloc(sizeof(TimedWrapper));
wrapper->func = callback;
api_register_timed(wrapper, interval_seconds, c_timed_callback);
api_register_timed(plugin_name, wrapper, interval_seconds, c_timed_callback);
}
static void
@ -110,7 +110,7 @@ c_api_completer_add(const char *filename, const char *key, char **items)
char *plugin_name = _c_plugin_name(filename);
log_debug("Autocomplete add %s for %s", key, plugin_name);
api_completer_add(key, items);
api_completer_add(plugin_name, key, items);
}
static void

View File

@ -165,7 +165,7 @@ python_api_register_command(PyObject *self, PyObject *args)
c_examples[len] = NULL;
allow_python_threads();
api_register_command(command_name, min_args, max_args, c_synopsis,
api_register_command(plugin_name, command_name, min_args, max_args, c_synopsis,
description, c_arguments, c_examples, p_callback, python_command_callback);
disable_python_threads();
}
@ -188,7 +188,7 @@ python_api_register_timed(PyObject *self, PyObject *args)
if (p_callback && PyCallable_Check(p_callback)) {
allow_python_threads();
api_register_timed(p_callback, interval_seconds, python_timed_callback);
api_register_timed(plugin_name, p_callback, interval_seconds, python_timed_callback);
disable_python_threads();
}
@ -220,7 +220,7 @@ python_api_completer_add(PyObject *self, PyObject *args)
c_items[len] = NULL;
allow_python_threads();
autocompleters_add(key, c_items);
api_completer_add(plugin_name, key, c_items);
disable_python_threads();
return Py_BuildValue("");
@ -248,7 +248,7 @@ python_api_completer_remove(PyObject *self, PyObject *args)
c_items[len] = NULL;
allow_python_threads();
autocompleters_remove(key, c_items);
api_completer_remove(key, c_items);
disable_python_threads();
return Py_BuildValue("");
@ -264,7 +264,7 @@ python_api_completer_clear(PyObject *self, PyObject *args)
}
allow_python_threads();
autocompleters_clear(key);
api_completer_clear(key);
disable_python_threads();
return Py_BuildValue("");