summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs42
1 files changed, 37 insertions, 5 deletions
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs
index 57e1741f..3336052b 100644
--- a/src/Network/Tox/Crypto/Handlers.hs
+++ b/src/Network/Tox/Crypto/Handlers.hs
@@ -1,8 +1,9 @@
1{-# LANGUAGE NamedFieldPuns #-} 1{-# LANGUAGE CPP #-}
2{-# LANGUAGE TupleSections #-} 2{-# LANGUAGE DeriveFunctor #-}
3{-# LANGUAGE TypeOperators #-} 3{-# LANGUAGE NamedFieldPuns #-}
4{-# LANGUAGE DeriveFunctor #-} 4{-# LANGUAGE PatternSynonyms #-}
5{-# LANGUAGE CPP #-} 5{-# LANGUAGE TupleSections #-}
6{-# LANGUAGE TypeOperators #-}
6module Network.Tox.Crypto.Handlers where 7module Network.Tox.Crypto.Handlers where
7 8
8import Network.Tox.NodeId 9import Network.Tox.NodeId
@@ -1099,6 +1100,37 @@ mkMsgTypes msgs = let zeros = A.listArray (0,255) (replicate 256 0)
1099 toIndex (GrpMsg KnownLossless nam) = 0x63 -- fromEnum MESSAGE_GROUPCHAT 1100 toIndex (GrpMsg KnownLossless nam) = 0x63 -- fromEnum MESSAGE_GROUPCHAT
1100 toIndex (GrpMsg KnownLossy nam) = 0xC7 -- fromEnum LOSSY_GROUPCHAT 1101 toIndex (GrpMsg KnownLossy nam) = 0xC7 -- fromEnum LOSSY_GROUPCHAT
1101 1102
1103------------------ Slurped from c-toxcore for reference. -------------------------------
1104pattern PACKET_ID_ONLINE = 24
1105pattern PACKET_ID_OFFLINE = 25
1106pattern PACKET_ID_NICKNAME = 48
1107pattern PACKET_ID_STATUSMESSAGE = 49
1108pattern PACKET_ID_USERSTATUS = 50
1109pattern PACKET_ID_TYPING = 51
1110pattern PACKET_ID_MESSAGE = 64
1111-- pattern PACKET_ID_ACTION = (PACKET_ID_MESSAGE + MESSAGE_ACTION) {- 65 -}
1112pattern PACKET_ID_MSI = 69
1113pattern PACKET_ID_FILE_SENDREQUEST = 80
1114pattern PACKET_ID_FILE_CONTROL = 81
1115pattern PACKET_ID_FILE_DATA = 82
1116pattern PACKET_ID_INVITE_CONFERENCE = 96
1117pattern PACKET_ID_ONLINE_PACKET = 97
1118pattern PACKET_ID_DIRECT_CONFERENCE = 98
1119pattern PACKET_ID_MESSAGE_CONFERENCE = 99
1120pattern PACKET_ID_LOSSY_CONFERENCE = 199
1121pattern PACKET_ID_LOSSLESS_RANGE_START = 160
1122pattern PACKET_ID_LOSSLESS_RANGE_SIZE = 32
1123pattern PACKET_ID_ALIVE = 16
1124pattern PACKET_ID_SHARE_RELAYS = 17
1125pattern PACKET_ID_FRIEND_REQUESTS = 18
1126pattern PACKET_ID_PADDING = 0 -- Denotes padding
1127pattern PACKET_ID_REQUEST = 1 -- Used to request unreceived packets
1128pattern PACKET_ID_KILL = 2 -- Used to killconnection
1129pattern PACKET_ID_LOSSY_RANGE_START = 192
1130pattern PACKET_ID_LOSSY_RANGE_SIZE = 63
1131----------------------------------------------------------------------------------------
1132
1133
1102-- | Handle all Tox messages that this code base is aware of. 1134-- | Handle all Tox messages that this code base is aware of.
1103-- The first parameter is a function which is applied to get the values 1135-- The first parameter is a function which is applied to get the values
1104-- for keys of unknown nature. Could be either 'id' or 'const 0' 1136-- for keys of unknown nature. Could be either 'id' or 'const 0'