summaryrefslogtreecommitdiff
path: root/Presence
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-05-18 23:16:46 -0400
committerjoe <joe@jerkface.net>2018-05-18 23:16:46 -0400
commitea3c97cea6cb2a690afca743fa8fecfbb533d69b (patch)
tree463c0ad5176f9978c8f1732069dfdb82f610e937 /Presence
parent6eefc1e5112753a9f01396e6ba54dca0b7f56c04 (diff)
Daemon options to enable or disable XMPP.
Diffstat (limited to 'Presence')
-rw-r--r--Presence/Presence.hs7
-rw-r--r--Presence/XMPPServer.hs7
2 files changed, 8 insertions, 6 deletions
diff --git a/Presence/Presence.hs b/Presence/Presence.hs
index c556a170..97b9d5b8 100644
--- a/Presence/Presence.hs
+++ b/Presence/Presence.hs
@@ -13,7 +13,7 @@ import Control.Concurrent.STM.TMVar
13import Control.Monad.Trans.Resource (runResourceT) 13import Control.Monad.Trans.Resource (runResourceT)
14import Control.Monad.Trans 14import Control.Monad.Trans
15import Control.Monad.IO.Class (MonadIO, liftIO) 15import Control.Monad.IO.Class (MonadIO, liftIO)
16import Network.Socket ( SockAddr(..) ) 16import Network.Socket ( SockAddr(..), PortNumber )
17import System.Endian (fromBE32) 17import System.Endian (fromBE32)
18import Data.List (nub, (\\), intersect, groupBy, sort, sortBy ) 18import Data.List (nub, (\\), intersect, groupBy, sort, sortBy )
19import Data.Ord (comparing ) 19import Data.Ord (comparing )
@@ -124,8 +124,8 @@ newPresenceState cw toxman xmpp = atomically $ do
124 } 124 }
125 125
126 126
127presenceHooks :: PresenceState -> Int -> XMPPServerParameters 127presenceHooks :: PresenceState -> Int -> Maybe PortNumber -> XMPPServerParameters
128presenceHooks state verbosity = XMPPServerParameters 128presenceHooks state verbosity mport = XMPPServerParameters
129 { xmppChooseResourceName = chooseResourceName state 129 { xmppChooseResourceName = chooseResourceName state
130 , xmppTellClientHisName = tellClientHisName state 130 , xmppTellClientHisName = tellClientHisName state
131 , xmppTellMyNameToClient = textHostName 131 , xmppTellMyNameToClient = textHostName
@@ -148,6 +148,7 @@ presenceHooks state verbosity = XMPPServerParameters
148 , xmppClientInformSubscription = clientInformSubscription state 148 , xmppClientInformSubscription = clientInformSubscription state
149 , xmppPeerInformSubscription = peerInformSubscription state 149 , xmppPeerInformSubscription = peerInformSubscription state
150 , xmppVerbosity = return verbosity 150 , xmppVerbosity = return verbosity
151 , xmppClientPort = fromMaybe 5222 mport
151 } 152 }
152 153
153 154
diff --git a/Presence/XMPPServer.hs b/Presence/XMPPServer.hs
index ea1500d4..c9132d0f 100644
--- a/Presence/XMPPServer.hs
+++ b/Presence/XMPPServer.hs
@@ -92,8 +92,8 @@ import qualified Connection
92 92
93peerport :: PortNumber 93peerport :: PortNumber
94peerport = 5269 94peerport = 5269
95clientport :: PortNumber 95-- clientport :: PortNumber
96clientport = 5222 96-- clientport = 5222
97 97
98my_uuid :: Text 98my_uuid :: Text
99my_uuid = "154ae29f-98f2-4af4-826d-a40c8a188574" 99my_uuid = "154ae29f-98f2-4af4-826d-a40c8a188574"
@@ -213,6 +213,7 @@ data XMPPServerParameters =
213 , -- | Called when a remote peer informs us of our subscription status. 213 , -- | Called when a remote peer informs us of our subscription status.
214 xmppPeerInformSubscription :: IO () -> ConnectionKey -> Stanza -> IO () 214 xmppPeerInformSubscription :: IO () -> ConnectionKey -> Stanza -> IO ()
215 , xmppVerbosity :: IO Int 215 , xmppVerbosity :: IO Int
216 , xmppClientPort :: PortNumber -- 5222
216 } 217 }
217 218
218 219
@@ -1841,7 +1842,7 @@ xmppServer xmpp = do
1841 hPutStrLn stderr $ "Starting peer listen" 1842 hPutStrLn stderr $ "Starting peer listen"
1842 control sv (Listen peerport peer_params) 1843 control sv (Listen peerport peer_params)
1843 hPutStrLn stderr $ "Starting client listen" 1844 hPutStrLn stderr $ "Starting client listen"
1844 control sv (Listen clientport client_params) 1845 control sv (Listen (xmppClientPort xmpp) client_params)
1845 return XMPPServer { _xmpp_sv = sv, _xmpp_peer_params = peer_params } 1846 return XMPPServer { _xmpp_sv = sv, _xmpp_peer_params = peer_params }
1846 1847
1847#if MIN_VERSION_stm(2,4,0) 1848#if MIN_VERSION_stm(2,4,0)