aboutsummaryrefslogtreecommitdiffstats
path: root/root_commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'root_commands.c')
-rw-r--r--root_commands.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/root_commands.c b/root_commands.c
index 702a068d..add9bceb 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -1123,6 +1123,91 @@ static void cmd_blist(irc_t *irc, char **cmd)
}
}
+static gint prplcmp(gconstpointer a, gconstpointer b)
+{
+ const struct prpl *pa = a;
+ const struct prpl *pb = b;
+
+ return g_strcasecmp(pa->name, pb->name);
+}
+
+static void prplstr(GList *prpls, GString *gstr)
+{
+ const char *last = NULL;
+ GList *l;
+ struct prpl *p;
+
+ prpls = g_list_copy(prpls);
+ prpls = g_list_sort(prpls, prplcmp);
+
+ for (l = prpls; l; l = l->next) {
+ p = l->data;
+
+ if (last && g_strcasecmp(p->name, last) == 0) {
+ /* Ignore duplicates (mainly for libpurple) */
+ continue;
+ }
+
+ if (gstr->len != 0) {
+ g_string_append(gstr, ", ");
+ }
+
+ g_string_append(gstr, p->name);
+ last = p->name;
+ }
+
+ g_list_free(prpls);
+}
+
+static void cmd_plugins(irc_t *irc, char **cmd)
+{
+ GList *prpls;
+ GString *gstr;
+
+#ifdef WITH_PLUGINS
+ GList *l;
+ struct plugin_info *info;
+
+ for (l = get_plugins(); l; l = l->next) {
+ info = l->data;
+ irc_rootmsg(irc, "%s:", info->name);
+ irc_rootmsg(irc, " Version: %s", info->version);
+
+ if (info->description) {
+ irc_rootmsg(irc, " Description: %s", info->description);
+ }
+
+ if (info->author) {
+ irc_rootmsg(irc, " Author: %s", info->author);
+ }
+
+ if (info->url) {
+ irc_rootmsg(irc, " URL: %s", info->url);
+ }
+
+ irc_rootmsg(irc, "");
+ }
+#endif
+
+ gstr = g_string_new(NULL);
+ prpls = get_protocols();
+
+ if (prpls) {
+ prplstr(prpls, gstr);
+ irc_rootmsg(irc, "Enabled Protocols: %s", gstr->str);
+ g_string_truncate(gstr, 0);
+ }
+
+ prpls = get_protocols_disabled();
+
+ if (prpls) {
+ prplstr(prpls, gstr);
+ irc_rootmsg(irc, "Disabled Protocols: %s", gstr->str);
+ }
+
+ g_string_free(gstr, TRUE);
+}
+
static void cmd_qlist(irc_t *irc, char **cmd)
{
query_t *q = irc->queries;
@@ -1381,6 +1466,7 @@ command_t root_commands[] = {
{ "info", 1, cmd_info, 0 },
{ "nick", 1, cmd_nick, 0 },
{ "no", 0, cmd_yesno, 0 },
+ { "plugins", 0, cmd_plugins, 0 },
{ "qlist", 0, cmd_qlist, 0 },
{ "register", 0, cmd_register, 0 },
{ "remove", 1, cmd_remove, 0 },