mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
List globally available plugins
Packagers can package https://github.com/profanity-im/profanity-plugins or another collection of plugins to `/usr/local/share/profanity/plugins` (python) and `/usr/local/lib64/profanity` (c). `/plugins` will list these globally available plugins now along with the ones thare are installed (`~/.local/share/profanity/plugins`) and loaded. Regards https://github.com/profanity-im/profanity/issues/945
This commit is contained in:
parent
7486e22b77
commit
25820235fe
@ -2155,7 +2155,7 @@ static struct cmd_t command_defs[] = {
|
|||||||
"/plugins reload [<plugin>]",
|
"/plugins reload [<plugin>]",
|
||||||
"/plugins python_version")
|
"/plugins python_version")
|
||||||
CMD_DESC(
|
CMD_DESC(
|
||||||
"Manage plugins. Passing no arguments lists currently loaded plugins.")
|
"Manage plugins. Passing no arguments lists currently loaded plugins and global plugins which are available for local installation. Global directory for Python plugins is " GLOBAL_PYTHON_PLUGINS_PATH " and for C Plugins is " GLOBAL_C_PLUGINS_PATH ".")
|
||||||
CMD_ARGS(
|
CMD_ARGS(
|
||||||
{ "install [<path>]", "Install a plugin, or all plugins found in a directory (recursive)." },
|
{ "install [<path>]", "Install a plugin, or all plugins found in a directory (recursive)." },
|
||||||
{ "uninstall [<plugin>]", "Uninstall a plugin." },
|
{ "uninstall [<plugin>]", "Uninstall a plugin." },
|
||||||
|
@ -7172,6 +7172,42 @@ cmd_plugins_python_version(ProfWin* window, const char* const command, gchar** a
|
|||||||
gboolean
|
gboolean
|
||||||
cmd_plugins(ProfWin* window, const char* const command, gchar** args)
|
cmd_plugins(ProfWin* window, const char* const command, gchar** args)
|
||||||
{
|
{
|
||||||
|
GDir* global_pyp_dir = NULL;
|
||||||
|
GDir* global_cp_dir = NULL;
|
||||||
|
|
||||||
|
if (access(GLOBAL_PYTHON_PLUGINS_PATH, R_OK) == 0) {
|
||||||
|
GError* error = NULL;
|
||||||
|
global_pyp_dir = g_dir_open(GLOBAL_PYTHON_PLUGINS_PATH, 0, &error);
|
||||||
|
if (error) {
|
||||||
|
log_warning("Error when trying to open global plugins path: %s", GLOBAL_PYTHON_PLUGINS_PATH);
|
||||||
|
g_error_free(error);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (access(GLOBAL_C_PLUGINS_PATH, R_OK) == 0) {
|
||||||
|
GError* error = NULL;
|
||||||
|
global_cp_dir = g_dir_open(GLOBAL_C_PLUGINS_PATH, 0, &error);
|
||||||
|
if (error) {
|
||||||
|
log_warning("Error when trying to open global plugins path: %s", GLOBAL_C_PLUGINS_PATH);
|
||||||
|
g_error_free(error);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (global_pyp_dir) {
|
||||||
|
const gchar *filename;
|
||||||
|
cons_show("The following Python plugins are available globally and can be installed:");
|
||||||
|
while ((filename = g_dir_read_name(global_pyp_dir))) {
|
||||||
|
cons_show(" %s", filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (global_cp_dir) {
|
||||||
|
const gchar *filename;
|
||||||
|
cons_show("The following C plugins are available globally and can be installed:");
|
||||||
|
while ((filename = g_dir_read_name(global_cp_dir))) {
|
||||||
|
cons_show(" %s", filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GList* plugins = plugins_loaded_list();
|
GList* plugins = plugins_loaded_list();
|
||||||
if (plugins == NULL) {
|
if (plugins == NULL) {
|
||||||
cons_show("No plugins installed.");
|
cons_show("No plugins installed.");
|
||||||
|
Loading…
Reference in New Issue
Block a user