Skip to content

Commit 976bd3a

Browse files
authored
agent: short link encodings (#1577)
1 parent bf27c84 commit 976bd3a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/Simplex/Messaging/Agent/Protocol.hs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,22 +1153,39 @@ connReqUriP overrideScheme = do
11531153

11541154
instance ConnectionModeI m => FromJSON (ConnectionRequestUri m) where
11551155
parseJSON = strParseJSON "ConnectionRequestUri"
1156+
{-# INLINE parseJSON #-}
11561157

11571158
instance ConnectionModeI m => ToJSON (ConnectionRequestUri m) where
11581159
toJSON = strToJSON
1160+
{-# INLINE toJSON #-}
11591161
toEncoding = strToJEncoding
1162+
{-# INLINE toEncoding #-}
11601163

11611164
instance FromJSON AConnectionRequestUri where
11621165
parseJSON = strParseJSON "ConnectionRequestUri"
1166+
{-# INLINE parseJSON #-}
11631167

11641168
instance ToJSON AConnectionRequestUri where
11651169
toJSON = strToJSON
1170+
{-# INLINE toJSON #-}
11661171
toEncoding = strToJEncoding
1172+
{-# INLINE toEncoding #-}
11671173

11681174
instance ConnectionModeI m => FromJSON (ConnShortLink m) where
11691175
parseJSON = strParseJSON "ConnShortLink"
1176+
{-# INLINE parseJSON #-}
11701177

11711178
instance ConnectionModeI m => ToJSON (ConnShortLink m) where
1179+
toJSON = strToJSON
1180+
{-# INLINE toJSON #-}
1181+
toEncoding = strToJEncoding
1182+
{-# INLINE toEncoding #-}
1183+
1184+
instance FromJSON AConnShortLink where
1185+
parseJSON = strParseJSON "AConnShortLink"
1186+
{-# INLINE parseJSON #-}
1187+
1188+
instance ToJSON AConnShortLink where
11721189
toJSON = strToJSON
11731190
toEncoding = strToJEncoding
11741191

@@ -1432,6 +1449,13 @@ data ContactConnType = CCTContact | CCTChannel | CCTGroup deriving (Eq, Show)
14321449

14331450
data AConnShortLink = forall m. ConnectionModeI m => ACSL (SConnectionMode m) (ConnShortLink m)
14341451

1452+
instance Eq AConnShortLink where
1453+
ACSL m sl == ACSL m' sl' = case testEquality m m' of
1454+
Just Refl -> sl == sl'
1455+
Nothing -> False
1456+
1457+
deriving instance Show AConnShortLink
1458+
14351459
instance ToField AConnShortLink where toField = toField . Binary . strEncode
14361460

14371461
instance FromField AConnShortLink where fromField = blobFieldDecoder strDecode

0 commit comments

Comments
 (0)