|
From: creedon <icr...@us...> - 2005-06-13 19:59:15
|
Update of /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/builtins/rootUpdates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31855 Modified Files: update Log Message: disabled trial version and serial number checks Index: update =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/builtins/rootUpdates/update,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** update 26 Mar 2005 19:43:27 -0000 1.1.1.1 --- update 13 Jun 2005 19:59:03 -0000 1.2 *************** *** 1,3 **** FrontierVcsFile:1:scpt:system.verbs.builtins.rootUpdates.update ! on update (adrInRoot = table.getcursoraddress (), flQuietMode=false, adrCtNewParts=nil) { ÇChange Notes Ç1/12/04; 12:48:36 AM by JES ÇChanged default updates server from madrid.userland.com to updates.userland.com. Ç8/28/02; 10:48:23 PM by JES ÇAdded support for two new callbacks: Çuser.rootUpdates.callbacks.beforeInstallPart -- scripts in this table are called with two parameters: the address of the part, and the change note. If any script returns false, then the part is not installed. No error is generated -- it's up to the callback script to provide feedback to the user. Çuser.rootUpdates.callbacks.afterInstallPart -- scripts in this table are called with two parameters: the address of the part, and the change note. The return value is ignored. Ç4/16/02; 4:34:53 PM by JES ÇBug fix: Store the new part count in adrCtNewParts^ even if no new parts were loaded. Ç1/21/02; 2:25:42 PM by JES ÇUse a string comparison to determine whether we're getting updates from radioupdates.userland.com, instead of a call to tcp.equalNames, since tcp.equalNames fails for some proxy server users. Ç1/7/02; 9:09:40 PM by PBS ÇIf getting Radio updates from radioupdates.userland.com, send your usernum as an additional parameter. Ç8/6/01; 2:22:37 PM by PBS ÇWhen updating Manila or mainResponder, send the serial number. Ç01/21/01; 6:03:11 PM by JES ÇAdded optional parameter, adrCtNewParts. If not nil, the number of updated parts is assigned to adrCtNewParts^. Ç08/20/00; 11:49:35 AM by PBS ÇIf the server returns a last update time, use that instead of clock.now (). This fixes problems with people missing updates due to having clocks out-of-synch with the server. This way, the server's time is always used. Ç06/17/00; 11:16:23 PM by PBS ÇUse new root updates timeout pref. ÇTuesday, November 16, 1999 at 1:43:53 AM by AR ÇMake sure backup folder exists before backing up GDBs. ÇAdded flQuietMode parameter, defaulting to false. If it's true, we suppress all server-unfriendly interaction like putting up dialogs or opening the outline of new parts, regardless of the settings in user.rootUpdates. Ç10/7/99; 6:43:29 PM by DW ÇNew pref, user.rootupdates.prefs.flShowUpdatesToUser, defaults true, initialized in rootUpdates.init. ÇNew pref, user.rootupdates.prefs.adrOutlineForUser, defaults to @user.rootUpdates.updateOutline. Çif flShowUpdatesToUser is true, we create the outline if it doesn't exist and add a top-level headline with the date and time and the name of the database being updated. Each subordinate entry is the address of an object that's been updated. Underneath the address is the explanation of the change, if available. bundle { //trial if defined (userland.trialVersionCheck) { if userland.trialVersionCheck () { scriptError ("Can't update the database because the trial period has expired.")}}}; rootUpdates.init (); local (adrroot = table.getrootaddress (adrInRoot)); local (alist = string.parseaddress (adrroot)); local (f = window.getFile (alist [1])); local (fname = file.filefrompath (f)); if not string.lower (fname) endswith ".root" { scripterror ("Can't update the file because its name doesn't end with .root.")}; local (channelname = string.mid (fname, 1, sizeof (fname) - 5)); local (adrtable = @user.rootUpdates.servers.[channelname]); if not defined (adrtable^) { new (tabletype, adrtable); adrtable^.server = "updates.userland.com"; //"madrid.userland.com" adrtable^.port = 80; adrtable^.method = "nirvanaServer.subscriptions.update"; adrtable^.dbname = fname; adrtable^.lastupdate = "Fri, 16 Oct 1998 12:00:00 GMT"; //indicate that it's never been updated adrtable^.autobackup = true; //if true the backup will be of docServer.root, not Frontier.root adrtable^.dialogs = true; //set this false if you're updating automatically thru the scheduler adrtable^.openLog = true; //show the log file of changes adrtable^.URL = ""} else { if string.lower (adrtable^.server) == "madrid.userland.com" { adrtable^.server = "updates.userland.com"}}; bundle { //the responder name on the server changed if adrtable^.method == "mainResponder.subscriptions.update" { adrtable^.method = "nirvanaServer.subscriptions.update"}}; on getUpdate (serverName, adrInRoot = nil) { //an enhanced version of rootupdates.getUpdate Ç10/18/98; 11:33:30 AM by DW ÇMade it guest database-aware. ÇIf adrInRoot is specified, it's assumed to point into the guest db that's getting updated ÇAdded a field to the prefs record, dbname, which names the guest database that's being shared ÇIt's an index into user.mainresponder.databases on the server. ÇThe handler for this is at mainresponder.rpchandlers.subscriptions.update. local (frontierVersion = Frontier.version ()); local (platform = string.mid (sys.os (), 1, 3)); local (ctnewparts = 0); local (flDialogs = true); local (flLogOutlineOpened = false, flNewLogOutline = false); local (adrPrefs = @user.rootUpdates.servers.[serverName]); local (flguestdb = false, addressprefixstring); //10/18/98 DW bundle { //gather info about guest database if adrInRoot != nil and string.lower (channelname) != "frontier" { addressprefixstring = string (table.getRootAddress (adrInRoot)); flguestdb = true}}; if defined (adrPrefs^.dialogs) and not adrPrefs^.dialogs { flDialogs = false}; if flQuietMode { //AR 11/15/1999 flDialogs = false}; if not defined (user.prefs.serialNumber) { user.prefs.serialNumber = ""}; try { //try to get the root update from the server if flDialogs { local (prompt = "Connect with " + adrPrefs^.server + " to get latest update"); if flguestdb { prompt = prompt + " of " + adrprefs^.dbname}; prompt = prompt + "?"; if not dialog.confirm (prompt) { return (false)}}; window.about (); local (sn); Çif adrPrefs == @user.rootUpdates.servers.Frontier ÇOnly send Frontier serial number when getting Frontier.root udpate. ÇThu, Mar 18, 1999 at 3:21:10 PM by PBS Çsn = user.prefs.serialNumber local (rpcPath = user.betty.prefs.rpcClientDefaultPath); case true { //PBS 08/06/01: send serial number for Frontier, Manila, and mainResponder adrPrefs == @user.rootUpdates.servers.Radio; adrPrefs == @user.rootUpdates.servers.radioCommunityServer; adrPrefs == @user.rootUpdates.servers.serverMonitor; adrPrefs == @user.rootUpdates.servers.Prefs; adrPrefs == @user.rootUpdates.servers.Frontier; adrPrefs == @user.rootUpdates.servers.Manila; adrPrefs == @user.rootUpdates.servers.mainResponder { sn = user.prefs.serialNumber; if string.lower (adrprefs^.server) endswith ".userland.com" { try { //add path args to rpcPath local (args); new (tableType, @args); args.org = user.prefs.organization; args.name = user.prefs.name; args.email = user.prefs.mailAddress; args.sn = user.prefs.serialNumber; if defined (config.mainResponder.domains) { args.domains = sizeOf (config.mainResponder.domains)} else { args.domains = 0}; if defined (config.manila.sites) { args.sites = sizeOf (config.manila.sites)} else { args.sites = 0}; if defined (radioCommunityServerData.users) { args.rcsUsers = sizeOf (radioCommunityServerData.users)} else { args.rcsUsers = 0}; rpcPath = rpcPath + "?" + webserver.encodeArgs (@args)}}}} else { if defined (adrPrefs^.serialNum) { sn = adrPrefs^.serialNum} else { sn = 0}}; local (paramlist = {adrPrefs^.lastupdate, platform, sn, user.prefs.name, user.prefs.mailAddress, frontierVersion}); bundle { //PBS 01/07/02: send usernum to radioupdates.userland.com Çif tcp.equalNames (adrPrefs^.server, "radioupdates.userland.com") Çparamlist = paramlist + user.radio.prefs.usernum if string.lower (adrPrefs^.server) == "radioupdates.userland.com" { paramlist = paramlist + user.radio.prefs.usernum}}; if flguestdb { paramlist = {adrprefs^.dbname} + {tcp.addressDecode (tcp.myAddress ())} + paramlist}; local (newpartstable); local (i); msg ("Connecting to " + adrPrefs^.server + " to get " + serverName + " update..."); newpartstable = betty.rpc.client (adrPrefs^.server, adrPrefs^.port, adrPrefs^.method, @paramlist, false, rpcPath:rpcPath, ticksToTimeOut:user.rootUpdates.prefs.timeout); Çbundle //original call Çnewpartstable = betty.rpc.client (adrPrefs^.server, adrPrefs^.port, adrPrefs^.method, @paramlist, false, ticksToTimeOut:user.rootUpdates.prefs.timeout) if not defined (newPartsTable.parts) { if newPartsTable beginsWith "There are no new or changed parts available." or newPartsTable beginsWith "Your root is already updated" { msg (""); if flDialogs { dialog.notify (newPartsTable)} else { msg (newPartsTable)}; if adrCtNewParts != nil { //4/16/02; 4:33:24 PM by JES: make the new part count available to the caller, even if there are no new parts adrCtNewParts^ = ctNewParts}; return (true)}}; if adrPrefs^.autobackup { //10/18/98; 11:36:58 AM by DW if flguestdb { backups.init (); //make sure user.backups.folder is set local (alist = string.parseaddress (adrInRoot)); local (source = alist [1]); filemenu.save (source); local (dest); bundle { //set dest to point at the destination file dest = file.filefrompath (source); if string.lower (dest) endswith ".root" { dest = string.delete (dest, sizeof (dest) - 4, 5); //pop off .root dest = dest + "." + user.backups.nextBackup + ".root"} else { dest = dest + "." + user.backups.nextBackup}; dest = user.backups.folder + dest; user.backups.nextBackup++}; file.sureFilePath (dest); //AR 11/15/1999 file.copy (source, dest); filemenu.save (); msg (dest + " is " + string.megabytestring (file.size (dest)))} else { backups.backuproot ()}}; for i = 1 to sizeof (newpartstable.parts) { local (adrnewpart = @newpartstable.parts [i]); local (bytes = binary (base64.decode (adrnewpart^))); local (flpartinstalled = true); setBinaryType (@bytes, tableType); unpack (@bytes, adrnewpart); on installPart (adrpart) { if defined (user.rootUpdates.protected) { //Don't import into these places. local (j); for j = 1 to sizeOf (user.rootUpdates.protected) { local (oneItem = address (user.rootUpdates.protected [j])); if table.tableContains (oneItem, adrpart^.adr) { //Don't install. flpartinstalled = false; return (true)}}}; if defined (adrpart^.platform) { if string.lower (adrpart^.platform) != "both" { // Only install parts for this platform. if string.lower (adrpart^.platform) != string.lower (platform) { return (true)}}}; try { if flguestdb { //we got a relative address, convert it to a real address adrpart^.adr = address (addressprefixstring + "." + adrpart^.adr)}; msg ("Importing " + adrpart^.adr + "."); local (adrcallback, ixcallback, ctcallbacks, flInstallPart = true); bundle { //call beforeInstallPart callbacks ctcallbacks = sizeOf (user.rootUpdates.callbacks.beforeInstallPart); for ixcallback = 1 to ctcallbacks { local (adrcallback = @user.rootUpdates.callbacks.beforeInstallPart[ixcallback] ); try { while typeOf (adrcallback^) == addressType { adrcallback = adrcallback^}; if not adrcallback^ (adrpart^.adr, string (adrpart^.changes) ) { flInstallPart = false; break}}}}; if flInstallPart { adrpart^.adr^ = adrpart^.data}; bundle { //call afterInstallPart callbacks ctcallbacks = sizeOf (user.rootUpdates.callbacks.afterInstallPart); for ixcallback = 1 to ctcallbacks { local (adrcallback = @user.rootUpdates.callbacks.afterInstallPart[ixcallback] ); try { while typeOf (adrcallback^) == addressType { adrcallback = adrcallback^}; adrcallback^ (adrpart^.adr, string (adrpart^.changes) )}}}} else { flpartinstalled = false; if flDialogs { if not dialog.yesNo ("Installation of \"" + adrpart^.adr + "\" failed. Continue installation?") { return (false)}}}; local (logline); bundle { //clean up address so you can 2click on it logline = string (adrpart^.adr); local (ix = string.patternmatch ("].", logline)); if ix != 0 { logline = string.delete (logline, 1, ix + 1)}}; bundle { //log the update on cleanNote (s) { if s != "" { s = string.replaceAll (s, "\r\n", "\r"); s = string.replace (s, ": ", ":\r"); s = string.replaceAll (s, ". ", ".\r"); s = string.replaceAll (s, "-- ", "--\r"); s = "Changed " + s; s = string.replaceAll (s, "\r\r\r\r", "\r\r"); s = string.replaceAll (s, "\r\r\r", "\r\r"); s = string.popTrailing (s, "\r")}; return (s)}; local (changenote = cleanNote (string (adrpart^.changes))); export.addToLog (logline, adrPrefs^.url, changenote); if user.rootupdates.prefs.flShowUpdatesToUser { if not flLogOutlineOpened { if not defined (user.rootupdates.prefs.adrOutlineForUser^) { new (outlinetype, user.rootupdates.prefs.adrOutlineForUser); local (oldtarget = target.set (user.rootupdates.prefs.adrOutlineForUser)); op.setLineText (user.rootupdates.prefs.adrOutlineForUser + " created on " + clock.now ()); target.set (oldtarget); flNewLogOutline = true}; local (oldtarget = target.set (user.rootupdates.prefs.adrOutlineForUser)); op.firstSummit (); op.insert ("Updated " + fname + " on " + clock.now (), up); target.set (oldtarget); flLogOutlineOpened = true}; local (oldtarget = target.set (user.rootupdates.prefs.adrOutlineForUser)); op.insert (logline, right); if sizeof (changenote) > 0 { op.insert (changenote, right); op.go (left, 1); op.collapse ()}; op.go (left, 1); target.set (oldtarget)}}; return (true)}; if not installPart (adrnewpart) { break}; if flpartinstalled { ctnewparts++}}; if defined (newPartsTable.lastUpdateTime) { //PBS 08/20/00: get last update time from server, if supplied adrPrefs^.lastUpdate = newPartsTable.lastUpdateTime} else { //PBS 08/20/00: fallback -- use clock.now () to set last update time adrPrefs^.lastUpdate = date.netStandardString (clock.now ())}; adrPrefs^.serialNum = newPartsTable.serialNum; if flguestdb { msg ("Saving " + adrprefs^.dbname + "..."); fileMenu.saveMyRoot (adrInRoot); msg ("")} else { menu.installMainMenu (); system.menus.buildSuitesSubMenu (); //re-build in case any new suites were imported. msg ("Saving Frontier.root..."); fileMenu.save (); msg ("")}; if flLogOutlineOpened and not flQuietMode { edit (user.rootupdates.prefs.adrOutlineForUser); if flNewLogOutline { window.zoom (user.rootupdates.prefs.adrOutlineForUser)}} else { thread.sleepFor (0); if ctnewparts == 1 { if flDialogs { dialog.alert ("1 new part loaded from \"" + adrPrefs^.server + "\".")} else { msg ("1 new part loaded from \"" + adrPrefs^.server + "\".")}} else { if flDialogs { dialog.alert (ctnewparts + " new parts loaded from \"" + adrPrefs^.server + "\".")} else { msg (ctnewparts + " new parts loaded from \"" + adrPrefs^.server + "\".")}}}} else { //handle errors on alert (message) { if flDialogs { return (dialog.alert (message))}; scriptError (message)}; local (lowerError = string.lower (tryerror)); local (errmsg = "Can't update the root because "); case true { lowerError contains "socket is not connected" { alert (errmsg + "the server is not responding.")}; lowerError contains "can't get the address of"; lowerError contains "poorly formed xml text"; lowerError contains "missing tag" { alert (errmsg + "the server timed out.")}} else { alert (errmsg + "\"" + tryError + ".\"")}; return (false)}; if adrCtNewParts != nil { //01/21/01 JES: make the new part count available to the caller adrCtNewParts^ = ctNewParts}; return (true)}; getUpdate (channelname, adrroot)}; Çbundle //test code Çupdate (@root) \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:system.verbs.builtins.rootUpdates.update ! on update (adrInRoot = table.getcursoraddress (), flQuietMode=false, adrCtNewParts=nil) { ÇChanges Ç6/13/05; 12:53:52 PM by TAC Çdisabled trial version and serial number checks Ç1/12/04; 12:48:36 AM by JES ÇChanged default updates server from madrid.userland.com to updates.userland.com. Ç8/28/02; 10:48:23 PM by JES ÇAdded support for two new callbacks: Çuser.rootUpdates.callbacks.beforeInstallPart -- scripts in this table are called with two parameters: the address of the part, and the change note. If any script returns false, then the part is not installed. No error is generated -- it's up to the callback script to provide feedback to the user. Çuser.rootUpdates.callbacks.afterInstallPart -- scripts in this table are called with two parameters: the address of the part, and the change note. The return value is ignored. Ç4/16/02; 4:34:53 PM by JES ÇBug fix: Store the new part count in adrCtNewParts^ even if no new parts were loaded. Ç1/21/02; 2:25:42 PM by JES ÇUse a string comparison to determine whether we're getting updates from radioupdates.userland.com, instead of a call to tcp.equalNames, since tcp.equalNames fails for some proxy server users. Ç1/7/02; 9:09:40 PM by PBS ÇIf getting Radio updates from radioupdates.userland.com, send your usernum as an additional parameter. Ç8/6/01; 2:22:37 PM by PBS ÇWhen updating Manila or mainResponder, send the serial number. Ç01/21/01; 6:03:11 PM by JES ÇAdded optional parameter, adrCtNewParts. If not nil, the number of updated parts is assigned to adrCtNewParts^. Ç08/20/00; 11:49:35 AM by PBS ÇIf the server returns a last update time, use that instead of clock.now (). This fixes problems with people missing updates due to having clocks out-of-synch with the server. This way, the server's time is always used. Ç06/17/00; 11:16:23 PM by PBS ÇUse new root updates timeout pref. ÇTuesday, November 16, 1999 at 1:43:53 AM by AR ÇMake sure backup folder exists before backing up GDBs. ÇAdded flQuietMode parameter, defaulting to false. If it's true, we suppress all server-unfriendly interaction like putting up dialogs or opening the outline of new parts, regardless of the settings in user.rootUpdates. Ç10/7/99; 6:43:29 PM by DW ÇNew pref, user.rootupdates.prefs.flShowUpdatesToUser, defaults true, initialized in rootUpdates.init. ÇNew pref, user.rootupdates.prefs.adrOutlineForUser, defaults to @user.rootUpdates.updateOutline. Çif flShowUpdatesToUser is true, we create the outline if it doesn't exist and add a top-level headline with the date and time and the name of the database being updated. Each subordinate entry is the address of an object that's been updated. Underneath the address is the explanation of the change, if available. Çbundle //trial, 6/13/05; 12:53:52 PM by TAC - disabled Çif defined (userland.trialVersionCheck) Çif userland.trialVersionCheck () ÇscriptError ("Can't update the database because the trial period has expired.") rootUpdates.init (); local (adrroot = table.getrootaddress (adrInRoot)); local (alist = string.parseaddress (adrroot)); local (f = window.getFile (alist [1])); local (fname = file.filefrompath (f)); if not string.lower (fname) endswith ".root" { scripterror ("Can't update the file because its name doesn't end with .root.")}; local (channelname = string.mid (fname, 1, sizeof (fname) - 5)); local (adrtable = @user.rootUpdates.servers.[channelname]); if not defined (adrtable^) { new (tabletype, adrtable); adrtable^.server = "updates.userland.com"; //"madrid.userland.com" adrtable^.port = 80; adrtable^.method = "nirvanaServer.subscriptions.update"; adrtable^.dbname = fname; adrtable^.lastupdate = "Fri, 16 Oct 1998 12:00:00 GMT"; //indicate that it's never been updated adrtable^.autobackup = true; //if true the backup will be of docServer.root, not Frontier.root adrtable^.dialogs = true; //set this false if you're updating automatically thru the scheduler adrtable^.openLog = true; //show the log file of changes adrtable^.URL = ""} else { if string.lower (adrtable^.server) == "madrid.userland.com" { adrtable^.server = "updates.userland.com"}}; bundle { //the responder name on the server changed if adrtable^.method == "mainResponder.subscriptions.update" { adrtable^.method = "nirvanaServer.subscriptions.update"}}; on getUpdate (serverName, adrInRoot = nil) { //an enhanced version of rootupdates.getUpdate Ç10/18/98; 11:33:30 AM by DW ÇMade it guest database-aware. ÇIf adrInRoot is specified, it's assumed to point into the guest db that's getting updated ÇAdded a field to the prefs record, dbname, which names the guest database that's being shared ÇIt's an index into user.mainresponder.databases on the server. ÇThe handler for this is at mainresponder.rpchandlers.subscriptions.update. local (frontierVersion = Frontier.version ()); local (platform = string.mid (sys.os (), 1, 3)); local (ctnewparts = 0); local (flDialogs = true); local (flLogOutlineOpened = false, flNewLogOutline = false); local (adrPrefs = @user.rootUpdates.servers.[serverName]); local (flguestdb = false, addressprefixstring); //10/18/98 DW bundle { //gather info about guest database if adrInRoot != nil and string.lower (channelname) != "frontier" { addressprefixstring = string (table.getRootAddress (adrInRoot)); flguestdb = true}}; if defined (adrPrefs^.dialogs) and not adrPrefs^.dialogs { flDialogs = false}; if flQuietMode { //AR 11/15/1999 flDialogs = false}; Çif not defined (user.prefs.serialNumber) // 6/13/05; 12:53:52 PM by TAC - disabled Çuser.prefs.serialNumber = "" try { //try to get the root update from the server if flDialogs { local (prompt = "Connect with " + adrPrefs^.server + " to get latest update"); if flguestdb { prompt = prompt + " of " + adrprefs^.dbname}; prompt = prompt + "?"; if not dialog.confirm (prompt) { return (false)}}; window.about (); local (sn); Çif adrPrefs == @user.rootUpdates.servers.Frontier ÇOnly send Frontier serial number when getting Frontier.root udpate. ÇThu, Mar 18, 1999 at 3:21:10 PM by PBS Çsn = user.prefs.serialNumber local (rpcPath = user.betty.prefs.rpcClientDefaultPath); Çbundle // 6/13/05; 12:53:52 PM by TAC - disabled, no serial number check needed for open source release Çcase true //PBS 08/06/01: send serial number for Frontier, Manila, and mainResponder ÇadrPrefs == @user.rootUpdates.servers.Radio ÇadrPrefs == @user.rootUpdates.servers.radioCommunityServer ÇadrPrefs == @user.rootUpdates.servers.serverMonitor ÇadrPrefs == @user.rootUpdates.servers.Prefs ÇadrPrefs == @user.rootUpdates.servers.Frontier ÇadrPrefs == @user.rootUpdates.servers.Manila ÇadrPrefs == @user.rootUpdates.servers.mainResponder Çsn = user.prefs.serialNumber Çif string.lower (adrprefs^.server) endswith ".userland.com" Çtry //add path args to rpcPath Çlocal (args); new (tableType, @args) Çargs.org (xn--args-zoa.org) = user.prefs.organization Çargs.name = user.prefs.name Çargs.email = user.prefs.mailAddress Çargs.sn = user.prefs.serialNumber Çif defined (config.mainResponder.domains) Çargs.domains = sizeOf (config.mainResponder.domains) Çelse Çargs.domains = 0 Çif defined (config.manila.sites) Çargs.sites = sizeOf (config.manila.sites) Çelse Çargs.sites = 0 Çif defined (radioCommunityServerData.users) Çargs.rcsUsers = sizeOf (radioCommunityServerData.users) Çelse Çargs.rcsUsers = 0 ÇrpcPath = rpcPath + "?" + webserver.encodeArgs (@args) Çelse Çif defined (adrPrefs^.serialNum) Çsn = adrPrefs^.serialNum Çelse Çsn = 0 local (paramlist = {adrPrefs^.lastupdate, platform, sn, user.prefs.name, user.prefs.mailAddress, frontierVersion}); bundle { //PBS 01/07/02: send usernum to radioupdates.userland.com Çif tcp.equalNames (adrPrefs^.server, "radioupdates.userland.com") Çparamlist = paramlist + user.radio.prefs.usernum if string.lower (adrPrefs^.server) == "radioupdates.userland.com" { paramlist = paramlist + user.radio.prefs.usernum}}; if flguestdb { paramlist = {adrprefs^.dbname} + {tcp.addressDecode (tcp.myAddress ())} + paramlist}; local (newpartstable); local (i); msg ("Connecting to " + adrPrefs^.server + " to get " + serverName + " update..."); newpartstable = betty.rpc.client (adrPrefs^.server, adrPrefs^.port, adrPrefs^.method, @paramlist, false, rpcPath:rpcPath, ticksToTimeOut:user.rootUpdates.prefs.timeout); Çbundle //original call Çnewpartstable = betty.rpc.client (adrPrefs^.server, adrPrefs^.port, adrPrefs^.method, @paramlist, false, ticksToTimeOut:user.rootUpdates.prefs.timeout) if not defined (newPartsTable.parts) { if newPartsTable beginsWith "There are no new or changed parts available." or newPartsTable beginsWith "Your root is already updated" { msg (""); if flDialogs { dialog.notify (newPartsTable)} else { msg (newPartsTable)}; if adrCtNewParts != nil { //4/16/02; 4:33:24 PM by JES: make the new part count available to the caller, even if there are no new parts adrCtNewParts^ = ctNewParts}; return (true)}}; if adrPrefs^.autobackup { //10/18/98; 11:36:58 AM by DW if flguestdb { backups.init (); //make sure user.backups.folder is set local (alist = string.parseaddress (adrInRoot)); local (source = alist [1]); filemenu.save (source); local (dest); bundle { //set dest to point at the destination file dest = file.filefrompath (source); if string.lower (dest) endswith ".root" { dest = string.delete (dest, sizeof (dest) - 4, 5); //pop off .root dest = dest + "." + user.backups.nextBackup + ".root"} else { dest = dest + "." + user.backups.nextBackup}; dest = user.backups.folder + dest; user.backups.nextBackup++}; file.sureFilePath (dest); //AR 11/15/1999 file.copy (source, dest); filemenu.save (); msg (dest + " is " + string.megabytestring (file.size (dest)))} else { backups.backuproot ()}}; for i = 1 to sizeof (newpartstable.parts) { local (adrnewpart = @newpartstable.parts [i]); local (bytes = binary (base64.decode (adrnewpart^))); local (flpartinstalled = true); setBinaryType (@bytes, tableType); unpack (@bytes, adrnewpart); on installPart (adrpart) { if defined (user.rootUpdates.protected) { //Don't import into these places. local (j); for j = 1 to sizeOf (user.rootUpdates.protected) { local (oneItem = address (user.rootUpdates.protected [j])); if table.tableContains (oneItem, adrpart^.adr) { //Don't install. flpartinstalled = false; return (true)}}}; if defined (adrpart^.platform) { if string.lower (adrpart^.platform) != "both" { // Only install parts for this platform. if string.lower (adrpart^.platform) != string.lower (platform) { return (true)}}}; try { if flguestdb { //we got a relative address, convert it to a real address adrpart^.adr = address (addressprefixstring + "." + adrpart^.adr)}; msg ("Importing " + adrpart^.adr + "."); local (adrcallback, ixcallback, ctcallbacks, flInstallPart = true); bundle { //call beforeInstallPart callbacks ctcallbacks = sizeOf (user.rootUpdates.callbacks.beforeInstallPart); for ixcallback = 1 to ctcallbacks { local (adrcallback = @user.rootUpdates.callbacks.beforeInstallPart[ixcallback] ); try { while typeOf (adrcallback^) == addressType { adrcallback = adrcallback^}; if not adrcallback^ (adrpart^.adr, string (adrpart^.changes) ) { flInstallPart = false; break}}}}; if flInstallPart { adrpart^.adr^ = adrpart^.data}; bundle { //call afterInstallPart callbacks ctcallbacks = sizeOf (user.rootUpdates.callbacks.afterInstallPart); for ixcallback = 1 to ctcallbacks { local (adrcallback = @user.rootUpdates.callbacks.afterInstallPart[ixcallback] ); try { while typeOf (adrcallback^) == addressType { adrcallback = adrcallback^}; adrcallback^ (adrpart^.adr, string (adrpart^.changes) )}}}} else { flpartinstalled = false; if flDialogs { if not dialog.yesNo ("Installation of \"" + adrpart^.adr + "\" failed. Continue installation?") { return (false)}}}; local (logline); bundle { //clean up address so you can 2click on it logline = string (adrpart^.adr); local (ix = string.patternmatch ("].", logline)); if ix != 0 { logline = string.delete (logline, 1, ix + 1)}}; bundle { //log the update on cleanNote (s) { if s != "" { s = string.replaceAll (s, "\r\n", "\r"); s = string.replace (s, ": ", ":\r"); s = string.replaceAll (s, ". ", ".\r"); s = string.replaceAll (s, "-- ", "--\r"); s = "Changed " + s; s = string.replaceAll (s, "\r\r\r\r", "\r\r"); s = string.replaceAll (s, "\r\r\r", "\r\r"); s = string.popTrailing (s, "\r")}; return (s)}; local (changenote = cleanNote (string (adrpart^.changes))); export.addToLog (logline, adrPrefs^.url, changenote); if user.rootupdates.prefs.flShowUpdatesToUser { if not flLogOutlineOpened { if not defined (user.rootupdates.prefs.adrOutlineForUser^) { new (outlinetype, user.rootupdates.prefs.adrOutlineForUser); local (oldtarget = target.set (user.rootupdates.prefs.adrOutlineForUser)); op.setLineText (user.rootupdates.prefs.adrOutlineForUser + " created on " + clock.now ()); target.set (oldtarget); flNewLogOutline = true}; local (oldtarget = target.set (user.rootupdates.prefs.adrOutlineForUser)); op.firstSummit (); op.insert ("Updated " + fname + " on " + clock.now (), up); target.set (oldtarget); flLogOutlineOpened = true}; local (oldtarget = target.set (user.rootupdates.prefs.adrOutlineForUser)); op.insert (logline, right); if sizeof (changenote) > 0 { op.insert (changenote, right); op.go (left, 1); op.collapse ()}; op.go (left, 1); target.set (oldtarget)}}; return (true)}; if not installPart (adrnewpart) { break}; if flpartinstalled { ctnewparts++}}; if defined (newPartsTable.lastUpdateTime) { //PBS 08/20/00: get last update time from server, if supplied adrPrefs^.lastUpdate = newPartsTable.lastUpdateTime} else { //PBS 08/20/00: fallback -- use clock.now () to set last update time adrPrefs^.lastUpdate = date.netStandardString (clock.now ())}; adrPrefs^.serialNum = newPartsTable.serialNum; if flguestdb { msg ("Saving " + adrprefs^.dbname + "..."); fileMenu.saveMyRoot (adrInRoot); msg ("")} else { menu.installMainMenu (); system.menus.buildSuitesSubMenu (); //re-build in case any new suites were imported. msg ("Saving Frontier.root..."); fileMenu.save (); msg ("")}; if flLogOutlineOpened and not flQuietMode { edit (user.rootupdates.prefs.adrOutlineForUser); if flNewLogOutline { window.zoom (user.rootupdates.prefs.adrOutlineForUser)}} else { thread.sleepFor (0); if ctnewparts == 1 { if flDialogs { dialog.alert ("1 new part loaded from \"" + adrPrefs^.server + "\".")} else { msg ("1 new part loaded from \"" + adrPrefs^.server + "\".")}} else { if flDialogs { dialog.alert (ctnewparts + " new parts loaded from \"" + adrPrefs^.server + "\".")} else { msg (ctnewparts + " new parts loaded from \"" + adrPrefs^.server + "\".")}}}} else { //handle errors on alert (message) { if flDialogs { return (dialog.alert (message))}; scriptError (message)}; local (lowerError = string.lower (tryerror)); local (errmsg = "Can't update the root because "); case true { lowerError contains "socket is not connected" { alert (errmsg + "the server is not responding.")}; lowerError contains "can't get the address of"; lowerError contains "poorly formed xml text"; lowerError contains "missing tag" { alert (errmsg + "the server timed out.")}} else { alert (errmsg + "\"" + tryError + ".\"")}; return (false)}; if adrCtNewParts != nil { //01/21/01 JES: make the new part count available to the caller adrCtNewParts^ = ctNewParts}; return (true)}; getUpdate (channelname, adrroot)}; Çbundle //test code Çupdate (@root) \ No newline at end of file |