def __init__(self, from_jid, to_jid, node_name=None, type=u'get', stanza_id=None): Entity.__init__(self, from_jid, to_jid, type, stanza_id) self.x = None self.node_name = node_name self.identities = [] self.features = [] self.items = []
def __init__(self, from_jid, to_jid, type=u'normal', stanza_id=None, lang=None): Entity.__init__(self, from_jid, to_jid, type, stanza_id) self.lang = lang self.bodies = [] self.subjects = [] self.event = None self.foreign = [] self.thread = None self.timestamp = datetime.now()
def to_unsubscription_element(e): iq = Entity.to_element(e) pubsub = E(u'pubsub', namespace=XMPP_PUBSUB_NS, parent=iq) sub_jid = e.sub_jid attrs = {u'node': e.node_name, u'jid': e.sub_jid} E(u'unsubscribe', attributes=attrs, namespace=XMPP_PUBSUB_NS, parent=pubsub) return iq
def to_element(e): iq = Entity.to_element(e) attrs = {u'node': e.node_name} E(u'query', namespace=XMPP_DISCO_INFO_NS, parent=iq, attributes=attrs) return iq
def to_element(e): iq = Entity.to_element(e) p = E(u'profile', namespace=XMPP_USER_PROFILE_NS, parent=iq) if e.x: Data.to_element(e.x, parent=p) return iq
def to_element(e): iq = Entity.to_element(e) query = E(u'query', namespace=XMPP_PUBSUB_NS, parent=iq) attr = None if e.node_name: attr = {u'node': e.node_name} E('subscriptions', namespace=XMPP_PUBSUB_NS, attributes=attr, parent=query) return iq
def to_retract_element(e): iq = Entity.to_element(e) pubsub = E(u'pubsub', namespace=XMPP_PUBSUB_NS, parent=iq) attrs = {u'node': e.node_name} publish = E(u'retract', attributes=attrs, namespace=XMPP_PUBSUB_NS, parent=pubsub) attrs = {u'id': e.item.id} item = E(u'item', attributes=attrs, namespace=XMPP_PUBSUB_NS, parent=publish) return iq
def to_request_item(e): iq = Entity.to_element(e) pubsub = E(u'pubsub', namespace=XMPP_PUBSUB_NS, parent=iq) attrs = {u'node': e.node_name} items = E(u'items', attributes=attrs, namespace=XMPP_PUBSUB_NS, parent=pubsub) if e.item: attrs = {u'id': e.item.id} E(u'item', attributes=attrs, namespace=XMPP_PUBSUB_NS, parent=items) return iq
def to_creation_element(e): iq = Entity.to_element(e) pubsub = E(u'pubsub', namespace=XMPP_PUBSUB_NS, parent=iq) attrs = {u'node': e.node_name} E(u'create', attributes=attrs, namespace=XMPP_PUBSUB_NS, parent=pubsub) if not e.configure: E(u'configure', namespace=XMPP_PUBSUB_NS, parent=pubsub) else: Configure.to_element(e.configure, parent=pubsub) return iq
def to_publication_element(e): iq = Entity.to_element(e) pubsub = E(u'pubsub', namespace=XMPP_PUBSUB_NS, parent=iq) attrs = {u'node': e.node_name} publish = E(u'publish', attributes=attrs, namespace=XMPP_PUBSUB_NS, parent=pubsub) attrs = {u'id': e.item.id} item = E(u'item', attributes=attrs, namespace=XMPP_PUBSUB_NS, parent=publish) if e.item.payload and isinstance(e.item.payload, E): e.item.payload.xml_parent = item item.xml_children.append(e.item.payload) elif e.item.payload and isinstance(e.item.payload, unicode): item.xml_text = e.item.payload return iq
def to_element(e): iq = Entity.to_element(e) query = E(u'query', namespace=XMPP_IBR_NS, parent=iq) if e.remove: E(u'remove', namespace=XMPP_IBR_NS, parent=query) if e.registered: E(u'registered', namespace=XMPP_IBR_NS, parent=query) for info in e.infos: E(info, namespace=XMPP_IBR_NS, parent=query, content=e.infos[info]) if e.x: Data.to_element(e.x, parent=query) return iq
def to_element(e): iq = Entity.to_element(e) if e.type != 'result': query = E(u'query', namespace=XMPP_ROSTER_NS, parent=iq) for item_id in e.items: item = e.items[item_id] attr = {u'jid': unicode(item.jid)} if item.subscription: attr[u'subscription'] = item.subscription if item.name: attr[u'name'] = item.name if item.language: attr[u'language'] = item.language i = E(u'item', namespace=XMPP_ROSTER_NS, attributes=attr, parent=query) for group in item.groups: E(u'group', namespace=XMPP_ROSTER_NS, content=group, parent=i) return iq
def __init__(self, kind=None, from_jid=None, to_jid=None, type=None, stanza_id=None, lang=None): Entity.__init__(self, from_jid, to_jid, type, stanza_id) self.kind = kind self.lang = lang self.children = []
def __init__(self, from_jid, to_jid=None, type=u'none', stanza_id=None): Entity.__init__(self, from_jid, to_jid, type=type, stanza_id=stanza_id) self.status = None self.show = None self.priority = 0 self.foreign = []
def to_purge_element(e): iq = Entity.to_element(e) pubsub = E(u'pubsub', namespace=XMPP_PUBSUB_OWNER_NS, parent=iq) attrs = {u'node': e.node_name} E(u'purge', attributes=attrs, namespace=XMPP_PUBSUB_OWNER_NS, parent=pubsub) return iq
def __init__(self, from_jid, to_jid=None, type=u'get', stanza_id=None): Entity.__init__(self, from_jid, to_jid, type=type, stanza_id=stanza_id) self.items = {}
def __init__(self, from_jid, to_jid, node_name=None, type=u'get', stanza_id=None): Entity.__init__(self, from_jid, to_jid, type, stanza_id) self.subscriptions = [] self.node_name = node_name
def __init__(self, from_jid, to_jid): Entity.__init__(self, from_jid, to_jid) self.node_name = None self.items = [] self.event = None
def __init__(self, from_jid, to_jid, type=u'get', stanza_id=None): Entity.__init__(self, from_jid, to_jid, type, stanza_id) self.affiliations = []
def to_element(e): iq = Entity.to_element(e) query = E(u'query', namespace=XMPP_PUBSUB_NS, parent=iq) E('affiliations', namespace=XMPP_PUBSUB_NS, parent=query) return iq
def __init__(self, from_jid, to_jid, node_name=None, type=u'set', stanza_id=None, **kwargs): Entity.__init__(self, from_jid, to_jid, type, stanza_id) self.node_name = node_name self.configure = None if kwargs: self.__dict__.update(kwargs)
def __init__(self, from_jid=None, to_jid=None, type=u'get', stanza_id=None): Entity.__init__(self, from_jid, to_jid, type, stanza_id) self.x = None self.registered = False self.remove = False self.infos = {}
def __init__(self, from_jid, to_jid, type=u"get", stanza_id=None, seconds=None, message=None): Entity.__init__(self, from_jid, to_jid) self.seconds = seconds self.message = message self.type = type self.stanza_id = stanza_id or generate_unique()
def __init__(self, from_jid=None, to_jid=None, type=u'none', stanza_id=None): Entity.__init__(self, from_jid, to_jid, type=type, stanza_id=stanza_id) self.x = None