login.c

MudOSa4DGD/mudlib/std/obj/login.c · 1.2 KB

From the archive MudOSa4DGD-30.06.98.tar.gz

Download the archive   « Back to the archive contents

/*  login.c
 *
 *  Object used as link between connected end-user and user object at login
 *  NB! This is only an example! And there is no need to use
 *  __XXX_DEF, __XXX_FUNC naming in the actual mudlib.
 */

/* seconds before we are thrown out */
#define LOGIN_TIME     300


static void __CREATE_DEF() {
  if (object_name(previous_object()) != master())
    __DESTROY_DEF();
  ::__CREATE_DEF();
#ifdef MUDOS_USER_ID
  seteuid(getuid());
#endif
}


static void __LOGOFF_DEF() {
  message("info", "\nBibi.\n", this_player());
  __DESTROY_DEF();
}


static void timeup() {
  message("info", "\n\nTime up.\n", this_player());
  __DESTROY_DEF();
}


static void __LOGON_DEF() {
  object player;

  call_out("timeup", LOGIN_TIME);

  set_screen_width(80);

  message("info", "Welcome to example login for "+
	  DRIVERLIB_LONG_NAME+" v"+DRIVERLIB_VERSION+"\n"+
	"You are now logged in.\n", this_player());

  input_to("parse", 0);
}


static void parse(string arg) {
  switch (arg) {
  case "quit":
    __DESTROY_DEF();
    break;
  case "shutdown":
    shutdown();
    break;
  default:
    message("info", "You just typed: '"+arg+"'\n", this_player());
    message("info", "Just type 'quit' or 'shutdown' to exit.\n", this_player());
    break;
  }

  input_to("parse", 0);
}

Site Stats

Snippets: 1791
Codebases: 571