diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-02-07 19:49:38 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-02-07 19:49:38 +0100 |
commit | 15ff5792f74ffe8b0cdcf24fb91e4ae0c32e94c8 (patch) | |
tree | 954fc930c3a6cc002d0acc8fd6674884a02c82bd /module/plugins | |
parent | added Thrift backend (diff) | |
download | pyload-15ff5792f74ffe8b0cdcf24fb91e4ae0c32e94c8.tar.xz |
captchamanager fix
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/hooks/CaptchaTrader.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/module/plugins/hooks/CaptchaTrader.py b/module/plugins/hooks/CaptchaTrader.py index 9bb8dd2f0..4b96f0922 100644 --- a/module/plugins/hooks/CaptchaTrader.py +++ b/module/plugins/hooks/CaptchaTrader.py @@ -47,9 +47,10 @@ class CaptchaTrader(Hook): __name__ = "CaptchaTrader" __version__ = "0.1" __description__ = """send captchas to captchatrader.com""" - __config__ = [("activated", "bool", "Activated", "True"), + __config__ = [("activated", "bool", "Activated", True), ("username", "str", "Username", ""), - ("passkey", "password", "Password", "")] + ("force", "bool", "Force CT even if client connected", False), + ("passkey", "password", "Password", ""),] __author_name__ = ("RaNaN") __author_mail__ = ("RaNaN@pyload.org") @@ -103,8 +104,10 @@ class CaptchaTrader(Hook): if not self.getConfig("username") or not self.getConfig("passkey"): return False - if self.getCredits() > 10: + if not (self.core.isClientConnected() and self.getConfig("force")): + return False + if self.getCredits() > 10: task.handler = self task.setWaiting(40) start_new_thread(self.processCaptcha, (task,)) @@ -113,12 +116,14 @@ class CaptchaTrader(Hook): self.log.info(_("Your CaptchaTrader Account has not enough credits")) def captchaCorrect(self, task): - ticket = task.data["ticket"] - self.respond(ticket, True) + if task.data.has_key("ticket"): + ticket = task.data["ticket"] + self.respond(ticket, True) def captchaWrong(self, task): - ticket = task.data["ticket"] - self.respond(ticket, True) + if task.data.has_key("ticket"): + ticket = task.data["ticket"] + self.respond(ticket, True) def processCaptcha(self, task): c = task.captchaFile @@ -126,6 +131,7 @@ class CaptchaTrader(Hook): ticket, result = self.submit(c) except CaptchaTraderException, e: task.error = e.getCode() + return task.data["ticket"] = ticket task.setResult(result) |