public override void Execute() { var wholist = _ircReadWriteExchange.GetWhoList(); var dbUsers = _persistance.GetUsers(); var violators = new List <string>(); foreach (var whoInfo in wholist) { if (!dbUsers.Contains(whoInfo.Ident, StringComparer.InvariantCultureIgnoreCase)) { violators.Add(whoInfo.Ident); } } if (violators.Any()) { Messages.Add("IRC security sweep: security violations detected, user(s) are online which are not present in the database:"); foreach (var violator in violators) { var user = wholist.First(w => w.Ident.Equals(violator)); var msg = string.Format("User: {0} Server: {1}", user.Ident, user.Server); Messages.Add(msg); } } else { if (Context.MessageOrigin == MessageOrigin.Channel || Context.MessageOrigin == MessageOrigin.Query) { Messages.Add("IRC security sweep: Ok. No users detected who are not present in the database."); } } }
public override void Execute() { var userlist = _persistance.GetUsers(); Messages.Add("Added users:"); var messages = _userDisplay.SortAlphabetically(userlist); Messages.AddRange(messages); Messages.Add(string.Format("Total: {0}", userlist.Count)); }