Message.send - check for missing identityKey, also add logging
FREEBIE
This commit is contained in:
		
					parent
					
						
							
								551aa24e9a
							
						
					
				
			
			
				commit
				
					
						4ee4ad80c3
					
				
			
		
					 3 changed files with 4 additions and 8 deletions
				
			
		| 
						 | 
					@ -38918,9 +38918,7 @@ OutgoingMessage.prototype = {
 | 
				
			||||||
            } else if (error.message === "Identity key changed") {
 | 
					            } else if (error.message === "Identity key changed") {
 | 
				
			||||||
                error.timestamp = this.timestamp;
 | 
					                error.timestamp = this.timestamp;
 | 
				
			||||||
                error.originalMessage = this.message.toArrayBuffer();
 | 
					                error.originalMessage = this.message.toArrayBuffer();
 | 
				
			||||||
                // looks like this is an error - we don't have the identity key in this situation!
 | 
					                console.log('Got "key changed" error from encrypt - no identityKey for application layer', number, deviceIds)
 | 
				
			||||||
                // but we need it to update the identity key when we get a OutgoingIdentityKeyError
 | 
					 | 
				
			||||||
                // error.identityKey = ????;
 | 
					 | 
				
			||||||
                throw error;
 | 
					                throw error;
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                this.registerError(number, "Failed to create or send message", error);
 | 
					                this.registerError(number, "Failed to create or send message", error);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -225,7 +225,7 @@
 | 
				
			||||||
                    if (result.name === 'SignedPreKeyRotationError') {
 | 
					                    if (result.name === 'SignedPreKeyRotationError') {
 | 
				
			||||||
                        return getAccountManager().rotateSignedPreKey();
 | 
					                        return getAccountManager().rotateSignedPreKey();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    else if (result.name === 'OutgoingIdentityKeyError') {
 | 
					                    else if (result.name === 'OutgoingIdentityKeyError' && result.identityKey) {
 | 
				
			||||||
                        promises.push(textsecure.storage.protocol.saveIdentity(
 | 
					                        promises.push(textsecure.storage.protocol.saveIdentity(
 | 
				
			||||||
                            result.number, result.identityKey, false
 | 
					                            result.number, result.identityKey, false
 | 
				
			||||||
                        ));
 | 
					                        ));
 | 
				
			||||||
| 
						 | 
					@ -237,7 +237,7 @@
 | 
				
			||||||
                        promises.push(this.sendSyncMessage());
 | 
					                        promises.push(this.sendSyncMessage());
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    promises = promises.concat(_.map(result.errors, function(error) {
 | 
					                    promises = promises.concat(_.map(result.errors, function(error) {
 | 
				
			||||||
                        if (error.name === 'OutgoingIdentityKeyError') {
 | 
					                        if (error.name === 'OutgoingIdentityKeyError' && error.identityKey) {
 | 
				
			||||||
                            return textsecure.storage.protocol.saveIdentity(
 | 
					                            return textsecure.storage.protocol.saveIdentity(
 | 
				
			||||||
                                error.number, error.identityKey, false
 | 
					                                error.number, error.identityKey, false
 | 
				
			||||||
                            );
 | 
					                            );
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -176,9 +176,7 @@ OutgoingMessage.prototype = {
 | 
				
			||||||
            } else if (error.message === "Identity key changed") {
 | 
					            } else if (error.message === "Identity key changed") {
 | 
				
			||||||
                error.timestamp = this.timestamp;
 | 
					                error.timestamp = this.timestamp;
 | 
				
			||||||
                error.originalMessage = this.message.toArrayBuffer();
 | 
					                error.originalMessage = this.message.toArrayBuffer();
 | 
				
			||||||
                // looks like this is an error - we don't have the identity key in this situation!
 | 
					                console.log('Got "key changed" error from encrypt - no identityKey for application layer', number, deviceIds)
 | 
				
			||||||
                // but we need it to update the identity key when we get a OutgoingIdentityKeyError
 | 
					 | 
				
			||||||
                // error.identityKey = ????;
 | 
					 | 
				
			||||||
                throw error;
 | 
					                throw error;
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                this.registerError(number, "Failed to create or send message", error);
 | 
					                this.registerError(number, "Failed to create or send message", error);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue