summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2024-02-17 11:30:54 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2024-02-17 11:30:54 +0100
commitd5b42ba6f344e96210c24c4507b459b118f37410 (patch)
treee6ba695bf65348aa3790f9d98a266a9e87ec1a17 /main
parent0ed3f76533cde17322cf04018713d70c2f78d490 (diff)
Flag to disable pjproject dependency
Changelog: Added flag to enable/disable ICE support with pjproject
Diffstat (limited to 'main')
-rw-r--r--main/Main.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/main/Main.hs b/main/Main.hs
index 3359598..90e4079 100644
--- a/main/Main.hs
+++ b/main/Main.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
@@ -32,8 +33,10 @@ import System.Environment
import Erebos.Attach
import Erebos.Contact
+#ifdef ENABLE_ICE_SUPPORT
import Erebos.Discovery
import Erebos.ICE
+#endif
import Erebos.Identity
import Erebos.Message
import Erebos.Network
@@ -159,7 +162,9 @@ interactiveLoop st opts = runInputT defaultSettings $ do
, someService @SyncService Proxy
, someService @ContactService Proxy
, someService @DirectMessage Proxy
+#ifdef ENABLE_ICE_SUPPORT
, someService @DiscoveryService Proxy
+#endif
]
peers <- liftIO $ newMVar []
@@ -227,7 +232,9 @@ interactiveLoop st opts = runInputT defaultSettings $ do
loop $ Just $ CommandState
{ csHead = erebosHead
, csContext = NoContext
+#ifdef ENABLE_ICE_SUPPORT
, csIceSessions = []
+#endif
, csIcePeer = Nothing
}
@@ -244,7 +251,9 @@ data CommandInput = CommandInput
data CommandState = CommandState
{ csHead :: Head LocalState
, csContext :: CommandContext
+#ifdef ENABLE_ICE_SUPPORT
, csIceSessions :: [IceSession]
+#endif
, csIcePeer :: Maybe Peer
}
@@ -302,6 +311,7 @@ commands =
, ("contact-add", cmdContactAdd)
, ("contact-accept", cmdContactAccept)
, ("contact-reject", cmdContactReject)
+#ifdef ENABLE_ICE_SUPPORT
, ("discovery-init", cmdDiscoveryInit)
, ("discovery", cmdDiscovery)
, ("ice-create", cmdIceCreate)
@@ -309,6 +319,7 @@ commands =
, ("ice-show", cmdIceShow)
, ("ice-connect", cmdIceConnect)
, ("ice-send", cmdIceSend)
+#endif
]
cmdUnknown :: String -> Command
@@ -408,6 +419,8 @@ cmdContactAccept = contactAccept =<< getSelectedPeer
cmdContactReject :: Command
cmdContactReject = contactReject =<< getSelectedPeer
+#ifdef ENABLE_ICE_SUPPORT
+
cmdDiscoveryInit :: Command
cmdDiscoveryInit = void $ do
server <- asks ciServer
@@ -477,3 +490,5 @@ cmdIceSend = void $ do
s:_ <- gets csIceSessions
server <- asks ciServer
liftIO $ serverPeerIce server s
+
+#endif