Ejemplo n.º 1
0
        public void handle(SignalServiceEnvelope envelope, bool sendExplicitReceipt)
        {
            if (!isActiveNumber(envelope.getSource()))
            {
                TextSecureDirectory directory           = DatabaseFactory.getDirectoryDatabase();
                ContactTokenDetails contactTokenDetails = new ContactTokenDetails();
                contactTokenDetails.setNumber(envelope.getSource());

                directory.setNumber(contactTokenDetails, true);

                // TODO: evtl DirectoryRefresh
            }

            if (envelope.isReceipt())
            {
                handleReceipt(envelope);
            }
            else if (envelope.isPreKeySignalMessage() || envelope.isSignalMessage())
            {
                handleMessage(envelope, sendExplicitReceipt);
            }
            else
            {
                Log.Warn($"Received envelope of unknown type: {envelope.GetType()}");
            }
        }
Ejemplo n.º 2
0
 public void OnMessage(SignalServiceMessagePipeMessage message)
 {
     if (message is SignalServiceEnvelope)
     {
         SignalServiceEnvelope envelope = (SignalServiceEnvelope)message;
         List <SignalMessage>  messages = new List <SignalMessage>();
         if (envelope.isReceipt())
         {
             SignalDBContext.IncreaseReceiptCountLocked(envelope, this);
         }
         else if (envelope.isPreKeySignalMessage() || envelope.isSignalMessage())
         {
             HandleMessage(envelope);
         }
         else
         {
             Debug.WriteLine("received message of unknown type " + envelope.getType() + " from " + envelope.getSource());
         }
     }
 }