Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • root_commands.c

    r5a8afc3 r4a9c6b0  
    10641064                format = "%s\t%s\t%s";
    10651065        } else {
    1066                 format = "%-16.16s  %-40.40s  %s";
     1066                format = "%-24.24s  %-40.40s  %s";
    10671067        }
    10681068
     
    11641164}
    11651165
     1166static void cmd_plugins_info(irc_t *irc, char **cmd)
     1167{
     1168        GList *l;
     1169        struct plugin_info *info;
     1170
     1171        MIN_ARGS(2);
     1172
     1173        for (l = get_plugins(); l; l = l->next) {
     1174                info = l->data;
     1175                if (g_strcasecmp(cmd[2], info->name) == 0) {
     1176                        break;
     1177                }
     1178        }
     1179
     1180        if (!l) {
     1181                return;
     1182        }
     1183
     1184        irc_rootmsg(irc, "%s:", info->name);
     1185        irc_rootmsg(irc, "  Version: %s", info->version);
     1186
     1187        if (info->description) {
     1188                irc_rootmsg(irc, "  Description: %s", info->description);
     1189        }
     1190
     1191        if (info->author) {
     1192                irc_rootmsg(irc, "  Author: %s", info->author);
     1193        }
     1194
     1195        if (info->url) {
     1196                irc_rootmsg(irc, "  URL: %s", info->url);
     1197        }
     1198}
     1199
    11661200static void cmd_plugins(irc_t *irc, char **cmd)
    11671201{
    11681202        GList *prpls;
    11691203        GString *gstr;
     1204
     1205        if (cmd[1] && g_strcasecmp(cmd[1], "info") == 0) {
     1206                cmd_plugins_info(irc, cmd);
     1207                return;
     1208        }
    11701209
    11711210#ifdef WITH_PLUGINS
    11721211        GList *l;
    11731212        struct plugin_info *info;
     1213        char *format;
     1214
     1215        if (strchr(irc->umode, 'b') != NULL) {
     1216                format = "%s\t%s";
     1217        } else {
     1218                format = "%-30s  %s";
     1219        }
     1220
     1221        irc_rootmsg(irc, format, "Plugin", "Version");
    11741222
    11751223        for (l = get_plugins(); l; l = l->next) {
     1224                char *c;
    11761225                info = l->data;
    1177                 irc_rootmsg(irc, "%s:", info->name);
    1178                 irc_rootmsg(irc, "  Version: %s", info->version);
    1179 
    1180                 if (info->description) {
    1181                         irc_rootmsg(irc, "  Description: %s", info->description);
    1182                 }
    1183 
    1184                 if (info->author) {
    1185                         irc_rootmsg(irc, "  Author: %s", info->author);
    1186                 }
    1187 
    1188                 if (info->url) {
    1189                         irc_rootmsg(irc, "  URL: %s", info->url);
    1190                 }
    1191 
    1192                 irc_rootmsg(irc, "");
     1226
     1227                /* some purple plugins like to include several versions separated by newlines... */
     1228                if ((c = strchr(info->version, '\n'))) {
     1229                        char *version = g_strndup(info->version, c - info->version);
     1230                        irc_rootmsg(irc, format, info->name, version);
     1231                        g_free(version);
     1232                } else {
     1233                        irc_rootmsg(irc, format, info->name, info->version);
     1234                }
    11931235        }
    11941236#endif
     1237
     1238        irc_rootmsg(irc, "");
    11951239
    11961240        gstr = g_string_new(NULL);
     
    13381382        } else if (g_strcasecmp(cmd[1], "set") == 0 ||
    13391383                   g_strcasecmp(cmd[1], "del") == 0) {
    1340                 irc_rootmsg(irc,
    1341                             "Warning: The \002chat\002 command was mostly replaced with the \002channel\002 command.");
    1342                 cmd_channel(irc, cmd);
     1384                irc_rootmsg(irc, "Unknown command: chat %s. Did you mean \002channel %s\002?", cmd[1], cmd[1]);
    13431385        } else {
    13441386                irc_rootmsg(irc,
     
    13981440                topic = ci->topic ? ci->topic : "";
    13991441
    1400                 padded = str_pad_and_truncate(ci->title, title_len, "[...]");
     1442                padded = str_pad_and_truncate(ci->title ? ci->title : "", title_len, "[...]");
    14011443                irc_rootmsg(irc, iformat, ++i, padded, topic);
    14021444                g_free(padded);
Note: See TracChangeset for help on using the changeset viewer.