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 @@ @@ -1,3 +1,6 @@
# 0.5.1 to 0.5.2
* Added onrosterPushL lens
# 0.5.0 to 0.5.1
* 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 @@ -70,6 +70,8 @@ type Plugin = (XmppElement -> IO (Either XmppFailure ())) -- ^ pass stanza to
-- next plugin
-> ErrorT XmppFailure IO Plugin'
type RosterPushCallback = (QueryItem -> IO ())
-- | Configuration for the @Session@ object.
data SessionConfiguration = SessionConfiguration
{ -- | Configuration for the @Stream@ object.
@ -90,7 +92,7 @@ data SessionConfiguration = SessionConfiguration @@ -90,7 +92,7 @@ data SessionConfiguration = SessionConfiguration
, initialRoster :: IO (Maybe Roster)
-- | Callback called on a roster Push. The callback is called after the
-- roster is updated
, onRosterPush :: Maybe (QueryItem -> IO ())
, onRosterPush :: Maybe RosterPushCallback
-- | Track incomming presence stancas.
, enablePresenceTracking :: Bool
-- | 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 @@ -102,6 +102,7 @@ module Network.Xmpp.Lens
, onConnectionClosedL
, sessionStanzaIDsL
, ensableRosterL
, onRosterPushL
, pluginsL
, onPresenceChangeL
-- ** IM
@ -552,6 +553,9 @@ ensableRosterL :: Lens SessionConfiguration Bool @@ -552,6 +553,9 @@ ensableRosterL :: Lens SessionConfiguration Bool
ensableRosterL inj sc@SessionConfiguration{enableRoster = 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 inj sc@SessionConfiguration{plugins = x}
= (\x' -> sc{plugins = x'}) <$> inj x

Loading…
Cancel
Save