diff options
-rw-r--r-- | Control/Concurrent/STM/StatusCache.hs | 1 | ||||
-rw-r--r-- | Presence/Server.hs | 15 | ||||
-rw-r--r-- | Presence/XMPPServer.hs | 1 | ||||
-rw-r--r-- | presence.cabal | 20 | ||||
-rw-r--r-- | xmppServer.hs | 5 |
5 files changed, 18 insertions, 24 deletions
diff --git a/Control/Concurrent/STM/StatusCache.hs b/Control/Concurrent/STM/StatusCache.hs index 3226978b..f6295aa0 100644 --- a/Control/Concurrent/STM/StatusCache.hs +++ b/Control/Concurrent/STM/StatusCache.hs | |||
@@ -58,6 +58,7 @@ | |||
58 | -- | 58 | -- |
59 | -- As shown above, it is intended that this module be imported qualified. | 59 | -- As shown above, it is intended that this module be imported qualified. |
60 | -- | 60 | -- |
61 | {-# LANGUAGE DoAndIfThenElse #-} | ||
61 | module Control.Concurrent.STM.StatusCache | 62 | module Control.Concurrent.STM.StatusCache |
62 | ( StatusCache | 63 | ( StatusCache |
63 | , new | 64 | , new |
diff --git a/Presence/Server.hs b/Presence/Server.hs index 6c2d1b5a..abf9f5e3 100644 --- a/Presence/Server.hs +++ b/Presence/Server.hs | |||
@@ -19,6 +19,7 @@ | |||
19 | -- | 19 | -- |
20 | -- * interface tweaks | 20 | -- * interface tweaks |
21 | -- | 21 | -- |
22 | {-# LANGUAGE DoAndIfThenElse #-} | ||
22 | module Server where | 23 | module Server where |
23 | 24 | ||
24 | import Data.ByteString (ByteString,hGetNonBlocking) | 25 | import Data.ByteString (ByteString,hGetNonBlocking) |
@@ -62,7 +63,7 @@ import Network.BSD | |||
62 | import Debug.Trace | 63 | import Debug.Trace |
63 | import Data.Time.Clock (UTCTime,getCurrentTime,diffUTCTime) | 64 | import Data.Time.Clock (UTCTime,getCurrentTime,diffUTCTime) |
64 | import Data.Time.Format (formatTime) | 65 | import Data.Time.Format (formatTime) |
65 | import System.Locale (defaultTimeLocale) | 66 | -- import System.Locale (defaultTimeLocale) |
66 | 67 | ||
67 | todo = error "unimplemented" | 68 | todo = error "unimplemented" |
68 | 69 | ||
@@ -519,27 +520,19 @@ newConnection server params conkey u h inout = do | |||
519 | 520 | ||
520 | sendPing PingTimeOut = do | 521 | sendPing PingTimeOut = do |
521 | {- | 522 | {- |
522 | let me = connPingTimer newCon | ||
523 | utc <- getCurrentTime | ||
524 | let utc' = formatTime defaultTimeLocale "%s" utc | ||
525 | warn $ "TIMEOUT " <> bshow utc' <> " " <> bshow (pingIdle me, pingTimeOut me) | ||
526 | -} | ||
527 | utc <- getCurrentTime | 523 | utc <- getCurrentTime |
528 | let utc' = formatTime defaultTimeLocale "%s" utc | 524 | let utc' = formatTime defaultTimeLocale "%s" utc |
529 | warn $ "ping:TIMEOUT " <> bshow utc' | 525 | warn $ "ping:TIMEOUT " <> bshow utc' |
526 | -} | ||
530 | atomically (connClose newCon) | 527 | atomically (connClose newCon) |
531 | eof | 528 | eof |
532 | 529 | ||
533 | sendPing PingIdle = do | 530 | sendPing PingIdle = do |
534 | {- | 531 | {- |
535 | let me = connPingTimer newCon | ||
536 | utc <- getCurrentTime | ||
537 | let utc' = formatTime defaultTimeLocale "%s" utc | ||
538 | warn $ "IDLE" <> bshow utc' <> " " <> bshow (pingIdle me, pingTimeOut me) | ||
539 | -} | ||
540 | utc <- getCurrentTime | 532 | utc <- getCurrentTime |
541 | let utc' = formatTime defaultTimeLocale "%s" utc | 533 | let utc' = formatTime defaultTimeLocale "%s" utc |
542 | -- warn $ "ping:IDLE " <> bshow utc' | 534 | -- warn $ "ping:IDLE " <> bshow utc' |
535 | -} | ||
543 | atomically $ announce ((conkey,u),RequiresPing) | 536 | atomically $ announce ((conkey,u),RequiresPing) |
544 | handleEOF conkey u mvar newCon | 537 | handleEOF conkey u mvar newCon |
545 | 538 | ||
diff --git a/Presence/XMPPServer.hs b/Presence/XMPPServer.hs index 5a5cd9cc..6f117204 100644 --- a/Presence/XMPPServer.hs +++ b/Presence/XMPPServer.hs | |||
@@ -2,6 +2,7 @@ | |||
2 | {-# LANGUAGE OverloadedStrings #-} | 2 | {-# LANGUAGE OverloadedStrings #-} |
3 | {-# LANGUAGE RankNTypes #-} | 3 | {-# LANGUAGE RankNTypes #-} |
4 | {-# LANGUAGE FlexibleInstances #-} -- instance for TChan Event | 4 | {-# LANGUAGE FlexibleInstances #-} -- instance for TChan Event |
5 | {-# LANGUAGE DoAndIfThenElse #-} | ||
5 | module XMPPServer | 6 | module XMPPServer |
6 | ( xmppServer | 7 | ( xmppServer |
7 | , ConnectionKey(..) | 8 | , ConnectionKey(..) |
diff --git a/presence.cabal b/presence.cabal index 4acae871..30081d17 100644 --- a/presence.cabal +++ b/presence.cabal | |||
@@ -14,22 +14,16 @@ author: Joe Crayne | |||
14 | data-dir: "" | 14 | data-dir: "" |
15 | 15 | ||
16 | executable presence | 16 | executable presence |
17 | build-depends: HList -any, async -any, | 17 | build-depends: base -any, stm -any, text (>=0.11.2.0), xml-types -any, containers -any, |
18 | base -any, binary -any, blaze-builder -any, | 18 | network -any, time -any, transformers -any, resourcet -any, bytestring -any, |
19 | blaze-builder-conduit -any, bytestring -any, bytestring-show -any, | 19 | mtl -any, mmorph -any, conduit -any, xml-conduit -any, void -any, random -any, |
20 | conduit -any, containers -any, cpu -any, data-default -any, | 20 | data-default -any, blaze-builder-conduit -any, blaze-builder -any, unix -any, |
21 | deepseq -any, directory -any, filepath -any, hinotify -any, | 21 | binary -any, directory -any, cpu -any, template-haskell -any, deepseq -any, |
22 | mtl -any, network -any, random -any, stm -any, | 22 | filepath -any |
23 | template-haskell -any, text (>=0.11.2.0), transformers -any, unix -any, | 23 | main-is: xmppServer.hs |
24 | xml-conduit -any, xml-types -any, stm-delay -any | ||
25 | main-is: main.hs | ||
26 | buildable: True | 24 | buildable: True |
27 | cpp-options: -DRENDERFLUSH | 25 | cpp-options: -DRENDERFLUSH |
28 | c-sources: Presence/monitortty.c | 26 | c-sources: Presence/monitortty.c |
29 | hs-source-dirs: . Presence | 27 | hs-source-dirs: . Presence |
30 | other-modules: Data.BitSyntax ByteStringOperators | ||
31 | ConfigFiles FGConsole LocalPeerCred UTmp | ||
32 | GetHostByAddr ServerC SocketLike XMPP XMPPTypes NestingXML | ||
33 | Text.XML.Stream.Render Text.XML.Stream.Token | ||
34 | ghc-prof-options: -DNOUTMP | 28 | ghc-prof-options: -DNOUTMP |
35 | 29 | ||
diff --git a/xmppServer.hs b/xmppServer.hs index 5771510a..fb056445 100644 --- a/xmppServer.hs +++ b/xmppServer.hs | |||
@@ -592,6 +592,8 @@ answerProbe state mto k chan = do | |||
592 | 592 | ||
593 | -- only subscribed peers should get probe replies | 593 | -- only subscribed peers should get probe replies |
594 | addrs <- subscribedPeers u | 594 | addrs <- subscribedPeers u |
595 | -- TODO: notify remote peer that they are unsubscribed? | ||
596 | -- reply <- makeInformSubscription "jabber:server" to from False | ||
595 | when (k `elem` map PeerKey addrs) $ do | 597 | when (k `elem` map PeerKey addrs) $ do |
596 | 598 | ||
597 | replies <- runTraversableT $ do | 599 | replies <- runTraversableT $ do |
@@ -891,6 +893,9 @@ peerInformSubscription state fail k stanza = do | |||
891 | to <- stanzaTo stanza | 893 | to <- stanzaTo stanza |
892 | let (mu,to_h,to_r) = splitJID to | 894 | let (mu,to_h,to_r) = splitJID to |
893 | mu | 895 | mu |
896 | -- TODO muser = Nothing when wanted=False | ||
897 | -- should probably mean unsubscribed for all users. | ||
898 | -- This would allow us to answer anonymous probes with 'unsubscribed'. | ||
894 | flip (maybe fail) muser $ \user -> do | 899 | flip (maybe fail) muser $ \user -> do |
895 | addrs <- resolvePeer from_h | 900 | addrs <- resolvePeer from_h |
896 | was_solicited <- removeFromRosterFile ConfigFiles.modifySolicited user from'' addrs | 901 | was_solicited <- removeFromRosterFile ConfigFiles.modifySolicited user from'' addrs |