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

system.verbs.builtins.tcp.im.builtinResponders.manila.methods.login

on login (driverName, screenname, message) {
	<<Changes
		<<8/12/02; 2:39:19 AM by JES
			<<Rewrite for simplified architecture.
	local (ct = string.countFields (message, " "));
	if ct < 5 {
		return ("Can't login because you have not supplied both a username and password. Send the login request in the format \"manila login siteurl username password\".")};
	
	local (siteurl = string.nthField (message, " ", 3));
	if not (siteurl beginsWith "http://") {
		siteurl = "http://" + siteurl};
	if not (siteurl endswith "/") {
		siteurl = siteurl + "/"};
	local (username = string.nthField (message, " ", 4));
	local (password = string.nthField (message, " ", 5));
	
	on dummyCreateInfoCallback (adrinfo) {
		return (true)}; //always allow the table to be created.
	local (adrinfo);
	if manila.windowTypes.findSiteInfo (siteurl, @adrinfo, @dummyCreateInfoCallback) {
		manila.windowTypes.initSiteInfo (adrinfo);
		adrinfo^.siteName = manila.getSiteName (siteurl);
		adrinfo^.username = username;
		adrinfo^.password = binary (password);
		try {
			adrinfo^.displaySiteName = manila.sitePref.get (adrinfo, "siteName")}
		else {
			return ("Can't login to \"" + siteurl + "\" because the username or password is incorrect.")};
		user.im.responders.manila.prefs.currentSite = nameOf (adrinfo^);
		return ("Logged in to " + adrinfo^.displaySiteName + ".")}}
<<bundle //test code
	<<login ("", "", "manila login jake.editthispage.com jake@jspace.org guessme")



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.