public ConfirmIdentityDialog(MessageRecord record)
        {
            this.InitializeComponent();
            this._messageRecord = record;

            if (record.MismatchedIdentities == null) CancelCommand.Execute(null);

            if (record.MismatchedIdentities != null) mismatch = record.MismatchedIdentities[0];
        }
Пример #2
0
        public void AddMismatchedIdentity(long messageId, long recipientId, IdentityKey identityKey)
        {
            var mismatch = new IdentityKeyMismatch(recipientId, identityKey);


            var message = conn.Get <Message>(messageId);

            var temp = message.MismatchedIdentities ?? new List <IdentityKeyMismatch>();

            temp.Add(mismatch);

            message.MismatchedIdentities = temp;

            conn.Update(message);
        }
Пример #3
0
        public override bool Equals(object other)
        {
            if (other == null)
            {
                return(false);
            }
            if (!(other is IdentityKeyMismatch))
            {
                return(false);
            }

            IdentityKeyMismatch that = (IdentityKeyMismatch)other;

            return(this.RecipientId.Equals(that.RecipientId) && this.IdentityKey.serialize().Equals(that.IdentityKey.serialize()));
        }
        private void processPendingMessageRecords(long threadId, IdentityKeyMismatch mismatch)
        {
            var messageDatabase = DatabaseFactory.getMessageDatabase();
            var conflictMessages = messageDatabase.getIdentityConflictMessagesForThread(threadId);
 

            foreach (var record in conflictMessages)
            {
                foreach (var recordMismatch in record.MismatchedIdentities)
                {
                    Log.Debug($"This: {mismatch.IdentityKey.getFingerprint()} That:{recordMismatch.IdentityKey.getFingerprint()}");
                    if (mismatch.Equals(recordMismatch))
                    {
                        processMessageRecord(record);
                    }
                }
            }

        }
Пример #5
0
        public void RemoveMismatchedIdentity(long messageId, long recipientId, IdentityKey identityKey)
        {
            var mismatch = new IdentityKeyMismatch(recipientId, identityKey);


            var message = conn.Get <Message>(messageId);

            var temp = message.MismatchedIdentities;

            foreach (var identity in temp)
            {
                if (identity.Equals(mismatch))
                {
                    temp.Remove(identity);
                }
            }
            message.MismatchedIdentities = temp;

            conn.Update(message);
        }