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:
parent
29eb843d56
commit
56480ce9ea
@ -106,7 +106,7 @@ api_cons_bad_cmd_usage(const char *const cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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,
|
const char **synopsis, const char *description, const char *arguments[][2], const char **examples, void *callback,
|
||||||
void(*callback_func)(PluginCommand *command, gchar **args))
|
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
|
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))
|
void (*callback_func)(PluginTimedFunction *timed_function))
|
||||||
{
|
{
|
||||||
PluginTimedFunction *timed_function = malloc(sizeof(PluginTimedFunction));
|
PluginTimedFunction *timed_function = malloc(sizeof(PluginTimedFunction));
|
||||||
@ -157,7 +157,7 @@ api_register_timed(void *callback, int interval_seconds,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
autocompleters_add(key, items);
|
||||||
}
|
}
|
||||||
|
@ -50,13 +50,13 @@ gboolean api_current_win_is_console(void);
|
|||||||
char* api_get_current_nick(void);
|
char* api_get_current_nick(void);
|
||||||
char** api_get_current_occupants(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,
|
const char **synopsis, const char *description, const char *arguments[][2], const char **examples,
|
||||||
void *callback, void(*callback_func)(PluginCommand *command, gchar **args));
|
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 (*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_remove(const char *key, char **items);
|
||||||
void api_completer_clear(const char *key);
|
void api_completer_clear(const char *key);
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ c_api_register_command(const char *filename, const char *command_name, int min_a
|
|||||||
|
|
||||||
CommandWrapper *wrapper = malloc(sizeof(CommandWrapper));
|
CommandWrapper *wrapper = malloc(sizeof(CommandWrapper));
|
||||||
wrapper->func = callback;
|
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);
|
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));
|
TimedWrapper *wrapper = malloc(sizeof(TimedWrapper));
|
||||||
wrapper->func = callback;
|
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
|
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);
|
char *plugin_name = _c_plugin_name(filename);
|
||||||
log_debug("Autocomplete add %s for %s", key, plugin_name);
|
log_debug("Autocomplete add %s for %s", key, plugin_name);
|
||||||
|
|
||||||
api_completer_add(key, items);
|
api_completer_add(plugin_name, key, items);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -165,7 +165,7 @@ python_api_register_command(PyObject *self, PyObject *args)
|
|||||||
c_examples[len] = NULL;
|
c_examples[len] = NULL;
|
||||||
|
|
||||||
allow_python_threads();
|
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);
|
description, c_arguments, c_examples, p_callback, python_command_callback);
|
||||||
disable_python_threads();
|
disable_python_threads();
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ python_api_register_timed(PyObject *self, PyObject *args)
|
|||||||
|
|
||||||
if (p_callback && PyCallable_Check(p_callback)) {
|
if (p_callback && PyCallable_Check(p_callback)) {
|
||||||
allow_python_threads();
|
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();
|
disable_python_threads();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ python_api_completer_add(PyObject *self, PyObject *args)
|
|||||||
c_items[len] = NULL;
|
c_items[len] = NULL;
|
||||||
|
|
||||||
allow_python_threads();
|
allow_python_threads();
|
||||||
autocompleters_add(key, c_items);
|
api_completer_add(plugin_name, key, c_items);
|
||||||
disable_python_threads();
|
disable_python_threads();
|
||||||
|
|
||||||
return Py_BuildValue("");
|
return Py_BuildValue("");
|
||||||
@ -248,7 +248,7 @@ python_api_completer_remove(PyObject *self, PyObject *args)
|
|||||||
c_items[len] = NULL;
|
c_items[len] = NULL;
|
||||||
|
|
||||||
allow_python_threads();
|
allow_python_threads();
|
||||||
autocompleters_remove(key, c_items);
|
api_completer_remove(key, c_items);
|
||||||
disable_python_threads();
|
disable_python_threads();
|
||||||
|
|
||||||
return Py_BuildValue("");
|
return Py_BuildValue("");
|
||||||
@ -264,7 +264,7 @@ python_api_completer_clear(PyObject *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
allow_python_threads();
|
allow_python_threads();
|
||||||
autocompleters_clear(key);
|
api_completer_clear(key);
|
||||||
disable_python_threads();
|
disable_python_threads();
|
||||||
|
|
||||||
return Py_BuildValue("");
|
return Py_BuildValue("");
|
||||||
|
Loading…
Reference in New Issue
Block a user