private void OnEvents(IrcConection connection, IrcMessage message) { this.channel1.Write(connection.GetIdentify(), "*", "", message.Raw); string channel; switch (message.Type) { case "JOIN": //Let us se if this is us there join a channel or it is a user if (message.Nick == connection.GetNick()) { channel = message.ParamsMidle; this.AppendChannel(connection.GetIdentify(), channel); } else if (message.ParamsMidle.IndexOf("#") == 0) { this.channel1.Write(connection.GetIdentify(), message.ParamsMidle, "", IrcUntil.ColoeredText(9, 0, message.Nick + " came into this room")); UserInfo info = new UserInfo(); info.Nick = message.Nick; this.channel1.AppendUser(connection.GetIdentify(), message.ParamsMidle, info); } break; case "PART": if (message.ParamsMidle == "") { return; } channel = message.ParamsMidle.Substring(1); this.channel1.Write(connection.GetIdentify(), channel, "", IrcUntil.ColoeredText(4, 0, message.Nick + " leaved this channel")); this.channel1.RemoveUser(connection.GetIdentify(), message.ParamsMidle.Substring(1), message.Nick); break; case "PRIVMSG": if (message.ParamsMidle == connection.GetNick()) { //this is a private message from user (channel start width #) so wee controle we have the channel. if (!this.ChannelExists(connection.GetIdentify(), message.Nick)) { this.AppendChannel(connection.GetIdentify(), message.Nick); this.channel1.Select(connection.GetIdentify(), message.Nick); } } if (message.ParamsTrailing.IndexOf('\x001'.ToString()) == 0) { if (message.ParamsTrailing.IndexOf('\x001'.ToString() + "ACTION") == 0) { this.channel1.Write(connection.GetIdentify(), message.ParamsTrailing == connection.GetNick() ? message.Nick : message.ParamsMidle, null, IrcUntil.ColoeredText(6, 0, "* " + message.Nick + " " + message.ParamsTrailing.Substring(8))); return; } } this.channel1.Write(connection.GetIdentify(), message.ParamsMidle == connection.GetNick() ? message.Nick : message.ParamsMidle, message.Nick, message.ParamsTrailing); break; case "NICK": string n = message.ParamsTrailing; if (n == connection.GetNick()) { //this is my there will or foreced to chage nick name. connection.SetNick(n); } this.channel1.UpdateNick(connection.GetIdentify(), message.Nick, n); break; } }