|
|
 |
 |
 |
mainResponder.subscriptions.server
Ensure that the number of changes sent to a subscriber is logged, it is useful information when debugging a problem with root updates.
| on server (dbname, ipaddress, lastupdate, username, mailaddress, serialnumber) |
| |
«Return new and changed parts of a database since the last update. |
| |
local (adrtable = log.addToGuestDatabase ("subscriptions")) |
| |
bundle //add a record to the subscription log |
| |
local (adrdb = @user.databases.[dbname]) |
| |
adrtable^.error = "The sysop hasn't registered a database named \"" + dbname + "\"." //02/04/07, 08:22:52 by DAB |
| |
scriptError ("Can't send you an update because the sysop hasn't registered a database named \"" + dbname + "\".") |
| |
if not (adrdb^.supportsSubscribe) |
| |
adrtable^.error = "The database \"" + dbname + "\" doesn't support subscriptions." //02/04/07, 08:22:48 by DAB |
| |
scriptError ("Can't send you an update because the database \"" + dbname + "\" doesn't support subscriptions.") |
| |
local (checkpointDate = date.tomorrow (clock.now ())) //tomorrow is always later than the last item in the #changes table |
| |
bundle //set checkpointDate based on per-database and server-wide settings, and on whether the client sent flIgnoreCheckpoint search arg |
| |
local (adrguestdatabase = @[adrdb^.f]) |
| |
table.sureDatabaseOpen (adrguestdatabase) |
| |
lastupdate = date (lastupdate) //convert from a net-standard-string |
| |
local (frontierVersion = Frontier.version ()) |
| |
local (adrchanges = @adrguestdatabase^.["#changes"]) |
| |
local (sizechanges = sizeof (adrchanges^)) |
| |
bundle //possibly upgrade to new version of #changes, which includes the actual parts |
| |
parts.serialNum = sizechanges //it's synthetic! |
| |
parts.lastUpdateTime = date.netStandardString (clock.now ()) //PBS 11/4/00: save server time on client, to avoid missing updates |
| |
new (tabletype, @parts.parts) |
| |
local (i, addeditems = {}, flLastUpdateTimeSet = false) |
| |
for i = sizechanges downto 1 |
| |
local (adritem = @adrchanges^ [i]) |
| |
if adritem^.when > checkpointDate //skip changes newer than the checkpoint date |
| |
if adritem^.when < lastupdate |
| |
if addeditems contains adritem^.what //we've already included this |
| |
local (name = "part" + string.padwithzeros (i, 4)) |
| |
local (adrnewpart = @parts.parts.[name]) |
| |
new (tabletype, adrnewpart) |
| |
bundle //2/14/99; 9:01:26 AM by DW, customized error if object doesn't exist |
| |
if defined (adritem^.data) |
| |
else //old style, get the object from its real location, instead of from the #changes table sub-item |
| |
if not defined (adritem^.what^) |
| |
«bundle //old code throws an error -- error is wired off. this is a very common error, and always a pain to fix on the server |
| |
«adrtable^.error = "The #changes table in \"" + dbname + "\" on the server says that \"" + adritem^.what + "\" has changed, but the object isn't in the database." //02/04/07, 08:22:41 by DAB |
| |
«scriptError ("Can't do the update because the #changes table in \"" + dbname + "\" on the server says that \"" + adritem^.what + "\" has changed, but the object isn't in the database.") |
| |
adrnewpart^.data = adritem^.what^ |
| |
adrnewpart^.timestamp = adritem^.when |
| |
if not flLastUpdateTimeSet |
| |
adrnewpart^.userName = adritem^.who |
| |
«bundle //old code: put the relative address into adr field |
| |
adrnewpart^.adr =adritem^.what //new code: put the address (as string) into adr field |
| |
wp.newtextobject ("", @adrnewpart^.changes) |
| |
adrnewpart^.platform = "both" |
| |
adrnewpart^.version = frontierVersion |
| |
pack (adrnewpart^, @bytes) |
| |
bytes = base64.encode (bytes, infinity) |
| |
addeditems = addeditems + {adritem^.what} |
| |
adrtable^.ctPartsSent = sizeof (addedItems) //02/04/07, 08:22:36 by DAB |
| |
«server ("prefs.root", tcp.dns.getMyDottedId (), clock.now (), "Jake", "jake@userland.com", 10) |
Relative to Frontier version 9.7b10
|