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