Differences From
Artifact [cb3e1743a5]:
119 119
120 120 actor_enum_local = {
121 121 params = {}, sql = [[
122 122 select id, nym, handle, origin, bio,
123 123 null::text, rank, quota, key, epithet,
124 124 knownsince::bigint,
125 125 '@' || handle,
126 - invites
126 + invites, avatarid
127 127 from parsav_actors where origin is null
128 128 order by nullif(rank,0) nulls last, handle
129 129 ]];
130 130 };
131 131
132 132 actor_enum = {
133 133 params = {}, sql = [[
................................................................................
502 502 };
503 503 artifact_disclaim = {
504 504 params = {uint64, uint64}, cmd = true, sql = [[
505 505 delete from parsav_artifact_claims where
506 506 uid = $1::bigint and
507 507 rid = $2::bigint
508 508 ]];
509 + };
510 + artifact_collect_garbage = {
511 + params = {}, cmd = true, sql = [[
512 + delete from parsav_artifacts where
513 + id not in (select rid from parsav_artifact_claims) and
514 + content is not null -- avoid stepping on toes of ban mech
515 + ]];
509 516 };
510 517 artifact_excise_forget = {
511 518 -- delete the blasted thing and pretend it never existed
512 519 params = {uint64}, cmd=true, sql = [[
513 520 delete from parsav_artifacts where id = $1::bigint
514 521 ]];
515 522 };
................................................................................
946 953 }) ]
947 954 a.ptr.id = r:int(uint64, row, 0);
948 955 a.ptr.rights = lib.store.rights_default();
949 956 a.ptr.rights.rank = r:int(uint16, row, 6);
950 957 a.ptr.rights.quota = r:int(uint32, row, 7);
951 958 a.ptr.rights.invites = r:int(uint32, row, 12);
952 959 a.ptr.knownsince = r:int(int64,row, 10);
960 + a.ptr.avatarid = r:int(uint64,row, 13);
953 961 if r:null(row,8) then
954 962 a.ptr.key.ct = 0 a.ptr.key.ptr = nil
955 963 else
956 964 a.ptr.key = r:bin(row,8)
957 965 end
958 966 a.ptr.origin = origin
959 967 if avia.buf ~= nil then avia:free() end
................................................................................
1500 1508 var r = queries.auth_enum_uid.exec(src,uid)
1501 1509 if r.sz == 0 then return [lib.mem.ptr(lib.mem.ptr(lib.store.auth))].null() end
1502 1510 var ret = lib.mem.heapa([lib.mem.ptr(lib.store.auth)], r.sz)
1503 1511 for i=0, r.sz do
1504 1512 var kind = r:_string(i, 1)
1505 1513 var comment = r:_string(i, 2)
1506 1514 var a = [ lib.str.encapsulate(lib.store.auth, {
1507 - kind = {`kind.ptr, `kind.ct};
1508 - comment = {`comment.ptr, `comment.ct};
1515 + kind = {`kind.ptr, `kind.ct+1};
1516 + comment = {`comment.ptr, `comment.ct+1};
1509 1517 }) ]
1510 1518 a.ptr.aid = r:int(uint64, i, 0)
1511 - a.ptr.netmask = r:cidr(i, 3)
1519 + if r:null(i,3)
1520 + then a.ptr.netmask.pv = 0
1521 + else a.ptr.netmask = r:cidr(i, 3)
1522 + end
1512 1523 a.ptr.blacklist = r:bool(i, 4)
1513 1524 ret.ptr[i] = a
1514 1525 end
1515 1526 return ret
1516 1527 end];
1517 1528
1518 1529 auth_attach_pw = [terra(
................................................................................
1595 1606 uid: uint64,
1596 1607 artifact: uint64,
1597 1608 desc: pstring,
1598 1609 folder: pstring
1599 1610 ): {}
1600 1611 queries.artifact_expropriate.exec(src,uid,artifact,desc,folder, lib.osclock.time(nil))
1601 1612 end];
1613 +
1614 + artifact_disclaim = [terra(
1615 + src: &lib.store.source,
1616 + uid: uint64,
1617 + artifact: uint64
1618 + )
1619 + queries.artifact_disclaim.exec(src,uid,artifact)
1620 + queries.artifact_collect_garbage.exec(src) -- TODO add a config option to change GC strategies, instead of just always running a cycle after an artifact is disclaimed, which is not very efficient
1621 + end];
1602 1622
1603 1623 artifact_enum_uid = [terra(
1604 1624 src: &lib.store.source,
1605 1625 uid: uint64,
1606 1626 folder: pstring
1607 1627 )
1608 1628 var res = queries.artifact_enum_uid.exec(src,uid,folder)