code wiki / _hdl_build / nx_connect_msgx.nx

nx_connect_msgx.nx

buildroot/runtime/_hdl_build/nx_connect_msgx.nx

8008 B151 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic connect
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_connect_msgx.nx

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

main sys_mmap sw sys_write react_toggle react_count tcheck sw ↻ thread_count bit_set pin_add is_pinned client_search server_search visible sn sys_mmap ↻ sys_write ↻ sys_exit

structs

none

consts

11const M_MAGIC_9001: i64 = 9001
12const M_MAGIC_9002: i64 = 9002
13const M_MAGIC_9003: i64 = 9003
14const M_MAGIC_9005: i64 = 9005
16const M_STRIDE: i64 = 8
17const F_ID: i64 = 0
18const F_SENDER: i64 = 1
19const F_CIPHER: i64 = 2
20const F_REPLY: i64 = 3
21const F_FWD: i64 = 4
22const F_MENT: i64 = 5 // mention bitmask (uid i -> bit i)
23const F_EXP: i64 = 6 // expiry time (0 = no TTL)
24const F_DEL: i64 = 7
25const ROLE_MEMBER: i64 = 1
26const ROLE_ADMIN: i64 = 2
27const EMOJI_HEART: i64 = 1

functions

29func sw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 2: tcheckmain calls 1: sys_write
30func 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 }
called by 1: main calls 2: sys_mmapsys_write
32func 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
35func react_toggle(rs: *i64, rc: *i64, msg: i64, user: i64, emoji: i64) -> i64
called by 1: main
49func react_count(rs: *i64, rc: i64, msg: i64, emoji: i64) -> i64
called by 1: main
54func thread_count(M: *i64, n: i64, root: i64) -> i64
called by 1: main
59func pin_add(pset: *i64, pc: *i64, role: i64, msg: i64) -> i64
called by 1: main
63func is_pinned(pset: *i64, pc: i64, msg: i64) -> i64
called by 1: main
76func visible(expiry: i64, now: i64) -> i64 { // disappearing TTL
called by 1: main
82func tcheck(pass: i64, label: *u8, fails: *i64) -> i64
called by 1: main calls 1: sw
88func main() -> i64