|  |  | @ -388,81 +388,83 @@ export async function innerHandleContentMessage( | 
			
		
	
		
		
			
				
					
					|  |  |  |   plaintext: ArrayBuffer |  |  |  |   plaintext: ArrayBuffer | 
			
		
	
		
		
			
				
					
					|  |  |  | ): Promise<void> { |  |  |  | ): Promise<void> { | 
			
		
	
		
		
			
				
					
					|  |  |  |   const { ConversationController } = window; |  |  |  |   const { ConversationController } = window; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |   try { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   const content = SignalService.Content.decode(new Uint8Array(plaintext)); |  |  |  |     const content = SignalService.Content.decode(new Uint8Array(plaintext)); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   const blocked = await isBlocked(envelope.source); |  |  |  |     const blocked = await isBlocked(envelope.source); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   if (blocked) { |  |  |  |     if (blocked) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     // We want to allow a blocked user message if that's a control message for a known group and the group is not blocked
 |  |  |  |       // We want to allow a blocked user message if that's a control message for a known group and the group is not blocked
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     if (shouldDropBlockedUserMessage(content)) { |  |  |  |       if (shouldDropBlockedUserMessage(content)) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       window.log.info('Dropping blocked user message'); |  |  |  |         window.log.info('Dropping blocked user message'); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       return; |  |  |  |         return; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     } else { |  |  |  |       } else { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       window.log.info('Allowing group-control message only from blocked user'); |  |  |  |         window.log.info( | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           'Allowing group-control message only from blocked user' | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |     const { FALLBACK_MESSAGE } = SignalService.Envelope.Type; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   const { FALLBACK_MESSAGE } = SignalService.Envelope.Type; |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   await ConversationController.getOrCreateAndWait(envelope.source, 'private'); |  |  |  |     await ConversationController.getOrCreateAndWait(envelope.source, 'private'); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   if (content.preKeyBundleMessage) { |  |  |  |     if (content.preKeyBundleMessage) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     await handleSessionRequestMessage(envelope, content.preKeyBundleMessage); |  |  |  |       await handleSessionRequestMessage(envelope, content.preKeyBundleMessage); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   } else if (envelope.type !== FALLBACK_MESSAGE) { |  |  |  |     } else if (envelope.type !== FALLBACK_MESSAGE) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     const device = new PubKey(envelope.source); |  |  |  |       const device = new PubKey(envelope.source); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     await SessionProtocol.onSessionEstablished(device); |  |  |  |       await SessionProtocol.onSessionEstablished(device); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     await libsession.getMessageQueue().processPending(device); |  |  |  |       await libsession.getMessageQueue().processPending(device); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |     } | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   if (content.pairingAuthorisation) { |  |  |  |     if (content.pairingAuthorisation) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     await handlePairingAuthorisationMessage( |  |  |  |       await handlePairingAuthorisationMessage( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       envelope, |  |  |  |         envelope, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       content.pairingAuthorisation, |  |  |  |         content.pairingAuthorisation, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       content.dataMessage |  |  |  |         content.dataMessage | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     ); |  |  |  |       ); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     return; |  |  |  |       return; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |     } | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   if (content.syncMessage) { |  |  |  |     if (content.syncMessage) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     await handleSyncMessage(envelope, content.syncMessage); |  |  |  |       await handleSyncMessage(envelope, content.syncMessage); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     return; |  |  |  |       return; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |     } | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   if (content.dataMessage) { |  |  |  |     if (content.dataMessage) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     if ( |  |  |  |       if ( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       content.dataMessage.profileKey && |  |  |  |         content.dataMessage.profileKey && | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       content.dataMessage.profileKey.length === 0 |  |  |  |         content.dataMessage.profileKey.length === 0 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     ) { |  |  |  |       ) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       content.dataMessage.profileKey = null; |  |  |  |         content.dataMessage.profileKey = null; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       await handleDataMessage(envelope, content.dataMessage); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       return; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     await handleDataMessage(envelope, content.dataMessage); |  |  |  |     if (content.nullMessage) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     return; |  |  |  |       await handleNullMessage(envelope); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |       return; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   if (content.nullMessage) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     await handleNullMessage(envelope); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     return; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   if (content.callMessage) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     await handleCallMessage(envelope); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     return; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   if (content.receiptMessage) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     await handleReceiptMessage(envelope, content.receiptMessage); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     return; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   if (content.typingMessage) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     if ( |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       content.typingMessage.groupId && |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       content.typingMessage.groupId.length === 0 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     ) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       content.typingMessage.groupId = null; |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     await handleTypingMessage(envelope, content.typingMessage); |  |  |  |     if (content.callMessage) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     return; |  |  |  |       await handleCallMessage(envelope); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       return; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (content.receiptMessage) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       await handleReceiptMessage(envelope, content.receiptMessage); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       return; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (content.typingMessage) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       if ( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         content.typingMessage.groupId && | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         content.typingMessage.groupId.length === 0 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       ) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         content.typingMessage.groupId = null; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       await handleTypingMessage(envelope, content.typingMessage); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       return; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   } catch (e) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     window.log.warn(e); | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   return; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | function onReadReceipt(readAt: any, timestamp: any, reader: any) { |  |  |  | function onReadReceipt(readAt: any, timestamp: any, reader: any) { | 
			
		
	
	
		
		
			
				
					|  |  | 
 |