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

system.verbs.builtins.tcp.im.builtinResponders.blogger.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 \"blogger login blogId username password\".")};
	
	local (blogId = string.nthField (message, " ", 3));
	if blogId beginsWith "http://" { //99% likely that we're talking to a UserLand XML-RPC server
		local (s = drivername + " " + screenname + " " + blogId);
		if not (s endswith "/") {
			s = s + "/"};
		parentOf (this^)^.setServer (driverName, screenname, s + "RPC2")};
	local (username = string.nthField (message, " ", 4));
	local (password = string.nthField (message, " ", 5));
	
	try {
		local (t);
		blogger.getRecentPosts (@t, 1, blogId, username, password, @user.im.responders.blogger.prefs.siteInfo);
		
		user.im.responders.blogger.prefs.username = username;
		user.im.responders.blogger.prefs.password = binary (password);
		user.im.responders.blogger.prefs.blogId = blogId}
	else {
		return ("Can't login to \"" + blogId + "\" because the server returned an error: \"" + tryerror + "\".")};
	
	return ("Login successful.")};

<<bundle //test code
	<<login ("", "", "blogger login 767753 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.