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

Add +T no-CTCP usermode

This commit is contained in:
Conrad Lukawski 2020-06-08 14:43:58 -04:00
parent 425cdffe39
commit fca2900918
4 changed files with 11 additions and 2 deletions

View File

@ -1938,6 +1938,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'
) )