Monday, April 04, 2011 at 1:08 AM.

radio2Suite.shortener.validate

on validate (username) {
	<<Changes
		<<3/25/11; 11:16:39 AM by DW
			<<Not sure why -- but when this bit of logic runs in the beaut.root prefs page, we end up trashing the password, but don't trash it in the radio2.root version. So I put a bit of baling wire in here that checks if the password got emptied, and put it back to what it was last time it wasn't empty. The issue goes away. I hate this kind of patchery.
		<<3/11/11; 7:36:59 AM by DW
			<<If nothing changed, there's nothing to validate. Get out quick and STFU. :-)
		<<2/22/11; 6:28:47 PM by DW
			<<When there's a problem, display the error -- might help in debugging?
		<<2/22/11; 10:43:56 AM by DW
			<<Called from the prefs outline, radio2suite.data.prefsOutline, we check to be sure that we can get counts and shorten urls. 
	local (pta = html.getpagetableaddress ());
	scratchpad.validateparams = pta^;
	if pta^.method == "POST" {
		try {
			local (adrdata = radio2suite.init (), adruser = @adrdata^.users.[username], urls);
			bundle { //super-hack -- 3/25/11 by DW
				if string (adruser^.prefs.shortener.password) == "" {
					if defined (adruser^.stats.savedShortenerPassword) {
						adruser^.prefs.shortener.password = string (adruser^.stats.savedShortenerPassword)}}};
			bundle { //don't do anything if the prefs haven't changed, 3/11/11 by DW
				 if adruser^.prefs.shortener.email == adruser^.stats.lastShortenerPrefs.email {
					 if adruser^.prefs.shortener.password == adruser^.stats.lastShortenerPrefs.password {
						 if adruser^.prefs.shortener.partnerID == adruser^.stats.lastShortenerPrefs.partnerID {
							return ("")}}}};
			local (s = "<font color=\"green\">Adjix likes your credentials.</font>");
			adruser^.stats.lastShortenerPrefs = adruser^.prefs.shortener;
			adjix.getaccounturls (@urls, adruser^.prefs.shortener.email, adruser^.prefs.shortener.password);
			adjix.create ("http://scripting.com/rss.xml", partnerId:adruser^.prefs.shortener.partnerID);
			return (s)}
		else {
			return ("<font color=\"red\">Adjix didn't like your credentials: \"" + tryerror + "\"</font>")}}
	else {
		bundle { //make a copy of user's shortener prefs for comparison later, 3/11/11 by DW
			local (adrdata = radio2suite.init (), adruser = @adrdata^.users.[username]);
			adruser^.stats.lastShortenerPrefs = adruser^.prefs.shortener;
			if sizeof (adruser^.prefs.shortener.password) > 0 { //3/25/11 by DW
				adruser^.stats.savedShortenerPassword = adruser^.prefs.shortener.password}};
		return ("")}}



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.