IRC server error replies handler
Handler of the IRC server error replies. See rfc1459 6.1 for details.
This commit is contained in:
parent
d11905962f
commit
4a498fc429
|
@ -46,6 +46,7 @@
|
|||
<Compile Include="Events\ChannelEventArgs.cs" />
|
||||
<Compile Include="Events\ChannelUserEventArgs.cs" />
|
||||
<Compile Include="Events\ErrorEventArgs.cs" />
|
||||
<Compile Include="Events\ErrorReplieEventArgs.cs" />
|
||||
<Compile Include="Events\IrcNoticeEventArgs.cs" />
|
||||
<Compile Include="Events\ErronousNickEventArgs.cs" />
|
||||
<Compile Include="Events\ModeChangeEventArgs.cs" />
|
||||
|
@ -56,6 +57,7 @@
|
|||
<Compile Include="Events\SupportsEventArgs.cs" />
|
||||
<Compile Include="Events\WhoIsEventArgs.cs" />
|
||||
<Compile Include="Handlers\ChannelHandlers.cs" />
|
||||
<Compile Include="Handlers\ErrorHandlers.cs" />
|
||||
<Compile Include="Handlers\ListingHandlers.cs" />
|
||||
<Compile Include="Handlers\MessageHandlers.cs" />
|
||||
<Compile Include="Handlers\MOTDHandlers.cs" />
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace ChatSharp.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Raised when a IRC Error replie occurs. See rfc1459 6.1 for details.
|
||||
/// </summary>
|
||||
public class ErrorReplieEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The IRC error replie that has occured.
|
||||
/// </summary>
|
||||
public IrcMessage Message { get; set; }
|
||||
|
||||
internal ErrorReplieEventArgs(IrcMessage message)
|
||||
{
|
||||
Message = message;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
using ChatSharp.Events;
|
||||
using System.Linq;
|
||||
|
||||
namespace ChatSharp.Handlers
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
internal static class ErrorHandlers
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public static void HandleError(IrcClient client, IrcMessage message)
|
||||
{
|
||||
// System.Diagnostics.Trace.WriteLine("HandleNoSuchNick");
|
||||
client.OnErrorReplie(new Events.ErrorReplieEventArgs(message));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -58,6 +58,15 @@ namespace ChatSharp.Handlers
|
|||
// Server handlers
|
||||
client.SetHandler("004", ServerHandlers.HandleMyInfo);
|
||||
client.SetHandler("005", ServerHandlers.HandleISupport);
|
||||
|
||||
// Error replies rfc1459 6.1
|
||||
client.SetHandler("401", ErrorHandlers.HandleError);//ERR_NOSUCHNICK "<nickname> :No such nick/channel"
|
||||
client.SetHandler("402", ErrorHandlers.HandleError);//ERR_NOSUCHSERVER "<server name> :No such server"
|
||||
client.SetHandler("403", ErrorHandlers.HandleError);//ERR_NOSUCHCHANNEL "<channel name> :No such channel"
|
||||
client.SetHandler("404", ErrorHandlers.HandleError);//ERR_CANNOTSENDTOCHAN "<channel name> :Cannot send to channel"
|
||||
client.SetHandler("405", ErrorHandlers.HandleError);//ERR_TOOMANYCHANNELS "<channel name> :You have joined too many \ channels"
|
||||
client.SetHandler("406", ErrorHandlers.HandleError);//ERR_WASNOSUCHNICK "<nickname> :There was no such nickname"
|
||||
client.SetHandler("407", ErrorHandlers.HandleError);//ERR_TOOMANYTARGETS "<target> :Duplicate recipients. No message \
|
||||
}
|
||||
|
||||
public static void HandleNick(IrcClient client, IrcMessage message)
|
||||
|
|
|
@ -366,6 +366,13 @@ namespace ChatSharp
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public event EventHandler<Events.ErrorReplieEventArgs> ErrorReplie;
|
||||
internal void OnErrorReplie(Events.ErrorReplieEventArgs e)
|
||||
{
|
||||
if (ErrorReplie != null) ErrorReplie(this, e);
|
||||
}
|
||||
/// <summary>
|
||||
/// Raised for errors.
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue