Esempio n. 1
0
        public virtual async Task Handle(IChatRemovedEvent <TChatInfo> @event, IChatBusContext chatBusContext)
        {
            var notification = ChatsNotificationBuilder.BuildChatRemovedNotification(@event);

            await Notify(@event.ChatId, notification);

            await NotificationRouteService.RemoveChat(@event.ChatId);
        }
Esempio n. 2
0
        public virtual async Task Handle(IChatParticipantBlockedEvent <TChatParticipant> @event, IChatBusContext chatBusContext)
        {
            var notification = ChatParticipantsNotificationBuilder.BuildChatParticipantBlockedNotification(@event);

            await Notify(@event.ChatId, notification);

            await NotificationRouteService.RemoveUserFromChat(@event.Participant.UserId, @event.ChatId);
        }
Esempio n. 3
0
        public virtual async Task Handle(IChatAddedEvent <TChat, TChatInfo, TChatParticipantCollection, TChatParticipant, TChatUser, TChatMessageInfo, TTextMessage, TQuoteMessage, TMessageAttachmentCollection, TMessageAttachment, TChatRefMessageCollection, TChatRefMessage, TContactMessageCollection, TContactMessage> @event, IChatBusContext chatBusContext)
        {
            var userIds = @event.Chat.Participants.Where(r => r.ChatParticipantStatus == ChatParticipantStatus.Active).Select(r => r.UserId);
            await NotificationRouteService.AddUsersToChat(userIds, @event.Chat.ChatId);

            var notification = ChatsNotificationBuilder.BuildChatAddedNotification(@event);

            await Notify(@event.Chat.ChatId, notification);
        }
Esempio n. 4
0
        public virtual async Task Handle(IChatParticipantsAppendedEvent <TParticipationResultCollection, TParticipationResult, TChatParticipant> @event, IChatBusContext chatBusContext)
        {
            var users = @event.Added.Select(r => r.Participant.UserId);
            await NotificationRouteService.AddUsersToChat(users, @event.ChatId);

            var notification = ChatParticipantsNotificationBuilder.BuildChatParticipantsAppendedNotification(@event);

            await Notify(@event.ChatId, notification);
        }