Sfoglia il codice sorgente

DISCONNECT Sno for always-on and/or multiclient

tags/v2.8.0-rc1
Pratyush Desai 2 anni fa
parent
commit
99cb1fd02c
5 ha cambiato i file con 12 aggiunte e 6 eliminazioni
  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 Vedi File

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

+ 3
- 0
irc/client.go Vedi File

1310
 			client.server.connectionLimiter.RemoveClient(flatip.FromNetIP(ip))
1310
 			client.server.connectionLimiter.RemoveClient(flatip.FromNetIP(ip))
1311
 			source = ip.String()
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
 		client.server.logger.Info("connect-ip", fmt.Sprintf("disconnecting session of %s from %s", details.nick, source))
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 Vedi File

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

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

17
 
17
 
18
 func TestEvaluateSnomaskChanges(t *testing.T) {
18
 func TestEvaluateSnomaskChanges(t *testing.T) {
19
 	add, remove, newArg := EvaluateSnomaskChanges(true, "*", nil)
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
 	assertEqual(len(remove), 0, t)
21
 	assertEqual(len(remove), 0, t)
22
-	assertEqual(newArg, "+acjknoqtuvx", t)
22
+	assertEqual(newArg, "+acdjknoqtuvx", t)
23
 
23
 
24
 	add, remove, newArg = EvaluateSnomaskChanges(true, "*", Masks{'a', 'u'})
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
 	assertEqual(len(remove), 0, t)
26
 	assertEqual(len(remove), 0, t)
27
-	assertEqual(newArg, "+cjknoqtvx", t)
27
+	assertEqual(newArg, "+cdjknoqtvx", t)
28
 
28
 
29
 	add, remove, newArg = EvaluateSnomaskChanges(true, "-a", Masks{'a', 'u'})
29
 	add, remove, newArg = EvaluateSnomaskChanges(true, "-a", Masks{'a', 'u'})
30
 	assertEqual(len(add), 0, t)
30
 	assertEqual(len(add), 0, t)

+ 1
- 1
traditional.yaml Vedi File

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

Loading…
Annulla
Salva