def keys_get(self, jids): with AxolotlOptionalModule(failMessage = self.__class__.FAIL_OPT_AXOLOTL) as importFn: importFn() from yowsup.layers.axolotl.protocolentities.iq_key_get import GetKeysIqProtocolEntity if self.assertConnected(): jids = [self.aliasToJid(jid) for jid in jids.split(',')] entity = GetKeysIqProtocolEntity(jids) self.toLower(entity)
def handleEncMessage(self, node): encMessageProtocolEntity = EncryptedMessageProtocolEntity.fromProtocolTreeNode( node) isGroup = node["participant"] is not None senderJid = node["participant"] if isGroup else node["from"] if node.getChild( "enc")["v"] == "2" and node["from"] not in self.v2Jids: self.v2Jids.append(node["from"]) try: if encMessageProtocolEntity.getEnc(EncProtocolEntity.TYPE_PKMSG): self.handlePreKeyWhisperMessage(node) elif encMessageProtocolEntity.getEnc(EncProtocolEntity.TYPE_MSG): self.handleWhisperMessage(node) if encMessageProtocolEntity.getEnc(EncProtocolEntity.TYPE_SKMSG): self.handleSenderKeyMessage(node) except (InvalidMessageException, InvalidKeyIdException) as e: logger.warning( "InvalidMessage or KeyId for %s, going to send a retry", encMessageProtocolEntity.getAuthor(False)) from yowsup.layers.axolotl.protocolentities.iq_key_get import GetKeysIqProtocolEntity logger.info("Trying GetKeys for %s, getting keys now", encMessageProtocolEntity.getAuthor(False)) entity = GetKeysIqProtocolEntity( [encMessageProtocolEntity.getAuthor(False)]) retry = RetryOutgoingReceiptProtocolEntity.fromMessageNode( node, self.store.getLocalRegistrationId()) self.toLower(retry.toProtocolTreeNode()) except NoSessionException as e: logger.warning("No session for %s, getting their keys now", encMessageProtocolEntity.getAuthor(False)) conversationIdentifier = (node["from"], node["participant"]) if conversationIdentifier not in self.pendingIncomingMessages: self.pendingIncomingMessages[conversationIdentifier] = [] self.pendingIncomingMessages[conversationIdentifier].append(node) successFn = lambda successJids, b: self.processPendingIncomingMessages( *conversationIdentifier) if len(successJids) else None self.getKeysFor([senderJid], successFn) except DuplicateMessageException as e: logger.warning( "Received a message that we've previously decrypted, goint to send the delivery receipt myself" ) self.toLower( OutgoingReceiptProtocolEntity( node["id"], node["from"], participant=node["participant"]).toProtocolTreeNode()) except UntrustedIdentityException as e: if self.getProp(PROP_IDENTITY_AUTOTRUST, False): logger.warning("Autotrusting identity for %s", e.getName()) self.store.saveIdentity(e.getName(), e.getIdentityKey()) return self.handleEncMessage(node) else: logger.error("Ignoring message with untrusted identity")
def keys_get(self, jids): if ModuleTools.INSTALLED_AXOLOTL(): from yowsup.layers.axolotl.protocolentities.iq_key_get import GetKeysIqProtocolEntity if self.assertConnected(): jids = [self.aliasToJid(jid) for jid in jids.split(',')] entity = GetKeysIqProtocolEntity(jids) self.toLower(entity) else: logger.error("Axolotl is not installed")
def keys_get(self, jids): if self.assertConnected(): jids = [self.aliasToJid(jid) for jid in jids.split(',')] entity = GetKeysIqProtocolEntity(jids) self.toLower(entity)
def keys_get(self, jid): if self.assertConnected(): entity = GetKeysIqProtocolEntity(self.aliasToJid(jid)) self.toLower(entity)