@verb #16:"@blacklist @graylist @unblacklist @ungraylist" any any any rdo #55 @program #16:"@blacklist @graylist @unblacklist @ungraylist" any any any "@[un]blacklist [ [commentary]]" "@[un]graylist [ [commentary]]" if (player != this) return player:tell(E_PERM) endif undo = verb[2..3] == "un" which = $login:listname(verb[undo ? 4 | 2..length(verb)]) downgrade = {"", "graylist", "blacklist"}[1 + index("br", which[1])] if (!(fw = $string_utils:first_word(argstr))) "... Just print the list..." slist = {} if (s = $login.(which)[1]) slist = {@slist, "--- Subnets ---", @s} endif if (s = $login.(which)[2]) slist = {@slist, "--- Domains ---", @s} endif if (!s) player:notify("Nothing has been " + which + "ed.") else player:notify($string_utils:columnize(slist, 3)) endif return endif target = fw[1] comment = fw[2] ? {fw[2]} | {} if (is_literal = $site_db:domain_literal(target)) if (target[l = length(target)] == ".") target = target[1..l - 1] endif fullname = "subnet " + target else if (target[1] == ".") target[1..1] = "" endif fullname = "domain `" + target + "'" endif rm = {} entrylist = $login.(which)[1 + !is_literal] if (!undo && target in entrylist) player:notify(tostr(fullname, " is already ", which, "ed.")) return endif entrylist = setremove(entrylist, target) confirm = 0 if (is_literal) for s in (entrylist) if ((i = index(s, target + ".")) == 1) "... target is a prefix of s, s should probably go..." rm = {@rm, s} elseif (index(target + ".", s + ".") != 1) "... s is not a prefix of target..." elseif (undo) player:notify(tostr("You will need to un", which, " subnet ", s, " as well.")) elseif (confirm) player:notify(tostr("...Subnet ", s, " already ", which, "ed...")) else player:notify(tostr("Subnet ", s, " already ", which, "ed.")) if (!(confirm = $command_utils:yes_or_no(tostr(which, " ", target, " anyway?")))) return endif endif endfor else for s in (entrylist) if ((i = rindex(s, "." + target)) && i == length(s) - length(target)) "... target is a suffix of s, s should probably go..." rm = {@rm, s} elseif (!(i = rindex("." + target, "." + s)) || i < length(target) - length(s) + 1) "... s is not a suffix of target..." elseif (undo) player:notify(tostr("You will need to un", which, " domain `", s, "' as well.")) elseif (confirm) player:notify(tostr("...Domain `", s, "' already ", which, "ed...")) else player:notify(tostr("Domain `", s, "' already ", which, "ed.")) if (!(confirm = $command_utils:yes_or_no(tostr(which, " ", target, " anyway?")))) return endif endif endfor endif namelist = $string_utils:english_list(rm) downgraded = {} if (rm) ntries = length(rm) == 1 ? "ntry" | "ntries" if ($command_utils:yes_or_no(tostr("Remove e", ntries, " for ", namelist, "?"))) dg = undo && (downgrade && $command_utils:yes_or_no(downgrade + " them?")) for s in (rm) $login:(which + "_remove")(s) dg && ($login:(downgrade + "_add")(s) && (downgraded = {@downgraded, s})) endfor player:notify(tostr("E", ntries, " removed", @dg ? {" and ", downgrade, "ed."} | {"."})) else player:notify(tostr(namelist, " will continue to be ", which, "ed.")) rm = {} endif endif if (downgraded) comment[1..0] = {tostr(downgrade, "ed ", $string_utils:english_list(downgraded), ".")} endif if (!undo) $login:(which + "_add")(target) player:notify(tostr(fullname, " ", which, "ed.")) if (rm) comment[1..0] = {tostr("Subsumes ", which, "ing for ", namelist, ".")} endif elseif ($login:(which + "_remove")(target)) player:notify(tostr(fullname, " un", which, "ed.")) if (downgrade && $command_utils:yes_or_no(downgrade + " it?")) $login:(downgrade + "_add")(target) && (downgraded = {target, @downgraded}) player:notify(tostr(fullname, " ", downgrade, "ed.")) endif if (downgraded) comment[1..0] = {tostr(downgrade, "ed ", $string_utils:english_list(downgraded), ".")} endif if (rm) comment[1..0] = {tostr("Also removed ", namelist, ".")} endif elseif (rm) player:notify(tostr(fullname, " itself was never actually ", which, "ed.")) comment[1..0] = {tostr("Removed ", namelist, ".")} else player:notify(tostr(fullname, " was not ", which, "ed before.")) return endif subject = tostr(undo ? "@un" | "@", which, " ", fullname) $mail_agent:send_message(player, $site_log, subject, comment) "..." "... make sure we haven't screwed ourselves..." uhoh = {} for site in (player:all_connect_places()) if (index(site, target) && $login:(which + "ed")(site)) uhoh = {@uhoh, site} endif endfor if (uhoh) player:notify(tostr("WARNING: ", $string_utils:english_list(uhoh), " are now ", which, "ed!")) endif "Last modified by Dax (#789) on Tue Jan 15 16:08:11 2002 MST." .