parsav  Diff

Differences From Artifact [900216dd8b]:

To Artifact [5c434424ea]:


34
35
36
37
38
39
40

41
42
43
44
45
46







47
48
49
50

51
52

53
54
55
56
57
58
59






60
61
62
63
64
65
66
67
68
69
70



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86







87
88
89
90
91
92
93
		sz = 0, run = 0
	}
	var fetchmode = lib.store.range {
		mode = 1; -- T->I
		from_time = stoptime;
		to_idx = 64;
	}

	if mode == modes.follow or mode == modes.mutual then
		posts = co.srv:timeline_actor_fetch_uid(co.who.id,fetchmode)
	elseif mode == [modes['local']] then
		posts = co.srv:timeline_instance_fetch(fetchmode)
	elseif mode == modes.fedi then
	elseif mode == modes.circle then







	end

	var acc = co:stra(1024)
	var modelabels = arrayof(pstr, 'followed', 'mutuals', 'local instance', 'fediverse', 'circle')

	var modelinks = arrayof(pstr, [modes.members])
	acc:lpush('<div style="text-align: right"><em>showing ')

	for i=0, [modelabels.type.N] do
		if co.aid ~= 0 or not requires_login(i) then
			if i > 0 then acc:lpush(' · ') end
			if i == mode and not (mode == modes.circle and spec:ref()) then
				acc:lpush('<strong>'):ppush(modelabels[i]):lpush('</strong>')
			else
				acc:lpush('<a href="/tl/'):ppush(modelinks[i]):lpush('">'):ppush(modelabels[i]):lpush('</a>')






			end
		end
	end
	acc:lpush('</em></div>')
	var newest: lib.store.timepoint = 0
	if mode == modes.circle and not spec then
		var circles = co.srv:circle_search(&co.srv.pool, co.who.id, 0)
		acc:lpush '<menu class="circles">'
		for i:intptr = 0, circles.ct do
			acc:lpush '<li><a href="/tl/circle/'
			   :shpush(circles(i).cid)



			   :lpush '">'
			   :ppush(circles(i).name)
			   :lpush '</a></li>'
		end
		-- TODO list circles
		acc:lpush '</menu>'
	else
		acc:lpush('<div id="tl" data-live="10">')
		for i = 0, posts.sz do
			var author = co:uid2actor(posts(i).ptr.author)
			if mode == modes.mutual and posts(i).ptr.author ~= co.who.id then
				if not author.relationship.recip.follow() then goto skip end
			end
			if author.relationship.rel.mute() or 
			   author.relationship.rel.avoid() or 
			   author.relationship.recip.exclude() then goto skip end







			lib.render.tweet(co, posts(i).ptr, &acc)
			var t = lib.math.biggest(lib.math.biggest(posts(i).ptr.posted, posts(i).ptr.discovered),posts(i).ptr.edited)
			if t > newest then newest = t end
			::skip:: posts(i):free()
		end
		if posts.run > 0 then posts:free() end
		acc:lpush('</div>')







>





|
>
>
>
>
>
>
>



|
>

<
>



|


|
>
>
>
>
>
>



|





|

>
>
>
|

|













>
>
>
>
>
>
>







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
		sz = 0, run = 0
	}
	var fetchmode = lib.store.range {
		mode = 1; -- T->I
		from_time = stoptime;
		to_idx = 64;
	}
	var circ: lib.mem.ptr(lib.store.circle) = nil
	if mode == modes.follow or mode == modes.mutual then
		posts = co.srv:timeline_actor_fetch_uid(co.who.id,fetchmode)
	elseif mode == [modes['local']] then
		posts = co.srv:timeline_instance_fetch(fetchmode)
	elseif mode == modes.fedi then
	elseif mode == modes.circle and spec:ref() then
		var cid, ok = lib.math.shorthand.parse(spec.ptr,spec.ct)
		if ok then
			circ = co.srv:circle_search(&co.srv.pool,co.who.id,cid)
			if circ.ct == 1 then
				posts = co.srv:timeline_circle_fetch(cid,fetchmode)
			end
		end
	end

	var acc = co:stra(1024)
	var modelabels = arrayof(pstr, '<u>f</u>ollowed', 'm<u>u</u>tuals', '<u>l</u>ocal instance', 'fedi<u>v</u>erse', 'ci<u>r</u>cle')
	var keybinds = arrayof(pstr, 'f', 'u', 'l', 'v', 'r')
	var modelinks = arrayof(pstr, [modes.members])

	acc:lpush('<div class="kind-picker">showing ')
	for i=0, [modelabels.type.N] do
		if co.aid ~= 0 or not requires_login(i) then
			if i > 0 then acc:lpush(' · ') end
			if i == mode and not circ then
				acc:lpush('<strong>'):ppush(modelabels[i]):lpush('</strong>')
			else
				acc:lpush('<a href="/tl/'):ppush(modelinks[i]):lpush('" accesskey="'):ppush(keybinds[i]):lpush('">')
				if i == mode and circ:ref() then
					acc:lpush'<strong>':ppush(modelabels[i]):lpush'</strong> (':ppush(circ().name):lpush(')')
				else
					acc:ppush(modelabels[i])
				end
				acc:lpush('</a>')
			end
		end
	end
	acc:lpush('</div>')
	var newest: lib.store.timepoint = 0
	if mode == modes.circle and not spec then
		var circles = co.srv:circle_search(&co.srv.pool, co.who.id, 0)
		acc:lpush '<menu class="circles">'
		for i:intptr = 0, circles.ct do
			acc:lpush '<a href="/tl/circle/'
			   :shpush(circles(i).cid)
			if i <= 10 then
				acc:lpush '" accesskey="':ipush((i+1) % 10)
			end
			acc:lpush '">'
			   :ppush(circles(i).name)
			   :lpush '</a>'
		end
		-- TODO list circles
		acc:lpush '</menu>'
	else
		acc:lpush('<div id="tl" data-live="10">')
		for i = 0, posts.sz do
			var author = co:uid2actor(posts(i).ptr.author)
			if mode == modes.mutual and posts(i).ptr.author ~= co.who.id then
				if not author.relationship.recip.follow() then goto skip end
			end
			if author.relationship.rel.mute() or 
			   author.relationship.rel.avoid() or 
			   author.relationship.recip.exclude() then goto skip end
			if posts(i).ptr.rtdby ~= 0 then
				var rter = co:uid2actor(posts(i).ptr.rtdby)
				if rter.relationship.rel.mute()
				or rter.relationship.rel.attenuate()
				or rter.relationship.rel.avoid()
				or rter.relationship.recip.exclude() then goto skip end
			end
			lib.render.tweet(co, posts(i).ptr, &acc)
			var t = lib.math.biggest(lib.math.biggest(posts(i).ptr.posted, posts(i).ptr.discovered),posts(i).ptr.edited)
			if t > newest then newest = t end
			::skip:: posts(i):free()
		end
		if posts.run > 0 then posts:free() end
		acc:lpush('</div>')