Monday, November 08, 2010 at 12:00 AM.


on getRealtimeUpdates () {
		<<7/15/10; 10:09:17 AM by DW
			<<Cribbed from instantOutline.root.
		<<2/3/09; 10:56:03 AM by DW
			<<Use the parameterized roomname, not the fixed one.
		<<1/1/09; 7:08:38 PM by DW
			<<Massive change -- we no longer poll. Instead we use FriendFeed's realtime updates capability. Much more responsive, and less of a resource hog. Total win-win.
		<<7/21/08; 5:58:03 AM by DW
			<<Add stats for tracking how long calls to FF take.
		<<7/19/08; 2:48:41 PM by DW
			<<Don't process updates from "davewiner" and "bullmancuso" -- these are just temporary limits, until we safe-up everything for users who don't exist anymore (they became dave and bull).
		<<7/19/08; 1:37:15 PM by DW
			<<When processing updates, just set the dirty bits on the users, read the outlines after the loop. This way if someone updates twice we only read once.
		<<7/16/08; 8:07:40 PM by DW
	local (adrdata = scripting2suite.init (), username, password, server);
	if not adrdata^.editor.stats.flPasswordValid { //this can't work if we haven't checked in yet
	system.temp.scripting2.editor.idRealtimeThread = thread.getcurrentid ();
	adrdata^.editor.stats.whenRealtimeThreadStarted = ();
	username = adrdata^.editor.prefs.username;
	password = string (adrdata^.editor.prefs.password);
	server = string (adrdata^.editor.prefs.server);
	local (adrtable = @system.temp.scripting2.editor.realtimeUpdates); //for debugging
	if not defined (adrtable^) {
		new (tabletype, adrtable)};
	loop {
		try {
			local (updates = [server].scripting2.getrealtimeupdates (username, password), adrupdate);
			for adrupdate in @updates {
				if adrupdate^.type == "instantOutline" { (adrupdate)};
				adrtable^.[nameof (adrupdate^)] = adrupdate^};
			adrdata^.editor.stats.whenLastRealtimeLoop = ()}}};
bundle { //test code
	getRealtimeUpdates ()}

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.