|
|
|
@ -80,9 +80,14 @@ iqResponder context = do |
|
|
|
|
|
|
|
|
|
|
|
autoAccept :: Xmpp () |
|
|
|
autoAccept :: Xmpp () |
|
|
|
autoAccept context = forever $ do |
|
|
|
autoAccept context = forever $ do |
|
|
|
st <- waitForPresence (\p -> presenceType p == Just Subscribe) context |
|
|
|
st <- waitForPresence (\p -> presenceType p == Subscribe) context |
|
|
|
sendPresence (presenceSubscribed (fromJust $ presenceFrom st)) context |
|
|
|
sendPresence (presenceSubscribed (fromJust $ presenceFrom st)) context |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showPresence context = forever $ do |
|
|
|
|
|
|
|
pr <- waitForPresence (const True) context |
|
|
|
|
|
|
|
print $ getIMPresence pr |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
simpleMessage :: Jid -> Text -> Message |
|
|
|
simpleMessage :: Jid -> Text -> Message |
|
|
|
simpleMessage to txt = message |
|
|
|
simpleMessage to txt = message |
|
|
|
{ messageTo = Just to |
|
|
|
{ messageTo = Just to |
|
|
|
@ -169,12 +174,12 @@ runMain debug number multi = do |
|
|
|
config |
|
|
|
config |
|
|
|
sendPresence presenceOnline context |
|
|
|
sendPresence presenceOnline context |
|
|
|
thread1 <- forkIO $ autoAccept =<< dupSession context |
|
|
|
thread1 <- forkIO $ autoAccept =<< dupSession context |
|
|
|
sendPresence (presenceSubscribe them) context |
|
|
|
|
|
|
|
thread2 <- forkIO $ iqResponder =<< dupSession context |
|
|
|
thread2 <- forkIO $ iqResponder =<< dupSession context |
|
|
|
|
|
|
|
thread2 <- forkIO $ showPresence =<< dupSession context |
|
|
|
when active $ do |
|
|
|
when active $ do |
|
|
|
liftIO $ threadDelay 1000000 -- Wait for the other thread to go online |
|
|
|
liftIO $ threadDelay 1000000 -- Wait for the other thread to go online |
|
|
|
-- discoTest debug' |
|
|
|
-- discoTest debug' |
|
|
|
when multi $ iqTest debug' we them context |
|
|
|
-- when multi $ iqTest debug' we them context |
|
|
|
killThread thread1 |
|
|
|
killThread thread1 |
|
|
|
killThread thread2 |
|
|
|
killThread thread2 |
|
|
|
return () |
|
|
|
return () |
|
|
|
|