|
@@ -2609,7 +2609,7 @@ func persistenceHandler(server *Server, client *Client, msg ircmsg.Message, rb *
|
2609
|
2609
|
|
2610
|
2610
|
switch strings.ToUpper(msg.Params[0]) {
|
2611
|
2611
|
case "GET":
|
2612
|
|
- reportPersistenceStatus(client, rb)
|
|
2612
|
+ reportPersistenceStatus(client, rb, false)
|
2613
|
2613
|
case "SET":
|
2614
|
2614
|
if len(msg.Params) == 1 {
|
2615
|
2615
|
goto fail
|
|
@@ -2626,10 +2626,12 @@ func persistenceHandler(server *Server, client *Client, msg ircmsg.Message, rb *
|
2626
|
2626
|
goto fail
|
2627
|
2627
|
}
|
2628
|
2628
|
|
|
2629
|
+ broadcast := false
|
2629
|
2630
|
_, err := server.accounts.ModifyAccountSettings(account,
|
2630
|
2631
|
func(input AccountSettings) (output AccountSettings, err error) {
|
2631
|
2632
|
output = input
|
2632
|
2633
|
output.AlwaysOn = desiredSetting
|
|
2634
|
+ broadcast = output.AlwaysOn != input.AlwaysOn
|
2633
|
2635
|
return
|
2634
|
2636
|
})
|
2635
|
2637
|
if err != nil {
|
|
@@ -2638,7 +2640,7 @@ func persistenceHandler(server *Server, client *Client, msg ircmsg.Message, rb *
|
2638
|
2640
|
return false
|
2639
|
2641
|
}
|
2640
|
2642
|
|
2641
|
|
- reportPersistenceStatus(client, rb)
|
|
2643
|
+ reportPersistenceStatus(client, rb, broadcast)
|
2642
|
2644
|
|
2643
|
2645
|
default:
|
2644
|
2646
|
goto fail
|
|
@@ -2651,7 +2653,7 @@ fail:
|
2651
|
2653
|
return false
|
2652
|
2654
|
}
|
2653
|
2655
|
|
2654
|
|
-func reportPersistenceStatus(client *Client, rb *ResponseBuffer) {
|
|
2656
|
+func reportPersistenceStatus(client *Client, rb *ResponseBuffer, broadcast bool) {
|
2655
|
2657
|
settings := client.AccountSettings()
|
2656
|
2658
|
serverSetting := client.server.Config().Accounts.Multiclient.AlwaysOn
|
2657
|
2659
|
effectiveSetting := persistenceEnabled(serverSetting, settings.AlwaysOn)
|
|
@@ -2667,11 +2669,19 @@ func reportPersistenceStatus(client *Client, rb *ResponseBuffer) {
|
2667
|
2669
|
return "*" // impossible
|
2668
|
2670
|
}
|
2669
|
2671
|
}
|
|
2672
|
+ storedSettingStr := toString(settings.AlwaysOn)
|
2670
|
2673
|
effectiveSettingStr := "OFF"
|
2671
|
2674
|
if effectiveSetting {
|
2672
|
2675
|
effectiveSettingStr = "ON"
|
2673
|
2676
|
}
|
2674
|
|
- rb.Add(nil, client.server.name, "PERSISTENCE", "STATUS", toString(settings.AlwaysOn), effectiveSettingStr)
|
|
2677
|
+ rb.Add(nil, client.server.name, "PERSISTENCE", "STATUS", storedSettingStr, effectiveSettingStr)
|
|
2678
|
+ if broadcast {
|
|
2679
|
+ for _, session := range client.Sessions() {
|
|
2680
|
+ if session != rb.session {
|
|
2681
|
+ session.Send(nil, client.server.name, "PERSISTENCE", "STATUS", storedSettingStr, effectiveSettingStr)
|
|
2682
|
+ }
|
|
2683
|
+ }
|
|
2684
|
+ }
|
2675
|
2685
|
}
|
2676
|
2686
|
|
2677
|
2687
|
// PING [params...]
|