private void IntersectDiscover(Packet p) { var tokens = p.Value?.Split(';'); var added = new List <string>(); foreach (var token in tokens) { if (token == "" || token == this.Me.Token) { continue; } var magicToken = new MagicToken(token); if (this.Remotes.Contains(magicToken)) { continue; } this.Logger.LogDeafen($"Adding {magicToken.Endpoint.ToString()}"); this.Remotes.Add(new MagicUser(magicToken)); added.Add(token); } // SEND ALL ADDED if (added.Count <= 0) { return; } this.Send(new Packet { Cmd = PacketType.Discover, Value = String.Join(';', added) }); }
public MagicUser(MagicToken tok, string alias = "anonymous") : base(tok.Endpoint, tok.Token, tok.LastValid) { this.Alias = alias; }