view irccdctl/cli-server-cmode.cpp @ 325:3d1f32a2b994

Irccdctl: bring back server-cmode
author David Demelier <markand@malikania.fr>
date Sun, 06 Nov 2016 20:59:42 +0100
parents
children
line wrap: on
line source

/*
 * command-server-cmode.cpp -- implementation of irccdctl server-mode
 *
 * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include "cli-server-cmode.hpp"

namespace irccd {

namespace cli {

ServerChannelMode::ServerChannelMode()
    : Cli("server-cmode",
          "change channel mode",
          "server-cmode server channel mode",
          "Change the mode of the specified channel.\n\n"
          "Example:\n"
          "\tirccdctl server-cmode freenode #staff +t")
{
}

void ServerChannelMode::exec(Irccdctl &irccdctl, const std::vector<std::string> &args)
{
    if (args.size() < 3)
        throw std::invalid_argument("server-cmode requires 3 arguments");

    check(request(irccdctl, {
        { "command",    "server-cmode"  },
        { "server",     args[0]         },
        { "channel",    args[1]         },
        { "mode",       args[2]         }
    }));
}

} // !cli

} // !irccd