mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-21 19:39:43 +01:00
DISCONNECT Sno for always-on and/or multiclient
This commit is contained in:
parent
62d78a64cb
commit
99cb1fd02c
@ -654,7 +654,7 @@ opers:
|
||||
# modes are modes to auto-set upon opering-up. uncomment this to automatically
|
||||
# enable snomasks ("server notification masks" that alert you to server events;
|
||||
# see `/quote help snomasks` while opered-up for more information):
|
||||
#modes: +is acjknoqtuxv
|
||||
#modes: +is acdjknoqtuxv
|
||||
|
||||
# operators can be authenticated either by password (with the /OPER command),
|
||||
# or by certificate fingerprint, or both. if a password hash is set, then a
|
||||
|
@ -1310,6 +1310,9 @@ func (client *Client) destroy(session *Session) {
|
||||
client.server.connectionLimiter.RemoveClient(flatip.FromNetIP(ip))
|
||||
source = ip.String()
|
||||
}
|
||||
if !shouldDestroy {
|
||||
client.server.snomasks.Send(sno.LocalDisconnects, fmt.Sprintf(ircfmt.Unescape("Client session disconnected for [a:%s] [h:%s] [ip:%s]"), details.accountName, session.rawHostname, source))
|
||||
}
|
||||
client.server.logger.Info("connect-ip", fmt.Sprintf("disconnecting session of %s from %s", details.nick, source))
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ type Masks []Mask
|
||||
const (
|
||||
LocalAnnouncements Mask = 'a'
|
||||
LocalConnects Mask = 'c'
|
||||
LocalDisconnects Mask = 'd'
|
||||
LocalChannels Mask = 'j'
|
||||
LocalKills Mask = 'k'
|
||||
LocalNicks Mask = 'n'
|
||||
@ -29,6 +30,7 @@ var (
|
||||
NoticeMaskNames = map[Mask]string{
|
||||
LocalAnnouncements: "ANNOUNCEMENT",
|
||||
LocalConnects: "CONNECT",
|
||||
LocalDisconnects: "DISCONNECT",
|
||||
LocalChannels: "CHANNEL",
|
||||
LocalKills: "KILL",
|
||||
LocalNicks: "NICK",
|
||||
@ -44,6 +46,7 @@ var (
|
||||
ValidMasks = []Mask{
|
||||
LocalAnnouncements,
|
||||
LocalConnects,
|
||||
LocalDisconnects,
|
||||
LocalChannels,
|
||||
LocalKills,
|
||||
LocalNicks,
|
||||
|
@ -17,14 +17,14 @@ func assertEqual(supplied, expected interface{}, t *testing.T) {
|
||||
|
||||
func TestEvaluateSnomaskChanges(t *testing.T) {
|
||||
add, remove, newArg := EvaluateSnomaskChanges(true, "*", nil)
|
||||
assertEqual(add, Masks{'a', 'c', 'j', 'k', 'n', 'o', 'q', 't', 'u', 'v', 'x'}, t)
|
||||
assertEqual(add, Masks{'a', 'c', 'd', 'j', 'k', 'n', 'o', 'q', 't', 'u', 'v', 'x'}, t)
|
||||
assertEqual(len(remove), 0, t)
|
||||
assertEqual(newArg, "+acjknoqtuvx", t)
|
||||
assertEqual(newArg, "+acdjknoqtuvx", t)
|
||||
|
||||
add, remove, newArg = EvaluateSnomaskChanges(true, "*", Masks{'a', 'u'})
|
||||
assertEqual(add, Masks{'c', 'j', 'k', 'n', 'o', 'q', 't', 'v', 'x'}, t)
|
||||
assertEqual(add, Masks{'c', 'd', 'j', 'k', 'n', 'o', 'q', 't', 'v', 'x'}, t)
|
||||
assertEqual(len(remove), 0, t)
|
||||
assertEqual(newArg, "+cjknoqtvx", t)
|
||||
assertEqual(newArg, "+cdjknoqtvx", t)
|
||||
|
||||
add, remove, newArg = EvaluateSnomaskChanges(true, "-a", Masks{'a', 'u'})
|
||||
assertEqual(len(add), 0, t)
|
||||
|
@ -627,7 +627,7 @@ opers:
|
||||
# modes are modes to auto-set upon opering-up. uncomment this to automatically
|
||||
# enable snomasks ("server notification masks" that alert you to server events;
|
||||
# see `/quote help snomasks` while opered-up for more information):
|
||||
#modes: +is acjknoqtuxv
|
||||
#modes: +is acdjknoqtuxv
|
||||
|
||||
# operators can be authenticated either by password (with the /OPER command),
|
||||
# or by certificate fingerprint, or both. if a password hash is set, then a
|
||||
|
Loading…
Reference in New Issue
Block a user