コード例 #1
0
ファイル: clone_object.c プロジェクト: sirdude/gurbalib
static object clone_object(string path) {
   object ob, ed;
   string trace, cloner;

   argcheck(path, 1, "string");

   ed = find_object(ERROR_D);

   /*
    * yeah.. calling the error_d to get a formatted runtime trace.. 
    * no, we aren't * reporting an error here, just using one of its 
    * nice utility functions to get a nicely formatted trace
    */
   if (ed) {
      trace =
         ed->format_runtime_error("Clone calltrace", ::call_trace(), 0, 0, 0);
   } else {
      trace = "No clone calltrace available\n";
   }

   if (this_object()->is_player() && this_object()->query_name()) {
      cloner = this_object()->query_name();
   } else if ((sscanf(object_name(this_object()), "/cmds/wiz/%*s") == 1) &&
      this_user()) {
      cloner = this_user()->query_name();
   } else {
      cloner = _owner;
   }

   if (strlen(path) > 2) {
      if ((path[strlen(path) - 2] == '.') && (path[strlen(path) - 1] == 'c')) {
         path = path[..strlen(path) - 3];
      }
   }
コード例 #2
0
ファイル: out_unmod.c プロジェクト: drlaforge/gurbalib
void out_unmod(string str) {
   argcheck(str, 1, "string");

   if (!this_user())
      return;
   this_user()->put_original(str);
   if (this_player()->is_snooped())
      this_player()->do_snoop(str);
}
コード例 #3
0
ファイル: this_player.c プロジェクト: Shea690901/gurbalib
static object this_player( void ) {
  object ob;
  ob = DRIVER->get_tlvar(TLS_THIS_PLAYER);
  if(ob) return ob;

  if( this_user() && this_user()->query_player() ) {
    if( this_user()->query_player()->is_possessing() )
      return( this_user()->query_player()->query_possessing() );
    return( this_user()->query_player() );
  }
}
コード例 #4
0
ファイル: this_body.c プロジェクト: Shea690901/gurbalib
static object this_body( void ) {
  if( !this_user() ) {
    if( !monster )
      return( previous_object() );
    else
      return( monster );
  }
  if( this_user()->query_player()->is_possessing() )
    return( this_user()->query_player()->query_possessing() );
  return( this_user()->query_player() );
}
コード例 #5
0
void check_security(string user, string creator)
{
	PERMISSION_CHECK(user != "System");

	if (user[0] >= 'a' && user[0] <= 'z') {
		/* Proxies for users must be initiated by that user */
		PERMISSION_CHECK(this_user());
		PERMISSION_CHECK(this_user()->query_name() == user);
	} else {
		/* Infrastructure can only be proxied by itself */
		PERMISSION_CHECK(creator == user);
	}
}
コード例 #6
0
ファイル: account.c プロジェクト: nbmc/DOGL
static void save_account(varargs object ACCOUNT account) {
/* Saves the status of the account. */
  DOGL_CHECK();

  if(!account) account = this_user();
  account->save_account();
}
コード例 #7
0
ファイル: bug.c プロジェクト: nbmc/DOGL
static object cmd(string arg, object body) {
  string cmd;
  int type;

  cmd = this_user()->query_actual_command();
  if(!strlen(arg)) {
    return failure("Usage: " + cmd + " <message>\n");
  }

  switch(cmd) {
    case "idea":
      type = LOG_IDEA;
    break;

    case "typo":
      type = LOG_TYPO;
    break;

    case "comment":
      type = LOG_COMMENT;
    break;

    default:
      type = LOG_BUG;
    break;
  }

  player_submission(arg, type);
  return success("Thank you!  Your " + cmd + " submission has been logged " +
      "and will be reviewed as soon as possible.\n");
}
コード例 #8
0
ファイル: account.c プロジェクト: nbmc/DOGL
static mixed set_env(string s, mixed val, varargs object ACCOUNT account) {
/* Set the specified environment variable s to the value val */
  DOGL_GLOBAL_CHECK();

  if(!account) account = this_user();
  return account->set_env(s, val);
}
コード例 #9
0
ファイル: account.c プロジェクト: nbmc/DOGL
static void logout_account(object ACCOUNT account, int quit) {
/* Logout the specified account, or if not specified the currently active
 * account. */
  calling_program_check(CHARACTER_D);

  if(!account) account = this_user();
  if(account) account->logout(quit);
}
コード例 #10
0
ファイル: account.c プロジェクト: nbmc/DOGL
static void check_wiztool(object ACCOUNT account) {
/* Function that will clone a wiztool for this account if they have access
 * to it or destroy it if it exists and they should not have access to it. */
  calling_program_check(SYSTEM_WIZTOOL);

  if(!account) account = this_user();
  account->check_wiztool();
}
コード例 #11
0
ファイル: clone_object.c プロジェクト: Shea690901/gurbalib
static object clone_object( string path ) {
  object ob, ed;
  string trace;
  string cloner;

  argcheck( path, 1, "string" );

  ed = find_object(ERROR_D);

  /*
   * yeah.. calling the error_d to get a formatted runtime trace.. no, we aren't
   * reporting an error here, just using one of its nice utility functions to get
   * a nicely formatted trace
   *
   */
  if(ed) trace = ed->format_runtime_error("Clone calltrace",::call_trace(),0,0,0);
  else trace = "No clone calltrace available\n";

  if(this_object()->is_player() && this_object()->query_name()) {
    cloner = this_object()->query_name();
  } else if(sscanf(object_name(this_object()),"/cmds/wiz/%*s") == 1 && this_user()) {
    cloner = this_user()->query_name();
  } else {
    cloner = _owner;
  }

  if( strlen(path) > 2 ) {
    if( path[strlen(path)-2] == '.' && path[strlen(path)-1] == 'c' )
      path = path[..strlen(path)-3];
  }

  if(find_object(COMPILER_D)) {
    path = COMPILER_D->allow_object( path );
  }

  if( !(ob = find_object( path ) ) ) {
    ob = compile_object( path );
    call_other(ob,"???");
  }

  ob = ::clone_object( ob );
  ob->_F_set_cloner(cloner,trace);
  ob->_F_create();
  return ob;
}
コード例 #12
0
ファイル: account.c プロジェクト: nbmc/DOGL
static mixed query_env(string s, varargs int flag, object ACCOUNT account) {
/* Return the value for the specified enironment variable, allowing any set
 * values to override the default ones. The optional flag may also be set to
 * HIDE_DEFAULT to stop any default values from being shown. */
  DOGL_GLOBAL_CHECK();

  if(!account) account = this_user();
  return account->query_env(s, flag);
}
コード例 #13
0
ファイル: account.c プロジェクト: nbmc/DOGL
static mapping query_all_env(varargs int flag, object ACCOUNT account) {
/* Returns all of the environment variables set for the account. The optional
 * flag variable can be used to hide the default values and/or show the masked
 * values. */
  DOGL_GLOBAL_CHECK();

  if(!account) account = this_user();
  return account->query_all_env(flag);
}
コード例 #14
0
ファイル: colours.c プロジェクト: Lundex/lima
void do_print(string which)
{
  string array colours;
  string array illegal;
  string array irrelevant;
  mapping null = ANSI_D->query_translations()[1];
  int longest;

  if(wizardp(this_user()))
    irrelevant = ({});
コード例 #15
0
ファイル: start.c プロジェクト: ClockworkSoul/MortalRemains
string query_start_location()
{
    if ( start_location && load_object(start_location) )
	return start_location;
    if(wizardp(this_user()))
       {
	 return WIZARD_START;
       }
    return START;
}
コード例 #16
0
ファイル: start.c プロジェクト: ClockworkSoul/MortalRemains
varargs int move_to_start(object ob) {
    object where;
    
    if (!ob) ob = this_object(); /* move us */
    
    if (start_location && (where = load_object(start_location))
	&& ob->move(where) == MOVE_OK)
	return 1;
    where = load_object(wizardp(this_user()) ? WIZARD_START : START);
    if (where && ob->move(where) == MOVE_OK)
	return 1;

    return (ob->move(VOID_ROOM) == MOVE_OK);
}
コード例 #17
0
ファイル: account.c プロジェクト: nbmc/DOGL
static void redirect_user_input(string prompt, string func, int resp_type,
    int front, int hide_input, varargs object ACCOUNT account, mixed args...) {
/* This function redirects the next input entered by a user to the function
 * specified as func in the object that called this function.  The resp_type
 * is used to indicate what if any sort of processing the input should be
 * subjected to before passing the result onto said function.  If the front
 * value is true, the response will be added to the front of the redirection
 * queue if there are already others there.  If not, it will be added to the
 * end of any existing queue.  If an account object is not supplied the
 * current result of this_user() is assumed. */
  GLOBAL_SYSTEM_CHECK();

  if(!account) account = this_user();
  account->redirect_user_input(prompt, func, resp_type, front, hide_input,
      args ...);
}
コード例 #18
0
int siteban(string str) {
   string *tmp;
   string tmp_name;
   int flag;

   flag = 0;
   tmp = explode(str, ".");
   if (sizeof(tmp) != 4) {
      return 0;
   }

   if ((tmp[1] == "new") && (tmp[2] == "new") && (tmp[3] == "new")) {
      /* A class siteban */
      write_file("/data/banned/a/" + str,
	 ctime(time()) + "\tnewban by:  " + this_user()->query_name() + "\n");
      flag = 1;
      a_banned_sites += ({ str });
コード例 #19
0
ファイル: input.c プロジェクト: houseofmaldorne/ccmudlib
static nomask void input_to(string func, varargs int flag, mixed arg...)
{
    object ob;

    // The call should go to the user associated with this_player().
    //    If there isn't one, probably the best bet is the current user.

    // if (this_player())
    //   ob = this_player()->query_user();

    // if (!ob)

    ob = this_user();

    if (ob)
    {
        ob->set_no_prompt();
        ob->set_input_to(this_object(), func, flag, arg...);
    }

    return;
}
コード例 #20
0
ファイル: proxyd.c プロジェクト: shentino/kotaka
void check_security(string user, string creator)
{
	PERMISSION_CHECK(user != "System");

	if (user[0] >= 'a' && user[0] <= 'z') {
		object this_user;

		/* may be set by interface objects or filter objects */
		this_user = TLSD->query_tls_value("System", "this-user");

		if (!this_user) {
			this_user = this_user();
		}

		/* Proxies for users must be initiated by that user */
		PERMISSION_CHECK(this_user);
		PERMISSION_CHECK(this_user->query_name() == user);
	} else {
		/* Infrastructure can only be proxied by itself */
		PERMISSION_CHECK(creator == user);
	}
}
コード例 #21
0
ファイル: quit.c プロジェクト: Shea690901/gurbalib
void main( string str ) {
  this_user()->query_player()->do_quit( str );
}
コード例 #22
0
ファイル: finger.c プロジェクト: houseofmaldorne/ccmudlib
static int cmd(string str, object me, string verb)
{
  string ret, ttl;

  if (!strlen(str))
  {
    object *obs;
    string type;
    int i;
    obs = users();

    write(sprintf("%-12.12s    %-20.20s %-20.20s %-20.20s\n",
        _LANG_FINGER_NAME, _LANG_FINGER_REAL_NAME, _LANG_FINGER_CITY, _LANG_FINGER_BIRTHDAY));

    for (i = 0; i < sizeof(obs); i++)
    {
      string euid;
      string rnstr;
      string pname;
      object player;
      object user;

      user = obs[i];
      player = obs[i]->player();

      // should not happen... EVER!
      if (!player)
        continue;

      if (user->query_invis() && !this_user()->query_coder())
        continue;

      if (user->query_invis() > 1 && !this_user()->query_administrator())
        continue;

      // type = (obs[i]->query_earmuffs() ? "e" : " ");
      euid = geteuid(user);
      type = user->query_object_type();

      if (user->query_object_type() != "X")
      {
        string r, birthday, name;

        rnstr = (string)user->query_real_name();
        pname = player->query_cap_name();
        name  = player->query_name();

        if (rnstr && rnstr[0..0] == ":")
          if (!MASTER->valid_read("/save/players/"+name[0..0]+"/"+name,
              geteuid(this_user())))
            rnstr = "-";

        if (user->query_birthday())
          birthday = handler(CALENDAR_HANDLER)->convert_birthday(user->query_birthday());
        else
          birthday = "";

        r = sprintf("%-12.12s %2.2s %-20.20s %-20.20s %-20.20s\n",
          (user->query_invis() ? "(" + player->query_cap_name() + ")" : "" + player->query_cap_name()),
          type,
          (rnstr?rnstr:" "),
          ((ret = user->query_location())?ret:" "),
          birthday);

        write(r);
      }
      else
      {
        string r;
        r = sprintf("%-12.12s %2.2s\n",
          "login",
          type);
        write(r);
      }
    }

    return 1;
  }

  str = (string)this_player()->expand_nickname(str);

  if ("/lib/core/secure/bastards.c"->query_banish_reason(str))
  {
    string retval;
    retval = sprintf("%35-s%35-s\n", "Nombre : "+str, "(tiene prohibido el acceso)");

    // retval += "No tiene muchos segundos reales de edad.\n";
    // retval += "Nunca tuvo correo (ni lo tendra...).\n";
    // retval += "Sin plan.\nSin futuro.\n";

    ret = "/lib/core/secure/bastards.c"->query_banish_reason(str);
    write(retval + "Prohibido por: '" + capitalize(ret) + "'\n");
    return 1;
  }

  ttl = "===] %^GREEN%^"+mud_name()+"%^RESET%^ [===";

  ret = (string)"/lib/core/secure/finger"->finger_info(str, me);

  if (strlen(ret))
  {
    ret = handler("frames")->frame(ret, ttl, this_user()->query_cols());
    write(ret);
    return 1;
  }
  /*
  else if (me->query_coder() &&
      sscanf(str, "%s@%s", mud, mud) == 2)
  {
    "/net/daemon/out_finger"->do_finger(str);
    return 1;
  }
  */
  else
  {
    notify_fail("Nadie con el nombre " + str + " ha visitado "+mud_name()+".\n");
    return 0;
  }
}
コード例 #23
0
ファイル: cmd.c プロジェクト: ClockworkSoul/MortalRemains
/*
** cmd_channel()
**
** Standard channel processing command for player input.  Most channel-
** oriented systems will use this to get standardized channel manipulation.
**
** channel_type is:
**	0 normal
**	1 intermud
*/
varargs nomask void cmd_channel(string channel_name, string arg,
  int channel_type)
{
    class channel_info ci = query_channel_info(channel_name);
    object tb;
    int listening;
    string user_channel_name;
    string sender_name;

    tb = this_body();
    listening = member_array(channel_name, tb->query_channel_list()) != -1;
    user_channel_name = user_channel_name(channel_name);

    if ( !arg || arg == "" )
    {
	if ( listening )
	{
	    printf("You are presently listening to '%s'.\n", user_channel_name);
	    print_mod_info(channel_name);
	}
	else
	{
	    printf("You are not listening to '%s'.\n", user_channel_name);
	}

	return;
    }

    if ( arg[0..3] == "/new" )
    {
	string * options = explode(arg[4..], " ");

	if ( ci )
	{
	    if ( sizeof(options) )
		printf("'%s' already exists; modifying options...\n",
		  user_channel_name);
	    else
		printf("'%s' already exists.\n", user_channel_name);
	}
	else
	{
	    create_channel(channel_name);
	    printf("'%s' has been created.\n", user_channel_name);
	}

	ci = query_channel_info(channel_name);

	foreach ( string option in options )
	{
	    switch ( option )
	    {
	    case "admin":
		if ( !adminp(this_user()) )
		{
		    printf("Only admins can create admin channels.\n");
		    return;
		}
		set_flags(channel_name, CHANNEL_ADMIN_ONLY);
		printf("  --> only admins may tune in\n");
		break;

	    case "wiz":
	    case "wizard":
		/* ### need better security? */
		if ( (ci->flags & CHANNEL_ADMIN_ONLY) && !adminp(this_user()) )
		{
		    printf("Only admins can turn off admin-only.\n");
		    return;
		}
		else if ( !wizardp(this_user()) )
		{
		    printf("Only wizards can create wizard channels.\n");
		    return;
		}
		set_flags(channel_name, CHANNEL_WIZ_ONLY);
		printf("  --> only wizards may tune in\n");
		break;

	    case "permanent":
		/* ### need better security? */
		if ( !adminp(this_user()) )
		{
		    printf("Only admins can tweak permanent channels.\n");
		    return;
		}
		set_permanent(channel_name, 1);
		printf("  --> the channel is permanent\n");
		break;

	    case "nopermanent":
	    case "goaway":
		/* ### need better security? */
		if ( !adminp(this_user()) )
		{
		    printf("Only admins can tweak permanent channels.\n");
		    return;
		}
		set_permanent(channel_name, 0);
		printf("  --> the channel may now go away\n");
		test_for_purge(channel_name);
		break;
	    }
	}

	/* tune the channel in now */
	arg = "/on";
    }
コード例 #24
0
ファイル: mail.c プロジェクト: Lundex/lima
nomask private void main(string arg)
{
  this_user()->query_mailer()->begin_mail(arg);
}