~singpolyma/cheogram

a06e06436429762527fdbd9b720e7e6cc4bca0a6 — Stephen Paul Weber 8 years ago ffd9ca7
Always send join/part SMS

This was causing only one person to get the SMS messages, since we
record that the person left as soon as we hear about it, and we process
stanzas in order, so no one else would get notified.

If we turn out to need this kind of filter, we can do a per-person list
of who they think is in the room or something?
1 files changed, 1 insertions(+), 3 deletions(-)

M Main.hs
M Main.hs => Main.hs +1 -3
@@ 265,8 265,7 @@ handleJoinPartRoom db toVitelity toComponent existingRoom from to tel payloads j
	| fmap bareTxt existingRoom == Just bareMUC = do
		presence <- fmap (map f . fromMaybe [] . (readZ =<<)) (TC.runTCM $ TC.get db ("presence\0" <> T.unpack bareMUC))
		log "JOINPART" (tel, existingRoom, join, resourceFrom, presence)
		when (mod $ resourceFrom `elem` presence) $
			writeStanzaChan toVitelity $ mkSMS tel $ mconcat [
		writeStanzaChan toVitelity $ mkSMS tel $ mconcat [
				fromString "* ",
				resourceFrom,
				fromString " has ",


@@ 276,7 275,6 @@ handleJoinPartRoom db toVitelity toComponent existingRoom from to tel payloads j
	| otherwise = log "UNKNOWN STATUS" (existingRoom, from, to, tel, payloads, join)
	where
	resourceFrom = fromMaybe mempty (strResource <$> jidResource from)
	mod = if join then not else id
	Just room = parseJID bareMUC
	bareMUC = bareTxt from
	f = fst :: (Text, Maybe Text) -> Text