/// <summary> /// Gets the <see cref="IrcUser"/>'s channel mode on the specified <see cref="IrcChannel"/>. /// </summary> /// <param name="channel">The <see cref="IrcChannel"/>.</param> /// <returns>The <see cref="IrcUser"/>'s channel mode on the specified <see cref="IrcChannel"/>.</returns> /// <remarks>This method may not return a correct result if the current <see cref="IrcUser"/> is not in the specified <see cref="IrcChannel"/>.</remarks> public IrcChannelUserModes GetChannelMode(IrcChannel channel) { Validate.IsNotNull(channel, "channel"); if (channel.Users.Contains(this)) { return(channel.UserModes[this]); } return(IrcChannelUserModes.Normal); }
/// <summary> /// Gets a known <see cref="IrcChannel"/> from its name. /// </summary> /// <param name="name">The channel name.</param> /// <returns>The <see cref="IrcChannel"/>.</returns> public IrcChannel GetChannel(string name) { Validate.IsNotDisposed(this._disposed); Validate.HasText(name, "name"); IrcValidate.IsChannelName(name, this.Parameters, "name"); IrcValidate.IsConnected(this.IsConnected); var channel = this.KnownChannels.FirstOrDefault(chan => this.Parameters.CaseMapping.AreEqual(chan.FullName, name)); if (channel == null) { channel = new IrcChannel(this.Client, this, name); this.KnownChannelsInternal.Add(channel); } return(channel); }
/// <summary> /// Delays the sending of a NAMES query /// </summary> private async void DelaySendNames(IrcChannel channel) { if (this._delayedNamesChannels.Contains(channel)) { return; } this._delayedNamesChannels.Add(channel); await Task.Delay(JoinNamesDelay); if (this._delayedNamesChannels.Contains(channel)) { channel.GetUserList(); this._delayedNamesChannels.Remove(channel); } }
public static void WhoIsChannel(IrcClient client, IrcMessage message) { var user = client.Network.GetUser(message.CommandArguments[1]); foreach (string chanName in message.Content.Split(IrcUtils.MessagePartsSeparatorArray, StringSplitOptions.RemoveEmptyEntries)) { var pair = IrcChannel.GuessChannelName(chanName, client.Network.Parameters); var channel = client.Network.GetChannel(pair.Name); if (!channel.Users.Contains(user)) { channel.AddUser(user); } channel.UserModes[user] = IrcChannel.GetUserMode(pair.Modifier, client.Network.Parameters); client._tempInfo.WhoIsReplies[user].ChannelsInternal.Add(channel); } }
internal ChannelEventArgs(IrcChannel channel) { this.Channel = channel; }
internal void OnChannelDiscovered(IrcChannel channel) { this.Raise(this.ChannelDiscovered, new ChannelEventArgs(channel)); }