internal void HandleUserLeft(IrcChannelUser channelUser, string comment) { lock (((ICollection)Users).SyncRoot) users.Remove(channelUser); OnUserLeft(new IrcChannelUserEventArgs(channelUser, comment)); }
internal void HandleUserKicked(IrcChannelUser channelUser, string comment) { lock (((ICollection)this.usersReadOnly).SyncRoot) this.users.Remove(channelUser); OnUserKicked(new IrcChannelUserEventArgs(channelUser, comment)); }
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; }
internal void HandleUserNameReply(IrcChannelUser channelUser) { if (this.users.Contains(channelUser)) { Debug.Fail("User already in channel."); return; } this.users.Add(channelUser); }
/// <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; }
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"; }
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)); }
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); }
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 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)); }
internal void HandleUserKicked(IrcChannelUser channelUser, string comment) { lock (((ICollection) Users).SyncRoot) users.Remove(channelUser); OnUserKicked(new IrcChannelUserEventArgs(channelUser, comment)); }
internal void HandleUserQuit(IrcChannelUser channelUser) { lock (((ICollection)this.usersReadOnly).SyncRoot) this.users.Remove(channelUser); }
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)); }
private bool CheckModeratorStatus(IrcChannelUser chanUser) { if (chanUser.Modes.Contains('o')) { m_chanData.AddModerator(chanUser.User.NickName.ToLower()); return true; } return false; }
public void WhoIs(IrcChannelUser user) { this.WhoIs(user.User.NickName); }
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); }
internal void HandleUserQuit(IrcChannelUser channelUser, string comment) { lock (((ICollection) Users).SyncRoot) users.Remove(channelUser); }
internal void HandleUserQuit(IrcChannelUser channelUser) { this.users.Remove(channelUser); }
internal void HandleUserQuit(IrcChannelUser channelUser, string comment) { lock (((ICollection)Users).SyncRoot) users.Remove(channelUser); }
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); } } } }
public static double OpacityFromStatus(IrcChannelUser user) { if (user.User.IsAway == true) return 0.4; return 1; }
/// <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; }
public static int Compare(IrcChannelUser x, IrcChannelUser y) { return string.Compare(x.User.NickName, y.User.NickName); }
internal void HandleUserLeft(IrcChannelUser channelUser, string comment) { lock (((ICollection)this.usersReadOnly).SyncRoot) this.users.Remove(channelUser); OnUserLeft(new IrcChannelUserEventArgs(channelUser, comment)); }
internal void HandleUserKicked(IrcChannelUser channelUser, string comment) { OnUserKicked(new IrcChannelUserEventArgs(channelUser, comment)); this.users.Remove(channelUser); }
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)); }
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)); }
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; }