@@ 1529,9 1529,10 @@ component db redis pushStatsd backendHost did maybeAvatar cacheOOB sendIQ iqRece
| Nothing <- mapM localpartToURI (T.split (==',') $ fromMaybe mempty $ fmap strNode $ jidNode to),
Just routeTo <- parseJID (unescapeJid localpart ++ maybe mempty (s"/"++) (strResource <$> jidResource to)),
fmap (((s"CHEOGRAM%") `T.isPrefixOf`) . strResource) (jidResource to) /= Just True -> liftIO $ do
+ maybeOwnedCheoJid <- (XMPP.parseJID =<<) <$> DB.get db (DB.byJid from ["cheoJid"])
maybeRoute <- DB.get db (DB.byJid routeTo ["direct-message-route"])
- case (maybeRoute, mapToComponent from) of
- (Just route, _)
+ case (maybeRoute, mapToComponent from, maybeOwnedCheoJid) of
+ (Just route, _, _)
| route == bareTxt from,
ReceivedIQ iq <- stanza,
iqType iq == IQSet,
@@ 1539,7 1540,7 @@ component db redis pushStatsd backendHost did maybeAvatar cacheOOB sendIQ iqRece
deleteDirectMessageRoute db routeTo
sendToComponent $ mkStanzaRec $ iqReply
(Just $ Element (fromString "{jabber:iq:register}query") [] []) iq
- (Just route, Just componentFrom)
+ (Just route, Just componentFrom, _)
| route == strDomain (jidDomain from),
ReceivedIQ iq <- stanza,
[items] <- XML.isNamed (s"{http://jabber.org/protocol/pubsub}items") =<< XML.elementChildren =<< XML.isNamed (s"{http://jabber.org/protocol/pubsub}pubsub") =<< justZ (iqPayload iq),
@@ 1561,7 1562,9 @@ component db redis pushStatsd backendHost did maybeAvatar cacheOOB sendIQ iqRece
sendToComponent $ receivedStanza $ receivedStanzaFromTo from' routeTo stanza
| route == strDomain (jidDomain from) ->
(sendToComponent . receivedStanza) =<< mapReceivedMessageM (fmap addMarkable . UIO.lift . (rememberIncomingBody db <=< cacheOOB (Just . addOOBFallbackBody) True)) (receivedStanzaFromTo componentFrom routeTo stanza)
- (Just route, _) -- Alphanumeric senders
+ (_, _, Just ownedCheoJid) ->
+ (sendToComponent . receivedStanza) =<< mapReceivedMessageM (fmap addMarkable . UIO.lift . (rememberIncomingBody db <=< cacheOOB (Just . addOOBFallbackBody) True)) (receivedStanzaFromTo ownedCheoJid routeTo stanza)
+ (Just route, _, _) -- Alphanumeric senders
| route == strDomain (jidDomain from),
Just localpart <- strNode <$> jidNode from,
Nothing <- T.find (\c -> not ((isAlphaNum c || c == ' ') && isAscii c)) localpart ->