summaryrefslogtreecommitdiff
path: root/Presence/XMPPServer.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Presence/XMPPServer.hs')
-rw-r--r--Presence/XMPPServer.hs15
1 files changed, 11 insertions, 4 deletions
diff --git a/Presence/XMPPServer.hs b/Presence/XMPPServer.hs
index dd693b8c..af392f27 100644
--- a/Presence/XMPPServer.hs
+++ b/Presence/XMPPServer.hs
@@ -16,6 +16,7 @@ module XMPPServer
16 , LangSpecificMessage(..) 16 , LangSpecificMessage(..)
17 , peerKeyToText 17 , peerKeyToText
18 , peerKeyToResolvedName 18 , peerKeyToResolvedName
19 , peerKeyToResolvedNames
19 , addrToText 20 , addrToText
20 , sendModifiedStanzaToPeer 21 , sendModifiedStanzaToPeer
21 , sendModifiedStanzaToClient 22 , sendModifiedStanzaToClient
@@ -50,6 +51,7 @@ import qualified Text.XML.Stream.Render as XML
50import qualified Text.XML.Stream.Parse as XML 51import qualified Text.XML.Stream.Parse as XML
51import Data.XML.Types as XML 52import Data.XML.Types as XML
52import Data.Maybe 53import Data.Maybe
54import Data.List (nub)
53import Data.Monoid ( (<>) ) 55import Data.Monoid ( (<>) )
54import Data.Text (Text) 56import Data.Text (Text)
55import qualified Data.Text as Text (pack,unpack) 57import qualified Data.Text as Text (pack,unpack)
@@ -227,12 +229,17 @@ peerKeyToText (ClientKey { localAddress=addr }) = "ErrorClIeNt0"
227 229
228peerKeyToResolvedName :: ConnectionKey -> IO Text 230peerKeyToResolvedName :: ConnectionKey -> IO Text
229peerKeyToResolvedName k@(ClientKey { localAddress=addr }) = return "ErrorClIeNt1" 231peerKeyToResolvedName k@(ClientKey { localAddress=addr }) = return "ErrorClIeNt1"
230peerKeyToResolvedName k@(PeerKey { callBackAddress=addr }) = do 232peerKeyToResolvedName pk = do
231 mname <- handleIO_ (return Nothing) $ do 233 ns <- peerKeyToResolvedNames pk
234 return $ maybe (peerKeyToText pk) id (listToMaybe ns)
235
236peerKeyToResolvedNames :: ConnectionKey -> IO [Text]
237peerKeyToResolvedNames k@(ClientKey { localAddress=addr }) = return []
238peerKeyToResolvedNames k@(PeerKey { callBackAddress=addr }) = do
239 handleIO_ (return []) $ do
232 ent <- getHostByAddr addr -- AF_UNSPEC addr 240 ent <- getHostByAddr addr -- AF_UNSPEC addr
233 let names = BSD.hostName ent : BSD.hostAliases ent 241 let names = BSD.hostName ent : BSD.hostAliases ent
234 return $ listToMaybe names 242 return $ map Text.pack $ nub names
235 return $ maybe (peerKeyToText k) Text.pack mname
236 243
237 244
238wlog :: String -> IO () 245wlog :: String -> IO ()