diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Data/Tox/Msg.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Data/Tox/Msg.hs b/src/Data/Tox/Msg.hs index e8c26a56..6550fd95 100644 --- a/src/Data/Tox/Msg.hs +++ b/src/Data/Tox/Msg.hs | |||
@@ -261,14 +261,14 @@ instance Show ChatID where | |||
261 | show (ChatID ed) = showToken32 ed | 261 | show (ChatID ed) = showToken32 ed |
262 | 262 | ||
263 | data InviteType = GroupInvite { groupName :: Text } | 263 | data InviteType = GroupInvite { groupName :: Text } |
264 | | AccptedInvite | 264 | | AcceptedInvite |
265 | | ConfirmedInvite { inviteNodes :: [NodeInfo] } | 265 | | ConfirmedInvite { inviteNodes :: [NodeInfo] } |
266 | deriving (Eq,Show) | 266 | deriving (Eq,Show) |
267 | 267 | ||
268 | instance Sized InviteType where | 268 | instance Sized InviteType where |
269 | size = VarSize $ \x -> case x of | 269 | size = VarSize $ \x -> case x of |
270 | GroupInvite name -> B.length (T.encodeUtf8 name) | 270 | GroupInvite name -> B.length (T.encodeUtf8 name) |
271 | AccptedInvite -> 0 | 271 | AcceptedInvite -> 0 |
272 | ConfirmedInvite ns -> 0 -- TODO: size of node list. | 272 | ConfirmedInvite ns -> 0 -- TODO: size of node list. |
273 | 273 | ||
274 | data Invite = Invite | 274 | data Invite = Invite |
@@ -292,20 +292,20 @@ instance Serialize Invite where | |||
292 | Invite chatid chatkey <$> case invite_type of | 292 | Invite chatid chatkey <$> case invite_type of |
293 | 0 -> do bs <- remaining >>= getBytes -- TODO: size can be determined from group shared state. | 293 | 0 -> do bs <- remaining >>= getBytes -- TODO: size can be determined from group shared state. |
294 | return $ GroupInvite $ decodeUtf8 bs | 294 | return $ GroupInvite $ decodeUtf8 bs |
295 | 1 -> return AccptedInvite | 295 | 1 -> return AcceptedInvite |
296 | 2 -> return $ ConfirmedInvite [] -- TODO: decode nodes | 296 | 2 -> return $ ConfirmedInvite [] -- TODO: decode nodes |
297 | 297 | ||
298 | put x = do | 298 | put x = do |
299 | putWord8 254 -- GP_FRIEND_INVITE | 299 | putWord8 254 -- GP_FRIEND_INVITE |
300 | putWord8 $ case invite x of | 300 | putWord8 $ case invite x of |
301 | GroupInvite {} -> 0 -- GROUP_INVITE | 301 | GroupInvite {} -> 0 -- GROUP_INVITE |
302 | AccptedInvite -> 1 -- GROUP_INVITE_ACCEPTED | 302 | AcceptedInvite -> 1 -- GROUP_INVITE_ACCEPTED |
303 | ConfirmedInvite {} -> 2 -- GROUP_INVITE_CONFIRMATION | 303 | ConfirmedInvite {} -> 2 -- GROUP_INVITE_CONFIRMATION |
304 | put $ inviteChatID x | 304 | put $ inviteChatID x |
305 | put $ key2id $ inviteChatKey x | 305 | put $ key2id $ inviteChatKey x |
306 | case invite x of | 306 | case invite x of |
307 | GroupInvite name -> putByteString $ encodeUtf8 name | 307 | GroupInvite name -> putByteString $ encodeUtf8 name |
308 | AccptedInvite -> return () | 308 | AcceptedInvite -> return () |
309 | ConfirmedInvite ns -> return () -- TODO: encode nodes. | 309 | ConfirmedInvite ns -> return () -- TODO: encode nodes. |
310 | 310 | ||
311 | instance Packet Invite where | 311 | instance Packet Invite where |