Browse Source

DISCONNECT Sno for always-on and/or multiclient

tags/v2.8.0-rc1
Pratyush Desai 2 years ago
parent
commit
99cb1fd02c
5 changed files with 12 additions and 6 deletions
  1. 1
    1
      default.yaml
  2. 3
    0
      irc/client.go
  3. 3
    0
      irc/sno/constants.go
  4. 4
    4
      irc/sno/utils_test.go
  5. 1
    1
      traditional.yaml

+ 1
- 1
default.yaml View File

@@ -654,7 +654,7 @@ opers:
654 654
         # modes are modes to auto-set upon opering-up. uncomment this to automatically
655 655
         # enable snomasks ("server notification masks" that alert you to server events;
656 656
         # see `/quote help snomasks` while opered-up for more information):
657
-        #modes: +is acjknoqtuxv
657
+        #modes: +is acdjknoqtuxv
658 658
 
659 659
         # operators can be authenticated either by password (with the /OPER command),
660 660
         # or by certificate fingerprint, or both. if a password hash is set, then a

+ 3
- 0
irc/client.go View File

@@ -1310,6 +1310,9 @@ func (client *Client) destroy(session *Session) {
1310 1310
 			client.server.connectionLimiter.RemoveClient(flatip.FromNetIP(ip))
1311 1311
 			source = ip.String()
1312 1312
 		}
1313
+		if !shouldDestroy {
1314
+			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))
1315
+		}
1313 1316
 		client.server.logger.Info("connect-ip", fmt.Sprintf("disconnecting session of %s from %s", details.nick, source))
1314 1317
 	}
1315 1318
 

+ 3
- 0
irc/sno/constants.go View File

@@ -13,6 +13,7 @@ type Masks []Mask
13 13
 const (
14 14
 	LocalAnnouncements Mask = 'a'
15 15
 	LocalConnects      Mask = 'c'
16
+	LocalDisconnects   Mask = 'd'
16 17
 	LocalChannels      Mask = 'j'
17 18
 	LocalKills         Mask = 'k'
18 19
 	LocalNicks         Mask = 'n'
@@ -29,6 +30,7 @@ var (
29 30
 	NoticeMaskNames = map[Mask]string{
30 31
 		LocalAnnouncements: "ANNOUNCEMENT",
31 32
 		LocalConnects:      "CONNECT",
33
+		LocalDisconnects:   "DISCONNECT",
32 34
 		LocalChannels:      "CHANNEL",
33 35
 		LocalKills:         "KILL",
34 36
 		LocalNicks:         "NICK",
@@ -44,6 +46,7 @@ var (
44 46
 	ValidMasks = []Mask{
45 47
 		LocalAnnouncements,
46 48
 		LocalConnects,
49
+		LocalDisconnects,
47 50
 		LocalChannels,
48 51
 		LocalKills,
49 52
 		LocalNicks,

+ 4
- 4
irc/sno/utils_test.go View File

@@ -17,14 +17,14 @@ func assertEqual(supplied, expected interface{}, t *testing.T) {
17 17
 
18 18
 func TestEvaluateSnomaskChanges(t *testing.T) {
19 19
 	add, remove, newArg := EvaluateSnomaskChanges(true, "*", nil)
20
-	assertEqual(add, Masks{'a', 'c', 'j', 'k', 'n', 'o', 'q', 't', 'u', 'v', 'x'}, t)
20
+	assertEqual(add, Masks{'a', 'c', 'd', 'j', 'k', 'n', 'o', 'q', 't', 'u', 'v', 'x'}, t)
21 21
 	assertEqual(len(remove), 0, t)
22
-	assertEqual(newArg, "+acjknoqtuvx", t)
22
+	assertEqual(newArg, "+acdjknoqtuvx", t)
23 23
 
24 24
 	add, remove, newArg = EvaluateSnomaskChanges(true, "*", Masks{'a', 'u'})
25
-	assertEqual(add, Masks{'c', 'j', 'k', 'n', 'o', 'q', 't', 'v', 'x'}, t)
25
+	assertEqual(add, Masks{'c', 'd', 'j', 'k', 'n', 'o', 'q', 't', 'v', 'x'}, t)
26 26
 	assertEqual(len(remove), 0, t)
27
-	assertEqual(newArg, "+cjknoqtvx", t)
27
+	assertEqual(newArg, "+cdjknoqtvx", t)
28 28
 
29 29
 	add, remove, newArg = EvaluateSnomaskChanges(true, "-a", Masks{'a', 'u'})
30 30
 	assertEqual(len(add), 0, t)

+ 1
- 1
traditional.yaml View File

@@ -627,7 +627,7 @@ opers:
627 627
         # modes are modes to auto-set upon opering-up. uncomment this to automatically
628 628
         # enable snomasks ("server notification masks" that alert you to server events;
629 629
         # see `/quote help snomasks` while opered-up for more information):
630
-        #modes: +is acjknoqtuxv
630
+        #modes: +is acdjknoqtuxv
631 631
 
632 632
         # operators can be authenticated either by password (with the /OPER command),
633 633
         # or by certificate fingerprint, or both. if a password hash is set, then a

Loading…
Cancel
Save