Skip to content

Commit d7a6222

Browse files
authored
Merge pull request #1123 from clukawski/no-ctcp-user-mode
Add +T no-CTCP usermode
2 parents fb7a460 + fca2900 commit d7a6222

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

irc/handlers.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,6 +2019,12 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
20192019
}
20202020
return
20212021
}
2022+
2023+
// Restrict CTCP message for target user with +T
2024+
if user.modes.HasMode(modes.UserNoCTCP) && message.IsRestrictedCTCPMessage() {
2025+
return
2026+
}
2027+
20222028
tDetails := user.Details()
20232029
tnick := tDetails.nick
20242030

irc/help.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Oragono supports the following channel modes:
5151
+R | Only registered users can join the channel.
5252
+s | Secret mode, channel won't show up in /LIST or whois replies.
5353
+t | Only channel opers can modify the topic.
54+
+C | Clients are blocked from sending CTCP messages in the channel.
5455
5556
= Prefixes =
5657
@@ -68,7 +69,8 @@ Oragono supports the following user modes:
6869
+o | User is an IRC operator.
6970
+R | User only accepts messages from other registered users.
7071
+s | Server Notice Masks (see help with /HELPOP snomasks).
71-
+Z | User is connected via TLS.`
72+
+Z | User is connected via TLS.
73+
+T | User is blocked from sending CTCP messages.`
7274
snomaskHelpText = `== Server Notice Masks ==
7375
7476
Oragono supports the following server notice masks for operators:

irc/modes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func ApplyUserModeChanges(client *Client, changes modes.ModeChanges, force bool,
3434

3535
for _, change := range changes {
3636
switch change.Mode {
37-
case modes.Bot, modes.Invisible, modes.WallOps, modes.UserRoleplaying, modes.Operator, modes.LocalOperator, modes.RegisteredOnly:
37+
case modes.Bot, modes.Invisible, modes.WallOps, modes.UserRoleplaying, modes.Operator, modes.LocalOperator, modes.RegisteredOnly, modes.UserNoCTCP:
3838
switch change.Op {
3939
case modes.Add:
4040
if (change.Mode == modes.Operator || change.Mode == modes.LocalOperator) && !(force && oper != nil) {

irc/modes/modes.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ const (
105105
RegisteredOnly Mode = 'R'
106106
ServerNotice Mode = 's'
107107
TLS Mode = 'Z'
108+
UserNoCTCP Mode = 'T'
108109
UserRoleplaying Mode = 'E'
109110
WallOps Mode = 'w'
110111
)

0 commit comments

Comments
 (0)