mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Only complete unloaded plugins on /plugins load
This commit is contained in:
parent
1a73aa39cb
commit
46687aeced
@ -3761,7 +3761,7 @@ _plugins_autocomplete(ProfWin *window, const char *const input)
|
||||
if ((strncmp(input, "/plugins load ", 14) == 0) && (strlen(input) > 14)) {
|
||||
if (plugins_load_ac == NULL) {
|
||||
plugins_load_ac = autocomplete_new();
|
||||
GSList *plugins = plugins_file_list();
|
||||
GSList *plugins = plugins_unloaded_list();
|
||||
GSList *curr = plugins;
|
||||
while (curr) {
|
||||
autocomplete_add(plugins_load_ac, curr->data);
|
||||
|
@ -181,29 +181,30 @@ _get_plugins_dir(void)
|
||||
}
|
||||
|
||||
void
|
||||
_plugins_list_dir(const gchar *const dir, GSList **result)
|
||||
_plugins_unloaded_list_dir(const gchar *const dir, GSList **result)
|
||||
{
|
||||
GDir *plugins = g_dir_open(dir, 0, NULL);
|
||||
if (plugins == NULL) {
|
||||
GDir *plugins_dir = g_dir_open(dir, 0, NULL);
|
||||
if (plugins_dir == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
const gchar *plugin = g_dir_read_name(plugins);
|
||||
const gchar *plugin = g_dir_read_name(plugins_dir);
|
||||
while (plugin) {
|
||||
if (g_str_has_suffix(plugin, ".so") || g_str_has_suffix(plugin, ".py")) {
|
||||
GSList *found = g_slist_find_custom(plugins, plugin, (GCompareFunc)_find_by_name);
|
||||
if ((g_str_has_suffix(plugin, ".so") || g_str_has_suffix(plugin, ".py")) && !found) {
|
||||
*result = g_slist_append(*result, strdup(plugin));
|
||||
}
|
||||
plugin = g_dir_read_name(plugins);
|
||||
plugin = g_dir_read_name(plugins_dir);
|
||||
}
|
||||
g_dir_close(plugins);
|
||||
g_dir_close(plugins_dir);
|
||||
}
|
||||
|
||||
GSList*
|
||||
plugins_file_list(void)
|
||||
plugins_unloaded_list(void)
|
||||
{
|
||||
GSList *result = NULL;
|
||||
char *plugins_dir = _get_plugins_dir();
|
||||
_plugins_list_dir(plugins_dir, &result);
|
||||
_plugins_unloaded_list_dir(plugins_dir, &result);
|
||||
free(plugins_dir);
|
||||
|
||||
return result;
|
||||
|
@ -99,7 +99,7 @@ typedef struct prof_plugin_t {
|
||||
|
||||
void plugins_init(void);
|
||||
GSList* plugins_get_list(void);
|
||||
GSList *plugins_file_list(void);
|
||||
GSList *plugins_unloaded_list(void);
|
||||
char* plugins_autocomplete(const char *const input);
|
||||
void plugins_reset_autocomplete(void);
|
||||
void plugins_shutdown(void);
|
||||
|
Loading…
Reference in New Issue
Block a user