/// <summary> /// This is a parser for command which is received when services send us a list of networks /// </summary> /// <param name="curr">XmlNode</param> /// <param name="protocol">Protocol which owns this request</param> public static void sNetworkList(XmlNode curr, ProtocolSv protocol) { if (!string.IsNullOrEmpty(curr.InnerText)) { string[] _networks = curr.InnerText.Split('|'); string[] mq = null; if (Configuration.Services.UsingCache) { if (curr.Attributes.Count > 0) { mq = curr.Attributes[0].Value.Split('|'); if (_networks.Length != mq.Length) { Core.DebugLog("Invalid buffer " + curr.Attributes[0].Value); mq = null; } } } if (Configuration.Services.UsingCache) { Core.SystemForm.Status("Loading disk cache from disk..."); protocol.sBuffer.ReadDisk(); } int id = 0; foreach (string i in _networks) { if (!string.IsNullOrEmpty(i)) { protocol.Deliver(new Datagram("NETWORKINFO", i)); Network nw = new Network(i, protocol); nw.Nickname = protocol.nick; protocol.cache.Add(new Cache()); protocol.NetworkList.Add(nw); // we flag the network as connected until we really know that nw.flagConnection(); // we ask for information about every channel on that network Datagram response = new Datagram("CHANNELINFO"); response._InnerText = "LIST"; response.Parameters.Add("network", i); protocol.Deliver(response); Datagram request = new Datagram("BACKLOGSV"); request.Parameters.Add("network", i); request.Parameters.Add("size", Configuration.Services.Depth.ToString()); // we insert this network to a list of waiting networks lock (protocol.WaitingNetw) { protocol.WaitingNetw.Add(i); } // we need to recover data from local storage if (Configuration.Services.UsingCache && mq != null) { if (!protocol.sBuffer.Networks.ContainsValue(mq[id])) { protocol.sBuffer.Make(i, mq[id]); protocol.sBuffer.networkInfo[mq[id]].NetworkID = mq[id]; protocol.sBuffer.networkInfo[mq[id]].Nick = nw.Nickname; protocol.sBuffer.networkInfo[mq[id]].Server = nw.ServerName; } else { Services.Buffer.NetworkInfo info = protocol.sBuffer.networkInfo[mq[id]]; info.recoverWindowText(nw.SystemWindow, nw.SystemWindow.WindowName); nw.CModes = info.CModes; nw.CUModes = info.CUModes; nw.PModes = info.PModes; nw.SModes = info.SModes; nw.UChars = info.UChars; nw.UModes = info.UModes; nw.XModes = info.XModes; nw.Nickname = info.Nick; nw.IrcdVersion = info.Version; nw.ChannelList.Clear(); nw.ChannelList.AddRange(info.ChannelList); info.ChannelList.Clear(); lock (nw.Descriptions) { nw.Descriptions.Clear(); foreach (Client.Services.Buffer.NetworkInfo.Description description in info.Descriptions) { nw.Descriptions.Add(description.Char, description.String); } } foreach (string ms in info.PrivateWins) { User current_pm = nw.Private(ms); info.recoverWindowText(nw.PrivateWins[current_pm], ms); } int mqid = info.lastMQID; request.Parameters.Add("last", mqid.ToString()); } } protocol.Deliver(request); } id++; } Core.SystemForm.Status("Waiting for services to send us remaining backlog"); } }