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",
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():

View File

@ -7,7 +7,7 @@ package caps
const (
// number of recognized capabilities:
numCapabs = 33
numCapabs = 34
// length of the uint32 array that represents the bitset:
bitsetLen = 2
)
@ -65,6 +65,10 @@ const (
// https://github.com/ircv3/ircv3-specifications/pull/398
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":
// https://github.com/ircv3/ircv3-specifications/pull/503
Persistence Capability = iota
@ -162,6 +166,7 @@ var (
"draft/languages",
"draft/message-redaction",
"draft/multiline",
"draft/no-implicit-names",
"draft/persistence",
"draft/pre-away",
"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 {
// don't send topic and names for a SAJOIN of a different client
channel.SendTopic(client, rb, false)
channel.Names(client, rb)
if !rb.session.capabilities.Has(caps.NoImplicitNames) {
channel.Names(client, rb)
}
} else {
// ensure that SAJOIN sends a MODE line to the originating client, if applicable
if givenMode != 0 {
@ -975,7 +977,9 @@ func (channel *Channel) playJoinForSession(session *Session) {
sessionRb.Add(nil, client.server.name, "MARKREAD", chname, client.GetReadMarker(chcfname))
}
channel.SendTopic(client, sessionRb, false)
channel.Names(client, sessionRb)
if !session.capabilities.Has(caps.NoImplicitNames) {
channel.Names(client, sessionRb)
}
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)
}
channel.SendTopic(mcl, targetRb, false)
channel.Names(mcl, targetRb)
if !targetRb.session.capabilities.Has(caps.NoImplicitNames) {
channel.Names(mcl, targetRb)
}
}
if mcl != client {
targetRb.Send(false)