增加了发布通道
This commit is contained in:
@@ -61,7 +61,10 @@ func (c *Client) handleClientEnterView(cmd *commands.Command) {
|
||||
c.mu.Lock()
|
||||
c.clients[clid] = info
|
||||
unescapedNick := commands.Unescape(nick)
|
||||
if isAutoNicknameMatch(c.nickname, unescapedNick) {
|
||||
// Only allow clid override from nickname match if we haven't received initserver yet.
|
||||
// After initserver, the clid is authoritative and should not be overwritten by
|
||||
// stale same-UID sessions that happen to have matching nicknames.
|
||||
if c.clid == 0 && isAutoNicknameMatch(c.nickname, unescapedNick) {
|
||||
c.clid = clid
|
||||
c.handler.SetClientID(clid)
|
||||
}
|
||||
@@ -80,11 +83,16 @@ func (c *Client) handleClientLeftView(cmd *commands.Command) {
|
||||
if clid != 0 {
|
||||
c.mu.Lock()
|
||||
isSelf := (clid == c.clid)
|
||||
uid := ""
|
||||
if info, ok := c.clients[clid]; ok {
|
||||
uid = info.UID
|
||||
}
|
||||
delete(c.clients, clid)
|
||||
c.mu.Unlock()
|
||||
|
||||
evt := ClientLeftViewEvent{
|
||||
ID: clid,
|
||||
UID: uid,
|
||||
ReasonID: reasonID,
|
||||
ReasonMsg: reasonMsg,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user