code wiki / (root) / nx_chatmsg.nx

nx_chatmsg.nx

buildroot/runtime/nx_chatmsg.nx

1311 B22 linesdepth 0pulls 0 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_chatmsg.nx -- sovereign chat message state ladder: the delivery/read-receipt spine of an S-class chat (exceed Telegram/Instagram/MMS). A message advances QUEUED -> SENT -> DELIVERED -> READ and NEVER regresses -- a late or duplicate receipt can't un-deliver or un-read a message, and an offline message stays QUEUED (never lost). Messages + receipts ride the E2E relay (nx_e2e), so the server sees only ciphertext. Pure state logic. license_tier: ORIGINAL

dependencies 0 imports · 1 importers

nx_chatmsg.nx nx_chatmsg_gate.nx

imports: none

imported by: nx_chatmsg_gate.nx

structs

none

consts

7const MS_QUEUED: i64 = 0 // composed offline / not yet at the relay
8const MS_SENT: i64 = 1 // reached the relay
9const MS_DELIVERED: i64 = 2 // reached the peer's device
10const MS_READ: i64 = 3 // peer opened it

functions

14func cm_advance(state: i64, ev: i64) -> i64 { if ev > state { return ev } return state }
called by 1: main
15func cm_is_read(state: i64) -> i64 { if state == MS_READ { return 1 } return 0 }
called by 1: main
17func cm_badge(states: *i64, n: i64) -> i64
called by 1: main