Skip to content

Commit

Permalink
feat: Add support for group and DHT debug events.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Jan 18, 2024
1 parent 3c6f012 commit 2540acd
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Network/Tox/Types/Events.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2540acd

Please sign in to comment.