3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-29 07:29:31 +01:00

Merge pull request #2083 from slingamn/nonames.2

implement draft/no-implicit-names
This commit is contained in:
Shivaram Lingamneni 2023-08-16 08:47:05 -07:00 committed by GitHub
commit f07707dfbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 4 deletions

View File

@ -213,6 +213,12 @@ CAPDEFS = [
url="https://github.com/ircv3/ircv3-specifications/pull/506", url="https://github.com/ircv3/ircv3-specifications/pull/506",
standard="IRCv3", standard="IRCv3",
), ),
CapDef(
identifier="NoImplicitNames",
name="draft/no-implicit-names",
url="https://github.com/ircv3/ircv3-specifications/pull/527",
standard="proposed IRCv3",
),
] ]
def validate_defs(): def validate_defs():

View File

@ -7,7 +7,7 @@ package caps
const ( const (
// number of recognized capabilities: // number of recognized capabilities:
numCapabs = 33 numCapabs = 34
// length of the uint32 array that represents the bitset: // length of the uint32 array that represents the bitset:
bitsetLen = 2 bitsetLen = 2
) )
@ -65,6 +65,10 @@ const (
// https://github.com/ircv3/ircv3-specifications/pull/398 // https://github.com/ircv3/ircv3-specifications/pull/398
Multiline Capability = iota Multiline Capability = iota
// NoImplicitNames is the proposed IRCv3 capability named "draft/no-implicit-names":
// https://github.com/ircv3/ircv3-specifications/pull/527
NoImplicitNames Capability = iota
// Persistence is the proposed IRCv3 capability named "draft/persistence": // Persistence is the proposed IRCv3 capability named "draft/persistence":
// https://github.com/ircv3/ircv3-specifications/pull/503 // https://github.com/ircv3/ircv3-specifications/pull/503
Persistence Capability = iota Persistence Capability = iota
@ -162,6 +166,7 @@ var (
"draft/languages", "draft/languages",
"draft/message-redaction", "draft/message-redaction",
"draft/multiline", "draft/multiline",
"draft/no-implicit-names",
"draft/persistence", "draft/persistence",
"draft/pre-away", "draft/pre-away",
"draft/read-marker", "draft/read-marker",

View File

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

View File

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