Ejemplo n.º 1
0
        public void SetEphemeral(MatrixSyncEvents matrixSyncEvents)
        {
            if (matrixSyncEvents == null)
            {
                throw new ArgumentNullException(nameof(matrixSyncEvents));
            }

            _ephemeral = matrixSyncEvents.Events;

            foreach (var matrixEvent in _ephemeral)
            {
                switch (matrixEvent)
                {
                case ReceiptEvent receiptEvent:
                    var rec = receiptEvent.Content;
                    foreach (var(eventId, receiptedUsers) in rec.ReceiptedEvents)
                    {
                        OnReceiptsReceived?.Invoke(eventId, receiptedUsers);
                    }
                    break;

                //case TypingEvent typingEvent:
                //    OnTypingChanged?.Invoke(typingEvent.Content.UserIds);
                //    break;

                default:
                    continue;
                }
            }
            ;

            OnEphemeralChanged?.Invoke();
        }
Ejemplo n.º 2
0
 public void SetEphemeral(MatrixSyncEvents ev)
 {
     ephemeral = ev.events;
     foreach (MatrixEvent evt in ephemeral)
     {
         if (evt.type == "m.reciept" && OnRecieptsRecieved != null)
         {
             MatrixMReceipt rec = (MatrixMReceipt)evt.content;
             foreach (KeyValuePair <string, MatrixReceipts> kv in rec.receipts)
             {
                 OnRecieptsRecieved.Invoke(kv.Key, kv.Value);
             }
         }
         else if (evt.type == "m.typing" && OnTypingChanged != null)
         {
             OnTypingChanged.Invoke(((MatrixMTyping)evt.content).user_ids);
         }
     }
     if (OnEphemeralChanged != null)
     {
         OnEphemeralChanged.Invoke();
     }
 }