From 3b3c1c733abb9b0b0cde417eaba35c4352e53ce3 Mon Sep 17 00:00:00 2001 From: Daniel Oaks Date: Sun, 7 Jan 2018 12:56:51 +1000 Subject: [PATCH] Support bot mode +B --- irc/modes.go | 5 +++-- irc/numerics.go | 1 + irc/server.go | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/irc/modes.go b/irc/modes.go index c2b4afbb..bd4b9657 100644 --- a/irc/modes.go +++ b/irc/modes.go @@ -96,6 +96,7 @@ func (modes Modes) String() string { // User Modes const ( Away Mode = 'a' + Bot Mode = 'B' Invisible Mode = 'i' LocalOperator Mode = 'O' Operator Mode = 'o' @@ -110,7 +111,7 @@ const ( var ( // SupportedUserModes are the user modes that we actually support (modifying). SupportedUserModes = Modes{ - Away, Invisible, Operator, RegisteredOnly, ServerNotice, UserRoleplaying, + Away, Bot, Invisible, Operator, RegisteredOnly, ServerNotice, UserRoleplaying, } // supportedUserModesString acts as a cache for when we introduce users supportedUserModesString = SupportedUserModes.String() @@ -276,7 +277,7 @@ func (client *Client) applyUserModeChanges(force bool, changes ModeChanges) Mode for _, change := range changes { switch change.mode { - case Invisible, WallOps, UserRoleplaying, Operator, LocalOperator, RegisteredOnly: + case Bot, Invisible, WallOps, UserRoleplaying, Operator, LocalOperator, RegisteredOnly: switch change.op { case Add: if !force && (change.mode == Operator || change.mode == LocalOperator) { diff --git a/irc/numerics.go b/irc/numerics.go index f7799d09..9265fcf1 100644 --- a/irc/numerics.go +++ b/irc/numerics.go @@ -72,6 +72,7 @@ const ( RPL_NOTOPIC = "331" RPL_TOPIC = "332" RPL_TOPICTIME = "333" + RPL_WHOISBOT = "335" RPL_WHOISACTUALLY = "338" RPL_INVITING = "341" RPL_SUMMONING = "342" diff --git a/irc/server.go b/irc/server.go index ebb66102..60ac5db2 100644 --- a/irc/server.go +++ b/irc/server.go @@ -988,6 +988,9 @@ func (client *Client) getWhoisOf(target *Client) { if target.flags[TLS] { client.Send(nil, client.server.name, RPL_WHOISSECURE, client.nick, target.nick, "is using a secure connection") } + if target.flags[Bot] { + client.Send(nil, client.server.name, RPL_WHOISBOT, client.nick, target.nick, ircfmt.Unescape("is a $bBot$b on ")+client.server.networkName) + } if target.certfp != "" && (client.flags[Operator] || client == target) { client.Send(nil, client.server.name, RPL_WHOISCERTFP, client.nick, target.nick, fmt.Sprintf("has client certificate fingerprint %s", target.certfp)) }