Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mrDoctorWho/vk4xmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Smith <mrdoctorwho@gmail.com>2016-12-25 14:25:48 +0300
committerJohn Smith <mrdoctorwho@gmail.com>2016-12-25 14:25:48 +0300
commit0774cf6241255389d2a83e1b68a0f08f04239f2c (patch)
tree6b6d9ac8928bac071cb550f69079bbc33484a952 /modules
parent80781818123375d3d9f65c7ed82d877e72252733 (diff)
Add captcha response
Diffstat (limited to 'modules')
-rw-r--r--modules/mod_iq_captcha.py6
-rw-r--r--modules/mod_msg_main.py3
2 files changed, 8 insertions, 1 deletions
diff --git a/modules/mod_iq_captcha.py b/modules/mod_iq_captcha.py
index 4ddaaf7..9168c3e 100644
--- a/modules/mod_iq_captcha.py
+++ b/modules/mod_iq_captcha.py
@@ -16,6 +16,7 @@ import mod_msg_main as mod_msg
def captcha_handler(cl, iq):
if iq.getTagAttr("captcha", "xmlns") == xmpp.NS_CAPTCHA:
source = iq.getFrom().getStripped()
+ result = iq.buildReply("result")
if source in Users:
destination = iq.getTo()
if destination == TransportID:
@@ -23,7 +24,10 @@ def captcha_handler(cl, iq):
xTag = capTag.getTag("x", {}, xmpp.NS_DATA)
ocrTag = xTag.getTag("field", {"var": "ocr"})
value = ocrTag.getTagData("value")
- mod_msg.acceptCaptcha(value, source, destination)
+ if mod_msg.acceptCaptcha(value, source, destination):
+ cl.send(result)
+ else:
+ result = buildIQError(iq, xmpp.ERR_NOT_ACCEPTABLE)
MOD_TYPE = "iq"
diff --git a/modules/mod_msg_main.py b/modules/mod_msg_main.py
index 78807af..2edc460 100644
--- a/modules/mod_msg_main.py
+++ b/modules/mod_msg_main.py
@@ -46,6 +46,9 @@ def acceptCaptcha(key, source, destination):
sendMessage(source, destination, answer, mtype="normal")
if not valid:
executeHandlers("evt04", (user, user.vk.engine.captcha["img"]))
+ return False
+ return True
+ return False
@utils.threaded