mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-04-03 00:36:00 +00:00
smp: support client notices (#1659)
* agent: support client notices * improve * fix, test * rename * cleanup * send and process notices in more cases * dont delete * dont remove notice on other permanent errors * dont remove notice if there is no notice ID in queue * add server to error * allow deleting * only use notice if key hash matches
This commit is contained in:
@@ -10,6 +10,9 @@ module Simplex.Messaging.Encoding.String
|
||||
strToJSON,
|
||||
strToJEncoding,
|
||||
strParseJSON,
|
||||
textToJSON,
|
||||
textToEncoding,
|
||||
textParseJSON,
|
||||
base64urlP,
|
||||
strEncodeList,
|
||||
strListP,
|
||||
@@ -225,9 +228,22 @@ _strP = A.space *> strP
|
||||
|
||||
strToJSON :: StrEncoding a => a -> J.Value
|
||||
strToJSON = J.String . decodeLatin1 . strEncode
|
||||
{-# INLINE strToJSON #-}
|
||||
|
||||
strToJEncoding :: StrEncoding a => a -> J.Encoding
|
||||
strToJEncoding = JE.text . decodeLatin1 . strEncode
|
||||
{-# INLINE strToJEncoding #-}
|
||||
|
||||
strParseJSON :: StrEncoding a => String -> J.Value -> JT.Parser a
|
||||
strParseJSON name = J.withText name $ either fail pure . parseAll strP . encodeUtf8
|
||||
|
||||
textToJSON :: TextEncoding a => a -> J.Value
|
||||
textToJSON = J.String . textEncode
|
||||
{-# INLINE textToJSON #-}
|
||||
|
||||
textToEncoding :: TextEncoding a => a -> J.Encoding
|
||||
textToEncoding = JE.text . textEncode
|
||||
{-# INLINE textToEncoding #-}
|
||||
|
||||
textParseJSON :: TextEncoding a => String -> J.Value -> JT.Parser a
|
||||
textParseJSON name = J.withText name $ maybe (fail name) pure . textDecode
|
||||
|
||||
Reference in New Issue
Block a user