tmi2_fluffos_v2/
tmi2_fluffos_v2/bin/
tmi2_fluffos_v2/etc/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/ChangeLog.old/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/Win32/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/compat/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/compat/simuls/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/include/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/clone/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/command/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/data/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/etc/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/include/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/inherit/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/inherit/master/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/log/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/single/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/single/tests/compiler/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/single/tests/efuns/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/single/tests/operators/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/u/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/tmp/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/windows/
tmi2_fluffos_v2/lib/
tmi2_fluffos_v2/lib/adm/
tmi2_fluffos_v2/lib/adm/daemons/languages/
tmi2_fluffos_v2/lib/adm/daemons/network/I3/
tmi2_fluffos_v2/lib/adm/daemons/virtual/
tmi2_fluffos_v2/lib/adm/daemons/virtual/template/
tmi2_fluffos_v2/lib/adm/news/
tmi2_fluffos_v2/lib/adm/obj/
tmi2_fluffos_v2/lib/adm/obj/master/
tmi2_fluffos_v2/lib/adm/priv/
tmi2_fluffos_v2/lib/adm/shell/
tmi2_fluffos_v2/lib/adm/tmp/
tmi2_fluffos_v2/lib/cmds/
tmi2_fluffos_v2/lib/d/
tmi2_fluffos_v2/lib/d/Conf/
tmi2_fluffos_v2/lib/d/Conf/adm/
tmi2_fluffos_v2/lib/d/Conf/boards/
tmi2_fluffos_v2/lib/d/Conf/cmds/
tmi2_fluffos_v2/lib/d/Conf/data/
tmi2_fluffos_v2/lib/d/Conf/logs/
tmi2_fluffos_v2/lib/d/Conf/obj/
tmi2_fluffos_v2/lib/d/Conf/text/help/
tmi2_fluffos_v2/lib/d/Fooland/adm/
tmi2_fluffos_v2/lib/d/Fooland/data/
tmi2_fluffos_v2/lib/d/Fooland/data/attic/
tmi2_fluffos_v2/lib/d/Fooland/items/
tmi2_fluffos_v2/lib/d/TMI/
tmi2_fluffos_v2/lib/d/TMI/adm/
tmi2_fluffos_v2/lib/d/TMI/boards/
tmi2_fluffos_v2/lib/d/TMI/data/
tmi2_fluffos_v2/lib/d/TMI/rooms/
tmi2_fluffos_v2/lib/d/grid/
tmi2_fluffos_v2/lib/d/grid/adm/
tmi2_fluffos_v2/lib/d/grid/data/
tmi2_fluffos_v2/lib/d/std/
tmi2_fluffos_v2/lib/d/std/adm/
tmi2_fluffos_v2/lib/data/adm/
tmi2_fluffos_v2/lib/data/adm/daemons/
tmi2_fluffos_v2/lib/data/adm/daemons/doc_d/
tmi2_fluffos_v2/lib/data/adm/daemons/emoted/
tmi2_fluffos_v2/lib/data/adm/daemons/network/http/
tmi2_fluffos_v2/lib/data/adm/daemons/network/services/mail_q/
tmi2_fluffos_v2/lib/data/adm/daemons/network/smtp/
tmi2_fluffos_v2/lib/data/adm/daemons/news/archives/
tmi2_fluffos_v2/lib/data/attic/connection/
tmi2_fluffos_v2/lib/data/attic/user/
tmi2_fluffos_v2/lib/data/std/connection/b/
tmi2_fluffos_v2/lib/data/std/connection/l/
tmi2_fluffos_v2/lib/data/std/user/a/
tmi2_fluffos_v2/lib/data/std/user/b/
tmi2_fluffos_v2/lib/data/std/user/d/
tmi2_fluffos_v2/lib/data/std/user/f/
tmi2_fluffos_v2/lib/data/std/user/l/
tmi2_fluffos_v2/lib/data/std/user/x/
tmi2_fluffos_v2/lib/data/u/d/dm/working/doc_d/
tmi2_fluffos_v2/lib/data/u/l/leto/doc_d/
tmi2_fluffos_v2/lib/data/u/l/leto/smtp/
tmi2_fluffos_v2/lib/doc/
tmi2_fluffos_v2/lib/doc/driverdoc/applies/
tmi2_fluffos_v2/lib/doc/driverdoc/applies/interactive/
tmi2_fluffos_v2/lib/doc/driverdoc/concepts/
tmi2_fluffos_v2/lib/doc/driverdoc/driver/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/arrays/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/buffers/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/compile/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/ed/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/filesystem/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/floats/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/functions/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/general/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/mappings/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/numbers/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/parsing/
tmi2_fluffos_v2/lib/doc/driverdoc/lpc/constructs/
tmi2_fluffos_v2/lib/doc/driverdoc/lpc/preprocessor/
tmi2_fluffos_v2/lib/doc/driverdoc/lpc/types/
tmi2_fluffos_v2/lib/doc/driverdoc/platforms/
tmi2_fluffos_v2/lib/doc/mudlib/
tmi2_fluffos_v2/lib/ftp/
tmi2_fluffos_v2/lib/include/driver/
tmi2_fluffos_v2/lib/log/
tmi2_fluffos_v2/lib/log/driver/
tmi2_fluffos_v2/lib/obj/net/
tmi2_fluffos_v2/lib/obj/shells/
tmi2_fluffos_v2/lib/obj/tools/
tmi2_fluffos_v2/lib/std/adt/
tmi2_fluffos_v2/lib/std/board/
tmi2_fluffos_v2/lib/std/body/
tmi2_fluffos_v2/lib/std/fun/
tmi2_fluffos_v2/lib/std/living/
tmi2_fluffos_v2/lib/std/object/
tmi2_fluffos_v2/lib/std/shop/
tmi2_fluffos_v2/lib/std/socket/
tmi2_fluffos_v2/lib/std/user/
tmi2_fluffos_v2/lib/std/virtual/
tmi2_fluffos_v2/lib/student/
tmi2_fluffos_v2/lib/student/kalypso/
tmi2_fluffos_v2/lib/student/kalypso/armor/
tmi2_fluffos_v2/lib/student/kalypso/rooms/
tmi2_fluffos_v2/lib/student/kalypso/weapons/
tmi2_fluffos_v2/lib/u/l/leto/
tmi2_fluffos_v2/lib/u/l/leto/cmds/
tmi2_fluffos_v2/lib/www/errors/
tmi2_fluffos_v2/lib/www/gateways/
tmi2_fluffos_v2/lib/www/images/
tmi2_fluffos_v2/old/
tmi2_fluffos_v2/win32/
//	File	: /cmds/adm/_banish.c
//	Creator	: Buddha@TMI
//	Updated	: Mobydick  (5/26/93)  Added rudimentary argument checking.
//		  Karathan  (7/13/93)  Rewritten for unified banish code.
//		  Karathan  (8/12/93)  Updated with banish daemon.

// The command to banish or unbanish a site or name. Just an interface to the
// banish daemon.  Command from Buddha, daemon from Dainia@Dreamshadow.

#include <mudlib.h>
#include <daemons.h>

inherit DAEMON;


int fail()
{
    notify_fail("Usage: banish <site [[-] site ip]|name [[-] name]>\n");
    return 0;
}


int cmd_banish(string str)
{
    int i;
    string *words;
    mixed *sites, *names;

    if (!str || !stringp(str) || str == "")
	return fail();
    replace_string(str, "  ", " ", 0);
    if (str == "")
	return fail();
    words = explode(lower_case(str), " ");
    if (sizeof(words) < 1 || sizeof(words) > 3 ||
	(sizeof(words) == 3 && words[1] != "-"))
	return fail();
    if (words[0] == "site" || words[0] == "sites")
      { if (sizeof(words) == 1)
	  { sites = BANISH_D->query_banished_sites();
	    if (!sites || sites == ({ }))
		write("There are no banished sites.\n");
	    else
	      { if (sizeof(sites) == 1)
		    str = "There is one banished site: " + sites[0];
	 else
	     str = "There are " + sizeof(sites) + " banished sites: " +
	    implode(sites[0..<2], ", ") + " and " +
	    sites[<1];
		write(wrap(str + ".\n")); }
	    return 1; }
    if (!adminp(geteuid(previous_object())))
      { notify_fail("You are not permitted to use the banish command.\n");
	return 0; }
	if (sizeof(words) == 2)
	  { i = BANISH_D->banish_site(words[1]);
	    if (!i)
		write("Banish site: Command failed.\n");
	    else if (i < 0)
		write("Site '" + words[1] +
		      "' is already in the banish list.\n");
	    else
		write("Site '" + words[1] +
		      "' has been added to the banish list.\n"); }
	else
	  { i = BANISH_D->remove_banished_site(words[2]);
	    if (!i)
		write("Banish site (removal): Command failed.\n");
	    else if (i < 0)
		write("Site '" + words[2] +
		      "' is not in the banish list.\n");
	    else
		write("Site '" + words[2] +
		      "' has been removed from the banish list.\n"); }
	return 1; }
    if (words[0] == "name" || words[0] == "names")
      { if (sizeof(words) == 1)
	  { names = BANISH_D->query_banished_names();
	    if (!names || names == ({ }))
		write("There are no banished names.\n");
	    else
	      { if (sizeof(names) == 1)
		    str = "There is one banished name: " + names[0];
	 else
	     str = "There are " + sizeof(names) + " banished names: " +
	    implode(names[0..<2], ", ") + " and " +
	    names[<1];
		write(wrap(str + ".\n")); }
	    return 1; }
    if (!adminp(geteuid(previous_object())))
      { notify_fail("You are not permitted to use the banish command.\n");
	return 0; }
	if (sizeof(words) == 2)
	  { i = BANISH_D->banish_name(words[1]);
	    if (!i)
		write("Banish name: Command failed.\n");
	    else if (i < 0)
		write("Name '" + words[1] +
		      "' is already in the banish list.\n");
	    else
		write("Name '" + words[1] +
		      "' has been added to the banish list.\n"); }
	else
	  { i = BANISH_D->remove_banished_name(words[2]);
	    if (!i)
		write("Banish name (removal): Command failed.\n");
	    else if (i < 0)
		write("Name '" + words[2] +
		      "' is not in the banish list.\n");
	    else
		write("Name '" + words[2] +
		      "' has been removed from the banish list.\n"); }
	return 1; }
    return fail();
}


string help()
{
    return(
"Usage: banish <site [[-] site ip]|name [[-] name]>\n"
"The <site> string may be either an IP number of the form 123.123.123.123 or\n"
"it may be a partial, such as 123.123, which banishes all sites whose root\n"
"IP numbers starts with 123.123.  Guest logins are also site-checked.  The\n"
"<name> string may include any regexp wildcards (eg, '.*fuck.*').  Preceding\n"
"the site or name with a (space separated) '-' character will remove it from\n"
"the relevant list.  With no name or site ip given, the full list is shown.\n"
"NB To banish only \"at\" not \"cat\", \"satan\" & \"atan\", use \"^at$\".\n"+
"\nSee also: nuke\n");
}