diff options
author | Marius Halden <marius.h@lden.org> | 2016-04-22 00:10:38 +0200 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2016-05-07 14:31:03 +0200 |
commit | 72df384c0d35f2d095956cd9e45369a74955a9db (patch) | |
tree | 94c01a89e0cabbc7555091d72c5def97c5aa8f3b | |
parent | 2c711f0dc44559ffaa6d3dba46bc4356e7e61dc6 (diff) |
Add command to rename channels
-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", |