summaryrefslogtreecommitdiff
path: root/src/Data
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2018-11-27 22:39:17 -0500
committerJoe Crayne <joe@jerkface.net>2018-12-16 14:08:26 -0500
commitaa0dd020cee882e218c9ab9eb6b75f142abfd8d5 (patch)
tree12333ca232fcbdb341c65fc2b3ceb36fd4688afe /src/Data
parent7e1dff874444dcc4e1e15adb2ef5bd0946526519 (diff)
group chat invite accepted message.
Diffstat (limited to 'src/Data')
-rw-r--r--src/Data/Tox/Msg.hs10
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
263data InviteType = GroupInvite { groupName :: Text } 263data 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
268instance Sized InviteType where 268instance 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
274data Invite = Invite 274data 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
311instance Packet Invite where 311instance Packet Invite where