def fromProtocolTreeNode(node): entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = UnregisterIqProtocolEntity removeNode = node.getChild("remove") assert removeNode["xmlns"] == UnregisterIqProtocolEntity.XMLNS, "Not an account delete xmlns, got %s" % removeNode["xmlns"] return entity
def fromProtocolTreeNode(node): entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = UnregisterIqProtocolEntity removeNode = node.getChild("remove") assert removeNode["xmlns"] == UnregisterIqProtocolEntity.XMLNS, "Not an account delete xmlns, got %s" % removeNode["xmlns"] return entity
def fromProtocolTreeNode(node): entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = PictureIqProtocolEntity pictureNode = node.getChild("picture") assert pictureNode["type"] == "image", "Not a profile picture with type image, got %s" \ % pictureNode["type"] entity.setPictureData(pictureNode.getData()) entity.setPictureId(pictureNode["id"]) return entity
def fromProtocolTreeNode(node): entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = PictureIqProtocolEntity pictureNode = node.getChild("picture") assert pictureNode["type"] == "image", "Not a profile picture with type image, got %s" \ % pictureNode["type"] entity.setPictureData(pictureNode.getData()) entity.setPictureId(pictureNode["id"]) return entity
def fromProtocolTreeNode(node): entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = GetStatusesIqProtocolEntity statusNode = node.getChild("status") userNodes = statusNode.getAllChildren() jids = [user['jid'] for user in userNodes] entity.setGetStatusesProps(jids) return entity
def fromProtocolTreeNode(node): entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = SetPrivacyIqProtocolEntity privacyNode = node.getChild(SetPrivacyIqProtocolEntity.XMLNS) names = [] for categoryNode in privacyNode.getAllChildren(): names.append(categoryNode["name"]) entity.setNames(names) entity.setValue("all") return entity
def fromProtocolTreeNode(node): entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = GetStatusesIqProtocolEntity statusNode = node.getChild("status") userNodes = statusNode.getAllChildren() jids = [user['jid'] for user in userNodes] entity.setGetStatusesProps(jids) return entity
def fromProtocolTreeNode(node): syncNode = node.getChild("sync") entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = SyncIqProtocolEntity entity.setSyncProps(syncNode.getAttributeValue("sid"), syncNode.getAttributeValue("index"), syncNode.getAttributeValue("last")) return entity
def fromProtocolTreeNode(node): entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = SetPrivacyIqProtocolEntity privacyNode = node.getChild(SetPrivacyIqProtocolEntity.XMLNS) names = [] for categoryNode in privacyNode.getAllChildren(): names.append(categoryNode["name"]) entity.setNames(names) entity.setValue("all") return entity
def fromProtocolTreeNode(node): statusNode = node.getChild('status') users = statusNode.getAllChildren() statuses = dict() for user in users: statuses[user['jid']] = (user.getData(), user['t']) entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = ResultStatusesIqProtocolEntity entity.setResultStatusesProps(statuses) return entity
def fromProtocolTreeNode(node): assert node.getAttributeValue("type") == "set", "Expected set as iq type in request upload, got %s" % node.getAttributeValue("type") entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = RequestUploadIqProtocolEntity mediaNode = node.getChild("media") entity.setRequestArguments( mediaNode.getAttributeValue("type"), mediaNode.getAttributeValue("hash"), mediaNode.getAttributeValue("size"), mediaNode.getAttributeValue("orighash") ) return entity
def fromProtocolTreeNode(node): assert node.getAttributeValue("type") == "set", "Expected set as iq type in request upload, got %s" % node.getAttributeValue("type") entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = RequestUploadIqProtocolEntity mediaNode = node.getChild("media") entity.setRequestArguments( mediaNode.getAttributeValue("type"), mediaNode.getAttributeValue("hash"), mediaNode.getAttributeValue("size"), mediaNode.getAttributeValue("orighash") ) return entity
def fromProtocolTreeNode(node): syncNode = node.getChild("sync") entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = SyncIqProtocolEntity entity.setSyncProps( syncNode.getAttributeValue("sid"), syncNode.getAttributeValue("index"), syncNode.getAttributeValue("last") ) return entity
def fromProtocolTreeNode(node): entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = SetKeysIqProtocolEntity regVal = node.getChild("registration").data typeVal = node.getChild("type").data idVal = node.getChild("identity").data preKeys = {} for keyNode in node.getChild("list").getAllChildren(): preKeys[keyNode.getChild("id").data] = keyNode.getChild("value").data skeyNode = node.getChild("skey") entity.setProps(idVal, (skeyNode.getChild("id").data, skeyNode.getChild("value").data, skeyNode.getChild("signature").data), preKeys, typeVal, regVal) return entity
def fromProtocolTreeNode(node): entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = SetKeysIqProtocolEntity regVal = node.getChild("registration").data typeVal = node.getChild("type").data idVal = node.getChild("identity").data preKeys = {} for keyNode in node.getChild("list").getAllChildren(): preKeys[keyNode.getChild("id").data] = keyNode.getChild( "value").data skeyNode = node.getChild("skey") entity.setProps( idVal, (skeyNode.getChild("id").data, skeyNode.getChild("value").data, skeyNode.getChild("signature").data), preKeys, typeVal, regVal) return entity
def fromProtocolTreeNode(node): entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = CleanIqProtocolEntity entity.setProps(node.getChild("clean").getAttributeValue("type")) return entity
def fromProtocolTreeNode(node): assert node.getChild(GetPrivacyIqProtocolEntity.XMLNS) is not None, "Not a get privacy iq node %s" % node entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = GetPrivacyIqProtocolEntity return entity
def fromProtocolTreeNode(node): entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = CleanIqProtocolEntity entity.setProps(node.getChild("clean").getAttributeValue("type")) return entity
def fromProtocolTreeNode(node): entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = PrivacyListIqProtocolEntity entity.setListName(node.getChild("query").getChild("list")["name"]) return entity
def fromProtocolTreeNode(node): entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = SetStatusIqProtocolEntity statusNode = node.getChild("status") entity.setData(statusNode.getData()) return entity
def fromProtocolTreeNode(node): entity = IqProtocolEntity.fromProtocolTreeNode(node) entity.__class__ = SetStatusIqProtocolEntity statusNode = node.getChild("status") entity.setData(statusNode.getData()) return entity