void ListAccessrights(string sendto, string name) { var message = new List<string>(); if (name.StartsWith(GroupPrefix) && accessList.ContainsKey(name)) { message.AddRange(accessList[name].ToLines(350, ", ", "Group Rights: ", "")); } else { foreach (string id in Identified(name)) { if (id == superUser) { message.Add("User Rights from '{0}': This user is botmaster".Fill(id)); } else if (accessList.ContainsKey(id)) { message.AddRange(accessList[id].ToLines(350, ", ", "User Rights from '{0}': ".Fill(id), "")); } foreach (string @group in GetGroups(id)) { if (accessList.ContainsKey(@group)) { message.AddRange(accessList[@group].ToLines(350, ", ", "inherited rights from group '{0}': ".Fill(@group), "")); } } } if (message.Count == 0) { message.Add(name.StartsWith(GroupPrefix) ? "Group '{0}' does not exist or has no rights set".Fill(name) : "User '{0}' does not exist or has no rights set".Fill(name)); } } foreach (var line in message.ToLines(350, " / ")) { bot.SendMessage(SendType.Message, sendto, line); } }
private void SendCommandList(string sendto, string nick, IEnumerable<Commandlet> commandList) { if (!commandList.Any()) return; var commandStrings = new List<string>(); foreach (var commandlet in commandList) { if (string.IsNullOrEmpty(commandlet.AccessString)) { commandStrings.Add(scopeColor[commandlet.Scope] + commandlet.Command + IrcConstants.IrcColor + IrcConstants.IrcBold); } else if (Acl.Access(nick, commandlet.AccessString, false)) { commandStrings.Add(scopeColor[commandlet.Scope] + "<" + commandlet.Command + ">" + IrcConstants.IrcColor + IrcConstants.IrcBold); } } foreach (string com in commandStrings.ToLines(350, ", ", "Active Commands (" + scopeColor[CommandScope.Public] + "public" + IrcConstants.IrcColor + IrcConstants.IrcBold + ", " + scopeColor[CommandScope.Private] + "private" + IrcConstants.IrcColor + IrcConstants.IrcBold + ") <restricted>: ", null)) { SendMessage(SendType.Message, sendto, com); } }