~singpolyma/cheogram-muc-bridge

4a610339a9216f1265991d64769983a4c75061b6 — Stephen Paul Weber 2 years ago 3806919
If a ghost has leaked through, remove it
1 files changed, 14 insertions(+), 11 deletions(-)

M Session.hs
M Session.hs => Session.hs +14 -11
@@ 77,18 77,21 @@ sendPresenceToMUC config presence@XMPP.Presence {
	XMPP.presencePayloads = payloads
} targetMuc tag = do
	ghost <- isGhost config from
	when (not ghost) $ do
		mkSession config typ (Just from) target
	let typ'
		| ghost = XMPP.PresenceUnavailable
		| otherwise = typ
	mkSession config typ' (Just from) target

		XMPP.putStanza $ presence {
				XMPP.presenceFrom = Just (proxyJid config from),
				XMPP.presenceTo = Just target,
				XMPP.presencePayloads = map (\payload ->
					case XML.isNamed (s"{http://jabber.org/protocol/muc#user}x") payload of
						[_] -> mucJoinX
						_ -> payload
				) payloads
			}
	XMPP.putStanza $ presence {
			XMPP.presenceType = typ',
			XMPP.presenceFrom = Just (proxyJid config from),
			XMPP.presenceTo = Just target,
			XMPP.presencePayloads = map (\payload ->
				case XML.isNamed (s"{http://jabber.org/protocol/muc#user}x") payload of
					[_] -> mucJoinX
					_ -> payload
			) payloads
		}
	where
	nickReplacement = maybe id replaceNotInClass (Config.nickChars targetMuc)
	target = maybeAddNick (Config.jid targetMuc) $ nickReplacement $