diff options
author | joe <joe@jerkface.net> | 2018-05-18 23:16:46 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2018-05-18 23:16:46 -0400 |
commit | ea3c97cea6cb2a690afca743fa8fecfbb533d69b (patch) | |
tree | 463c0ad5176f9978c8f1732069dfdb82f610e937 /Presence | |
parent | 6eefc1e5112753a9f01396e6ba54dca0b7f56c04 (diff) |
Daemon options to enable or disable XMPP.
Diffstat (limited to 'Presence')
-rw-r--r-- | Presence/Presence.hs | 7 | ||||
-rw-r--r-- | Presence/XMPPServer.hs | 7 |
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 | |||
13 | import Control.Monad.Trans.Resource (runResourceT) | 13 | import Control.Monad.Trans.Resource (runResourceT) |
14 | import Control.Monad.Trans | 14 | import Control.Monad.Trans |
15 | import Control.Monad.IO.Class (MonadIO, liftIO) | 15 | import Control.Monad.IO.Class (MonadIO, liftIO) |
16 | import Network.Socket ( SockAddr(..) ) | 16 | import Network.Socket ( SockAddr(..), PortNumber ) |
17 | import System.Endian (fromBE32) | 17 | import System.Endian (fromBE32) |
18 | import Data.List (nub, (\\), intersect, groupBy, sort, sortBy ) | 18 | import Data.List (nub, (\\), intersect, groupBy, sort, sortBy ) |
19 | import Data.Ord (comparing ) | 19 | import Data.Ord (comparing ) |
@@ -124,8 +124,8 @@ newPresenceState cw toxman xmpp = atomically $ do | |||
124 | } | 124 | } |
125 | 125 | ||
126 | 126 | ||
127 | presenceHooks :: PresenceState -> Int -> XMPPServerParameters | 127 | presenceHooks :: PresenceState -> Int -> Maybe PortNumber -> XMPPServerParameters |
128 | presenceHooks state verbosity = XMPPServerParameters | 128 | presenceHooks 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 | ||
93 | peerport :: PortNumber | 93 | peerport :: PortNumber |
94 | peerport = 5269 | 94 | peerport = 5269 |
95 | clientport :: PortNumber | 95 | -- clientport :: PortNumber |
96 | clientport = 5222 | 96 | -- clientport = 5222 |
97 | 97 | ||
98 | my_uuid :: Text | 98 | my_uuid :: Text |
99 | my_uuid = "154ae29f-98f2-4af4-826d-a40c8a188574" | 99 | my_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) |