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


on deleteOldInboxes () {
		<<7/26/10; 6:58:11 PM by DW
			<<Count individual deletions, not calls to this routine.
		<<7/26/10; 6:54:30 PM by DW
			<<Count the number of inbox deletions.
		<<7/26/10; 6:30:03 PM by DW
			<<If an inbox hasn't been checked in N hours, it's deemed old and can be reclaimed. 
	local (adrdata = realtime.init (), adruser, now = (), i);
	adrdata^.server.stats.whenLastDeleteInboxes = now;
	local (ctsecsmax = adrdata^.server.prefs.ctSecsReclaimInbox);
	for adruser in @adrdata^.server.users {
		for i = sizeof (adruser^.inboxes) downto 1 {
			local (adrinbox = @adruser^.inboxes [i]);
			local (ctsecs = number (now - adrinbox^.stats.whenLastCheck));
			if ctsecs > ctsecsmax {
				delete (adrinbox)}}}};
bundle { //test code
	deleteOldInboxes ()}

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.