3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-22 03:49:27 +01:00

implement draft/no-implicit-names

This commit is contained in:
Shivaram Lingamneni 2023-08-15 20:29:57 -04:00
parent 24ba72cfd6
commit 3f74612e2b
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

@ -884,7 +884,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)
if !rb.session.capabilities.Has(caps.NoImplicitNames) {
channel.Names(client, rb) 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 {
@ -975,7 +977,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)
if !session.capabilities.Has(caps.NoImplicitNames) {
channel.Names(client, sessionRb) channel.Names(client, sessionRb)
}
sessionRb.Send(false) sessionRb.Send(false)
} }

View File

@ -3169,8 +3169,10 @@ 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)
if !targetRb.session.capabilities.Has(caps.NoImplicitNames) {
channel.Names(mcl, targetRb) channel.Names(mcl, targetRb)
} }
}
if mcl != client { if mcl != client {
targetRb.Send(false) targetRb.Send(false)
} }