diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-05-07 10:44:36 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-05-07 10:44:36 +0200 |
commit | b61e1467ee19ca96782248c0189424334d5980b7 (patch) | |
tree | cb7b7283f725efe9a525e81f535d22cb2a287e54 /module/remote/thriftbackend/Handler.py | |
parent | merged (diff) | |
download | pyload-b61e1467ee19ca96782248c0189424334d5980b7.tar.xz |
hooks methods callable via rpc, closed #299
Diffstat (limited to 'module/remote/thriftbackend/Handler.py')
-rw-r--r-- | module/remote/thriftbackend/Handler.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/module/remote/thriftbackend/Handler.py b/module/remote/thriftbackend/Handler.py index bd37c7eb2..9d38109db 100644 --- a/module/remote/thriftbackend/Handler.py +++ b/module/remote/thriftbackend/Handler.py @@ -537,3 +537,31 @@ class Handler(Iface): def getUserData(self): return self.serverMethods.checkAuth(username, password) + + + def getServices(self): + data = {} + for plugin, funcs in self.core.hookManager.methods.iteritems(): + data[plugin] = ServiceInfo(funcs) + + return data + + def hasService(self, plugin, func): + cont = self.core.hookManager.methods + return cont.has_key(plugin) and cont[plugin].has_key(func) + + def call(self, info): + plugin = info.plugin + func = info.func + args = info.arguments + parse = info.parseArguments + + if not self.hasService(plugin, func): + raise ServiceDoesNotExists(plugin, func) + + try: + ret = self.core.hookManager.callRPC(plugin, func, args, parse) + return str(ret) + except Exception, e: + raise ServiceException(e.message) +
\ No newline at end of file |