diff options
author | Lance Stout <lancestout@gmail.com> | 2013-01-21 02:34:22 -0800 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2013-01-21 02:34:22 -0800 |
commit | bad405bea96405eb952888dc6996b8b40be85ac4 (patch) | |
tree | b5998707d5d8d836eaa807f1e755047c1aed5c48 /sleekxmpp/plugins/jobs.py | |
parent | 648f3f978a84445ed188be055453ac4cab3ed4f5 (diff) | |
parent | 4f9a95b011277ab64a137aceeb4df2e9fc0f1e25 (diff) | |
download | slixmpp-bad405bea96405eb952888dc6996b8b40be85ac4.tar.gz slixmpp-bad405bea96405eb952888dc6996b8b40be85ac4.tar.bz2 slixmpp-bad405bea96405eb952888dc6996b8b40be85ac4.tar.xz slixmpp-bad405bea96405eb952888dc6996b8b40be85ac4.zip |
Merge branch 'master' into develop
Diffstat (limited to 'sleekxmpp/plugins/jobs.py')
-rw-r--r-- | sleekxmpp/plugins/jobs.py | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/sleekxmpp/plugins/jobs.py b/sleekxmpp/plugins/jobs.py deleted file mode 100644 index cb9deba8..00000000 --- a/sleekxmpp/plugins/jobs.py +++ /dev/null @@ -1,49 +0,0 @@ -from . import base -import logging -from xml.etree import cElementTree as ET - - -log = logging.getLogger(__name__) - - -class jobs(base.base_plugin): - def plugin_init(self): - self.xep = 'pubsubjob' - self.description = "Job distribution over Pubsub" - - def post_init(self): - pass - #TODO add event - - def createJobNode(self, host, jid, node, config=None): - pass - - def createJob(self, host, node, jobid=None, payload=None): - return self.xmpp.plugin['xep_0060'].setItem(host, node, ((jobid, payload),)) - - def claimJob(self, host, node, jobid, ifrom=None): - return self._setState(host, node, jobid, ET.Element('{http://andyet.net/protocol/pubsubjob}claimed')) - - def unclaimJob(self, host, node, jobid): - return self._setState(host, node, jobid, ET.Element('{http://andyet.net/protocol/pubsubjob}unclaimed')) - - def finishJob(self, host, node, jobid, payload=None): - finished = ET.Element('{http://andyet.net/protocol/pubsubjob}finished') - if payload is not None: - finished.append(payload) - return self._setState(host, node, jobid, finished) - - def _setState(self, host, node, jobid, state, ifrom=None): - iq = self.xmpp.Iq() - iq['to'] = host - if ifrom: iq['from'] = ifrom - iq['type'] = 'set' - iq['psstate']['node'] = node - iq['psstate']['item'] = jobid - iq['psstate']['payload'] = state - result = iq.send() - if result is None or type(result) == bool or result['type'] != 'result': - log.error("Unable to change %s:%s to %s", node, jobid, state) - return False - return True - |