mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-06-09 03:42:25 +03:00
A kick in the pants.
This commit is contained in:
parent
8b4f05b344
commit
820372a975
16
client.go
16
client.go
@ -25,6 +25,7 @@ const HELP_TEXT string = SYSTEM_MESSAGE_FORMAT + `-> Available commands:
|
|||||||
|
|
||||||
const OP_HELP_TEXT string = SYSTEM_MESSAGE_FORMAT + `-> Available operator commands:
|
const OP_HELP_TEXT string = SYSTEM_MESSAGE_FORMAT + `-> Available operator commands:
|
||||||
/ban $NAME - Banish a user from the chat
|
/ban $NAME - Banish a user from the chat
|
||||||
|
/kick $NAME - Kick em' out.
|
||||||
/op $NAME - Promote a user to server operator
|
/op $NAME - Promote a user to server operator
|
||||||
/silence $NAME - Revoke a user's ability to speak
|
/silence $NAME - Revoke a user's ability to speak
|
||||||
`
|
`
|
||||||
@ -236,6 +237,21 @@ func (c *Client) handleShell(channel ssh.Channel) {
|
|||||||
c.Server.Op(fingerprint)
|
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":
|
case "/silence":
|
||||||
if !c.Server.IsOp(c) {
|
if !c.Server.IsOp(c) {
|
||||||
c.SysMsg("You're not an admin.")
|
c.SysMsg("You're not an admin.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user