3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 10:42:52 +01:00

Support bot mode +B

This commit is contained in:
Daniel Oaks 2018-01-07 12:56:51 +10:00
parent 7f06f25c15
commit 3b3c1c733a
3 changed files with 7 additions and 2 deletions

View File

@ -96,6 +96,7 @@ func (modes Modes) String() string {
// User Modes // User Modes
const ( const (
Away Mode = 'a' Away Mode = 'a'
Bot Mode = 'B'
Invisible Mode = 'i' Invisible Mode = 'i'
LocalOperator Mode = 'O' LocalOperator Mode = 'O'
Operator Mode = 'o' Operator Mode = 'o'
@ -110,7 +111,7 @@ const (
var ( var (
// SupportedUserModes are the user modes that we actually support (modifying). // SupportedUserModes are the user modes that we actually support (modifying).
SupportedUserModes = Modes{ 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 acts as a cache for when we introduce users
supportedUserModesString = SupportedUserModes.String() supportedUserModesString = SupportedUserModes.String()
@ -276,7 +277,7 @@ func (client *Client) applyUserModeChanges(force bool, changes ModeChanges) Mode
for _, change := range changes { for _, change := range changes {
switch change.mode { switch change.mode {
case Invisible, WallOps, UserRoleplaying, Operator, LocalOperator, RegisteredOnly: case Bot, Invisible, WallOps, UserRoleplaying, Operator, LocalOperator, RegisteredOnly:
switch change.op { switch change.op {
case Add: case Add:
if !force && (change.mode == Operator || change.mode == LocalOperator) { if !force && (change.mode == Operator || change.mode == LocalOperator) {

View File

@ -72,6 +72,7 @@ const (
RPL_NOTOPIC = "331" RPL_NOTOPIC = "331"
RPL_TOPIC = "332" RPL_TOPIC = "332"
RPL_TOPICTIME = "333" RPL_TOPICTIME = "333"
RPL_WHOISBOT = "335"
RPL_WHOISACTUALLY = "338" RPL_WHOISACTUALLY = "338"
RPL_INVITING = "341" RPL_INVITING = "341"
RPL_SUMMONING = "342" RPL_SUMMONING = "342"

View File

@ -988,6 +988,9 @@ func (client *Client) getWhoisOf(target *Client) {
if target.flags[TLS] { if target.flags[TLS] {
client.Send(nil, client.server.name, RPL_WHOISSECURE, client.nick, target.nick, "is using a secure connection") 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) { 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)) client.Send(nil, client.server.name, RPL_WHOISCERTFP, client.nick, target.nick, fmt.Sprintf("has client certificate fingerprint %s", target.certfp))
} }