From ed3bfff125c3a81f2318ac7541123f3311e2d94e Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Sun, 4 Nov 2018 22:30:50 -0500 Subject: Removed dead code. --- Presence/XMPPServer.hs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'Presence') diff --git a/Presence/XMPPServer.hs b/Presence/XMPPServer.hs index 42425c5e..3327b523 100644 --- a/Presence/XMPPServer.hs +++ b/Presence/XMPPServer.hs @@ -57,8 +57,6 @@ import qualified Connection import Util import Network.Address (getBindAddress, sockAddrPort) -import Data.Bits -import Data.Word import Debug.Trace import Control.Monad.Trans (lift) import Control.Monad.IO.Class (MonadIO, liftIO) @@ -281,7 +279,7 @@ cacheMessageId id' replyto = do addrToText :: SockAddr -> Text addrToText (addr@(SockAddrInet _ _)) = Text.pack $ stripColon (show addr) - where stripColon s = pre where (pre,port) = break (==':') s + where stripColon s = pre where (pre,_) = break (==':') s addrToText (addr@(SockAddrInet6 _ _ _ _)) = Text.pack $ stripColon (show addr) where stripColon s = if null bracket then pre else pre ++ "]" where @@ -911,8 +909,6 @@ makePong namespace mid to from = , EventEndElement (mkname namespace "iq") ] -data ClientOrPeer = IsClient | IsPeer - xmppInbound :: ConnectionData -> XMPPServerParameters -- ^ XXX: unused -> (Text, IO Text, IO Text, TChan Stanza -> StanzaOrigin) @@ -1008,6 +1004,7 @@ while cond body = do return (x:xs) else return [] +{- readUntilNothing :: TChan (Maybe x) -> IO [x] readUntilNothing ch = do x <- atomically $ readTChan ch @@ -1016,7 +1013,7 @@ readUntilNothing ch = do xs <- readUntilNothing ch return (x:xs)) x - +-} streamFeatures :: Text -> [XML.Event] streamFeatures "jabber:client" = @@ -1167,11 +1164,13 @@ greet namespace = ] -} +{- goodbye :: [XML.Event] goodbye = [ EventEndElement (streamP "stream") , EventEndDocument ] +-} simulateChatError :: StanzaError -> Maybe Text -> [Event] simulateChatError err mfrom = @@ -1586,8 +1585,7 @@ data StanzaError | UnexpectedRequest deriving (Show,Enum,Ord,Eq) -xep0086 :: - forall t t1. (Num t1, IsString t) => StanzaError -> (t, t1) +xep0086 :: StanzaError -> (Text, Int) xep0086 e = case e of BadRequest -> ("modify", 400) @@ -1660,7 +1658,7 @@ makeErrorStanza stanza = do mto = Map.lookup "to" amap0 mfrom = Map.lookup "from" amap0 mtype = Map.lookup "type" amap0 - mid = Map.lookup "id" amap0 + -- mid = Map.lookup "id" amap0 amap1 = Map.alter (const mto) "from" amap0 -- amap2 = Map.alter (const $ Just $ [ContentText "blackbird"]) {-mfrom)-} "to" amap1 amap2 = Map.alter (const mfrom) "to" amap1 @@ -1679,9 +1677,9 @@ makeErrorStanza stanza = do , nameLocalName = errorTagLocalName err , namePrefix = Nothing } errattrs = errorAttribs err [] + {- let wlogd v s = do wlog $ "error "++show (lookupAttrib "id" $ tagAttrs startTag)++" " ++ v ++ " = " ++ show s - {- wlogd "amap0" amap0 wlogd "mto" mto wlogd "mfrom" mfrom @@ -1941,7 +1939,7 @@ xmppServer allocate bind_addr = do liftIO $ do gen <- System.Random.getStdGen peer_bind <- maybe (getBindAddress "5269" True) return bind_addr - let (r,gen') = System.Random.next gen + let (r, _) = System.Random.next gen fuzz = r `mod` 2000 -- maximum 2 seconds of ping fuzz peer_params :: ConnectionParameters PeerAddress ConnectionData peer_params = (connectionDefaults $ peerKey $ Just peer_bind) -- cgit v1.2.3