Browse Source

add onRosterPushL lens

master
Philipp Balzarek 10 years ago
parent
commit
db36ebafe5
  1. 3
      ChangeLog.md
  2. 4
      source/Network/Xmpp/Concurrent/Types.hs
  3. 4
      source/Network/Xmpp/Lens.hs

3
ChangeLog.md

@ -1,3 +1,6 @@
# 0.5.1 to 0.5.2
* Added onrosterPushL lens
# 0.5.0 to 0.5.1 # 0.5.0 to 0.5.1
* Fixed input logger choking on long non-ascii messages * Fixed input logger choking on long non-ascii messages

4
source/Network/Xmpp/Concurrent/Types.hs

@ -70,6 +70,8 @@ type Plugin = (XmppElement -> IO (Either XmppFailure ())) -- ^ pass stanza to
-- next plugin -- next plugin
-> ErrorT XmppFailure IO Plugin' -> ErrorT XmppFailure IO Plugin'
type RosterPushCallback = (QueryItem -> IO ())
-- | Configuration for the @Session@ object. -- | Configuration for the @Session@ object.
data SessionConfiguration = SessionConfiguration data SessionConfiguration = SessionConfiguration
{ -- | Configuration for the @Stream@ object. { -- | Configuration for the @Stream@ object.
@ -90,7 +92,7 @@ data SessionConfiguration = SessionConfiguration
, initialRoster :: IO (Maybe Roster) , initialRoster :: IO (Maybe Roster)
-- | Callback called on a roster Push. The callback is called after the -- | Callback called on a roster Push. The callback is called after the
-- roster is updated -- roster is updated
, onRosterPush :: Maybe (QueryItem -> IO ()) , onRosterPush :: Maybe RosterPushCallback
-- | Track incomming presence stancas. -- | Track incomming presence stancas.
, enablePresenceTracking :: Bool , enablePresenceTracking :: Bool
-- | Callback that is invoked when the presence status of a peer changes, -- | Callback that is invoked when the presence status of a peer changes,

4
source/Network/Xmpp/Lens.hs

@ -102,6 +102,7 @@ module Network.Xmpp.Lens
, onConnectionClosedL , onConnectionClosedL
, sessionStanzaIDsL , sessionStanzaIDsL
, ensableRosterL , ensableRosterL
, onRosterPushL
, pluginsL , pluginsL
, onPresenceChangeL , onPresenceChangeL
-- ** IM -- ** IM
@ -552,6 +553,9 @@ ensableRosterL :: Lens SessionConfiguration Bool
ensableRosterL inj sc@SessionConfiguration{enableRoster = x} ensableRosterL inj sc@SessionConfiguration{enableRoster = x}
= (\x' -> sc{enableRoster = x'}) <$> inj x = (\x' -> sc{enableRoster = x'}) <$> inj x
onRosterPushL :: Lens SessionConfiguration (Maybe RosterPushCallback)
onRosterPushL = mkLens onRosterPush (\orp x -> x{onRosterPush = orp})
pluginsL :: Lens SessionConfiguration [Plugin] pluginsL :: Lens SessionConfiguration [Plugin]
pluginsL inj sc@SessionConfiguration{plugins = x} pluginsL inj sc@SessionConfiguration{plugins = x}
= (\x' -> sc{plugins = x'}) <$> inj x = (\x' -> sc{plugins = x'}) <$> inj x

Loading…
Cancel
Save