~singpolyma/cheogram

0cd9825fb2744ce4d79f1a94698e112a8d78f359 — Stephen Paul Weber 8 years ago b8e1871
Remove when you leave room
1 files changed, 2 insertions(+), 1 deletions(-)

M Main.hs
M Main.hs => Main.hs +2 -1
@@ 179,12 179,13 @@ viteltiy db toVitelity toComponent = do
			(Just tel, Just txt) -> case parseCommand txt tel of
					Just (Join room) -> do
						existingRoom <- (parseJID . fromString =<<) <$> TC.runTCM (TC.get db $ T.unpack tel)
						forM_ existingRoom $ \leaveRoom ->
						forM_ existingRoom $ \leaveRoom -> do
							writeStanzaChan toComponent $ (emptyPresence PresenceUnavailable) {
								presenceTo = Just leaveRoom,
								presenceFrom = parseJID $ tel <> fromString "@sms.singpolyma.net",
								presencePayloads = [Element (fromString "{jabber:component:accept}status") [] [NodeContent $ ContentText $ fromString "Joined a different room."]]
							}
							TC.runTCM $ TC.out db $ T.unpack tel

						writeStanzaChan toComponent $ (emptyPresence PresenceAvailable) {
							presenceTo = Just room,