예제 #1
0
    def recvNotification(self, node):
        if node["type"] == "picture":
            if node.getChild("set"):
                self.toUpper(
                    SetPictureNotificationProtocolEntity.fromProtocolTreeNode(
                        node))
            elif node.getChild("delete"):
                self.toUpper(
                    DeletePictureNotificationProtocolEntity.
                    fromProtocolTreeNode(node))
            else:
                self.raiseErrorForNode(node)
        elif node["type"] == "status":
            self.toUpper(
                StatusNotificationProtocolEntity.fromProtocolTreeNode(node))
        elif node["type"] == "features":
            # Not implemented
            pass
        elif node["type"] in ["contacts", "subject", "w:gp2"]:
            # Implemented in respectively the protocol_contacts and protocol_groups layer
            pass
        elif node["type"] == "contacts":
            pass
        elif node["type"] == "web":
            # Not implemented
            pass
        #else:
        #pass
        # self.raiseErrorForNode(node)

        ack = OutgoingAckProtocolEntity(node["id"], "notification",
                                        node["type"], node["from"])
        self.toLower(ack.toProtocolTreeNode())
예제 #2
0
    def recvNotification(self, node):
        if node["type"] == "picture":
            if node.getChild("set"):
                self.toUpper(SetPictureNotificationProtocolEntity.fromProtocolTreeNode(node))
            elif node.getChild("delete"):
                self.toUpper(DeletePictureNotificationProtocolEntity.fromProtocolTreeNode(node))
            else:
                self.raiseErrorForNode(node)
        elif node["type"] == "status":
            self.toUpper(StatusNotificationProtocolEntity.fromProtocolTreeNode(node))
        elif node["type"] == "features":
            # Not implemented
            pass
        elif node["type"] in ["contacts", "subject", "w:gp2"]:
            # Implemented in respectively the protocol_contacts and protocol_groups layer
            pass
        elif node["type"] in ["features", "contacts", "web", "location"]:
            # implement individually at some point
            # but keep this pass block so system doesn't crash on these types
            pass
        else:
            self.raiseErrorForNode(node)

        ack = OutgoingAckProtocolEntity(node["id"], "notification", node["type"], node["from"])
        self.toLower(ack.toProtocolTreeNode())
예제 #3
0
    def recvNotification(self, node):
        if node["type"] == "picture":
            if node.getChild("set"):
                self.toUpper(
                    SetPictureNotificationProtocolEntity.fromProtocolTreeNode(
                        node))
            elif node.getChild("delete"):
                self.toUpper(
                    DeletePictureNotificationProtocolEntity.
                    fromProtocolTreeNode(node))
            else:
                self.raiseErrorForNode(node)
        elif node["type"] == "status":
            self.toUpper(
                StatusNotificationProtocolEntity.fromProtocolTreeNode(node))
        elif node["type"] in ["contacts", "subject", "w:gp2"]:
            # Implemented in respectively the protocol_contacts and protocol_groups layer
            pass
        else:
            logger.warning("Unsupported notification type: %s " % node["type"])
            logger.debug("Unsupported notification node: %s" % node)

        ack = OutgoingAckProtocolEntity(node["id"],
                                        "notification",
                                        node["type"],
                                        node["from"],
                                        participant=node["participant"])
        self.toLower(ack.toProtocolTreeNode())
예제 #4
0
파일: layer.py 프로젝트: colonyhq/yowsup
    def recvNotification(self, node):
        if node["type"] == "picture":
            if node.getChild("set"):
                self.toUpper(SetPictureNotificationProtocolEntity.fromProtocolTreeNode(node))
            elif node.getChild("delete"):
                self.toUpper(DeletePictureNotificationProtocolEntity.fromProtocolTreeNode(node))
            else:
                self.raiseErrorForNode(node)
        elif node["type"] == "status":
            self.toUpper(StatusNotificationProtocolEntity.fromProtocolTreeNode(node))
        elif node["type"] == "features":
            # Not implemented
            pass
        elif node["type"] in [ "contacts", "subject", "w:gp2" ]:
            # Implemented in respectively the protocol_contacts and protocol_groups layer
            pass
        elif node["type"] == "contacts":
            pass
        elif node["type"] == "mediaretry":
            # Not implemented
            pass
        elif node["type"] == "web":
            # Not implemented
            pass
        else:
            self.raiseErrorForNode(node)

        ack = OutgoingAckProtocolEntity(node["id"], "notification", node["type"], node["from"])
        self.toLower(ack.toProtocolTreeNode())
예제 #5
0
파일: layer.py 프로젝트: eshwar2305/WC_2015
 def onEncryptNotification(self, protocolTreeNode):
     entity = EncryptNotification.fromProtocolTreeNode(protocolTreeNode)
     ack = OutgoingAckProtocolEntity(protocolTreeNode["id"], "notification",
                                     protocolTreeNode["type"])
     self.toLower(ack.toProtocolTreeNode())
     self.sendKeys(fresh=False,
                   countPreKeys=self.__class__._COUNT_PREKEYS -
                   entity.getCount())
예제 #6
0
 def onEncryptNotification(self, protocolTreeNode):
     entity = EncryptNotification.fromProtocolTreeNode(protocolTreeNode)
     ack = OutgoingAckProtocolEntity(protocolTreeNode["id"], "notification", protocolTreeNode["type"], protocolTreeNode["from"])
     self.toLower(ack.toProtocolTreeNode())
     self.flush_keys(
         self.manager.generate_signed_prekey(),
         self.manager.level_prekeys(force=True)
     )
예제 #7
0
파일: layer.py 프로젝트: 3esmit/yowsup
 def recvCall(self, node):
     entity = CallProtocolEntity.fromProtocolTreeNode(node)
     if entity.getType() == "offer":
         receipt = OutgoingReceiptProtocolEntity(node["id"], node["from"], callId = entity.getCallId())
         self.toLower(receipt.toProtocolTreeNode())
     else:
         ack = OutgoingAckProtocolEntity(node["id"], "call", None, node["from"])
         self.toLower(ack.toProtocolTreeNode())
     self.toUpper(entity)
예제 #8
0
 def onIdentityChangeEncryptNotification(self, protocoltreenode):
     entity = IdentityChangeEncryptNotification.fromProtocolTreeNode(
         protocoltreenode)
     ack = OutgoingAckProtocolEntity(protocoltreenode["id"], "notification",
                                     protocoltreenode["type"],
                                     protocoltreenode["from"])
     self.toLower(ack.toProtocolTreeNode())
     self.getKeysFor([entity.getFrom(True)],
                     resultClbk=lambda _, __: None,
                     reason="identity")
예제 #9
0
파일: layer.py 프로젝트: gsahbi/yowsup
 def recvCall(self, node):
     entity = CallProtocolEntity.fromProtocolTreeNode(node)
     if entity.getType() == "offer":
         receipt = OutgoingReceiptProtocolEntity(node["id"],
                                                 node["from"],
                                                 callId=entity.getCallId())
         self.toLower(receipt.toProtocolTreeNode())
     else:
         ack = OutgoingAckProtocolEntity(node["id"], "call", None,
                                         node["from"])
         self.toLower(ack.toProtocolTreeNode())
     self.toUpper(entity)
예제 #10
0
파일: layer.py 프로젝트: be31/yowsup
    def recvNotification(self, node):
        if node["type"] == "picture":
            if node.getChild("set"):
                self.toUpper(PictureNotificationProtocolEntity.fromProtocolTreeNode(node))
            else:
                self.raiseErrorForNode(node)
        elif node["type"] == "status":
            self.toUpper(StatusNotificationProtocolEntity.fromProtocolTreeNode(node))
        elif node["type"] == "features":
            pass
        else:
            self.raiseErrorForNode(node)

        ack = OutgoingAckProtocolEntity(node["id"], "notification", node["type"])
        self.toLower(ack.toProtocolTreeNode())
예제 #11
0
    def recvNotification(self, node):
        if node["type"] == "picture":
            if node.getChild("set"):
                self.toUpper(
                    PictureNotificationProtocolEntity.fromProtocolTreeNode(
                        node))
            else:
                self.raiseErrorForNode(node)
        elif node["type"] == "status":
            self.toUpper(
                StatusNotificationProtocolEntity.fromProtocolTreeNode(node))
        elif node["type"] == "features":
            pass
        else:
            self.raiseErrorForNode(node)

        ack = OutgoingAckProtocolEntity(node["id"], "notification",
                                        node["type"])
        self.toLower(ack.toProtocolTreeNode())
예제 #12
0
파일: layer.py 프로젝트: tgalal/yowsup
    def recvNotification(self, node):
        if node["type"] == "picture":
            if node.getChild("set"):
                self.toUpper(SetPictureNotificationProtocolEntity.fromProtocolTreeNode(node))
            elif node.getChild("delete"):
                self.toUpper(DeletePictureNotificationProtocolEntity.fromProtocolTreeNode(node))
            else:
                self.raiseErrorForNode(node)
        elif node["type"] == "status":
            self.toUpper(StatusNotificationProtocolEntity.fromProtocolTreeNode(node))
        elif node["type"] in ["contacts", "subject", "w:gp2"]:
            # Implemented in respectively the protocol_contacts and protocol_groups layer
            pass
        else:
            logger.warn("Unsupported notification type: %s " % node["type"])
            logger.debug("Unsupported notification node: %s" % node)

        ack = OutgoingAckProtocolEntity(node["id"], "notification", node["type"], node["from"], participant=node["participant"])
        self.toLower(ack.toProtocolTreeNode())
예제 #13
0
 def onEncryptNotification(self, protocolTreeNode):
     entity = EncryptNotification.fromProtocolTreeNode(protocolTreeNode)
     ack = OutgoingAckProtocolEntity(protocolTreeNode["id"], "notification", protocolTreeNode["type"], protocolTreeNode["from"])
     self.toLower(ack.toProtocolTreeNode())
     self.sendKeys(fresh=False, countPreKeys = self.__class__._COUNT_PREKEYS - entity.getCount())