summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Presence/XMPPServer.hs14
1 files changed, 11 insertions, 3 deletions
diff --git a/Presence/XMPPServer.hs b/Presence/XMPPServer.hs
index 912bbf0b..e44ae37b 100644
--- a/Presence/XMPPServer.hs
+++ b/Presence/XMPPServer.hs
@@ -1358,6 +1358,12 @@ monitor sv params xmpp = do
1358 dput XJabber $ "CHAT " ++ Text.unpack rkey ++ ": <" ++ Text.unpack cnick ++ "> " ++ show es 1358 dput XJabber $ "CHAT " ++ Text.unpack rkey ++ ": <" ++ Text.unpack cnick ++ "> " ++ show es
1359 forM_ es $ \case 1359 forM_ es $ \case
1360 Join | mine -> sendRoomOccupants muckey me cnick rkey r replyto 1360 Join | mine -> sendRoomOccupants muckey me cnick rkey r replyto
1361 Join -> do
1362 stanza <- makePresenceStanzaEx "jabber:client" (Just $ roomjid muckey me rkey cnick) Available
1363 [ EventBeginElement "{http://jabber.org/protocol/muc#user}x" []
1364 , EventEndElement "{http://jabber.org/protocol/muc#user}x"
1365 ]
1366 ioWriteChan replyto stanza
1361 _ -> return () 1367 _ -> return ()
1362 ] 1368 ]
1363 action 1369 action
@@ -1367,12 +1373,14 @@ monitor sv params xmpp = do
1367 where 1373 where
1368 _ = str :: String 1374 _ = str :: String
1369 1375
1376roomjid :: Text {- ^ service -} -> Text {- ^ hostname -} -> Text {- ^ room -} -> Text {- ^ nick -} -> Text
1377roomjid a me room n = room <> "@" <> a <> "." <> me <> "/" <> n
1378
1370sendRoomOccupants :: Text -> Text -> Text -> Text -> JoinedRoom k -> TChan Stanza -> IO () 1379sendRoomOccupants :: Text -> Text -> Text -> Text -> JoinedRoom k -> TChan Stanza -> IO ()
1371sendRoomOccupants a me them room r replyto = do 1380sendRoomOccupants a me them room r replyto = do
1372 let roomjid n = room <> "@" <> a <> "." <> me <> "/" <> n 1381 xs <- map (\(n,m) -> (roomjid a me room n, m))
1373 xs <- map (\(n,m) -> (roomjid n, m))
1374 <$> atomically (roomOccupants $ joinedRoom r) 1382 <$> atomically (roomOccupants $ joinedRoom r)
1375 let (ys,xs') = partition (\(jid,_) -> jid == roomjid them) xs 1383 let (ys,xs') = partition (\(jid,_) -> jid == roomjid a me room them) xs
1376 forM_ xs $ \(jid,_) -> do 1384 forM_ xs $ \(jid,_) -> do
1377 stanza <- makePresenceStanzaEx "jabber:client" (Just jid) Available 1385 stanza <- makePresenceStanzaEx "jabber:client" (Just jid) Available
1378 [ EventBeginElement "{http://jabber.org/protocol/muc#user}x" [] 1386 [ EventBeginElement "{http://jabber.org/protocol/muc#user}x" []