Added Api.main_action_xmlrpc() method which could replace the three other XML-RPC methods

This commit is contained in:
Tobi Schäfer 2008-06-12 16:47:37 +00:00
parent 9011841b88
commit 8e8667e5f4

View file

@ -31,8 +31,8 @@ Api.constrain = function(site, user) {
Api.dispatch = function() { Api.dispatch = function() {
var handler = Api[this]; var handler = Api[this];
var method = arguments[0]; var method = arguments[0];
if (!method.startsWith("_")) { if (method && !method.startsWith("_")) {
if (handler && method && handler[method]) { if (handler && handler[method]) {
var args = Array.prototype.splice.call(arguments, 1); var args = Array.prototype.splice.call(arguments, 1);
return handler[method].apply(null, args); return handler[method].apply(null, args);
} }
@ -109,11 +109,20 @@ Api.prototype.callback_action = function() {
return; return;
} }
Api.prototype.blogger_action_xmlrpc = function(method) { Api.prototype.main_action_xmlrpc = function(method) {
if (!method) {
return false;
}
var parts = method.split(".");
arguments[0] = parts[1];
return Api.dispatch.apply(parts[0], arguments);
}
Api.prototype.blogger_action_xmlrpc = function() {
return Api.dispatch.apply("blogger", arguments); return Api.dispatch.apply("blogger", arguments);
} }
Api.prototype.movableType_action_xmlrpc = function(method) { Api.prototype.movableType_action_xmlrpc = function() {
return Api.dispatch.apply("movableType", arguments); return Api.dispatch.apply("movableType", arguments);
} }