Inheritance: INotifyPropertyChanged
Esempio n. 1
0
        internal void HandleUserLeft(IrcChannelUser channelUser, string comment)
        {
            lock (((ICollection)Users).SyncRoot)
                users.Remove(channelUser);

            OnUserLeft(new IrcChannelUserEventArgs(channelUser, comment));
        }
Esempio n. 2
0
        internal void HandleUserKicked(IrcChannelUser channelUser, string comment)
        {
            lock (((ICollection)this.usersReadOnly).SyncRoot)
                this.users.Remove(channelUser);

            OnUserKicked(new IrcChannelUserEventArgs(channelUser, comment));
        }
Esempio n. 3
0
 public static SRLIRCRights FromIrcChannelUser(IrcChannelUser user)
 {
     if (user.Modes.Contains('o'))
         return SRLIRCRights.Operator;
     else if (user.Modes.Contains('v'))
         return SRLIRCRights.Voice;
     return SRLIRCRights.Normal;
 }
Esempio n. 4
0
 internal void HandleUserNameReply(IrcChannelUser channelUser)
 {
     if (this.users.Contains(channelUser))
     {
         Debug.Fail("User already in channel.");
         return;
     }
     this.users.Add(channelUser);
 }
Esempio n. 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IrcChannelUserEventArgs"/> class.
        /// </summary>
        /// <param name="channelUser">The channel user that the event concerns.</param>
        public IrcChannelUserEventArgs(IrcChannelUser channelUser, string comment)
            : base(comment)
        {
            if (channelUser == null)
            {
                throw new ArgumentNullException("channelUser");
            }

            this.ChannelUser = channelUser;
        }
Esempio n. 6
0
 public static string ColorFromStatus(IrcChannelUser user)
 {
     if (user.Modes.Contains('o'))
         return "Red";
     if (user.Modes.Contains('h'))
         return "Orange";
     if (user.Modes.Contains('v'))
         return "Green";
     return "Black";
 }
Esempio n. 7
0
 internal void HandleUserJoined(IrcChannelUser channelUser)
 {
     if (this.users.Contains(channelUser))
     {
         Debug.Fail("User already in channel.");
         return;
     }
     this.users.Add(channelUser);
     OnUserJoined(new IrcChannelUserEventArgs(channelUser, null));
 }
Esempio n. 8
0
        internal void HandleUserNameReply(IrcChannelUser channelUser)
        {
            lock (((ICollection)Modes).SyncRoot)
            {
                if (users.Contains(channelUser))
                {
#if SILVERLIGHT
#else
                    Debug.Fail("User already in channel.");
#endif
                    return;
                }
            }

            channelUser.Channel = this;
            lock (((ICollection)Users).SyncRoot)
                users.Add(channelUser);
        }
Esempio n. 9
0
        internal void HandleUserNameReply(IrcChannelUser channelUser)
        {
            lock (((ICollection)this.modesReadOnly).SyncRoot)
            {
                if (this.users.Contains(channelUser))
                {
#if SILVERLIGHT
                    Debug.Assert(false, "User already in channel.");
#else
                    Debug.Fail("User already in channel.");
#endif
                    return;
                }
            }

            channelUser.Channel = this;
            lock (((ICollection)this.usersReadOnly).SyncRoot)
                this.users.Add(channelUser);
        }
Esempio n. 10
0
        internal void HandleUserJoined(IrcChannelUser channelUser)
        {
            lock (((ICollection)Modes).SyncRoot)
            {
                if (users.Contains(channelUser))
                {
#if SILVERLIGHT
#else
                    Debug.Fail("User already in channel.");
#endif
                    return;
                }
            }

            channelUser.Channel = this;
            lock (((ICollection)Users).SyncRoot)
                users.Add(channelUser);

            OnUserJoined(new IrcChannelUserEventArgs(channelUser, null));
        }
Esempio n. 11
0
        internal void HandleUserKicked(IrcChannelUser channelUser, string comment)
        {
            lock (((ICollection) Users).SyncRoot)
                users.Remove(channelUser);

            OnUserKicked(new IrcChannelUserEventArgs(channelUser, comment));
        }
Esempio n. 12
0
 internal void HandleUserQuit(IrcChannelUser channelUser)
 {
     lock (((ICollection)this.usersReadOnly).SyncRoot)
         this.users.Remove(channelUser);
 }
Esempio n. 13
0
        protected void ProcessMessageReplyWhoReply(IrcMessage message)
        {
            Debug.Assert(message.Parameters[0] == this.localUser.NickName);

            Debug.Assert(message.Parameters[1] != null);
            var channel = message.Parameters[1] == "*" ? null : GetChannelFromName(message.Parameters[1]);

            Debug.Assert(message.Parameters[5] != null);
            var user = GetUserFromNickName(message.Parameters[5]);

            Debug.Assert(message.Parameters[2] != null);
            var userName = message.Parameters[2];

            Debug.Assert(message.Parameters[3] != null);
            user.HostName = message.Parameters[3];
            Debug.Assert(message.Parameters[4] != null);
            user.ServerName = message.Parameters[4];

            Debug.Assert(message.Parameters[6] != null);
            var userModeFlags = message.Parameters[6];

            Debug.Assert(userModeFlags.Length > 0);
            if (userModeFlags.Contains('H'))
            {
                user.IsAway = false;
            }
            else if (userModeFlags.Contains('G'))
            {
                user.IsAway = true;
            }
            user.IsOperator = userModeFlags.Contains('*');
            if (channel != null)
            {
                // Add user to channel if it does not already exist in it.
                var channelUser = channel.GetChannelUser(user);
                if (channelUser == null)
                {
                    channelUser = new IrcChannelUser(user);
                    channel.HandleUserJoined(channelUser);
                }

                // Set modes on user corresponding to given mode flags (prefix characters).
                foreach (var c in userModeFlags)
                {
                    char mode;
                    if (this.channelUserModesPrefixes.TryGetValue(c, out mode))
                    {
                        channelUser.HandleModeChanged(true, mode);
                    }
                    else
                    {
                        break;
                    }
                }
            }

            Debug.Assert(message.Parameters[7] != null);
            var lastParamParts = message.Parameters[7].SplitAtIndex(message.Parameters[7].IndexOf(' '));

            user.HopCount = int.Parse(lastParamParts.Item1);
            if (lastParamParts.Item2 != null)
            {
                user.RealName = lastParamParts.Item2;
            }
        }
        private IUser CreateUser(IrcChannelUser ircChannelUser, IChannel channel)
        {
            IUser user;

            if (!this.users.TryGetValue(ircChannelUser.User, out user))
            {
                user = new User
                {
                    Nickname = ircChannelUser.User.NickName,
                    Hostname = ircChannelUser.User.HostName,
                    Modes = ircChannelUser.Modes.Join(),
                    IsAway = ircChannelUser.User.IsAway,
                    Network = channel.Network,
                };

                IrcUser ircUser = ircChannelUser.User;

                ircUser.NickNameChanged += ircUser_NickNameChanged;
                ircUser.IsAwayChanged += ircUser_IsAwayChanged;
                ircUser.Quit += ircUser_Quit;

                this.users.Add(user, ircUser);
            }

            IChannelUser channelUser = new ChannelUser
            {
                User = user,
            };

            Application.Current.Dispatcher.InvokeAsync(() =>
            {
                channel.Users.Add(channelUser);
                user.Channels.Add(channel);
                this.client.Users.Add(user);
            });

            return user;
        }
        internal void HandleUserQuit(IrcChannelUser channelUser, string comment)
        {
			lock (this.modesReadOnly)
                this.users.Remove(channelUser);
        }
        internal void HandleUserKicked(IrcChannelUser channelUser, string comment)
        {
			lock (this.modesReadOnly)
                this.users.Remove(channelUser);

            OnUserKicked(new IrcChannelUserEventArgs(channelUser, comment));
        }
Esempio n. 17
0
        private bool CheckModeratorStatus(IrcChannelUser chanUser)
        {
            if (chanUser.Modes.Contains('o'))
            {
                m_chanData.AddModerator(chanUser.User.NickName.ToLower());
                return true;
            }

            return false;
        }
Esempio n. 18
0
 public void WhoIs(IrcChannelUser user)
 {
     this.WhoIs(user.User.NickName);
 }
Esempio n. 19
0
        public void Query(IrcChannelUser user)
        {
            IrcQueryViewModel ipcvm = null;
              foreach (var item in (this.Parent as IrcNetworkViewModel).Items)
              {
            if (item.DisplayName == user.User.NickName)
            {
              ipcvm = item;
            }
              }

              if (ipcvm == null)
              {
            ipcvm = new IrcQueryViewModel(user.User, this.Channel.Client, this.Settings);
            (this.Parent as IrcNetworkViewModel).Items.Add(ipcvm);
              }

              (this.Parent as IrcNetworkViewModel).ActivateItem(ipcvm);
        }
Esempio n. 20
0
 internal void HandleUserQuit(IrcChannelUser channelUser, string comment)
 {
     lock (((ICollection) Users).SyncRoot)
         users.Remove(channelUser);
 }
Esempio n. 21
0
 internal void HandleUserQuit(IrcChannelUser channelUser)
 {
     this.users.Remove(channelUser);
 }
Esempio n. 22
0
 internal void HandleUserQuit(IrcChannelUser channelUser, string comment)
 {
     lock (((ICollection)Users).SyncRoot)
         users.Remove(channelUser);
 }
Esempio n. 23
0
        private void CheckModeratorStatus(IrcChannelUser chanUser)
        {
            string username = chanUser.User.NickName;

            bool op = chanUser.Modes.Contains('o');
            TwitchUser user = m_data.GetUser(username, op);

            if (user != null)
            {
                if (op)
                {
                    if (!m_mods.Contains(user))
                    {
                        OnInformModerator(user, true);
                        m_mods.Add(user);
                    }
                }
                else
                {
                    if (m_mods.Contains(user))
                    {
                        OnInformModerator(user, false);
                        m_mods.Remove(user);
                    }
                }
            }
        }
Esempio n. 24
0
 public static double OpacityFromStatus(IrcChannelUser user)
 {
     if (user.User.IsAway == true)
         return 0.4;
     return 1;
 }
Esempio n. 25
0
        /// <inheritdoc/>
        /// <summary>
        /// Initializes a new instance of the <see cref="IrcChannelUserEventArgs"/> class.
        /// </summary>
        /// <param name="channelUser">The channel user that the event concerns.</param>
        public IrcChannelUserEventArgs(IrcChannelUser channelUser, string comment = null)
            : base(comment)
        {
            if (channelUser == null)
                throw new ArgumentNullException("channelUser");

            this.ChannelUser = channelUser;
        }
Esempio n. 26
0
 public static int Compare(IrcChannelUser x, IrcChannelUser y)
 {
     return string.Compare(x.User.NickName, y.User.NickName);
 }
Esempio n. 27
0
        internal void HandleUserLeft(IrcChannelUser channelUser, string comment)
        {
            lock (((ICollection)this.usersReadOnly).SyncRoot)
                this.users.Remove(channelUser);

            OnUserLeft(new IrcChannelUserEventArgs(channelUser, comment));
        }
Esempio n. 28
0
 internal void HandleUserKicked(IrcChannelUser channelUser, string comment)
 {
     OnUserKicked(new IrcChannelUserEventArgs(channelUser, comment));
     this.users.Remove(channelUser);
 }
Esempio n. 29
0
 internal void HandleUserQuit(IrcChannelUser channelUser)
 {
     lock (((ICollection)this.usersReadOnly).SyncRoot)
         this.users.Remove(channelUser);
 }
 internal void HandleUserNameReply(IrcChannelUser channelUser)
 {
     if (this.users.Contains(channelUser))
     {
         Debug.Fail("User already in channel.");
         return;
     }
     this.users.Add(channelUser);
 }
Esempio n. 31
0
        internal void HandleUserJoined(IrcChannelUser channelUser)
        {
            lock (((ICollection) Modes).SyncRoot)
            {
                if (users.Contains(channelUser))
                {
            #if SILVERLIGHT
                Debug.Assert(false, "User already in channel.");
            #else
                    Debug.Fail("User already in channel.");
            #endif
                    return;
                }
            }

            channelUser.Channel = this;
            lock (((ICollection) Users).SyncRoot)
                users.Add(channelUser);

            OnUserJoined(new IrcChannelUserEventArgs(channelUser, null));
        }
Esempio n. 32
0
        internal void HandleUserJoined(IrcChannelUser channelUser)
        {
            lock (((ICollection)this.modesReadOnly).SyncRoot)
            {
                if (this.users.Contains(channelUser))
                {
            #if WINDOWS_UWP
                Debug.Assert(false, "User already in channel.");
            #else
                    Debug.Fail("User already in channel.");
            #endif
                    return;
                }
            }

            channelUser.Channel = this;
            lock (((ICollection)this.usersReadOnly).SyncRoot)
                this.users.Add(channelUser);

            OnUserJoined(new IrcChannelUserEventArgs(channelUser, null));
        }
 internal void HandleUserJoined(IrcChannelUser channelUser)
 {
     if (this.users.Contains(channelUser))
     {
         Debug.Fail("User already in channel.");
         return;
     }
     this.users.Add(channelUser);
     OnUserJoined(new IrcChannelUserEventArgs(channelUser, null));
 }
Esempio n. 34
0
        internal void HandleUserNameReply(IrcChannelUser channelUser)
        {
            lock (((ICollection)this.modesReadOnly).SyncRoot)
            {
                if (this.users.Contains(channelUser))
                {
            #if SILVERLIGHT
                    Debug.Assert(false, "User already in channel.");
            #else
                    Debug.Fail("User already in channel.");
            #endif
                    return;
                }
            }

            channelUser.Channel = this;
            lock (((ICollection)this.usersReadOnly).SyncRoot)
                this.users.Add(channelUser);
        }
 internal void HandleUserKicked(IrcChannelUser channelUser, string comment)
 {
     OnUserKicked(new IrcChannelUserEventArgs(channelUser, comment));
     this.users.Remove(channelUser);
 }
        protected internal void ProcessMessageReplyWhoReply(IrcMessage message)
        {
            Debug.Assert(message.Parameters[0] == localUser.NickName);

            Debug.Assert(message.Parameters[1] != null);
            var channel = message.Parameters[1] == "*" ? null : GetChannelFromName(message.Parameters[1]);

            Debug.Assert(message.Parameters[5] != null);
            var user = GetUserFromNickName(message.Parameters[5]);

            Debug.Assert(message.Parameters[2] != null);
            var userName = message.Parameters[2];
            Debug.Assert(message.Parameters[3] != null);
            user.HostName = message.Parameters[3];
            Debug.Assert(message.Parameters[4] != null);
            user.ServerName = message.Parameters[4];

            Debug.Assert(message.Parameters[6] != null);
            var userModeFlags = message.Parameters[6];
            Debug.Assert(userModeFlags.Length > 0);
            if (userModeFlags.Contains('H'))
                user.IsAway = false;
            else if (userModeFlags.Contains('G'))
                user.IsAway = true;
            user.IsOperator = userModeFlags.Contains('*');
            if (channel != null)
            {
                // Add user to channel if it does not already exist in it.
                var channelUser = channel.GetChannelUser(user);
                if (channelUser == null)
                {
                    channelUser = new IrcChannelUser(user);
                    channel.HandleUserJoined(channelUser);
                }

                // Set modes on user corresponding to given mode flags (prefix characters).
                foreach (var c in userModeFlags)
                {
                    char mode;
                    if (channelUserModesPrefixes.TryGetValue(c, out mode))
                        channelUser.HandleModeChanged(true, mode);
                    else
                        break;
                }
            }

            Debug.Assert(message.Parameters[7] != null);
            var lastParamParts = message.Parameters[7].SplitIntoPair(" ");
            user.HopCount = int.Parse(lastParamParts.Item1);
            if (lastParamParts.Item2 != null)
                user.RealName = lastParamParts.Item2;
        }
 internal void HandleUserQuit(IrcChannelUser channelUser)
 {
     this.users.Remove(channelUser);
 }