Esempio n. 1
0
 public User(Bouncer.User native)
 {
     Bot                          = native.bot;
     CreatedAt                    = native.createdAt;
     FirstMessageTime             = native.firstMessageTime;
     FirstMessageTimeThisInstance = native.firstMessageTimeThisInstance;
     NeedsGreeting                = native.needsGreeting;
     Id                      = native.id;
     IsBanned                = native.isBanned;
     IsJoined                = native.isJoined;
     IsNewAccount            = native.isNewAccount;
     IsRecentChatter         = native.isRecentChatter;
     Watching                = native.watching;
     IsWhitelisted           = native.isWhitelisted;
     JoinTime                = native.joinTime;
     LastMessageTime         = native.lastMessageTime;
     Login                   = native.login;
     Name                    = native.name;
     Note                    = native.note;
     PartTime                = native.partTime;
     TotalViewTime           = native.totalViewTime;
     NumMessages             = native.numMessages;
     NumMessagesThisInstance = native.numMessagesThisInstance;
     Role                    = native.role;
     Timeout                 = native.timeout;
     for (int i = 0; i < native.lastChat.Count; ++i)
     {
         LastChat.Add(native.lastChat[i]);
     }
 }
Esempio n. 2
0
        private bool FilterUser(Bouncer.User user)
        {
            bool show = false;

            if (ShowAllViewers)
            {
                return(true);
            }
            switch (user.bot)
            {
            case Bouncer.User.Bot.Yes:
                if (ShowKnownBotViewers)
                {
                    show = true;
                }
                break;

            case Bouncer.User.Bot.No:
                if (ShowNonBotViewers)
                {
                    show = true;
                }
                break;

            default:
                if (ShowPossibleBotViewers)
                {
                    show = true;
                }
                break;
            }
            if (!show)
            {
                return(false);
            }
            show = false;
            if (user.isBanned)
            {
                if (ShowBannedViewers)
                {
                    show = true;
                }
            }
            else if (user.timeout != 0.0)
            {
                if (ShowTimedOutViewers)
                {
                    show = true;
                }
            }
            else
            {
                if (ShowNonTimedOutViewers)
                {
                    show = true;
                }
            }
            if (!show)
            {
                return(false);
            }
            show = false;
            switch (user.role)
            {
            case Bouncer.User.Role.Staff:
            case Bouncer.User.Role.Admin:
            case Bouncer.User.Role.Broadcaster:
            case Bouncer.User.Role.Moderator:
                if (ShowModViewers)
                {
                    show = true;
                }
                break;

            case Bouncer.User.Role.VIP:
                if (ShowVipViewers)
                {
                    show = true;
                }
                break;

            case Bouncer.User.Role.Pleb:
                if (ShowPlebViewers)
                {
                    show = true;
                }
                break;

            default:
                if (ShowUnknownViewers)
                {
                    show = true;
                }
                break;
            }
            if (!show)
            {
                return(false);
            }
            show = false;
            if (user.isJoined)
            {
                if (ShowCurrentViewers)
                {
                    show = true;
                }
                if (user.numMessagesThisInstance == 0)
                {
                    if (ShowLurkingViewers)
                    {
                        show = true;
                    }
                }
                else
                {
                    if (ShowChattingViewers)
                    {
                        show = true;
                    }
                    if (
                        ShowRecentlyChattingViewers &&
                        user.isRecentChatter
                        )
                    {
                        show = true;
                    }
                }
            }
            else
            {
                if (ShowMissingViewers)
                {
                    show = true;
                }
            }
            if (!show)
            {
                return(false);
            }
            show = false;
            if (user.isWhitelisted)
            {
                if (ShowWhitelistedViewers)
                {
                    show = true;
                }
            }
            else
            {
                if (ShowNonWhitelistedViewers)
                {
                    show = true;
                }
            }
            if (!show)
            {
                return(false);
            }
            show = false;
            if (user.watching)
            {
                if (ShowWatchedViewers)
                {
                    show = true;
                }
            }
            else
            {
                if (ShowUnwatchedViewers)
                {
                    show = true;
                }
            }
            if (!show)
            {
                return(false);
            }
            show = false;
            if (user.isNewAccount)
            {
                if (ShowNewAccounts)
                {
                    show = true;
                }
            }
            else
            {
                if (ShowOldAccounts)
                {
                    show = true;
                }
            }
            return(show);
        }
Esempio n. 3
0
        public void Update(Bouncer.User native)
        {
            if (Bot != native.bot)
            {
                Bot = native.bot;
                NotifyPropertyChanged("Bot");
                NotifyPropertyChanged("MarkBotMenuItemVisibility");
                NotifyPropertyChanged("MarkNotBotMenuItemVisibility");
                NotifyPropertyChanged("MarkPossibleBotMenuItemVisibility");
            }
            if (CreatedAt != native.createdAt)
            {
                CreatedAt = native.createdAt;
                NotifyPropertyChanged("CreatedAt");
                NotifyPropertyChanged("CreatedAtFormatted");
            }
            if (FirstMessageTime != native.firstMessageTime)
            {
                FirstMessageTime = native.firstMessageTime;
                NotifyPropertyChanged("FirstMessageTime");
                NotifyPropertyChanged("FirstMessageTimeFormatted");
                if (FirstMessageTimeThisInstance == native.firstMessageTimeThisInstance)
                {
                    NotifyPropertyChanged("FirstMessageTimeReport");
                }
            }
            if (FirstMessageTimeThisInstance != native.firstMessageTimeThisInstance)
            {
                FirstMessageTimeThisInstance = native.firstMessageTimeThisInstance;
                NotifyPropertyChanged("FirstMessageTimeThisInstance");
                NotifyPropertyChanged("FirstMessageTimeReport");
            }
            if (NeedsGreeting != native.needsGreeting)
            {
                NeedsGreeting = native.needsGreeting;
                NotifyPropertyChanged("NeedsGreeting");
                NotifyPropertyChanged("NeedsGreetingImage");
            }
            if (Id != native.id)
            {
                Id = native.id;
                NotifyPropertyChanged("Id");
            }
            if (IsBanned != native.isBanned)
            {
                IsBanned = native.isBanned;
                NotifyPropertyChanged("IsBanned");
                NotifyPropertyChanged("Foreground");
                NotifyPropertyChanged("BanMenuItemVisibility");
                NotifyPropertyChanged("UnbanMenuItemVisibility");
            }
            if (IsNewAccount != native.isNewAccount)
            {
                IsNewAccount = native.isNewAccount;
                NotifyPropertyChanged("IsNewAccount");
                NotifyPropertyChanged("Foreground");
            }
            if (IsRecentChatter != native.isRecentChatter)
            {
                IsRecentChatter = native.isRecentChatter;
                NotifyPropertyChanged("IsRecentChatter");
                NotifyPropertyChanged("Foreground");
            }
            if (IsWhitelisted != native.isWhitelisted)
            {
                IsWhitelisted = native.isWhitelisted;
                NotifyPropertyChanged("IsWhitelisted");
                NotifyPropertyChanged("WhitelistMenuItemVisibility");
                NotifyPropertyChanged("UnwhitelistMenuItemVisibility");
            }
            if (IsJoined != native.isJoined)
            {
                IsJoined = native.isJoined;
                NotifyPropertyChanged("IsJoined");
            }
            if (Watching != native.watching)
            {
                Watching = native.watching;
                NotifyPropertyChanged("Watching");
                NotifyPropertyChanged("Foreground");
                NotifyPropertyChanged("StartWatchingMenuItemVisibility");
                NotifyPropertyChanged("StopWatchingMenuItemVisibility");
            }
            if (JoinTime != native.joinTime)
            {
                JoinTime = native.joinTime;
                NotifyPropertyChanged("JoinTime");
                NotifyPropertyChanged("JoinTimeFormatted");
            }
            if (LastMessageTime != native.lastMessageTime)
            {
                LastMessageTime = native.lastMessageTime;
                NotifyPropertyChanged("LastMessageTime");
                NotifyPropertyChanged("LastMessageTimeFormatted");
            }
            if (Login != native.login)
            {
                Login = native.login;
                NotifyPropertyChanged("Login");
            }
            if (Name != native.name)
            {
                Name = native.name;
                NotifyPropertyChanged("Name");
                NotifyPropertyChanged("WindowTitle");
                NotifyPropertyChanged("BanMenuItemHeader");
                NotifyPropertyChanged("UnbanMenuItemHeader");
                NotifyPropertyChanged("StartWatchingMenuItemHeader");
                NotifyPropertyChanged("StopWatchingMenuItemHeader");
                NotifyPropertyChanged("UnwhitelistMenuItemHeader");
                NotifyPropertyChanged("WhitelistMenuItemHeader");
            }
            if (Note != native.note)
            {
                Note = native.note;
                NotifyPropertyChanged("Note");
            }
            if (PartTime != native.partTime)
            {
                PartTime = native.partTime;
                NotifyPropertyChanged("PartTime");
                NotifyPropertyChanged("PartTimeFormatted");
            }
            if (TotalViewTime != native.totalViewTime)
            {
                TotalViewTime = native.totalViewTime;
                NotifyPropertyChanged("TotalViewTime");
                NotifyPropertyChanged("TotalViewTimeFormatted");
            }
            if (NumMessages != native.numMessages)
            {
                NumMessages = native.numMessages;
                NotifyPropertyChanged("NumMessages");
                if (NumMessagesThisInstance != native.numMessagesThisInstance)
                {
                    NotifyPropertyChanged("NumMessagesReport");
                }
            }
            if (NumMessagesThisInstance != native.numMessagesThisInstance)
            {
                NumMessagesThisInstance = native.numMessagesThisInstance;
                NotifyPropertyChanged("NumMessagesThisInstance");
                NotifyPropertyChanged("NumMessagesReport");
            }
            if (Role != native.role)
            {
                Role = native.role;
                NotifyPropertyChanged("Role");
            }
            if (Timeout != native.timeout)
            {
                Timeout = native.timeout;
                NotifyPropertyChanged("Timeout");
                NotifyPropertyChanged("TimeoutFormatted");
                NotifyPropertyChanged("Foreground");
            }
            while (
                (LastChat.Count > 0) &&
                (
                    (native.lastChat.Count == 0) ||
                    (LastChat[0] != native.lastChat[0])
                )
                )
            {
                LastChat.RemoveAt(0);
            }
            int i = 0;

            while (
                (i < native.lastChat.Count) &&
                (i < LastChat.Count) &&
                (LastChat[i] == native.lastChat[i])
                )
            {
                ++i;
            }
            while (i < LastChat.Count)
            {
                LastChat.RemoveAt(i);
            }
            while (i < native.lastChat.Count)
            {
                LastChat.Add(native.lastChat[i]);
                ++i;
            }
        }