/// <summary> /// Channel info /// </summary> /// <param name="curr">XmlNode</param> /// <param name="protocol">Protocol which owns this request</param> public static void sChannelInfo(XmlNode curr, ProtocolSv protocol) { if (string.IsNullOrEmpty(curr.InnerText)) { if (curr.Attributes.Count > 1) { if (curr.Attributes[1].Name == "channels") { string[] channellist = curr.Attributes[1].Value.Split('!'); Network nw = protocol.retrieveNetwork(curr.Attributes[0].Value); if (nw != null) { foreach (string channel in channellist) { if (!string.IsNullOrEmpty(channel)) { if (nw.getChannel(channel) == null) { Channel xx = nw.Channel(channel, !Configuration.UserData.SwitchWindowOnJoin); if (Configuration.Services.UsingCache) { string ID = protocol.sBuffer.getUID(curr.Attributes[0].Value); if (ID != null && protocol.sBuffer.networkInfo.ContainsKey(ID)) { Graphics.Window window = xx.RetrieveWindow(); if (xx != null) { protocol.sBuffer.networkInfo[ID].recoverWindowText(window, window.WindowName); } Services.Buffer.ChannelInfo channel_info = protocol.sBuffer.networkInfo[ID].getChannel(channel); if (channel_info != null) { xx.Bans = channel_info.Bans; xx.Exceptions = channel_info.Exceptions; xx.ChannelWork = channel_info.ChannelWork; xx.Invites = channel_info.Invites; xx.Name = channel_info.Name; xx.IsParsingBanData = channel_info.parsing_bans; xx.IsParsingWhoisData = channel_info.parsing_wh; xx.IsParsingWhoData = channel_info.parsing_who; xx.ChannelMode = new NetworkMode(channel_info.mode); xx.IsParsingExceptionData = channel_info.parsing_xe; xx.Redraw = channel_info.Redraw; xx.TemporarilyHidden = channel_info.temporary_hide; xx.Topic = channel_info.Topic; xx.TopicDate = channel_info.TopicDate; xx.TopicUser = channel_info.TopicUser; } } } } if (!Configuration.Services.Retrieve_Sv) { protocol.SendData(nw.ServerName, "TOPIC " + channel, Configuration.Priority.Normal); protocol.SendData(nw.ServerName, "MODE " + channel, Configuration.Priority.Low); } Datagram response2 = new Datagram("CHANNELINFO", "INFO"); response2.Parameters.Add("network", curr.Attributes[0].Value); response2.Parameters.Add("channel", channel); lock (protocol.RemainingJobs) { protocol.RemainingJobs.Add(new ProtocolSv.Request(channel, ProtocolSv.Request.Type.ChannelInfo)); } protocol.Deliver(response2); } } System.Threading.Thread.Sleep(800); } } } return; } if (curr.Attributes[1].Name == "channel") { string[] userlist = curr.Attributes[2].Value.Split(':'); Network nw = protocol.retrieveNetwork(curr.Attributes[0].Value); if (nw != null) { lock (protocol.RemainingJobs) { ProtocolSv.Request item = null; foreach (ProtocolSv.Request work in protocol.RemainingJobs) { if (work.type == ProtocolSv.Request.Type.ChannelInfo && curr.Attributes[1].Value == work.Name) { item = work; } } if (item != null) { protocol.RemainingJobs.Remove(item); Core.SystemForm.Status(protocol.getInfo()); } } Channel channel = nw.getChannel(curr.Attributes[1].Value); if (channel != null) { foreach (string user in userlist) { if (user.Contains("!") && user.Contains("@")) { string us = ""; string ident; us = user.Substring(0, user.IndexOf("!", StringComparison.Ordinal)); if (channel.ContainsUser(us)) { continue; } ident = user.Substring(user.IndexOf("!", StringComparison.Ordinal) + 1); if (ident.StartsWith("@", StringComparison.Ordinal)) { ident = ""; } else { if (ident.Contains("@")) { ident = ident.Substring(0, ident.IndexOf("@", StringComparison.Ordinal)); } } string host = user.Substring(user.IndexOf("@", StringComparison.Ordinal) + 1); if (host.StartsWith("+", StringComparison.Ordinal)) { host = ""; } else { if (host.Contains("+")) { host = host.Substring(0, host.IndexOf("+", StringComparison.Ordinal)); } } lock (channel.UserList) { if (!channel.ContainsUser(us)) { User f2 = new User(us, host, nw, ident); if (user.Contains("+") && !user.StartsWith("+", StringComparison.Ordinal)) { f2.ChannelMode.ChangeMode(user.Substring(user.IndexOf("+", StringComparison.Ordinal))); f2.ResetMode(); } channel.UserList.Add(f2); } } } } Datagram response = new Datagram("USERLIST", "INFO"); response.Parameters.Add("network", curr.Attributes[0].Value); response.Parameters.Add("channel", channel.Name); protocol.Deliver(response); channel.RedrawUsers(); channel.UpdateInfo(); } } } }