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())
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())
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())
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())
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())
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) )
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)
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")
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)
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())
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())
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())
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())