2011-01-13 07:40:53 +00:00
|
|
|
"""
|
|
|
|
SleekXMPP: The Sleek XMPP Library
|
|
|
|
Copyright (C) 2011 Nathanael C. Fritz, Dann Martens (TOMOTON).
|
|
|
|
This file is part of SleekXMPP.
|
|
|
|
|
|
|
|
See the file LICENSE for copying permission.
|
|
|
|
"""
|
|
|
|
|
|
|
|
from sleekxmpp.xmlstream.stanzabase import ElementBase
|
|
|
|
from xml.etree import cElementTree as ET
|
|
|
|
|
|
|
|
|
|
|
|
class RPCQuery(ElementBase):
|
|
|
|
name = 'query'
|
|
|
|
namespace = 'jabber:iq:rpc'
|
|
|
|
plugin_attrib = 'rpc_query'
|
2011-02-09 01:45:45 +00:00
|
|
|
interfaces = set(())
|
2011-01-13 07:40:53 +00:00
|
|
|
subinterfaces = set(())
|
|
|
|
plugin_attrib_map = {}
|
|
|
|
plugin_tag_map = {}
|
|
|
|
|
|
|
|
|
|
|
|
class MethodCall(ElementBase):
|
|
|
|
name = 'methodCall'
|
|
|
|
namespace = 'jabber:iq:rpc'
|
|
|
|
plugin_attrib = 'method_call'
|
2011-02-09 01:45:45 +00:00
|
|
|
interfaces = set(('method_name', 'params'))
|
2011-01-13 07:40:53 +00:00
|
|
|
subinterfaces = set(())
|
|
|
|
plugin_attrib_map = {}
|
2011-02-09 01:45:45 +00:00
|
|
|
plugin_tag_map = {}
|
2011-01-13 07:40:53 +00:00
|
|
|
|
|
|
|
def get_method_name(self):
|
|
|
|
return self._get_sub_text('methodName')
|
|
|
|
|
|
|
|
def set_method_name(self, value):
|
|
|
|
return self._set_sub_text('methodName', value)
|
2011-02-09 01:45:45 +00:00
|
|
|
|
2011-01-13 07:40:53 +00:00
|
|
|
def get_params(self):
|
|
|
|
return self.xml.find('{%s}params' % self.namespace)
|
2011-02-09 01:45:45 +00:00
|
|
|
|
2011-01-13 07:40:53 +00:00
|
|
|
def set_params(self, params):
|
|
|
|
self.append(params)
|
|
|
|
|
2011-02-09 01:45:45 +00:00
|
|
|
|
2011-01-13 07:40:53 +00:00
|
|
|
class MethodResponse(ElementBase):
|
|
|
|
name = 'methodResponse'
|
|
|
|
namespace = 'jabber:iq:rpc'
|
|
|
|
plugin_attrib = 'method_response'
|
2011-02-09 01:45:45 +00:00
|
|
|
interfaces = set(('params', 'fault'))
|
2011-01-13 07:40:53 +00:00
|
|
|
subinterfaces = set(())
|
|
|
|
plugin_attrib_map = {}
|
|
|
|
plugin_tag_map = {}
|
2011-02-09 01:45:45 +00:00
|
|
|
|
2011-01-13 07:40:53 +00:00
|
|
|
def get_params(self):
|
|
|
|
return self.xml.find('{%s}params' % self.namespace)
|
2011-02-09 01:45:45 +00:00
|
|
|
|
2011-01-13 07:40:53 +00:00
|
|
|
def set_params(self, params):
|
|
|
|
self.append(params)
|
|
|
|
|
|
|
|
def get_fault(self):
|
|
|
|
return self.xml.find('{%s}fault' % self.namespace)
|
2011-02-09 01:45:45 +00:00
|
|
|
|
2011-01-13 07:40:53 +00:00
|
|
|
def set_fault(self, fault):
|
|
|
|
self.append(fault)
|