~singpolyma/cheogram

4b70ea93d628fa6bf4cacf8345f2ce2e02ef12aa — Stephen Paul Weber a month ago 5996f1e master
Do not log or record in the DB on non-MUC presence
1 files changed, 6 insertions(+), 2 deletions(-)

M Main.hs
M Main.hs => Main.hs +6 -2
@@ 483,14 483,18 @@ handleJoinPartRoom db toRoomPresences toRejoinManager toJoinPartDebouncer compon
	| fmap bareTxt existingRoom == Just bareMUC && not join = do
		atomically $ writeTChan toJoinPartDebouncer $ DebouncePart to from
		return []
	| join = do
	| join,
	  (_:_) <- isNamed (fromString "{http://jabber.org/protocol/muc#user}x") =<< payloads = do
		log "UNKNOWN JOIN" (existingRoom, from, to, payloads, join)
		atomically $ writeTChan toRoomPresences $ RecordJoin to from (participantJid payloads)
		return []
	| otherwise = do
	| (_:_) <- isNamed (fromString "{http://jabber.org/protocol/muc#user}x") =<< payloads = do
		log "UNKNOWN NOT JOIN" (existingRoom, from, to, payloads, join)
		atomically $ writeTChan toRoomPresences $ RecordPart to from
		return []
	| otherwise =
		-- This is just presence. It's not marked as MUC or from the room this user is in
		return []
	where
	resourceFrom = fromMaybe mempty (strResource <$> jidResource from)
	Just room = parseJID bareMUC