parsav  Diff

Differences From Artifact [1e81acf0af]:

To Artifact [75a5e28d82]:


1
2
3
4
5
6
7
8
9
10
..
33
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
..
71
72
73
74
75
76
77
78
79
80
81
82
83
84
-- vim: ft=terra
local pstr = lib.mem.ptr(int8)
local P = lib.str.plit
local terra cs(s: rawstring)
	return pstr { ptr = s, ct = lib.str.sz(s) }
end

local terra 
render_notices(
	co: &lib.srv.convo
................................................................................
			avatar = cs(who(0).avatar);
			nym = lib.render.nym(who.ptr,0,nil,true);
			pflink = pstr{ptr = pflink.buf; ct = pflink.sz};
		}
		var notweet, nopost = true, false
		switch notes(i).kind do
			case lib.store.noticetype.rt then
				n.kind = P'rt'
				n.act = P'retweeted your post'
			end
			case lib.store.noticetype.like then
				n.kind = P'like'
				n.act = P'likes your post'
			end
			case lib.store.noticetype.reply then
				n.kind = P'reply'
				n.act = P'replied to your post'
				notweet = false
			end
			case lib.store.noticetype.follow then
				n.kind = P'follow'
				n.act = P'followed you!'
				nopost = true
			end
		else goto skip end
		if not nopost then
			var what = co.srv:post_fetch(notes(i).what) defer what:free()
			var b = lib.smackdown.html(&co.srv.pool, pstr {ptr=what(0).body,ct=0},true) --defer b:free()
			body:lpush(' <a class="quote" href="/post/'):shpush(notes(i).what):lpush('">'):ppush(b):lpush('</a>')
................................................................................
		::skip:: n.nym:free()
		         pflink:reset()
				 body:reset()
	end
	--pflink:free()
	pg:lpush('<form method="post"><button name="act" value="clear">clear all notices</button></form>')
	co:livepage([lib.srv.convo.page] {
		title = P'notices', class = P'notices';
		body = pstr {ptr = pg.buf, ct = pg.sz};
		cache = false;
	}, latest)
end

return render_notices


<







 







|
|


|
|


|
|



|
|







 







|






1
2

3
4
5
6
7
8
9
..
32
33
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
..
70
71
72
73
74
75
76
77
78
79
80
81
82
83
-- vim: ft=terra
local pstr = lib.mem.ptr(int8)

local terra cs(s: rawstring)
	return pstr { ptr = s, ct = lib.str.sz(s) }
end

local terra 
render_notices(
	co: &lib.srv.convo
................................................................................
			avatar = cs(who(0).avatar);
			nym = lib.render.nym(who.ptr,0,nil,true);
			pflink = pstr{ptr = pflink.buf; ct = pflink.sz};
		}
		var notweet, nopost = true, false
		switch notes(i).kind do
			case lib.store.noticetype.rt then
				n.kind = 'rt'
				n.act = 'retweeted your post'
			end
			case lib.store.noticetype.like then
				n.kind = 'like'
				n.act = 'likes your post'
			end
			case lib.store.noticetype.reply then
				n.kind = 'reply'
				n.act = 'replied to your post'
				notweet = false
			end
			case lib.store.noticetype.follow then
				n.kind = 'follow'
				n.act = 'followed you!'
				nopost = true
			end
		else goto skip end
		if not nopost then
			var what = co.srv:post_fetch(notes(i).what) defer what:free()
			var b = lib.smackdown.html(&co.srv.pool, pstr {ptr=what(0).body,ct=0},true) --defer b:free()
			body:lpush(' <a class="quote" href="/post/'):shpush(notes(i).what):lpush('">'):ppush(b):lpush('</a>')
................................................................................
		::skip:: n.nym:free()
		         pflink:reset()
				 body:reset()
	end
	--pflink:free()
	pg:lpush('<form method="post"><button name="act" value="clear">clear all notices</button></form>')
	co:livepage([lib.srv.convo.page] {
		title = 'notices', class = 'notices';
		body = pstr {ptr = pg.buf, ct = pg.sz};
		cache = false;
	}, latest)
end

return render_notices