Differences From
Artifact [6a947d38ca]:
15 15 overlord: &srv
16 16 ui_cue_staff: pstring
17 17 ui_cue_founder: pstring
18 18 ui_hue: uint16
19 19 nranks: uint16
20 20 maxinvites: uint16
21 21 master: uint64
22 +
23 + usrdef_pol_follow: pstring
24 + usrdef_pol_follow_req: pstring
22 25 }
23 26 local struct srv {
24 27 sources: lib.mem.ptr(lib.store.source)
25 28 webmgr: lib.net.mg_mgr
26 29 webcon: &lib.net.mg_connection
27 30 cfg: cfgcache
28 31 id: rawstring
................................................................................
30 33 }
31 34
32 35 terra cfgcache:free() -- :/
33 36 self.secret:free()
34 37 self.instance:free()
35 38 self.ui_cue_staff:free()
36 39 self.ui_cue_founder:free()
40 + self.usrdef_pol_follow:free()
41 + self.usrdef_pol_follow_req:free()
37 42 end
38 43
39 44 terra srv:post_enum_author_uid(uid: uint64, r: lib.store.range): lib.mem.vec(lib.mem.ptr(lib.store.post))
40 45 var all: lib.mem.vec(lib.mem.ptr(lib.store.post)) all:init(64)
41 46 for i=0,self.sources.ct do var src = self.sources.ptr + i
42 47 if src.handle ~= nil and src.backend.timeline_instance_fetch ~= nil then
43 48 var lst = src:post_enum_author_uid(uid,r)
................................................................................
66 71 end
67 72 return all
68 73 end
69 74 end
70 75
71 76 deftlfetch('instance_fetch')
72 77 deftlfetch('actor_fetch_uid', uint64)
78 +deftlfetch('circle_fetch', uint64)
73 79
74 80 srv.metamethods.__methodmissing = macro(function(meth, self, ...)
75 81 local primary, ptr, stat, simple, oid = 0,1,2,3,4
76 82 local tk, rt = primary
77 83 local expr = {...}
78 84 for _,f in pairs(lib.store.backend.entries) do
79 85 local fn = f.field or f[1]
................................................................................
163 169
164 170 struct convo.page {
165 171 title: pstring
166 172 body: pstring
167 173 class: pstring
168 174 cache: bool
169 175 }
176 +
177 +local usrdefs = {
178 + str = {
179 + ['acl-follow' ] = {cfgfld = 'usrdef_pol_follow', fallback = 'local'};
180 + ['acl-follow-req'] = {cfgfld = 'usrdef_pol_follow_req', fallback = 'all'};
181 + };
182 +}
183 +
184 +terra convo:usercfg_str(uid: uint64, setting: pstring): pstring
185 + var set = self.srv:actor_conf_str_get(&self.srv.pool, uid, setting)
186 + if not set then
187 + [(function()
188 + local q = quote return pstring.null() end
189 + for key, dfl in pairs(usrdefs.str) do
190 + local rv
191 + if dfl.cfgfld then
192 + rv = quote
193 + var cf = self.srv.cfg.[dfl.cfgfld]
194 + in terralib.select(not cf, pstring([dfl.fallback]), cf) end
195 + elseif dfl.lit then rv = dfl.lit end
196 + q = quote
197 + if setting:cmp([key]) then return [rv] else [q] end
198 + end
199 + end
200 + return q
201 + end)()]
202 + else return set end
203 +end
170 204
171 205 -- this is unfortunately necessary to work around a terra bug
172 206 -- it can't seem to handle forward-declarations of structs in C
173 207
174 208 local getpeer
175 209 do local struct strucheader {
176 210 next: &lib.net.mg_connection
................................................................................
1078 1112 self.master = wma(0).id
1079 1113 wma:free()
1080 1114 end
1081 1115 end
1082 1116
1083 1117 self.ui_cue_staff = self.overlord:conf_get('ui-profile-cue-staff')
1084 1118 self.ui_cue_founder = self.overlord:conf_get('ui-profile-cue-master')
1119 +
1120 + self.usrdef_pol_follow = self.overlord:conf_get('user-default-acl-follow')
1121 + self.usrdef_pol_follow_req = self.overlord:conf_get('user-default-acl-follow-req')
1085 1122 end
1086 1123
1087 1124 return {
1088 1125 overlord = srv;
1089 1126 convo = convo;
1090 1127 route = route;
1091 1128 secmode = secmode;
1092 1129 }