mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-05-31 23:59:26 +03:00
Merge pull request #106 from leonklingele/unban-fingerprint
Unban fingerprint & List banned fingerprints
This commit is contained in:
commit
6098911ef5
27
client.go
27
client.go
@ -37,6 +37,8 @@ const (
|
|||||||
// OpHelpText is the additional text returned by /help if the client is an Op
|
// OpHelpText is the additional text returned by /help if the client is an Op
|
||||||
OpHelpText string = `Available operator commands:
|
OpHelpText string = `Available operator commands:
|
||||||
/ban $NAME - Banish a user from the chat
|
/ban $NAME - Banish a user from the chat
|
||||||
|
/unban $FINGERPRINT - Unban a fingerprint
|
||||||
|
/banned - List all banned fingerprints
|
||||||
/kick $NAME - Kick em' out.
|
/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.
|
||||||
@ -309,6 +311,31 @@ func (c *Client) handleShell(channel ssh.Channel) {
|
|||||||
c.Server.Broadcast(fmt.Sprintf("* %s was banned by %s", parts[1], c.ColoredName()), nil)
|
c.Server.Broadcast(fmt.Sprintf("* %s was banned by %s", parts[1], c.ColoredName()), nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case "/unban":
|
||||||
|
if !c.Server.IsOp(c) {
|
||||||
|
c.SysMsg("You're not an admin.")
|
||||||
|
} else if len(parts) != 2 {
|
||||||
|
c.SysMsg("Missing $FINGERPRINT from: /unban $FINGERPRINT")
|
||||||
|
} else {
|
||||||
|
fingerprint := parts[1]
|
||||||
|
isBanned := c.Server.IsBanned(fingerprint)
|
||||||
|
if !isBanned {
|
||||||
|
c.SysMsg("No such banned fingerprint: %s", fingerprint)
|
||||||
|
} else {
|
||||||
|
c.Server.Unban(fingerprint)
|
||||||
|
c.Server.Broadcast(fmt.Sprintf("* %s was unbanned by %s", fingerprint, c.ColoredName()), nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case "/banned":
|
||||||
|
if !c.Server.IsOp(c) {
|
||||||
|
c.SysMsg("You're not an admin.")
|
||||||
|
} else if len(parts) != 1 {
|
||||||
|
c.SysMsg("Too many arguments for /banned")
|
||||||
|
} else {
|
||||||
|
for fingerprint := range c.Server.bannedPK {
|
||||||
|
c.SysMsg("Banned fingerprint: %s", fingerprint)
|
||||||
|
}
|
||||||
|
}
|
||||||
case "/op":
|
case "/op":
|
||||||
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