mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-23 11:12:44 +01:00
commit
f7853b15ca
@ -80,6 +80,7 @@ type Client struct {
|
||||
hostname string
|
||||
invitedTo map[string]channelInvite
|
||||
isSTSOnly bool
|
||||
isKlined bool // #1941: k-line kills are special-cased to suppress some triggered notices/events
|
||||
languages []string
|
||||
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
|
||||
@ -1181,6 +1182,7 @@ func (client *Client) destroy(session *Session) {
|
||||
details := client.detailsNoMutex()
|
||||
sessionRemoved := false
|
||||
registered := client.registered
|
||||
isKlined := client.isKlined
|
||||
// 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
|
||||
alwaysOn := registered && client.alwaysOn
|
||||
@ -1341,8 +1343,10 @@ func (client *Client) destroy(session *Session) {
|
||||
}
|
||||
|
||||
if registered {
|
||||
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))
|
||||
if !isKlined {
|
||||
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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,6 +550,12 @@ func (client *Client) shouldFlushTimestamps() (result bool) {
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) setKlined() {
|
||||
client.stateMutex.Lock()
|
||||
client.isKlined = true
|
||||
client.stateMutex.Unlock()
|
||||
}
|
||||
|
||||
func (channel *Channel) Name() string {
|
||||
channel.stateMutex.RLock()
|
||||
defer channel.stateMutex.RUnlock()
|
||||
|
@ -373,7 +373,9 @@ func (server *Server) tryRegister(c *Client, session *Session) (exiting bool) {
|
||||
if !session.IP().IsLoopback() || session.isTor {
|
||||
isBanned, info := server.klines.CheckMasks(c.AllNickmasks()...)
|
||||
if isBanned {
|
||||
c.setKlined()
|
||||
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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user