/// <summary> /// Raises the NewEmote event. /// </summary> /// <param name="e">The event data.</param> protected void OnNewEmote(CtcpEventArgs e) { if (e != null) { NewEmote?.Invoke(this, e); } }
/// <summary> /// Event handling method for the <see cref="Irc.IrcClient.CtcpReceived"/> event. /// </summary> /// <param name="sender">The <see cref="Irc.IIrcxProtocol"/> object raising the event.</param> /// <param name="e">The event data for the event.</param> protected override void OnCtcpReceived(object sender, CtcpEventArgs e) { if (e == null) { throw new ArgumentNullException(nameof(e)); } if (e.MessageTarget is IrcNickname && e.CtcpCommand == CtcpCommands.ACTION) { if ((IrcNickname)e.MessageTarget == Client.Nickname && RemoteUser.Nickname == e.Nickname) { OnNewEmote(e); } } }
/// <summary> /// Emotes to the remote user. /// </summary> /// <param name="message">The message to send.</param> /// <exception cref="System.InvalidOperationException">Throw if ConnectionState is not Registered.</exception> /// <exception cref="System.IO.IOException">Thrown if there is a problem communicating with the server.</exception> /// <exception cref="System.ArgumentNullException">Thrown if message is null or empty.</exception> /// <exception cref="System.ObjectDisposedException">Thrown if the object has been disposed of.</exception> public virtual void Emote(string message) { if (_isDisposed) { throw new ObjectDisposedException(this.GetType().ToString()); } if (string.IsNullOrEmpty(message)) { throw new ArgumentNullException(nameof(message)); } Client.CtcpAction(TargetName, message); CtcpEventArgs pmea = new CtcpEventArgs(Client.Nickname, TargetName) { UserName = Client.Username, RealName = Client.RealName, Message = message, IsLocalEcho = true }; OnNewEmote(pmea); }
/// <summary> /// Event handling method for <see cref="Irc.Ctcp.ICtcp.CtcpReceived"/> event. To be /// overridden in derived classes. /// </summary> /// <param name="sender">The <see cref="Irc.Ctcp.ICtcp"/> object raising the event.</param> /// <param name="e">The event data for the event.</param> protected abstract void OnCtcpReceived(object sender, CtcpEventArgs e);