Selaa lähdekoodia

Add +T no-CTCP usermode

tags/v2.2.0-rc1
Conrad Lukawski 4 vuotta sitten
vanhempi
commit
fca2900918
4 muutettua tiedostoa jossa 11 lisäystä ja 2 poistoa
  1. 6
    0
      irc/handlers.go
  2. 3
    1
      irc/help.go
  3. 1
    1
      irc/modes.go
  4. 1
    0
      irc/modes/modes.go

+ 6
- 0
irc/handlers.go Näytä tiedosto

@@ -1938,6 +1938,12 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
1938 1938
 			}
1939 1939
 			return
1940 1940
 		}
1941
+
1942
+		// Restrict CTCP message for target user with +T
1943
+		if user.modes.HasMode(modes.UserNoCTCP) && message.IsRestrictedCTCPMessage() {
1944
+			return
1945
+		}
1946
+
1941 1947
 		tDetails := user.Details()
1942 1948
 		tnick := tDetails.nick
1943 1949
 

+ 3
- 1
irc/help.go Näytä tiedosto

@@ -51,6 +51,7 @@ Oragono supports the following channel modes:
51 51
   +R  |  Only registered users can join the channel.
52 52
   +s  |  Secret mode, channel won't show up in /LIST or whois replies.
53 53
   +t  |  Only channel opers can modify the topic.
54
+  +C  |  Clients are blocked from sending CTCP messages in the channel.
54 55
 
55 56
 = Prefixes =
56 57
 
@@ -68,7 +69,8 @@ Oragono supports the following user modes:
68 69
   +o  |  User is an IRC operator.
69 70
   +R  |  User only accepts messages from other registered users. 
70 71
   +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.`
72 74
 	snomaskHelpText = `== Server Notice Masks ==
73 75
 
74 76
 Oragono supports the following server notice masks for operators:

+ 1
- 1
irc/modes.go Näytä tiedosto

@@ -34,7 +34,7 @@ func ApplyUserModeChanges(client *Client, changes modes.ModeChanges, force bool,
34 34
 
35 35
 	for _, change := range changes {
36 36
 		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:
38 38
 			switch change.Op {
39 39
 			case modes.Add:
40 40
 				if (change.Mode == modes.Operator || change.Mode == modes.LocalOperator) && !(force && oper != nil) {

+ 1
- 0
irc/modes/modes.go Näytä tiedosto

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

Loading…
Peruuta
Tallenna