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

Merge branch 'master' into osx-functional

This commit is contained in:
James Booth 2016-04-12 23:26:31 +01:00
commit 4849e097d3
3 changed files with 12 additions and 11 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);