A kick in the pants.

This commit is contained in:
Andrey Petrov 2014-12-13 11:25:54 -08:00
parent 8b4f05b344
commit 820372a975
1 changed files with 16 additions and 0 deletions

View File

@ -25,6 +25,7 @@ const HELP_TEXT string = SYSTEM_MESSAGE_FORMAT + `-> Available commands:
const OP_HELP_TEXT string = SYSTEM_MESSAGE_FORMAT + `-> Available operator commands:
/ban $NAME - Banish a user from the chat
/kick $NAME - Kick em' out.
/op $NAME - Promote a user to server operator
/silence $NAME - Revoke a user's ability to speak
`
@ -236,6 +237,21 @@ func (c *Client) handleShell(channel ssh.Channel) {
c.Server.Op(fingerprint)
}
}
case "/kick":
if !c.Server.IsOp(c) {
c.SysMsg("You're not an admin.")
} else if len(parts) != 2 {
c.SysMsg("Missing $NAME from: /kick $NAME")
} else {
client := c.Server.Who(parts[1])
if client == nil {
c.SysMsg("No such name: %s", parts[1])
} else {
client.SysMsg2("Kicked by %s.", c.ColoredName())
client.Conn.Close()
c.Server.Broadcast(fmt.Sprintf("* %s was kicked by %s", parts[1], c.ColoredName()), nil)
}
}
case "/silence":
if !c.Server.IsOp(c) {
c.SysMsg("You're not an admin.")