@@ 704,7 704,7 @@ componentStanza _ (ReceivedMessage (m@Message { messageTo = Just to, messageFrom
queryDisco from to
componentStanza (ComponentContext { db, smsJid = (Just smsJid), componentJid, ctxCacheOOB }) (ReceivedMessage (m@Message { messageTo = Just to@(JID { jidNode = Just _ }), messageFrom = Just from})) = do
existingRoom <- (parseJID =<<) <$> DB.get db (DB.byNode to ["joined"])
- m' <- UIO.lift $ ctxCacheOOB (Just . addOOBFallbackBodyWhenNoBody) False m
+ m' <- UIO.lift $ ctxCacheOOB addOOBFallbackBodyWhenNoBody False m
UIO.lift $ rememberOutgoingBody db m'
componentMessage db componentJid m' existingRoom from smsJid $
getBody "jabber:component:accept" m'
@@ 1353,10 1353,10 @@ oobDescUrl oob = (
mconcat (XML.elementText =<< XML.isNamed (s"{jabber:x:oob}url") =<< XML.elementChildren oob)
)
-addOOBFallbackBodyWhenNoBody :: XMPP.Message -> XMPP.Message
+addOOBFallbackBodyWhenNoBody :: XMPP.Message -> Maybe XMPP.Message
addOOBFallbackBodyWhenNoBody m
- | Just _ <- getBody "jabber:component:accept" m = m
- | otherwise = addOOBFallbackBody m
+ | Just _ <- getBody "jabber:component:accept" m = Nothing
+ | otherwise = Just $ addOOBFallbackBody m
addOOBFallbackBody :: XMPP.Message -> XMPP.Message
addOOBFallbackBody m
@@ 1524,7 1524,7 @@ component db redis pushStatsd backendHost did maybeAvatar cacheOOB sendIQ iqRece
| Just multipleTo <- mapM localpartToURI (T.split (==',') localpart),
ReceivedMessage m <- stanza,
Just backendJid <- parseJID backendHost -> liftIO $ do
- m' <- UIO.lift $ cacheOOB (Just . addOOBFallbackBodyWhenNoBody) False $ m { messagePayloads = messagePayloads m ++ [
+ m' <- UIO.lift $ cacheOOB addOOBFallbackBodyWhenNoBody False $ m { messagePayloads = messagePayloads m ++ [
Element (s"{http://jabber.org/protocol/address}addresses") [] $ map (\oneto ->
NodeElement $ Element (s"{http://jabber.org/protocol/address}address") [
(s"{http://jabber.org/protocol/address}type", [ContentText $ s"to"]),