mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-25 13:29:27 +01:00
fix #1941
KLINE'd clients would produce a QUIT snotice without a corresponding CONNECT snotice; explicitly suppress the QUIT snotice.
This commit is contained in:
parent
dea2e7961a
commit
077081076c
@ -80,6 +80,7 @@ type Client struct {
|
|||||||
hostname string
|
hostname string
|
||||||
invitedTo map[string]channelInvite
|
invitedTo map[string]channelInvite
|
||||||
isSTSOnly bool
|
isSTSOnly bool
|
||||||
|
isKlined bool // #1941: k-line kills are special-cased to suppress some triggered notices/events
|
||||||
languages []string
|
languages []string
|
||||||
lastActive time.Time // last time they sent a command that wasn't PONG or similar
|
lastActive time.Time // last time they sent a command that wasn't PONG or similar
|
||||||
lastSeen map[string]time.Time // maps device ID (including "") to time of last received command
|
lastSeen map[string]time.Time // maps device ID (including "") to time of last received command
|
||||||
@ -1181,6 +1182,7 @@ func (client *Client) destroy(session *Session) {
|
|||||||
details := client.detailsNoMutex()
|
details := client.detailsNoMutex()
|
||||||
sessionRemoved := false
|
sessionRemoved := false
|
||||||
registered := client.registered
|
registered := client.registered
|
||||||
|
isKlined := client.isKlined
|
||||||
// XXX a temporary (reattaching) client can be marked alwaysOn when it logs in,
|
// XXX a temporary (reattaching) client can be marked alwaysOn when it logs in,
|
||||||
// but then the session attaches to another client and we need to clean it up here
|
// but then the session attaches to another client and we need to clean it up here
|
||||||
alwaysOn := registered && client.alwaysOn
|
alwaysOn := registered && client.alwaysOn
|
||||||
@ -1341,9 +1343,11 @@ func (client *Client) destroy(session *Session) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if registered {
|
if registered {
|
||||||
|
if !isKlined {
|
||||||
client.server.snomasks.Send(sno.LocalQuits, fmt.Sprintf(ircfmt.Unescape("%s$r exited the network"), details.nick))
|
client.server.snomasks.Send(sno.LocalQuits, fmt.Sprintf(ircfmt.Unescape("%s$r exited the network"), details.nick))
|
||||||
client.server.logger.Info("quit", fmt.Sprintf("%s is no longer on the server", details.nick))
|
client.server.logger.Info("quit", fmt.Sprintf("%s is no longer on the server", details.nick))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendSplitMsgFromClient sends an IRC PRIVMSG/NOTICE coming from a specific client.
|
// SendSplitMsgFromClient sends an IRC PRIVMSG/NOTICE coming from a specific client.
|
||||||
|
@ -550,6 +550,12 @@ func (client *Client) shouldFlushTimestamps() (result bool) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (client *Client) setKlined() {
|
||||||
|
client.stateMutex.Lock()
|
||||||
|
client.isKlined = true
|
||||||
|
client.stateMutex.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
func (channel *Channel) Name() string {
|
func (channel *Channel) Name() string {
|
||||||
channel.stateMutex.RLock()
|
channel.stateMutex.RLock()
|
||||||
defer channel.stateMutex.RUnlock()
|
defer channel.stateMutex.RUnlock()
|
||||||
|
@ -373,7 +373,9 @@ func (server *Server) tryRegister(c *Client, session *Session) (exiting bool) {
|
|||||||
if !session.IP().IsLoopback() || session.isTor {
|
if !session.IP().IsLoopback() || session.isTor {
|
||||||
isBanned, info := server.klines.CheckMasks(c.AllNickmasks()...)
|
isBanned, info := server.klines.CheckMasks(c.AllNickmasks()...)
|
||||||
if isBanned {
|
if isBanned {
|
||||||
|
c.setKlined()
|
||||||
c.Quit(info.BanMessage(c.t("You are banned from this server (%s)")), nil)
|
c.Quit(info.BanMessage(c.t("You are banned from this server (%s)")), nil)
|
||||||
|
server.logger.Info("connect", "Client rejected by k-line", c.NickMaskString())
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user