README: document message types; taro-ctl: fix 0-length message sending; taro-ls: fix 0-length message reading and list length off-by-1 error
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmQZQYEACgkQO3+8IhRO Y5ghaw/+NHn+IyrDNqWM8H86+yu3O0c5VZA01Cp9VkC1ZgCiUxTjXiibunl6mPZx wyVgEKb4Sd5Pvi/Rzp6dL5ZKo5R/cmRUtGOYUFfH5cKnPuHzALhIxQOeSmjmwW9T KZoRzLFrUKQf+XxpgS7pYrxT0Iy3f6PpYHiQ7Is1CVQ7V+j1BJYsVkv/TMfwAFfk GSaULefxU++RDcLHyLW3/twLmRUAL8EbLeBxLdFIovhbKkL91SkFPls3hwaWqf7v B6eS71zbibW/GamknKCroVreO1M9zylc8z61kz/tlsOzmCDl+j0A1KHnQt1hiz30 pyKp23r/+OmCU0e98TBFNBrTtHikZt1nNwPboOGnpp0m+NaZq/mg8w9wIQ7eIYbS kBPkUeGkFLuBWK6wdAqVLcscNtyPGwpxusuXevojSwpi2N7Mv5mo7QfFrXnWNbNG UL7UNy/dtUCbi5JFLqTVgzMKc7RejR2Gbc6LRmi2BtXAbzIWmEgudXgcL8jAilWJ 2RHLhI945P13yerea3Fe8XkOWUkJd8xyPUPLNUqBktxlnqpX0dsB2GY+liLD+V1Q SSsv2kFJz37kSyI0A0I4x3wEJIxMSluIwCkIaThUmTuXc1Mqu5yTNRqmFrvSFj4c zfdHJludPgYe7MKIMpX8kxIfAubGdSC9JdZwPtqU7JDigUBM8po= =aLzg -----END PGP SIGNATURE-----
3 files changed,
26 insertions(+),
10 deletions(-)
M
README.md
→
README.md
@@ -4,11 +4,20 @@ `mblaze` frontend in `uxn` and `crystal`
## messages +Messages are in the format `[1][2:3][...]`: +- byte 1 is the message type +- bytes 2 and 3 are the length of the message, in bytes +- bytes 4 and beyond are the message itself (payload) - won't be present if the length is 0 + Even messages go from `taro-ctl` to the `uxn` windows. - `0`: mailbox list -- `2`: list mail in mailbox +- `2`: list mail in current mailbox Odd messages go from the `uxn` windows to `taro-ctl`. -- `1`: change/refresh mailbox+- `1`: change/refresh mailbox; payload is the mailbox to read +- `3`: mark all as read in current mailbox; no payload +- `5`: search mail; payload is the regex +- `7`: refile mail; payload is a mblaze msg number/range, a space, and then the mailbox name +- `9`: trash mail; payload is a mblaze msg number/range
M
taro-ctl.cr
→
taro-ctl.cr
@@ -74,19 +74,13 @@
def write_msg(msgtype : UInt8, data : Slice) msgsz = UInt16.new(data.size > 16384 ? 16384 : data.size) msgtype.to_io(@stdin_w, IO::ByteFormat::BigEndian) - if msgsz != 0 - msgsz.to_io(@stdin_w, IO::ByteFormat::BigEndian) - else - 8_u16.to_io(@stdin_w, IO::ByteFormat::BigEndian) - end + msgsz.to_io(@stdin_w, IO::ByteFormat::BigEndian) if msgsz == 16384 @stdin_w.write(data[0..msgsz - 2]) 10_u8.to_io(@stdin_w, IO::ByteFormat::BigEndian) elsif msgsz != 0 @stdin_w.write(data[0..msgsz - 1]) - else - @stdin_w.write("nothing\n".to_slice) end end
M
taro-ls.tal
→
taro-ls.tal
@@ -145,6 +145,19 @@
&count_2 .Console/read DEI .decoding/count INC STZ #00 .decoding/counting STZ + .decoding/count LDZ2 #0000 NEQ2 ,&has_data JCN + .decoding/msg_type LDZ + DUP MBOX_LIST NEQ ,&no_mbox_empty JCN + POP #0000 .mboxes/bytes STZ2 decode_is_done POP + ,&done JMP + &no_mbox_empty + DUP MAIL_LIST NEQ ,&no_mail_empty JCN + POP + #0000 .list/bytes STZ2 decode_is_done POP + ,&done JMP + &no_mail_empty + POP + &has_data BRK@@ -611,7 +624,7 @@
&continue INC2 ,&while JMP &end - STHkr LB_OFFSET LDZ2 #0001 SUB2 STHr LB_LEN STZ2 POP2 POP2 + STHkr LB_OFFSET LDZ2 STHr LB_LEN STZ2 POP2 POP2 JMP2r