mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Add macro for plugins completer add
This commit is contained in:
parent
1e37b755fe
commit
61a09476c5
@ -105,8 +105,11 @@ c_api_register_timed(const char *filename, void(*callback)(void), int interval_s
|
||||
}
|
||||
|
||||
static void
|
||||
c_api_completer_add(const char *key, char **items)
|
||||
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);
|
||||
}
|
||||
|
||||
@ -307,7 +310,7 @@ c_api_init(void)
|
||||
prof_cons_bad_cmd_usage = c_api_cons_bad_cmd_usage;
|
||||
_prof_register_command = c_api_register_command;
|
||||
_prof_register_timed = c_api_register_timed;
|
||||
prof_completer_add = c_api_completer_add;
|
||||
_prof_completer_add = c_api_completer_add;
|
||||
prof_completer_remove = c_api_completer_remove;
|
||||
prof_completer_clear = c_api_completer_clear;
|
||||
prof_notify = c_api_notify;
|
||||
|
@ -48,7 +48,7 @@ void (*_prof_register_command)(const char *filename, const char *command_name, i
|
||||
|
||||
void (*_prof_register_timed)(const char *filename, void(*callback)(void), int interval_seconds) = NULL;
|
||||
|
||||
void (*prof_completer_add)(const char *key, char **items) = NULL;
|
||||
void (*_prof_completer_add)(const char *filename, const char *key, char **items) = NULL;
|
||||
void (*prof_completer_remove)(const char *key, char **items) = NULL;
|
||||
void (*prof_completer_clear)(const char *key) = NULL;
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#define prof_register_command(command_name, min_args, max_args, synopsis, description, arguments, examples, callback) _prof_register_command(__FILE__, command_name, min_args, max_args, synopsis, description, arguments, examples, callback)
|
||||
#define prof_register_timed(callback, interval_seconds) _prof_register_timed(__FILE__, callback, interval_seconds)
|
||||
#define prof_completer_add(key, items) _prof_completer_add(__FILE__, key, items)
|
||||
|
||||
typedef char* PROF_WIN_TAG;
|
||||
|
||||
@ -51,7 +52,7 @@ void (*_prof_register_command)(const char *filename, const char *command_name, i
|
||||
|
||||
void (*_prof_register_timed)(const char *filename, void(*callback)(void), int interval_seconds);
|
||||
|
||||
void (*prof_completer_add)(const char *key, char **items);
|
||||
void (*_prof_completer_add)(const char *filename, const char *key, char **items);
|
||||
void (*prof_completer_remove)(const char *key, char **items);
|
||||
void (*prof_completer_clear)(const char *key);
|
||||
|
||||
|
@ -205,6 +205,9 @@ python_api_completer_add(PyObject *self, PyObject *args)
|
||||
return Py_BuildValue("");
|
||||
}
|
||||
|
||||
char *plugin_name = _python_plugin_name();
|
||||
log_debug("Autocomplete add %s for %s", key, plugin_name);
|
||||
|
||||
Py_ssize_t len = PyList_Size(items);
|
||||
char *c_items[len];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user