Skip to content

Commit

Permalink
Reload server settings on /reload
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDaemoness committed Aug 15, 2024
1 parent 8de23ba commit e6f6e47
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Client/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ import Client.State
import Client.State.Extensions (clientCommandExtension, clientStartExtensions)
import Client.State.Focus
import Client.State.Help (hsQuery, helpQueryToText)
import Client.State.Network (csNick, isChannelIdentifier, sendMsg)
import Client.State.Network (csNick, csSettings, isChannelIdentifier, sendMsg)
import Client.State.Url
import Control.Applicative (liftA2, (<|>))
import Control.Exception (displayException, try)
import Control.Lens
import Control.Monad (guard, foldM)
import Data.Foldable (foldl', toList)
import Data.HashMap.Strict qualified as HashMap
import Data.Maybe (fromMaybe)
import Data.Text (Text)
import Data.Text qualified as Text
Expand Down Expand Up @@ -415,10 +416,15 @@ cmdReload st mbPath =
Left e -> commandFailureMsg (describeProblem e) st
Right (path',cfg) ->
do st1 <- clientStartExtensions
$ over clientConnections (HashMap.mapWithKey updateNetConfig)
$ set clientConfig cfg
$ set clientConfigPath path' st
commandSuccess st1

where
updateNetConfig name cs =
case HashMap.lookup name $ _configServers cfg of
Nothing -> cs
Just netcfg -> set csSettings netcfg cs
where
describeProblem err =
Text.pack $
Expand Down

0 comments on commit e6f6e47

Please sign in to comment.