about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-06-30 22:54:46 +0100
committerJames Booth <boothj5@gmail.com>2016-06-30 22:54:46 +0100
commit56480ce9ea25697215e677d029f0ad25f9cc8b99 (patch)
treed6e50f2244d94efd1ef681dfc7bac298e4a7e9b0
parent29eb843d56c2c52e9ae13144c93f094821ecff06 (diff)
downloadprofani-tty-56480ce9ea25697215e677d029f0ad25f9cc8b99.tar.gz
Pass plugin name to api layer
-rw-r--r--src/plugins/api.c6
-rw-r--r--src/plugins/api.h6
-rw-r--r--src/plugins/c_api.c6
-rw-r--r--src/plugins/python_api.c10
4 files changed, 14 insertions, 14 deletions
diff --git a/src/plugins/api.c b/src/plugins/api.c
index 326ec61d..3bdb073b 100644
--- a/src/plugins/api.c
+++ b/src/plugins/api.c
@@ -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);
 }
diff --git a/src/plugins/api.h b/src/plugins/api.h
index a835cd8b..afa9f5a1 100644
--- a/src/plugins/api.h
+++ b/src/plugins/api.h
@@ -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);
 
diff --git a/src/plugins/c_api.c b/src/plugins/c_api.c
index b5624946..1fab40f9 100644
--- a/src/plugins/c_api.c
+++ b/src/plugins/c_api.c
@@ -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
diff --git a/src/plugins/python_api.c b/src/plugins/python_api.c
index 87a2b4d2..d0d223e8 100644
--- a/src/plugins/python_api.c
+++ b/src/plugins/python_api.c
@@ -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("");