code wiki / _hdl_build / nx_connect_msgx.nx
nx_connect_msgx.nx
buildroot/runtime/_hdl_build/nx_connect_msgx.nx
about
nx_connect_msgx.nx -- FUNCTIONALITY rung: message BREADTH. Extends the messaging core with the
everyday chat features: reactions (toggle), reply/threads, forward (with provenance), @mentions,
pinned (admin-gated), full-text search, and disappearing (TTL) messages.
Honest design note: full-text search is CLIENT-SIDE here BECAUSE the store is content-blind --
the server holds ciphertext and cannot search plaintext (that is the privacy tradeoff vs WeChat /
Telegram-cloud, which search server-side because they read everything). The gate proves the client
(with the key) finds matches while the server finds ZERO. 7 checks incl. negative controls.
100% sovereign. license_tier: ORIGINAL expect_exit: 0
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 11 | const M_MAGIC_9001: i64 = 9001 |
| 12 | const M_MAGIC_9002: i64 = 9002 |
| 13 | const M_MAGIC_9003: i64 = 9003 |
| 14 | const M_MAGIC_9005: i64 = 9005 |
| 16 | const M_STRIDE: i64 = 8 |
| 17 | const F_ID: i64 = 0 |
| 18 | const F_SENDER: i64 = 1 |
| 19 | const F_CIPHER: i64 = 2 |
| 20 | const F_REPLY: i64 = 3 |
| 21 | const F_FWD: i64 = 4 |
| 22 | const F_MENT: i64 = 5 // mention bitmask (uid i -> bit i) |
| 23 | const F_EXP: i64 = 6 // expiry time (0 = no TTL) |
| 24 | const F_DEL: i64 = 7 |
| 25 | const ROLE_MEMBER: i64 = 1 |
| 26 | const ROLE_ADMIN: i64 = 2 |
| 27 | const EMOJI_HEART: i64 = 1 |
functions
| 29 | func sw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 30 | func sn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 } |
| 32 | func bit_set(mask: i64, pos: i64) -> i64 { var m: i64=mask; var i: i64=0; while i<pos { m=m/2; i=i+1 } return m - (m/2)*2 } called by 1: main |
| 35 | func react_toggle(rs: *i64, rc: *i64, msg: i64, user: i64, emoji: i64) -> i64 called by 1: main |
| 49 | func react_count(rs: *i64, rc: i64, msg: i64, emoji: i64) -> i64 called by 1: main |
| 54 | func thread_count(M: *i64, n: i64, root: i64) -> i64 called by 1: main |
| 59 | func pin_add(pset: *i64, pc: *i64, role: i64, msg: i64) -> i64 called by 1: main |
| 63 | func is_pinned(pset: *i64, pc: i64, msg: i64) -> i64 called by 1: main |
| 66 | func client_search(M: *i64, n: i64, key: i64, term: i64) -> i64 { // client has the key -> can match called by 1: main |
| 71 | func server_search(M: *i64, n: i64, term: i64) -> i64 { // server has only ciphertext called by 1: main |
| 76 | func visible(expiry: i64, now: i64) -> i64 { // disappearing TTL called by 1: main |
| 82 | func tcheck(pass: i64, label: *u8, fails: *i64) -> i64 |
| 88 | func main() -> i64 |