Commit Graph

111 Commits

Author SHA1 Message Date
61ab96abdc Don't duplicate messages when sending multiple TLVs 2020-12-23 23:59:09 +01:00
597dd658f4 Lock during refresh in order to manage concurrency, fixes #5 2020-12-23 23:51:16 +01:00
39b4157836 Fix acknowledge 2020-12-23 23:10:57 +01:00
901d4aad05 Acknowledge Data TLVs
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:36:04 +01:00
e1f0d54ac8 Use a random squirrel id and an incremental nonce
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:36:04 +01:00
ebd6c18032 Ignore duplicate messages
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:36:04 +01:00
17ca4d105f Use screen.get_wch() rather than screen.getkey() to have better support of UTF-8
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:36:03 +01:00
e44998028d Don't add stars to mark a text as bold or italic if non-markdown mode
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:36:03 +01:00
9f070f594b Better nickname parsing, warn other clients when they does not provide a parsable nickname
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:36:02 +01:00
e37c43b78d Scroll horizontally on the input line for long messages
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:36:02 +01:00
dd4f839fad Long messages are wrapped in the history to avoid crashes
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:36:02 +01:00
7a25d24ba3 Ensure that a DataTLV is not too long
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:36:01 +01:00
b96ff488e7 If the total packet size is larger than 1024, then it is splitted into subpackets
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:36:01 +01:00
bda4860aca Convert host to network byte order if necessary
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:36:01 +01:00
833c56755a Some imports were missing
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:36:00 +01:00
0c4ef9da5a Split the file into more readable-sized files 2020-12-21 16:36:00 +01:00
63407461fe Python 3.7 does not support continue in a finally block
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:59 +01:00
38cea234bb Make the emoji lib optional
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:59 +01:00
3d444f57f0 Adapt the byte order to the system configuration
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:59 +01:00
00e24d74ee Cut the main loop into smaller functions to have more modularity
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:58 +01:00
e8fa0ece22 More abstraction on packet building
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:58 +01:00
592cbc3792 Add basic implementations for all TLVs
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:57 +01:00
8a066bb340 Handle warnings (receive only)
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:57 +01:00
f1e04b1dc8 Properly handle TLVs
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:57 +01:00
eeff80a85f Add add_system_message function
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:56 +01:00
2630137019 In no-emoji mode, don't display the emoji menu
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:56 +01:00
9fcc0c30a7 The emoji selection is working
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:55 +01:00
5a212750e6 Don't display too complex emojis
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:55 +01:00
90918ddd71 Add emoji selector
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:54 +01:00
2f752592a1 Scroll in the history with up/down arrows and page up/page down
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:54 +01:00
f5baea585e We can navigate in order to edit our message
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:54 +01:00
a21b0aa652 Manage backspace key
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:53 +01:00
639ad2b3bd Argument parsing test got broken
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:53 +01:00
504811a32c Don't send an empty message
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:52 +01:00
39016f6980 Screen is resizable
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:52 +01:00
ce61532f35 Markdown-formatting and emojis can be disabled with a CLI
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:51 +01:00
9835fff1f9 Emojize texts
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:51 +01:00
b007f4fce5 Text can be striked
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:50 +01:00
fce8e01a5b Format bold, italic, underline text
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:50 +01:00
a1b93e851e The nickname of the current user is colored
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:50 +01:00
dfd2d319a8 Add text colors
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:49 +01:00
04f31a1159 Better terminal refresh
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:49 +01:00
c609ca998a Uses curses to have a proper terminal UI
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:48 +01:00
a28975c895 Clients can communicate together (without any innondation)
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:48 +01:00
9561912ac6 A packet can have multiple TLVs
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:47 +01:00
a796bed259 Receive packets in a dedicated thread, that is called "worm"
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:47 +01:00
8ef3f3a21c Use IPv4-Mapping to have IPv4 compatibility
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:47 +01:00
e06d7b9540 Linting
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:46 +01:00
a4cf467e59 Translate tuples (address, port) into hazelnuts
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:46 +01:00
79b8a44461 Resolve DNS as IPv6 addresses before connecting to the socket
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2020-12-21 16:35:45 +01:00