space Baylys
Just practicing to pass the Turing test.
space
space
space
space
Developer for Hire!
space
addedValues Plugin
space

Home

What's new

Bayly.Root

Cornershop Plugin

Career

edutools Root

Enhancements

Interests

linguist Plugin

Manila

Patches

space

mainresponder

space
space

adminSite

calendar

controlpanel

discuss

getFileMimeType

members

parseMultipart

respond

subscriptions

space
space

server

space

manilaData

manilamacros

manilaSuite

system

Patches by Group

Papers

Sales

Sign My Guestbook

User(land) Relations.

Contact Address

Search Baylys

urlchains

space
Join Now
Login
space space space

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.
  «Changes:
 unaltered lines omitted
  local (adrtable = log.addToGuestDatabase ("subscriptions"))
  bundle //add a record to the subscription log
  bundle //call callbacks
  local (adrdb = @user.databases.[dbname])
  if not defined (adrdb^)
  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
 
  local (parts)
  new (tabletype, @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
  if sizechanges > 0
 unaltered lines omitted
  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
 unaltered lines omitted
  if adritem^.when < lastupdate
 unaltered lines omitted
  if addeditems contains adritem^.what //we've already included this
 unaltered lines omitted
 
  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)
 unaltered lines omitted
  else //old style, get the object from its real location, instead of from the #changes table sub-item
  if not defined (adritem^.what^)
  delete (adrnewpart)
  continue
  «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
 unaltered lines omitted
  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
 
  local (bytes)
  pack (adrnewpart^, @bytes)
  bytes = base64.encode (bytes, infinity)
  delete (adrnewpart)
  adrnewpart^ = bytes
 
  addeditems = addeditems + {adritem^.what}
 
  sys.systemTask ()
 
  adrtable^.ctPartsSent = sizeof (addedItems) //02/04/07, 08:22:36 by DAB
 
  return (parts)
«bundle //test code
  «server ("prefs.root", tcp.dns.getMyDottedId (), clock.now (), "Jake", "jake@userland.com", 10)

Relative to Frontier version 9.7b10