Monday, November 08, 2010 at 12:06 AM.
system.verbs.builtins.tcp.im.builtinResponders.metaWeblog.methods.login
on login (driverName, screenname, message) {
<<Changes
<<8/12/02; 11:14:20 PM by JES
<<Created.
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 \"metaWeblog 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 {
<<If there were a method we could call without more info, we'd call it here to make sure that the login info is good -- but there isn't.
user.im.responders.metaWeblog.prefs.username = username;
user.im.responders.metaWeblog.prefs.password = binary (password);
user.im.responders.metaWeblog.prefs.blogId = blogId}
else {
return ("Can't login to \"" + blogId + "\" because the server returned an error: \"" + tryerror + "\".")};
return ("Login successful.")}
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.