Browse Source

implement draft/no-implicit-names

tags/v2.12.0-rc1
Shivaram Lingamneni 8 months ago
parent
commit
3f74612e2b
4 changed files with 21 additions and 4 deletions
  1. 6
    0
      gencapdefs.py
  2. 6
    1
      irc/caps/defs.go
  3. 6
    2
      irc/channel.go
  4. 3
    1
      irc/handlers.go

+ 6
- 0
gencapdefs.py View File

@@ -213,6 +213,12 @@ CAPDEFS = [
213 213
         url="https://github.com/ircv3/ircv3-specifications/pull/506",
214 214
         standard="IRCv3",
215 215
     ),
216
+   CapDef(
217
+        identifier="NoImplicitNames",
218
+        name="draft/no-implicit-names",
219
+        url="https://github.com/ircv3/ircv3-specifications/pull/527",
220
+        standard="proposed IRCv3",
221
+    ),
216 222
 ]
217 223
 
218 224
 def validate_defs():

+ 6
- 1
irc/caps/defs.go View File

@@ -7,7 +7,7 @@ package caps
7 7
 
8 8
 const (
9 9
 	// number of recognized capabilities:
10
-	numCapabs = 33
10
+	numCapabs = 34
11 11
 	// length of the uint32 array that represents the bitset:
12 12
 	bitsetLen = 2
13 13
 )
@@ -65,6 +65,10 @@ const (
65 65
 	// https://github.com/ircv3/ircv3-specifications/pull/398
66 66
 	Multiline Capability = iota
67 67
 
68
+	// NoImplicitNames is the proposed IRCv3 capability named "draft/no-implicit-names":
69
+	// https://github.com/ircv3/ircv3-specifications/pull/527
70
+	NoImplicitNames Capability = iota
71
+
68 72
 	// Persistence is the proposed IRCv3 capability named "draft/persistence":
69 73
 	// https://github.com/ircv3/ircv3-specifications/pull/503
70 74
 	Persistence Capability = iota
@@ -162,6 +166,7 @@ var (
162 166
 		"draft/languages",
163 167
 		"draft/message-redaction",
164 168
 		"draft/multiline",
169
+		"draft/no-implicit-names",
165 170
 		"draft/persistence",
166 171
 		"draft/pre-away",
167 172
 		"draft/read-marker",

+ 6
- 2
irc/channel.go View File

@@ -884,7 +884,9 @@ func (channel *Channel) Join(client *Client, key string, isSajoin bool, rb *Resp
884 884
 	if rb.session.client == client {
885 885
 		// don't send topic and names for a SAJOIN of a different client
886 886
 		channel.SendTopic(client, rb, false)
887
-		channel.Names(client, rb)
887
+		if !rb.session.capabilities.Has(caps.NoImplicitNames) {
888
+			channel.Names(client, rb)
889
+		}
888 890
 	} else {
889 891
 		// ensure that SAJOIN sends a MODE line to the originating client, if applicable
890 892
 		if givenMode != 0 {
@@ -975,7 +977,9 @@ func (channel *Channel) playJoinForSession(session *Session) {
975 977
 		sessionRb.Add(nil, client.server.name, "MARKREAD", chname, client.GetReadMarker(chcfname))
976 978
 	}
977 979
 	channel.SendTopic(client, sessionRb, false)
978
-	channel.Names(client, sessionRb)
980
+	if !session.capabilities.Has(caps.NoImplicitNames) {
981
+		channel.Names(client, sessionRb)
982
+	}
979 983
 	sessionRb.Send(false)
980 984
 }
981 985
 

+ 3
- 1
irc/handlers.go View File

@@ -3169,7 +3169,9 @@ func renameHandler(server *Server, client *Client, msg ircmsg.Message, rb *Respo
3169 3169
 					targetRb.Add(nil, targetPrefix, "JOIN", newName)
3170 3170
 				}
3171 3171
 				channel.SendTopic(mcl, targetRb, false)
3172
-				channel.Names(mcl, targetRb)
3172
+				if !targetRb.session.capabilities.Has(caps.NoImplicitNames) {
3173
+					channel.Names(mcl, targetRb)
3174
+				}
3173 3175
 			}
3174 3176
 			if mcl != client {
3175 3177
 				targetRb.Send(false)

Loading…
Cancel
Save