summaryrefslogtreecommitdiff
path: root/Presence
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-06-22 21:17:22 -0400
committerjoe <joe@jerkface.net>2018-06-22 21:17:22 -0400
commitf5f854c8144dc29086928a94b2ea86cfae0d0557 (patch)
tree5a7daccc1be66375edd35b238f348129f540b146 /Presence
parent6f040764654640730d3f832cf4e41174562718fb (diff)
Removed redundant imports and other clean up.
Diffstat (limited to 'Presence')
-rw-r--r--Presence/ControlMaybe.hs1
-rw-r--r--Presence/DNSCache.hs1
-rw-r--r--Presence/PeerResolve.hs12
-rw-r--r--Presence/Presence.hs32
-rw-r--r--Presence/SockAddr.hs5
-rw-r--r--Presence/XMPPServer.hs10
6 files changed, 14 insertions, 47 deletions
diff --git a/Presence/ControlMaybe.hs b/Presence/ControlMaybe.hs
index c98a6fb9..a101d667 100644
--- a/Presence/ControlMaybe.hs
+++ b/Presence/ControlMaybe.hs
@@ -7,7 +7,6 @@ module ControlMaybe
7 7
8-- import GHC.IO.Exception (IOException(..)) 8-- import GHC.IO.Exception (IOException(..))
9import Control.Monad 9import Control.Monad
10import Control.Exception as Exception (IOException(..),catch)
11import Data.Functor 10import Data.Functor
12import System.IO.Error 11import System.IO.Error
13 12
diff --git a/Presence/DNSCache.hs b/Presence/DNSCache.hs
index afcc227c..ce35752e 100644
--- a/Presence/DNSCache.hs
+++ b/Presence/DNSCache.hs
@@ -43,7 +43,6 @@ import Data.Function
43import Data.List 43import Data.List
44import Data.Ord 44import Data.Ord
45import Data.Maybe 45import Data.Maybe
46import System.IO
47import System.IO.Error 46import System.IO.Error
48 47
49import SockAddr () 48import SockAddr ()
diff --git a/Presence/PeerResolve.hs b/Presence/PeerResolve.hs
index 0854b365..900688c3 100644
--- a/Presence/PeerResolve.hs
+++ b/Presence/PeerResolve.hs
@@ -6,24 +6,12 @@ module PeerResolve
6 , withPort 6 , withPort
7 ) where 7 ) where
8 8
9import Data.List ( nub )
10import Data.Text ( Text ) 9import Data.Text ( Text )
11import Network.Socket ( SockAddr(..) ) 10import Network.Socket ( SockAddr(..) )
12import System.Endian ( fromBE32, toBE32 )
13import System.IO.Error ( isDoesNotExistError )
14import Control.Exception ( handle, ErrorCall(..) )
15import qualified Network.BSD as BSD
16import qualified Data.Text as Text
17import Control.Concurrent
18import Control.Concurrent.STM
19import Control.Monad
20import Data.Maybe
21import System.IO.Unsafe 11import System.IO.Unsafe
22 12
23import GetHostByAddr
24import DNSCache 13import DNSCache
25import ConnectionKey 14import ConnectionKey
26import ControlMaybe
27 15
28{-# NOINLINE global_dns_cache #-} 16{-# NOINLINE global_dns_cache #-}
29global_dns_cache :: DNSCache 17global_dns_cache :: DNSCache
diff --git a/Presence/Presence.hs b/Presence/Presence.hs
index 697c1476..af6597b6 100644
--- a/Presence/Presence.hs
+++ b/Presence/Presence.hs
@@ -6,32 +6,27 @@
6module Presence where 6module Presence where
7 7
8import System.Directory 8import System.Directory
9import System.Environment
10import System.IO.Error 9import System.IO.Error
11import System.Posix.Signals 10#ifndef THREAD_DEBUG
12import Control.Concurrent (threadDelay,forkIO,forkOS,killThread,throwTo) 11import Control.Concurrent
12#else
13import Control.Concurrent.Lifted.Instrument
14#endif
15
13import Control.Concurrent.STM 16import Control.Concurrent.STM
14import Control.Concurrent.STM.TMVar
15import Control.Monad.Trans 17import Control.Monad.Trans
16import Control.Monad.IO.Class (MonadIO, liftIO) 18import Network.Socket ( SockAddr(..) )
17import Network.Socket ( SockAddr(..), PortNumber )
18import System.Endian (fromBE32)
19import Data.Char 19import Data.Char
20import Data.List (nub, (\\), intersect, groupBy, sort, sortBy ) 20import Data.List (nub, (\\), intersect, groupBy, sort, sortBy )
21import Data.Ord (comparing ) 21import Data.Ord (comparing )
22import Data.Monoid ( (<>), Sum(..), getSum ) 22import Data.Monoid ((<>))
23import qualified Data.Text as Text 23import qualified Data.Text as Text
24import qualified Data.Text.IO as Text
25import qualified Data.Text.Encoding as Text 24import qualified Data.Text.Encoding as Text
26import Control.Monad 25import Control.Monad
27import Control.Monad.Fix
28import qualified Network.BSD as BSD
29import qualified Data.Text as Text
30import Data.Text (Text) 26import Data.Text (Text)
31import qualified Data.Map as Map 27import qualified Data.Map as Map
32import Data.Map (Map) 28import Data.Map (Map)
33import Control.Exception ({-evaluate,-}handle,SomeException(..),bracketOnError,ErrorCall(..)) 29import Control.Exception ({-evaluate,-}handle,SomeException(..))
34import System.IO.Error (isDoesNotExistError)
35import System.Posix.User (getUserEntryForID,userName) 30import System.Posix.User (getUserEntryForID,userName)
36import qualified Data.ByteString.Lazy.Char8 as L 31import qualified Data.ByteString.Lazy.Char8 as L
37import qualified ConfigFiles 32import qualified ConfigFiles
@@ -41,14 +36,7 @@ import Data.Int (Int8)
41import Data.XML.Types (Event) 36import Data.XML.Types (Event)
42import System.Posix.Types (UserID,CPid) 37import System.Posix.Types (UserID,CPid)
43import Control.Applicative 38import Control.Applicative
44#ifdef CRYPTONITE_BACKPORT
45import Crypto.Error.Types (CryptoFailable (..))
46#else
47import Crypto.Error
48#endif
49import Crypto.PubKey.Curve25519 (SecretKey,toPublic) 39import Crypto.PubKey.Curve25519 (SecretKey,toPublic)
50import Text.Read (readMaybe)
51import System.IO
52 40
53import ControlMaybe 41import ControlMaybe
54import LockedChan (LockedChan) 42import LockedChan (LockedChan)
@@ -61,7 +49,7 @@ import ConsoleWriter
61import ClientState 49import ClientState
62import Util 50import Util
63import qualified Connection 51import qualified Connection
64import Network.Tox.NodeId (id2key,key2id) 52import Network.Tox.NodeId (key2id)
65import Crypto.Tox (decodeSecret) 53import Crypto.Tox (decodeSecret)
66import DPut 54import DPut
67 55
diff --git a/Presence/SockAddr.hs b/Presence/SockAddr.hs
index 91a03870..b5fbf16e 100644
--- a/Presence/SockAddr.hs
+++ b/Presence/SockAddr.hs
@@ -2,10 +2,11 @@
2{-# LANGUAGE StandaloneDeriving #-} 2{-# LANGUAGE StandaloneDeriving #-}
3module SockAddr () where 3module SockAddr () where
4 4
5import Network.Socket ( SockAddr(..) )
6
7#if MIN_VERSION_network(2,4,0) 5#if MIN_VERSION_network(2,4,0)
6import Network.Socket ()
8#else 7#else
8import Network.Socket ( SockAddr(..) )
9
9deriving instance Ord SockAddr 10deriving instance Ord SockAddr
10#endif 11#endif
11 12
diff --git a/Presence/XMPPServer.hs b/Presence/XMPPServer.hs
index cf7aca70..8d294698 100644
--- a/Presence/XMPPServer.hs
+++ b/Presence/XMPPServer.hs
@@ -48,10 +48,8 @@ import PeerResolve
48import qualified Connection 48import qualified Connection
49import Util 49import Util
50import Network.Address (getBindAddress, sockAddrPort) 50import Network.Address (getBindAddress, sockAddrPort)
51import Blaze.ByteString.Builder (Builder)
52 51
53import Debug.Trace 52import Debug.Trace
54import System.IO (hFlush,stdout)
55import Control.Monad.Trans (lift) 53import Control.Monad.Trans (lift)
56import Control.Monad.IO.Class (MonadIO, liftIO) 54import Control.Monad.IO.Class (MonadIO, liftIO)
57import Control.Monad.Fix (fix) 55import Control.Monad.Fix (fix)
@@ -66,7 +64,6 @@ import Control.Concurrent.STM
66-- import Control.Concurrent.STM.TChan 64-- import Control.Concurrent.STM.TChan
67import Network.SocketLike 65import Network.SocketLike
68import Text.Printf 66import Text.Printf
69import System.Posix.Signals
70import Data.ByteString (ByteString) 67import Data.ByteString (ByteString)
71import qualified Data.ByteString.Char8 as Strict8 68import qualified Data.ByteString.Char8 as Strict8
72-- import qualified Data.ByteString.Lazy.Char8 as Lazy8 69-- import qualified Data.ByteString.Lazy.Char8 as Lazy8
@@ -86,21 +83,16 @@ import qualified Text.XML.Stream.Render as XML hiding (content)
86import qualified Text.XML.Stream.Parse as XML 83import qualified Text.XML.Stream.Parse as XML
87import Data.XML.Types as XML 84import Data.XML.Types as XML
88import Data.Maybe 85import Data.Maybe
89import Data.List (nub)
90import Data.Monoid ( (<>) ) 86import Data.Monoid ( (<>) )
91import Data.Text (Text) 87import Data.Text (Text)
92import qualified Data.Text as Text (pack,unpack,words,intercalate) 88import qualified Data.Text as Text (pack,unpack,words,intercalate)
93import Data.Char (toUpper,chr,ord) 89import Data.Char (chr,ord)
94import Data.Map (Map)
95import qualified Data.Map as Map 90import qualified Data.Map as Map
96import Data.Set (Set, (\\) ) 91import Data.Set (Set, (\\) )
97import qualified Data.Set as Set 92import qualified Data.Set as Set
98import Data.String ( IsString(..) ) 93import Data.String ( IsString(..) )
99import qualified System.Random 94import qualified System.Random
100import Data.Void (Void) 95import Data.Void (Void)
101import System.Endian (toBE32)
102import Control.Applicative
103import System.IO
104import DPut 96import DPut
105 97
106-- peerport :: PortNumber 98-- peerport :: PortNumber