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