mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-06-04 09:31:14 +03:00
Adding troutslap command
This commit is contained in:
parent
9a2d14066c
commit
fb71e60d99
23
client.go
23
client.go
@ -173,6 +173,15 @@ func (c *Client) Fingerprint() string {
|
|||||||
return c.Conn.Permissions.Extensions["fingerprint"]
|
return c.Conn.Permissions.Extensions["fingerprint"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Emote formats and sends an emote
|
||||||
|
func (c *Client) Emote(message string) {
|
||||||
|
formatted := fmt.Sprintf("** %s%s", c.ColoredName(), message)
|
||||||
|
if c.IsSilenced() || len(message) > 1000 {
|
||||||
|
c.SysMsg("Message rejected")
|
||||||
|
}
|
||||||
|
c.Server.Broadcast(formatted, nil)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) handleShell(channel ssh.Channel) {
|
func (c *Client) handleShell(channel ssh.Channel) {
|
||||||
defer channel.Close()
|
defer channel.Close()
|
||||||
|
|
||||||
@ -229,12 +238,16 @@ func (c *Client) handleShell(channel ssh.Channel) {
|
|||||||
if me == "" {
|
if me == "" {
|
||||||
me = " is at a loss for words."
|
me = " is at a loss for words."
|
||||||
}
|
}
|
||||||
msg := fmt.Sprintf("** %s%s", c.ColoredName(), me)
|
c.Emote(me)
|
||||||
if c.IsSilenced() || len(msg) > 1000 {
|
case "/slap":
|
||||||
c.SysMsg("Message rejected.")
|
slappee := "themself"
|
||||||
} else {
|
if len(parts) > 1 {
|
||||||
c.Server.Broadcast(msg, nil)
|
slappee = parts[1]
|
||||||
|
if len(parts[1]) > 100 {
|
||||||
|
slappee = "some long-named jerk"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
c.Emote(fmt.Sprintf(" slaps %s around a bit with a large trout", slappee))
|
||||||
case "/nick":
|
case "/nick":
|
||||||
if len(parts) == 2 {
|
if len(parts) == 2 {
|
||||||
c.Server.Rename(c, parts[1])
|
c.Server.Rename(c, parts[1])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user