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/
// _term.c
// Creator: Leto@EarthMud (04/29/94)
// Description: The start of an advanced customizable term setting
//              Maybe someday it will use TERMCAP, if someone tells
//              me how it works
//
//  You might need to change some query(foo)'s to link_data(foo)'s 
//  if you use tmi 1.1 or newer
//
// If you wonder why i dont use setenv/getenv for this, it's because
// it messes up your screen after typing 'set'
// I think it's not worth it to fix that, so i use the set/get

#include <mudlib.h>
#include <commands.h>
#include <ansi.h>

/* 
 * Colours that we support, and their ansi values. Will be replaced by
 * Pinkfish keywords asap. right now, it's hardcoded ansi
 */
#define VALID_COLOURS ({ "bold" ,"normal" ,"red" ,"green" ,"yellow" ,"blue" ,"magenta" , "cyan" ,"white" ,"hred"  ,"hgreen", "hyellow" , "hblue" , "hmagenta" , "hcyan" , "hwhite" })
#define VALID_COLOURS_ANSI ({ BOLD ,NOR , RED , GRN  , YEL , BLU , MAG , CYN , WHT , HIR, HIG , HIY , HIB , HIM  , HIC , HIW  })
/* 
 * Should prob. be moved to messages.h or something. It's a 2d array (mortals,
 * wizards) holding a 2d array (class,default_colour)
 */
#define MES_CLASSES ({ ({ ({"tell","hgreen"}) , ({"channels","hblue"}), ({"say","hcyan"}),({"announce","hyellow"}),({"combat","normal"}),({"spell","red"}),({"system","hred"}),({"error","normal"}) }), ({ ({"tell","hgreen"}) , ({"channels","hblue"}), ({"say","hcyan"}),({"announce","hyellow"}),({"combat","normal"}),({"spell","red"}),({"system","hred"}),({"error","normal"}),({"developer","normal"}),({"debug","white"}),({"wizcall","hred"}) }) })

void configure(int count);
int help();
void colour(string col, int count);

inherit DAEMON;


int cmd_term(string str) {

	int x,y;
    string sts;
    object shell;

     if (!str)
       { 
	write(help());
        return 1;
       }
   if(sscanf(str,"%s %d %d",str,x,y)!=3)
    sscanf(str,"%s %dx%d",str,x,y);

  switch(str) {
    case "on" :
  {
   write("ANSI / VT100 enabled.\n");
   (CMD_CHSH->cmd_chsh("/obj/shells/term.c")) ;
    CMD_SHELL->cmd_shell("");
    return 1;
  }
    case "off" :
  {
   write("ANSI disabled.\n");
   shell = present("shell", this_player());
   if (shell) shell->remove();
   this_player()->delete("shell");
   return 1;
  }

   case "config" :
   case "configure" : { configure(-1); return 1 ; }
   case "auto" :
{
   write("Setting window size on auto detect. You might need to relogin for it to take effect.\n");
 this_player()->delete("terminal_override");
  return 1;
}
   case "screen":
{
   if( (x>0) && (y>0) )
   {
  write(sprintf("Setting terminal window size override to:%d,%d\n",x,y));
 this_player()->set("terminal_override",({ x,y }) );
  this_player()->setenv("LINES",(int)y);
 this_player()->setenv("COLUMNS",(int)x);
  return 1;
 }
  return notify_fail("Usage: term screen <columns> <lines>\n");
 }
   case "test" :
 {
  int i;
  write("Testing ANSI colour capability.\n");
  for(i=0;i<sizeof(VALID_COLOURS);i++) write("Testing "+VALID_COLOURS_ANSI[i]+
  VALID_COLOURS[i]+NOR+".\n");
  return;
  }
     default :
 {
  if (present("shell"))  sts = "on" ;
   else sts = "off";
  notify_fail("Use <term on> , <term off> or <term config>\n"+
              "Your current setting is: "+sts+".\n");
  return 0;
}
}
}

int help(){
write( @EndHelp
The term command allows you to customize your settings, sometimes
overriding settings that are determined upon login.

Usage:

term configure   : configures your terminal in repect with colours
term on          : enables the special term colour settings.
term off         : disables the special term colour settings.
term screen x y  : overrides the determined screen size (stays after quit!)
term auto        : disables the screen size override.
term test        : test ANSI colours.
EndHelp
);}

void configure(int count) {
/*
 * We use VALID_COLOURS,MES_CLASSES (A 2d array for: class,default)
 */
	if(count==-1) {
	write(@EndBan
Okay, lets get some nice settings for your terms. All these settings will 
be saved. If you want the [default] colour, you can just press return.
Valid VT100 modes are     : bold, normal
Addition for ANSI we have : red,green,yellow,blue,magenta,cyan,white 
or for high intensity     : hred,hgreen,hyellow,hblue,hmagenta,hcyan,hwhite

EndBan);
	return configure(0);
	}

	if(count<sizeof( MES_CLASSES[wizardp(this_player())] )) {
	write(sprintf("Which colour would you like for %s messages [%s] ?",
	MES_CLASSES[wizardp(this_player())][count][0], MES_CLASSES[wizardp(this_player())][count][1]));
	input_to("colour",0,count);
	return;
	}

	write("Configuration finished.\n");
	return ;
}

void colour(string col, int count) {

	if(col!="" && member_array(col,VALID_COLOURS)==-1) {
	write(sprintf("Invalid colours, valid colours are:%s.\n",
	implode(VALID_COLOURS,",")));
	return configure(count);
	}

	if(!col||col=="") col = MES_CLASSES[wizardp(this_player())][count][1];
	this_player()->set("term/"+MES_CLASSES[wizardp(this_player())][count][0],
	VALID_COLOURS_ANSI[member_array(col,VALID_COLOURS)]    );
	count++;
	return configure(count);
}