-- vim: ft=terra
local pstr = lib.mem.ptr(int8)
local pref = lib.mem.ref(int8)

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

local terra 
render_conf_profile(co: &lib.srv.convo, path: lib.mem.ptr(pref)): pstr
	var hue: int8[21]
	var c = data.view.conf_profile {
		handle = cs(co.who.handle);
		nym = cs(lib.coalesce(co.who.nym,''));
		bio = cs(lib.coalesce(co.who.bio,''));
		hue = lib.math.decstr(co.ui_hue, &hue[20]);
		acl_follow = co:usercfg_str(co.who.id, 'acl-follow');
		acl_follow_req = co:usercfg_str(co.who.id, 'acl-follow-req');
	}
	return c:poolstr(&co.srv.pool)
end

return render_conf_profile
