def __init__(self, msg_dict): # , contact_jid, key, iv, payload, dev_id, my_dev_id): Node.__init__(self, 'encrypted', attrs={'xmlns': NS_OMEMO}) header = Node('header', attrs={'sid': msg_dict['sid']}) for rid, key in msg_dict['keys'].items(): header.addChild('key', attrs={'rid': rid}).addData(b64encode(key)) header.addChild('iv').addData(b64encode(msg_dict['iv'])) self.addChild(node=header) self.addChild('payload').addData(b64encode(msg_dict['payload']))
def __init__(self, data): assert isinstance(data, Node) Node.__init__(self, tag='pubsub', attrs={'xmlns': NS_PUBSUB}) self.addChild(node=data)
def __init__(self, node_str, data): assert node_str is not None and isinstance(data, Node) Node.__init__(self, tag='publish', attrs={'node': node_str}) self.addChild('item').addChild(node=data)
def __init__(self, data): assert data is Node Node.__init__(self, tag='pubsub', attrs={'xmlns': NS_PUBSUB}) self.addChild(node=data)
def __init__(self, node_str, data): assert node_str is not None and data is Node Node.__init__(self, tag='publish', attrs={'node': node_str}) self.addChild('item').addChild(node=data)