diff options
| -rw-r--r-- | doc/user-guide/commands.xml | 6 | ||||
| -rw-r--r-- | root_commands.c | 67 | 
2 files changed, 56 insertions, 17 deletions
| diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index 6b725156..7190f024 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -1868,12 +1868,16 @@  	<bitlbee-command name="plugins">  		<short-description>List all the external plugins and protocols</short-description> -		<syntax>plugins</syntax> +		<syntax>plugins [info <name>]</syntax>  		<description>  			<para>  				This gives you a list of all the external plugins and protocols.  			</para> + +			<para> +				Use the <emphasis>info</emphasis> subcommand to get more details about a plugin. +			</para>  		</description>  	</bitlbee-command> diff --git a/root_commands.c b/root_commands.c index e0c0b7f8..6bc34fb5 100644 --- a/root_commands.c +++ b/root_commands.c @@ -1163,36 +1163,71 @@ static void prplstr(GList *prpls, GString *gstr)  	g_list_free(prpls);  } +static void cmd_plugins_info(irc_t *irc, char **cmd) +{ +	GList *l; +	struct plugin_info *info; + +	MIN_ARGS(2); + +	for (l = get_plugins(); l; l = l->next) { +		info = l->data; +		if (g_strcasecmp(cmd[2], info->name) == 0) { +			break; +		} +	} + +	if (!l) { +		return; +	} + +	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); +	} +} +  static void cmd_plugins(irc_t *irc, char **cmd)  {  	GList *prpls;  	GString *gstr; +	if (cmd[1] && g_strcasecmp(cmd[1], "info") == 0) { +		cmd_plugins_info(irc, cmd); +		return; +	} +  #ifdef WITH_PLUGINS  	GList *l;  	struct plugin_info *info; +	char *format; -	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 (strchr(irc->umode, 'b') != NULL) { +		format = "%s\t%s"; +	} else { +		format = "%-30s  %s"; +	} -		if (info->url) { -			irc_rootmsg(irc, "  URL: %s", info->url); -		} +	irc_rootmsg(irc, format, "Plugin", "Version"); -		irc_rootmsg(irc, ""); +	for (l = get_plugins(); l; l = l->next) { +		info = l->data; +		irc_rootmsg(irc, format, info->name, info->version);  	}  #endif +	irc_rootmsg(irc, ""); +  	gstr = g_string_new(NULL);  	prpls = get_protocols(); | 
