Beispiel #1
0
        public void handle(TextSecureEnvelope 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.isPreKeyWhisperMessage() || envelope.isWhisperMessage())
            {
                handleMessage(envelope, sendExplicitReceipt);
            }
            else
            {
                Log.Warn($"Received envelope of unknown type: {envelope.GetType()}");
            }
        }
Beispiel #2
0
        public void setNumber(ContactTokenDetails token, bool active)
        {
            Directory dir = new Directory()
            {
                Number = token.getNumber(),
                Relay = token.getRelay(),
                Registered = active ? (uint)1 : 0,
                //supports_sms = token.isSupportsSms() ? (uint)1 : 0,
                Time = TimeUtil.GetDateTimeMillis()
            };

            conn.InsertOrReplace(dir);
        }