Merge pull request #1123 from clukawski/no-ctcp-user-mode

Add +T no-CTCP usermode
This commit is contained in:
Shivaram Lingamneni 2020-06-27 21:13:24 -07:00 committed by GitHub
commit d7a62223a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 2 deletions

View File

@ -2019,6 +2019,12 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
} }
return return
} }
// Restrict CTCP message for target user with +T
if user.modes.HasMode(modes.UserNoCTCP) && message.IsRestrictedCTCPMessage() {
return
}
tDetails := user.Details() tDetails := user.Details()
tnick := tDetails.nick tnick := tDetails.nick

View File

@ -51,6 +51,7 @@ Oragono supports the following channel modes:
+R | Only registered users can join the channel. +R | Only registered users can join the channel.
+s | Secret mode, channel won't show up in /LIST or whois replies. +s | Secret mode, channel won't show up in /LIST or whois replies.
+t | Only channel opers can modify the topic. +t | Only channel opers can modify the topic.
+C | Clients are blocked from sending CTCP messages in the channel.
= Prefixes = = Prefixes =
@ -68,7 +69,8 @@ Oragono supports the following user modes:
+o | User is an IRC operator. +o | User is an IRC operator.
+R | User only accepts messages from other registered users. +R | User only accepts messages from other registered users.
+s | Server Notice Masks (see help with /HELPOP snomasks). +s | Server Notice Masks (see help with /HELPOP snomasks).
+Z | User is connected via TLS.` +Z | User is connected via TLS.
+T | User is blocked from sending CTCP messages.`
snomaskHelpText = `== Server Notice Masks == snomaskHelpText = `== Server Notice Masks ==
Oragono supports the following server notice masks for operators: Oragono supports the following server notice masks for operators:

View File

@ -34,7 +34,7 @@ func ApplyUserModeChanges(client *Client, changes modes.ModeChanges, force bool,
for _, change := range changes { for _, change := range changes {
switch change.Mode { switch change.Mode {
case modes.Bot, modes.Invisible, modes.WallOps, modes.UserRoleplaying, modes.Operator, modes.LocalOperator, modes.RegisteredOnly: case modes.Bot, modes.Invisible, modes.WallOps, modes.UserRoleplaying, modes.Operator, modes.LocalOperator, modes.RegisteredOnly, modes.UserNoCTCP:
switch change.Op { switch change.Op {
case modes.Add: case modes.Add:
if (change.Mode == modes.Operator || change.Mode == modes.LocalOperator) && !(force && oper != nil) { if (change.Mode == modes.Operator || change.Mode == modes.LocalOperator) && !(force && oper != nil) {

View File

@ -105,6 +105,7 @@ const (
RegisteredOnly Mode = 'R' RegisteredOnly Mode = 'R'
ServerNotice Mode = 's' ServerNotice Mode = 's'
TLS Mode = 'Z' TLS Mode = 'Z'
UserNoCTCP Mode = 'T'
UserRoleplaying Mode = 'E' UserRoleplaying Mode = 'E'
WallOps Mode = 'w' WallOps Mode = 'w'
) )