diff options
Diffstat (limited to 'src/Network')
-rw-r--r-- | src/Network/Tox/Crypto/Handlers.hs | 42 |
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 #-} | ||
6 | module Network.Tox.Crypto.Handlers where | 7 | module Network.Tox.Crypto.Handlers where |
7 | 8 | ||
8 | import Network.Tox.NodeId | 9 | import 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. ------------------------------- | ||
1104 | pattern PACKET_ID_ONLINE = 24 | ||
1105 | pattern PACKET_ID_OFFLINE = 25 | ||
1106 | pattern PACKET_ID_NICKNAME = 48 | ||
1107 | pattern PACKET_ID_STATUSMESSAGE = 49 | ||
1108 | pattern PACKET_ID_USERSTATUS = 50 | ||
1109 | pattern PACKET_ID_TYPING = 51 | ||
1110 | pattern PACKET_ID_MESSAGE = 64 | ||
1111 | -- pattern PACKET_ID_ACTION = (PACKET_ID_MESSAGE + MESSAGE_ACTION) {- 65 -} | ||
1112 | pattern PACKET_ID_MSI = 69 | ||
1113 | pattern PACKET_ID_FILE_SENDREQUEST = 80 | ||
1114 | pattern PACKET_ID_FILE_CONTROL = 81 | ||
1115 | pattern PACKET_ID_FILE_DATA = 82 | ||
1116 | pattern PACKET_ID_INVITE_CONFERENCE = 96 | ||
1117 | pattern PACKET_ID_ONLINE_PACKET = 97 | ||
1118 | pattern PACKET_ID_DIRECT_CONFERENCE = 98 | ||
1119 | pattern PACKET_ID_MESSAGE_CONFERENCE = 99 | ||
1120 | pattern PACKET_ID_LOSSY_CONFERENCE = 199 | ||
1121 | pattern PACKET_ID_LOSSLESS_RANGE_START = 160 | ||
1122 | pattern PACKET_ID_LOSSLESS_RANGE_SIZE = 32 | ||
1123 | pattern PACKET_ID_ALIVE = 16 | ||
1124 | pattern PACKET_ID_SHARE_RELAYS = 17 | ||
1125 | pattern PACKET_ID_FRIEND_REQUESTS = 18 | ||
1126 | pattern PACKET_ID_PADDING = 0 -- Denotes padding | ||
1127 | pattern PACKET_ID_REQUEST = 1 -- Used to request unreceived packets | ||
1128 | pattern PACKET_ID_KILL = 2 -- Used to killconnection | ||
1129 | pattern PACKET_ID_LOSSY_RANGE_START = 192 | ||
1130 | pattern 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' |