Example #1
0
    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
Example #2
0
    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
Example #3
0
 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
Example #4
0
 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
Example #5
0
    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
Example #6
0
 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
Example #7
0
    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
Example #8
0
    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
Example #9
0
 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
Example #10
0
    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
Example #11
0
 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
Example #12
0
 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
Example #13
0
    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 
Example #14
0
    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
Example #15
0
    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
Example #16
0
 def fromProtocolTreeNode(node):
     entity = IqProtocolEntity.fromProtocolTreeNode(node)
     entity.__class__ = CleanIqProtocolEntity
     entity.setProps(node.getChild("clean").getAttributeValue("type"))
     return entity
Example #17
0
 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
Example #18
0
 def fromProtocolTreeNode(node):
     entity = IqProtocolEntity.fromProtocolTreeNode(node)
     entity.__class__ = CleanIqProtocolEntity
     entity.setProps(node.getChild("clean").getAttributeValue("type"))
     return entity
Example #19
0
 def fromProtocolTreeNode(node):
     entity = IqProtocolEntity.fromProtocolTreeNode(node)
     entity.__class__ = PrivacyListIqProtocolEntity
     entity.setListName(node.getChild("query").getChild("list")["name"])
     return entity
Example #20
0
 def fromProtocolTreeNode(node):
     entity = IqProtocolEntity.fromProtocolTreeNode(node)
     entity.__class__ = SetStatusIqProtocolEntity
     statusNode = node.getChild("status")
     entity.setData(statusNode.getData())
     return entity
Example #21
0
 def fromProtocolTreeNode(node):
     entity = IqProtocolEntity.fromProtocolTreeNode(node)
     entity.__class__ = SetStatusIqProtocolEntity
     statusNode = node.getChild("status")
     entity.setData(statusNode.getData())
     return entity