From 2540acd2285952d68a624462f86eb41235a88920 Mon Sep 17 00:00:00 2001 From: iphydf Date: Thu, 18 Jan 2024 13:51:38 +0000 Subject: [PATCH] feat: Add support for group and DHT debug events. --- src/Network/Tox/Types/Events.hs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/Network/Tox/Types/Events.hs b/src/Network/Tox/Types/Events.hs index f0df35b..6f8ea5b 100644 --- a/src/Network/Tox/Types/Events.hs +++ b/src/Network/Tox/Types/Events.hs @@ -8,6 +8,12 @@ import Data.MessagePack (MessagePack) import Data.Word (Word16, Word32, Word64) import FFI.Tox.Tox (ConferenceType, Connection, FileControl, + GroupExitType, + GroupJoinFail, + GroupModEvent, + GroupPrivacyState, + GroupTopicLock, + GroupVoiceState, MessageType, UserStatus) import GHC.Generics (Generic) import Network.Tox.C.Type (PublicKey) @@ -45,6 +51,27 @@ data Event | ConferenceTitle { conferenceNumber :: Word32, peerNumber :: Word32, title :: BS.ByteString } | ConferenceMessage { conferenceNumber :: Word32, peerNumber :: Word32, messageType :: MessageType, message :: BS.ByteString } + + | GroupPeerName { groupNumber :: Word32, peerId :: Word32, name :: BS.ByteString } + | GroupPeerStatus { groupNumber :: Word32, peerId :: Word32, status :: UserStatus } + | GroupTopic { groupNumber :: Word32, peerId :: Word32, topic :: BS.ByteString } + | GroupPrivacyState { groupNumber :: Word32, privacyState :: GroupPrivacyState } + | GroupVoiceState { groupNumber :: Word32, voiceState :: GroupVoiceState } + | GroupTopicLock { groupNumber :: Word32, topicLock :: GroupTopicLock } + | GroupPeerLimit { groupNumber :: Word32, peerLimit :: Word32 } + | GroupPassword { groupNumber :: Word32, password :: BS.ByteString } + | GroupMessage { groupNumber :: Word32, peerId :: Word32, messageType :: MessageType, message :: BS.ByteString, messageId :: Word32 } + | GroupPrivateMessage { groupNumber :: Word32, peerId :: Word32, messageType :: MessageType, message :: BS.ByteString } + | GroupCustomPacket { groupNumber :: Word32, peerId :: Word32, data' :: BS.ByteString } + | GroupCustomPrivatePacket { groupNumber :: Word32, peerId :: Word32, data' :: BS.ByteString } + | GroupInvite { groupNumber :: Word32, inviteData :: BS.ByteString, groupName :: BS.ByteString } + | GroupPeerJoin { groupNumber :: Word32, peerId :: Word32 } + | GroupPeerExit { groupNumber :: Word32, peerId :: Word32, exitType :: GroupExitType, name :: BS.ByteString, partMessage :: BS.ByteString } + | GroupSelfJoin { groupNumber :: Word32 } + | GroupJoinFail { groupNumber :: Word32, failType :: GroupJoinFail } + | GroupModeration { groupNumber :: Word32, sourcePeerId :: Word32, targetPeerId :: Word32, modType :: GroupModEvent } + + | DhtGetNodesResponse { publicKey :: PublicKey, ip :: BS.ByteString, port :: Word16 } deriving (Ord, Eq, Show, Generic) instance MessagePack Event