Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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 
Esempio n. 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
Esempio n. 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
Esempio n. 16
0
 def fromProtocolTreeNode(node):
     entity = IqProtocolEntity.fromProtocolTreeNode(node)
     entity.__class__ = CleanIqProtocolEntity
     entity.setProps(node.getChild("clean").getAttributeValue("type"))
     return entity
Esempio n. 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
Esempio n. 18
0
 def fromProtocolTreeNode(node):
     entity = IqProtocolEntity.fromProtocolTreeNode(node)
     entity.__class__ = CleanIqProtocolEntity
     entity.setProps(node.getChild("clean").getAttributeValue("type"))
     return entity
Esempio n. 19
0
 def fromProtocolTreeNode(node):
     entity = IqProtocolEntity.fromProtocolTreeNode(node)
     entity.__class__ = PrivacyListIqProtocolEntity
     entity.setListName(node.getChild("query").getChild("list")["name"])
     return entity
Esempio n. 20
0
 def fromProtocolTreeNode(node):
     entity = IqProtocolEntity.fromProtocolTreeNode(node)
     entity.__class__ = SetStatusIqProtocolEntity
     statusNode = node.getChild("status")
     entity.setData(statusNode.getData())
     return entity
Esempio n. 21
0
 def fromProtocolTreeNode(node):
     entity = IqProtocolEntity.fromProtocolTreeNode(node)
     entity.__class__ = SetStatusIqProtocolEntity
     statusNode = node.getChild("status")
     entity.setData(statusNode.getData())
     return entity