parsav  Diff

Differences From Artifact [71eb9101d9]:

To Artifact [00c7b6fd89]:


4
5
6
7
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
	return pstr { ptr = s, ct = lib.str.sz(s) }
end

local terra 
render_tweet(co: &lib.srv.convo, p: &lib.store.post, acc: &lib.str.acc)
	var author: &lib.store.actor
	for j = 0, co.actorcache.top do
		lib.io.fmt('scanning cache for author %llu (%llu/%llu)\n', p.author, j, co.actorcache.top)
		if p.author == co.actorcache(j).ptr.id then
			author = co.actorcache(j).ptr
			lib.io.fmt('cache hit on idx %llu, skipping db lookup\n', j) 
			goto foundauth
		end
	end
	lib.io.fmt('cache miss, checking db for id %llu\n', p.author) 
	author = co.actorcache:insert(co.srv:actor_fetch_uid(p.author)).ptr
	lib.io.fmt('got author %s\n', author.handle) 

	::foundauth::
	var avistr: lib.str.acc if author.origin == 0 then
		avistr:compose('/avi/',author.handle)
	end
	var timestr: int8[26] lib.osclock.ctime_r(&p.posted, &timestr[0])
	lib.io.fmt('got body %s\n', author.handle) 

	var bhtml = lib.smackdown.html([lib.mem.ptr(int8)] {ptr=p.body,ct=0}) defer bhtml:free()

	var idbuf: int8[lib.math.shorthand.maxlen]
	var idlen = lib.math.shorthand.gen(p.id, idbuf)
	var permalink: lib.str.acc permalink:compose('/post/',{idbuf,idlen})








<


<



<

<






<







4
5
6
7
8
9
10

11
12

13
14
15

16

17
18
19
20
21
22

23
24
25
26
27
28
29
	return pstr { ptr = s, ct = lib.str.sz(s) }
end

local terra 
render_tweet(co: &lib.srv.convo, p: &lib.store.post, acc: &lib.str.acc)
	var author: &lib.store.actor
	for j = 0, co.actorcache.top do

		if p.author == co.actorcache(j).ptr.id then
			author = co.actorcache(j).ptr

			goto foundauth
		end
	end

	author = co.actorcache:insert(co.srv:actor_fetch_uid(p.author)).ptr


	::foundauth::
	var avistr: lib.str.acc if author.origin == 0 then
		avistr:compose('/avi/',author.handle)
	end
	var timestr: int8[26] lib.osclock.ctime_r(&p.posted, &timestr[0])


	var bhtml = lib.smackdown.html([lib.mem.ptr(int8)] {ptr=p.body,ct=0}) defer bhtml:free()

	var idbuf: int8[lib.math.shorthand.maxlen]
	var idlen = lib.math.shorthand.gen(p.id, idbuf)
	var permalink: lib.str.acc permalink:compose('/post/',{idbuf,idlen})