Differences From
Artifact [ea921b8ffe]:
8 8 render_nym(who: &lib.store.actor, scope: uint64, tgt: &lib.str.acc, minimal: bool)
9 9 var acc: lib.str.acc
10 10 var n: &lib.str.acc
11 11 if tgt ~= nil then n = tgt else
12 12 n = &acc
13 13 n:init(128)
14 14 end
15 - var xidsan = lib.html.sanitize(cs(who.xid),false)
15 +
16 + var pool_obj: lib.mem.pool
17 + var pool: &lib.mem.pool
18 + if tgt ~= nil and tgt.pool ~= nil then
19 + pool = tgt.pool
20 + else
21 + pool_obj:init(128)
22 + pool = &pool_obj
23 + end
24 +
25 + var xidsan = lib.html.sanitize(pool,cs(who.xid),false)
16 26 if who.nym ~= nil and who.nym[0] ~= 0 then
17 - var nymsan = lib.html.sanitize(cs(who.nym),false)
27 + var nymsan = lib.html.sanitize(pool,cs(who.nym),false)
18 28 n:lpush('<span class="nym">'):ppush(nymsan)
19 29 :lpush('</span> [<span class="handle">'):ppush(xidsan)
20 30 :lpush('</span>]')
21 - nymsan:free()
31 + --nymsan:free()
22 32 else n:lpush('<span class="handle">'):ppush(xidsan):lpush('</span>') end
23 - xidsan:free()
33 + --xidsan:free()
24 34
25 35 if not minimal then
26 36 if who.epithet ~= nil then
27 - var episan = lib.html.sanitize(cs(who.epithet),false)
37 + var episan = lib.html.sanitize(pool,cs(who.epithet),false)
28 38 n:lpush('<span class="epithet">'):ppush(episan):lpush('</span>')
29 - episan:free()
39 + --episan:free()
30 40 end
31 41 end
32 42
43 + if pool == &pool_obj then pool:free() end
33 44 -- TODO: if scope == chat room then lookup titles in room member db
34 45 if tgt == nil then
35 46 return n:finalize()
36 47 else return pstr.null() end
37 48 end
38 49
39 50 return render_nym