diff options
-rw-r--r-- | root_commands.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/root_commands.c b/root_commands.c index d731b0d9..702a068d 100644 --- a/root_commands.c +++ b/root_commands.c @@ -654,6 +654,23 @@ static void cmd_channel(irc_t *irc, char **cmd) "channels you're still in cannot be deleted).", irc->default_channel->name); } + } else if (len >= 1 && g_strncasecmp(cmd[2], "rename", len) == 0) { + if (strlen(cmd[3]) < 1) { + irc_rootmsg(irc, "You have to specify new name."); + } else if (!(ic->flags & IRC_CHANNEL_JOINED) && + ic != ic->irc->default_channel) { + if (irc_channel_name_hint(ic, cmd[3])) { + irc_rootmsg(irc, "Channel %s renamed to %s.", + cmd[1], cmd[3]); + } else { + irc_rootmsg(irc, "Failed to rename channel %s to %s.", + cmd[1], cmd[3]); + } + } else { + irc_rootmsg(irc, "Couldn't rename channel (main channel %s or " + "channels you're still in cannot be renamed).", + irc->default_channel->name); + } } else { irc_rootmsg(irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "channel", |