mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
core: types to support xftp (#1971)
* core: types to support xftp * migration, amend types * update protocol / types * update protocol, types * update schema, simplexmq
This commit is contained in:
committed by
GitHub
parent
5f587c2104
commit
2817306659
@@ -45,7 +45,7 @@ import qualified Simplex.Messaging.Crypto as C
|
||||
import Simplex.Messaging.Encoding
|
||||
import Simplex.Messaging.Encoding.String
|
||||
import Simplex.Messaging.Parsers (dropPrefix, taggedObjectJSON)
|
||||
import Simplex.Messaging.Protocol (AProtocolType, ProtocolServer (..))
|
||||
import Simplex.Messaging.Protocol (AProtocolType, ProtocolServer (..), ProtocolTypeI)
|
||||
import qualified Simplex.Messaging.Protocol as SMP
|
||||
import Simplex.Messaging.Transport.Client (TransportHost (..))
|
||||
import Simplex.Messaging.Util (bshow, tshow)
|
||||
@@ -721,12 +721,13 @@ viewUserProfile Profile {displayName, fullName} =
|
||||
"(the updated profile will be sent to all your contacts)"
|
||||
]
|
||||
|
||||
viewSMPServers :: [ServerCfg] -> Bool -> [StyledString]
|
||||
viewSMPServers smpServers testView =
|
||||
-- TODO make more generic messages or split
|
||||
viewSMPServers :: ProtocolTypeI p => [ServerCfg p] -> Bool -> [StyledString]
|
||||
viewSMPServers servers testView =
|
||||
if testView
|
||||
then [customSMPServers]
|
||||
then [customServers]
|
||||
else
|
||||
[ customSMPServers,
|
||||
[ customServers,
|
||||
"",
|
||||
"use " <> highlight' "/smp test <srv>" <> " to test SMP server connection",
|
||||
"use " <> highlight' "/smp set <srv1[,srv2,...]>" <> " to switch to custom SMP servers",
|
||||
@@ -734,10 +735,10 @@ viewSMPServers smpServers testView =
|
||||
"(chat option " <> highlight' "-s" <> " (" <> highlight' "--server" <> ") has precedence over saved SMP servers for chat session)"
|
||||
]
|
||||
where
|
||||
customSMPServers =
|
||||
if null smpServers
|
||||
customServers =
|
||||
if null servers
|
||||
then "no custom SMP servers saved"
|
||||
else viewServers smpServers
|
||||
else viewServers servers
|
||||
|
||||
viewSMPTestResult :: Maybe SMPTestFailure -> [StyledString]
|
||||
viewSMPTestResult = \case
|
||||
@@ -798,7 +799,7 @@ viewConnectionStats ConnectionStats {rcvServers, sndServers} =
|
||||
["receiving messages via: " <> viewServerHosts rcvServers | not $ null rcvServers]
|
||||
<> ["sending messages via: " <> viewServerHosts sndServers | not $ null sndServers]
|
||||
|
||||
viewServers :: [ServerCfg] -> StyledString
|
||||
viewServers :: ProtocolTypeI p => [ServerCfg p] -> StyledString
|
||||
viewServers = plain . intercalate ", " . map (B.unpack . strEncode . (\ServerCfg {server} -> server))
|
||||
|
||||
viewServerHosts :: [SMPServer] -> StyledString
|
||||
|
||||
Reference in New Issue
Block a user