diff --git a/source/Network/Xmpp.hs b/source/Network/Xmpp.hs index 815701a..aa362db 100644 --- a/source/Network/Xmpp.hs +++ b/source/Network/Xmpp.hs @@ -197,6 +197,11 @@ module Network.Xmpp , establishSessionL , tlsBehaviourL , tlsParamsL + -- ** SessionConfiguration + , streamConfigurationL + , onConnectionClosedL + , sessionStanzaIDsL + , ensableRoster -- * Threads , dupSession -- * Miscellaneous diff --git a/source/Network/Xmpp/Lens.hs b/source/Network/Xmpp/Lens.hs index 91e8b38..b37219b 100644 --- a/source/Network/Xmpp/Lens.hs +++ b/source/Network/Xmpp/Lens.hs @@ -39,7 +39,11 @@ module Network.Xmpp.Lens , establishSessionL , tlsBehaviourL , tlsParamsL - + -- ** SessionConfiguration + , streamConfigurationL + , onConnectionClosedL + , sessionStanzaIDsL + , ensableRoster ) where @@ -51,6 +55,7 @@ import Data.XML.Types(Element) import Network.DNS(ResolvConf) import Network.TLS (TLSParams) import Network.Xmpp.Types +import Network.Xmpp.Concurrent.Types -- | Van-Laarhoven lenses. type Lens a b = Functor f => (b -> f b) -> a -> f a @@ -291,6 +296,27 @@ tlsParamsL :: Lens StreamConfiguration TLSParams tlsParamsL inj sc@StreamConfiguration{tlsParams = x} = (\x' -> sc{tlsParams = x'}) <$> inj x +-- SessioConfiguration +----------------------- +streamConfigurationL :: Lens SessionConfiguration StreamConfiguration +streamConfigurationL inj sc@SessionConfiguration{sessionStreamConfiguration = x} + = (\x' -> sc{sessionStreamConfiguration = x'}) <$> inj x + +onConnectionClosedL :: Lens SessionConfiguration (Session -> XmppFailure -> IO ()) +onConnectionClosedL inj sc@SessionConfiguration{onConnectionClosed = x} + = (\x' -> sc{onConnectionClosed = x'}) <$> inj x + +sessionStanzaIDsL :: Lens SessionConfiguration (IO (IO Text)) +sessionStanzaIDsL inj sc@SessionConfiguration{sessionStanzaIDs = x} + = (\x' -> sc{sessionStanzaIDs = x'}) <$> inj x + +ensableRoster :: Lens SessionConfiguration Bool +ensableRoster inj sc@SessionConfiguration{enableRoster = x} + = (\x' -> sc{enableRoster = x'}) <$> inj x + +pluginsL inj sc@SessionConfiguration{plugins = x} + = (\x' -> sc{plugins = x'}) <$> inj x + -- | Read the value the lens is pointing to view :: Lens a b -> a -> b view l x = getConst $ l Const x