rendered paste body protected void HandleNumericReply(object sender, ReplyReceivedEventArgs e)
{
Channel channel = null;
switch (e.Code)
{
case NumericReply.RPL_NAMREPLY:
channel = GetChannel(e.Targets[2]);
string[] names = e.Payload.Split(sep, StringSplitOptions.RemoveEmptyEntries);
UpdateChannelMembers(channel, names);
break;
case NumericReply.RPL_WHOREPLY:
// update user
channel = GetChannel(e.Targets[1]);
IrcUser user;
if (channel != null)
user = FindUser(e.Targets[5], channel);
else
user = FindUser(e.Targets[5]);
if (user != null)
{
user.Ident = e.Targets[2];
user.Host = e.Targets[3];
user.RealName = e.Payload.Substring(e.Payload.IndexOf(' ') + 1);
}
break;
case NumericReply.RPL_NOTOPIC:
case NumericReply.RPL_TOPIC:
channel = GetChannel(e.Targets[1]);
if (!Channel.IsNull(channel))
channel.topic = e.Payload;
break;
case NumericReply.ERR_BANNEDFROMCHAN:
case NumericReply.ERR_INVITEONLYCHAN:
case NumericReply.ERR_CHANNELISFULL:
case NumericReply.ERR_NOSUCHCHANNEL:
case NumericReply.ERR_TOOMANYCHANNELS:
case NumericReply.ERR_BADCHANMASK:
channels.Remove(e.Targets[1]);
break;
case NumericReply.RPL_UNAWAY:
this.isMarkedAway = false;
break;
case NumericReply.RPL_NOWAWAY:
this.isMarkedAway = true;
break;
case NumericReply.RPL_MOTD:
motd += e.Payload.TrimStart(motdChar) + Environment.NewLine;
break;
case NumericReply.ERR_NOMOTD:
motd = e.Payload;
break;
case NumericReply.RPL_YOURHOST:
// TODO: Implement server capabilities parsing
break;
case NumericReply.RPL_BOUNCE:
// See above
break;
}
}