void HandleUserList(string[] users) { string me = users[2]; string channelName = users[4].Substring(1); string currencyName = channelName.Substring(0, channelName.Length - 2); if (mCurrencies.ContainsKey(currencyName)) { IRCCurrency c = mCurrencies[currencyName]; for (int i = 5; i < users.Length; i++) { string name = users[i]; if (i == 5) { name = name.Substring(1); // Skip the colon on the first name } if (name == me) { continue; } c.DiscoverPeer(name); } } else { Console.WriteLine("CryptoIRC::HandleUserList - Unknown currency: " + currencyName); } }
void HandleUserJoinedChannel(string[] joinInfo) { string channelName = joinInfo[2].Substring(2); string currencyName = channelName.Substring(0, channelName.Length - 2); if (mCurrencies.ContainsKey(currencyName)) { IRCCurrency c = mCurrencies[currencyName]; string user = joinInfo[0].Substring(1); int idx = user.IndexOf('!'); if (idx > 0) { user = user.Substring(0, idx); if (user != "CryptoIRC") { c.DiscoverPeer(user); } } } else { Console.WriteLine("CryptoIRC::HandleUserJoinedChannel - Unknown currency: " + currencyName); } }
public void SubscribeCurrency(string currency, PeerDiscoveredCB cb) { IRCCurrency c = new IRCCurrency(cb); mCurrencies[currency] = c; }