From 50d4df8b4d48b855bd18e9922355b7f3f2b4da4e Mon Sep 17 00:00:00 2001 From: RaNaN Date: Tue, 20 Mar 2012 14:57:45 +0100 Subject: captcha decrypting for all plugin types, new interaction manager --- module/Api.py | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'module/Api.py') diff --git a/module/Api.py b/module/Api.py index 84712af18..6d7ac75b6 100644 --- a/module/Api.py +++ b/module/Api.py @@ -766,18 +766,45 @@ class Api(Iface): # User Interaction ############################# - @permission(PERMS.INTERACTION) def isInteractionWaiting(self, mode): - pass + """ Check if task is waiting. + + :param mode: binary or'ed output type + :return: boolean + """ + return self.core.interactionManager.isTaskWaiting(mode) @permission(PERMS.INTERACTION) def getInteractionTask(self, mode): - pass + """Retrieve task for specific mode. + + :param mode: binary or'ed output type + :return: :class:`InteractionTask` + """ + task = self.core.interactionManager.getTask(mode) + return InteractionTask(-1) if not task else task + @permission(PERMS.INTERACTION) def setInteractionResult(self, iid, result): - pass + """Set Result for a interaction task. It will be immediately removed from task queue afterwards + + :param iid: interaction id + :param result: result as string + """ + task = self.core.interactionManager.getTaskByID(iid) + if task: + task.setResult(result) + + @permission(PERMS.INTERACTION) + def getNotifications(self): + """List of all available notifcations. They stay in queue for some time, client should\ + save which notifications it already has seen. + + :return: list of :class:`InteractionTask` + """ + return self.core.interactionManager.getNotifications() @permission(PERMS.INTERACTION) def getAddonHandler(self): -- cgit v1.2.3