Beispiel #1
0
Datei: home.c Projekt: cosin/XYJ
int main(object me, string arg)
{
	string msg, loc;
	object ridee;

	if( file_size(user_path(geteuid(me)) + "workroom.c") <= 0 )
		return notify_fail("你没有自己的工作室。\n");

	if( stringp(msg = me->query("env/msg_home")) )
		if (msg != "") message_vision(msg + "\n", me);
	loc = user_path(geteuid(me)) + "workroom";
	if (ridee = me->ride())
		ridee->move(loc);
	me->move(loc);	
	return 1;
}
Beispiel #2
0
int
sco_statvfs(char *filename, struct sco_statvfs *bufp)
{
#if _KSL > 26
	struct path path;
#else
	struct nameidata nd;
#endif
	int error;

#if _KSL > 26
	error = user_path(filename, &path);
#else
	error = user_path_walk(filename, &nd);
#endif

	if (!error) {
#if _KSL > 24
#if _KSL > 26
		error = report_statvfs(path.mnt, path.dentry->d_inode, bufp);
		path_put(&path);
#else
		error = report_statvfs(nd.path.mnt, nd.path.dentry->d_inode, bufp);
		path_put(&nd.path);

#endif
#else
		error = report_statvfs(nd.mnt, nd.dentry->d_inode, bufp);
		path_release(&nd);
#endif
	}
	return error;
}
Beispiel #3
0
int cmd_sponsor(string str) {
    object who;

    if(!str) {
	notify_fail("Sponsor whom?\n");
	return 0;
    }
    who = find_living(str);
    if(!who) {
	notify_fail("No "+capitalize(str)+" on the mud.\n");
	return 0;
    }
    if((string)who->query_position() != "new immortal") {
	notify_fail(capitalize(str)+" is still a mortal!\n");
	return 0;
    }
    if(!archp(this_player()) && (string)this_player()->query_position() != "mentor") {
	notify_fail("You are not allowed to sponsor anyone!\n");
	return 0;
    }
    who->set_level(1);
    seteuid(UID_ADVANCE);
    who->set_position("immortal");
    seteuid(UID_ARCHSAVE);
    write_file("/adm/etc/sponsor", str+" ("+(string)this_player()->query_name()+
	":"+ctime(time())+")\n");
    seteuid(getuid());
    message("info", sprintf("You are now a full immortal!\nYour home "
      "directory is %s.", user_path(str)), who);
    message("info", sprintf("%s is now a full immortal!", capitalize(str)),
      users(), ({ who }));
Beispiel #4
0
mixed cmd(string args) {
    object player = this_player();
    mixed replee = player->GetProperty("reply");
    string ret = "";
    string *tmp;
    ret += "Screen: \t\t"+identify(this_player()->GetScreen())+"\n";
    ret += "Terminal: \t\t"+this_player()->GetTerminal()+"\n";
    ret += "Brief mode: \t\t"+ ( (this_player()->GetBriefMode()) ? "on" : "off" )+"\n";
    ret += "Cursefilter: \t\t"+ ( (this_player()->GetParanoia("cursefilter")) ? "on" : "off" )+"\n";
    ret += "Channel message colors: "+ ( (this_player()->GetNoChanColors()) ? "off" : "on" )+"\n";
    ret += "Playerkiller mode: \t"+ ( (this_player()->GetPK()) ? "on" : "off" )+"\n";
    ret += "Mute mode: \t\t"+ GetMuted()+" \n";
    ret += "Gag mode: \t\t"+ GetGagged()+" \n";
    ret += "Wimpy mode: \t\t"+ ( (this_player()->GetWimpy()) ? "on" : "off" )+"\n";
#if efun_defined(compressedp)
    ret += "MCCP mode: \t\t"+(compressedp(this_player()) ? "on" : "off")+"\n";
#endif
#if MINIMAP
    ret += "Minimap mode: \t\t"+ ( this_player()->GetProperty("minimapping") ? "on" : "off" )+"\n";
#endif
    ret += "Annoyblock: \t\t"+ ( (this_player()->GetAnnoyblock()) ? "on" : "off" )+"\n";
    ret += "Reprompt mode: \t\t"+ ( this_player()->GetProperty("reprompt") ? "on" : "off" )+"\n";
    ret += "Screenlock mode: \t"+ ( this_player()->GetProperty("screenlock") ? "on" : "off" )+"\n";
    ret += "Timezone: \t\t"+ ( this_player()->GetProperty("timezone") ? 
            this_player()->GetProperty("timezone") : "None specified" )+"\n";
#ifdef __GET_CHAR_IS_BUFFERED__
    ret += "Charmode: \t\t"+ 
        //( (query_charmode(player) > 0) ? "on" : "off" )+"\n";
        ( (player->GetCharmode()) ? "on" : "off" )+"\n";
#endif
    ret += "Commandecho: \t\t"+ ( this_player()->GetProperty("commandecho") ? this_player()->GetProperty("commandecho") : "off" )+"\n";
#ifdef __DSLIB__
    ret += "Keepalive mode: \t"+ ( this_player()->GetProperty("keepalive") 
            ? this_player()->GetProperty("keepalive") : "off" )+"\n";
#endif

    if(creatorp(this_player())){ 
        ret += "Homedir: \t\t"+user_path(this_player())+"\n";
        if(this_player()->GetParanoia("homeroom")){
            ret += "Homeroom: \t\t"+this_player()->GetParanoia("homeroom")+"\n";
        }
        ret += "Debug mode: \t\t"+ ( (this_player()->GetProperty("debug")) ? "on" : "off" )+"\n";
        ret += "Godmode: \t\t"+ ( (this_player()->GetGodMode()) ? "on" : "off" )+"\n";
        ret += "Wizvision: \t\t"+ ( (this_player()->GetWizVision()) ? "on" : "off" )+"\n";
#if GRID
        ret += "Showgrid: \t\t"+ ( (this_player()->GetVisibleGrid()) ? "on" : "off" )+"\n";
        ret += "Wizmap mode: \t\t"+ ( this_player()->GetProperty("wizmapping") ? "on" : "off" )+"\n";
        ret += "Noclip mode: \t\t"+ ( this_player()->GetProperty("noclip") ? "on" : "off" )+"\n";
        ret += "Anchor: \t\t"+ ( this_player()->GetAnchored() ? "on" : "off" )+"\n";
#endif
    }
    if(replee){
        ret += "Reply target: \t\t"+replee+"\n";
    }
    tmp = sort_array(explode(ret, "\n"),1);
    ret = implode(tmp, "\n");
    write(ret);
    return 1;
}
Beispiel #5
0
static long do_sys_truncate(const char __user *pathname, loff_t length)
{
	struct path path;
	struct inode *inode;
	int error;

	error = -EINVAL;
	if (length < 0)	
		goto out;

	error = user_path(pathname, &path);
	if (error)
		goto out;
	inode = path.dentry->d_inode;

	
	error = -EISDIR;
	if (S_ISDIR(inode->i_mode))
		goto dput_and_out;

	error = -EINVAL;
	if (!S_ISREG(inode->i_mode))
		goto dput_and_out;

	error = mnt_want_write(path.mnt);
	if (error)
		goto dput_and_out;

	error = inode_permission(inode, MAY_WRITE);
	if (error)
		goto mnt_drop_write_and_out;

	error = -EPERM;
	if (IS_APPEND(inode))
		goto mnt_drop_write_and_out;

	error = get_write_access(inode);
	if (error)
		goto mnt_drop_write_and_out;

	error = break_lease(inode, O_WRONLY);
	if (error)
		goto put_write_and_out;

	error = locks_verify_truncate(inode, NULL, length);
	if (!error)
		error = security_path_truncate(&path);
	if (!error)
		error = do_truncate(path.dentry, length, 0, NULL);

put_write_and_out:
	put_write_access(inode);
mnt_drop_write_and_out:
	mnt_drop_write(path.mnt);
dput_and_out:
	path_put(&path);
out:
	return error;
}
Beispiel #6
0
mixed GoHome(string str) {
    object ob, prev;
    string who, room;

    prev = environment(this_player());
    if( !str || str == "" || !creatorp(this_player())){
        who = this_player()->GetKeyName();
    }
    else who = lower_case(str);
    if(!user_exists(who)) return "There's no such user.";
    room = PLAYERS_D->GetHomeRoom(who);
    if(!room || !strsrch(room, "/tmp/")){
        str = user_path(who, 1);
        if(!directory_exists(str)) return "That person has no home dir.";
        str = user_path(who, 1)+"workroom.c";
        arg = str;
        if(!unguarded((: file_exists(arg) :)))
            return capitalize(who)+" has no active workroom.";
    }
Beispiel #7
0
SYSCALL_DEFINE4(getxattr, const char __user *, pathname,
		const char __user *, name, void __user *, value, size_t, size)
{
	struct path path;
	ssize_t error;

	error = user_path(pathname, &path);
	if (error)
		return error;
	error = getxattr(path.dentry, name, value, size);
	path_put(&path);
	return error;
}
Beispiel #8
0
SYSCALL_DEFINE3(listxattr, const char __user *, pathname, char __user *, list,
		size_t, size)
{
	struct path path;
	ssize_t error;

	error = user_path(pathname, &path);
	if (error)
		return error;
	error = listxattr(path.dentry, list, size);
	path_put(&path);
	return error;
}
Beispiel #9
0
int main(object me, string arg)
{
	string dir;

	if( !arg )
		arg = user_path(me->query("id"));
	dir = resolve_path(me->query("cwd"), arg);
	if(file_size(dir)!=-2) return notify_fail("没有这个目录。\n");

	if(dir[strlen(dir)-1]!='/') dir += "/";
	me->set("cwd", dir);
	write(dir + "\n");
	return 1;	
}
Beispiel #10
0
asmlinkage long sys_statfs(const char __user *pathname, struct statfs __user * buf)
{
	struct path path;
	int error;

	error = user_path(pathname, &path);
	if (!error) {
		struct statfs tmp;
		error = vfs_statfs_native(path.dentry, &tmp);
		if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
			error = -EFAULT;
		path_put(&path);
	}
	return error;
}
static long do_sys_truncate(const char __user *pathname, loff_t length)
{
	struct path path;
	int error;

	if (length < 0)	/* sorry, but loff_t says... */
		return -EINVAL;

	error = user_path(pathname, &path);
	if (!error) {
		error = vfs_truncate(&path, length);
		path_put(&path);
	}
	return error;
}
Beispiel #12
0
SYSCALL_DEFINE2(statfs, const char __user *, pathname, struct statfs __user *, buf)
{
	struct path path;
	int error;

	error = user_path(pathname, &path);
	if (!error) {
		struct statfs tmp;
		error = vfs_statfs_native(path.dentry, &tmp);
		if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
			error = -EFAULT;
		path_put(&path);
	}
	return error;
}
Beispiel #13
0
SYSCALL_DEFINE3(statfs64, const char __user *, pathname, size_t, sz, struct statfs64 __user *, buf)
{
	struct path path;
	long error;

	if (sz != sizeof(*buf))
		return -EINVAL;
	error = user_path(pathname, &path);
	if (!error) {
		struct statfs64 tmp;
		error = vfs_statfs64(path.dentry, &tmp);
		if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
			error = -EFAULT;
		path_put(&path);
	}
	return error;
}
Beispiel #14
0
SYSCALL_DEFINE2(removexattr, const char __user *, pathname,
		const char __user *, name)
{
	struct path path;
	int error;

	error = user_path(pathname, &path);
	if (error)
		return error;
	error = mnt_want_write(path.mnt);
	if (!error) {
		error = removexattr(path.dentry, name);
		mnt_drop_write(path.mnt);
	}
	path_put(&path);
	return error;
}
Beispiel #15
0
asmlinkage long sys_statfs64(const char __user *pathname, size_t sz, struct statfs64 __user *buf)
{
	struct path path;
	long error;

	if (sz != sizeof(*buf))
		return -EINVAL;
	error = user_path(pathname, &path);
	if (!error) {
		struct statfs64 tmp;
		error = vfs_statfs64(path.dentry, &tmp);
		if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
			error = -EFAULT;
		path_put(&path);
	}
	return error;
}
Beispiel #16
0
SYSCALL_DEFINE3(chown, const char __user *, filename, uid_t, user, gid_t, group)
{
	struct path path;
	int error;

	error = user_path(filename, &path);
	if (error)
		goto out;
	error = mnt_want_write(path.mnt);
	if (error)
		goto out_release;
	error = chown_common(&path, user, group);
	mnt_drop_write(path.mnt);
out_release:
	path_put(&path);
out:
	return error;
}
Beispiel #17
0
SYSCALL_DEFINE5(setxattr, const char __user *, pathname,
		const char __user *, name, const void __user *, value,
		size_t, size, int, flags)
{
	struct path path;
	int error;

	error = user_path(pathname, &path);
	if (error)
		return error;
	error = mnt_want_write(path.mnt);
	if (!error) {
		error = setxattr(path.dentry, name, value, size, flags);
		mnt_drop_write(path.mnt);
	}
	path_put(&path);
	return error;
}
Beispiel #18
0
asmlinkage long sys_chown(const char __user * filename, uid_t user, gid_t group)
{
	struct path path;
	int error;

	error = user_path(filename, &path);
	if (error)
		goto out;
	error = mnt_want_write(path.mnt);
	if (error)
		goto out_release;
	error = chown_common(path.dentry, user, group);
	mnt_drop_write(path.mnt);
out_release:
	path_put(&path);
out:
	return error;
}
Beispiel #19
0
static int coda_pioctl(struct inode * inode, struct file * filp, 
                       unsigned int cmd, unsigned long user_data)
{
	struct path path;
        int error;
	struct PioctlData data;
        struct inode *target_inode = NULL;
        struct coda_inode_info *cnp;

        /* get the Pioctl data arguments from user space */
        if (copy_from_user(&data, (void __user *)user_data, sizeof(data))) {
	    return -EINVAL;
	}
       
        /* 
         * Look up the pathname. Note that the pathname is in 
         * user memory, and namei takes care of this
         */
        if (data.follow) {
                error = user_path(data.path, &path);
	} else {
	        error = user_lpath(data.path, &path);
	}
		
	if ( error ) {
		return error;
        } else {
		target_inode = path.dentry->d_inode;
	}
	
	/* return if it is not a Coda inode */
	if ( target_inode->i_sb != inode->i_sb ) {
		path_put(&path);
	        return  -EINVAL;
	}

	/* now proceed to make the upcall */
        cnp = ITOC(target_inode);

	error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data);

	path_put(&path);
        return error;
}
SYSCALL_DEFINE3(chown, const char __user *, filename, uid_t, user, gid_t, group)
{
	struct path path;
	int error;

	error = user_path(filename, &path);
	if (error)
		goto out;
//ASUS_BSP +++ Jimmy,Josh "remove fuse"
	if(strcmp(path.mnt->mnt_mountpoint->d_iname,"sdcard")==0){
		error = -ENOSYS;
		goto out_release;
	}
//ASUS_BSP --- Jimmy,Josh "remove fuse"
	error = mnt_want_write(path.mnt);
	if (error)
		goto out_release;
	error = chown_common(&path, user, group);
	mnt_drop_write(path.mnt);
out_release:
	path_put(&path);
out:
	return error;
}
Beispiel #21
0
static long do_sys_truncate(const char __user *pathname, loff_t length)
{
	struct path path;
	struct inode *inode;
	int error;

	error = -EINVAL;
	if (length < 0)	/* sorry, but loff_t says... */
		goto out;

	error = user_path(pathname, &path);
	if (error)
		goto out;
	inode = path.dentry->d_inode;

	/* For directories it's -EISDIR, for other non-regulars - -EINVAL */
	error = -EISDIR;
	if (S_ISDIR(inode->i_mode))
		goto dput_and_out;

	error = -EINVAL;
	if (!S_ISREG(inode->i_mode))
		goto dput_and_out;

	error = mnt_want_write(path.mnt);
	if (error)
		goto dput_and_out;

	error = inode_permission(inode, MAY_WRITE);
	if (error)
		goto mnt_drop_write_and_out;

	error = -EPERM;
	if (IS_APPEND(inode))
		goto mnt_drop_write_and_out;

	error = get_write_access(inode);
	if (error)
		goto mnt_drop_write_and_out;

	/*
	 * Make sure that there are no leases.  get_write_access() protects
	 * against the truncate racing with a lease-granting setlease().
	 */
	error = break_lease(inode, O_WRONLY);
	if (error)
		goto put_write_and_out;

	error = locks_verify_truncate(inode, NULL, length);
	if (!error)
		error = security_path_truncate(&path);
	if (!error)
		error = do_truncate(path.dentry, length, 0, NULL);

put_write_and_out:
	put_write_access(inode);
mnt_drop_write_and_out:
	mnt_drop_write(path.mnt);
dput_and_out:
	path_put(&path);
out:
	return error;
}
Beispiel #22
0
string datafile()
{
    return user_path( geteuid( this_object() ) ) + ".memo";
}
Beispiel #23
0
int cmd_update(string str)
{
    object	ob;
    string	file, res, temp, *obs, logf;
    int		i, deep_up, syslog_siz, mylog_siz;

    if (!str)
	str = (string)this_player()->query("cwf");
    if (!str) {
        notify_fail("You have no current working file set.\n");
        return 0;
    }
  
if ( (strsrch(str,"/std/user#") != -1 ) || ( strsrch(str,
     "/std/connection#") != -1 ) )
  {
    write("Updating a user or connection object isn't allowed!\n");
    return 1;
  }
    if (str)		// update the specified file
    {
	if(sscanf(str, "-r %s", temp))
	{
	    file = temp;
	    deep_up = 1;
	}
	else if(sscanf(str, "-R %s", temp))
	{
	    file = temp;
	    deep_up = 2;
	}
	else if(str == "-r")
	{
	    file = 0;
	    deep_up = 1;
	}
	else if(str == "-R")
	{
	    file = 0;
	    deep_up = 2;
	}
	else
	     file = str;
    } // if(str)
    if(!file)
    {
	if(!environment(this_player()))
	{
	    notify_fail("Update: You don't have an environment.\n");
	    return 0;
	}
	file = file_name(environment(this_player()));
    }
    else 
	file = resolv_path("cwd", file);
 
    //	Make sure that a ".c" is appended on the filename

    if(extract(file, strlen(file)-2, strlen(file)-1) != ".c")
	file += ".c";
 
    this_player()->set("cwf",file);

    logf = (string) this_player()->query("name");
    logf=user_path(logf) + "log";	// assume if can use update, has a name
    mylog_siz = file_size(logf);
    syslog_siz = file_size(LOG_DIR + "log");

    seteuid(geteuid(previous_object()));

/* Beek 091993 - doesn't dest virtual objects now */
    if (find_object(file) && virtualp(find_object(file))) {
      notify_fail("That object is virtual and cannot be updated.\n");
      return 0;
    }
    if(!file_exists(file)) {
	if(find_object(file)) {
	destruct(find_object(file));
	notify_fail("Update: " + file + " does not exist.\n\tLoaded " +
		    "copy of file removed from memory.\n"); }
    	else notify_fail("Update: " + file + " does not exist.\n");
    return 0; }

    ob = find_object(file);
    if (!ob)
    {
	res = catch(file->apply_load());
	if(res)
	{
	    display_errs(mylog_siz, logf);
	    display_errs(syslog_siz, LOG_DIR + "log");
	    notify_fail("Failure to load object.\n");
	    return 0;
	}
	ob = find_object(file);
    }
Beispiel #24
0
string finger_user(string who) {
    object link, body;
    mixed tmp1, tmp2, tmp3, tmp4, tmp5;
    string msg;
    mapping mail_stat;
    int hibernate;

    link = restore_data(who);
    if (link) body = restore_body(who);

    if (!link || !body) {
	if (sscanf(who, "(%s)", who))
	    return finger_group(who);
	return "Finger: There is no such user.\n";
    }

    msg = LINE1;

    // Line 1: Fingerguy the Utter Novice (Chaotic Neutral)
    if (link->query("wizard")) {
	string al, title = body->getenv( "TITLE" );
	al = body->query("al_title");
	if (!al || al=="") {
	    msg += body->query_title() + "\n";
	} else {
	    if (!title) title = "$N the New Wizard ($A)";
	    title = replace_string(title, "$N", body->query("cap_name"));
	    title = replace_string(title, "$A", al);
	    msg += title + "\n";
	}
    } else
	msg += body->query_title() + "\n";

    // Line 2: Male Human Mage [Level 5]
    // or:    Male Human Necromancer [Lesser Power of Prime]
    msg += capitalize(body->query("gender"));
    msg += " "+capitalize(body->query("race"));

    mail_stat = link->query("Class");
    if (mail_stat) {
	tmp1 = (values(mail_stat))[0];
	msg += ( " " +  capitalize(tmp1) );
    }

    if (wizardp(TP)) {
	if (link->query("wizard")) {
	    if (member_group(body->query("name"), "ambassador")) {
		tmp1 = "Ambassador";
		tmp2 = body->query("ambassador");
		if ((tmp2 != 0) && (tmp2 != ""))
		    tmp1 = tmp1 + " of " + capitalize(tmp2);
	    } else {
		tmp1 = DOMAIN_D->query_domain(link);
		tmp2 = DOMAIN_D->query_domain_level(link);
		if ((tmp1 == 0) || (tmp1 == ""))
		    tmp1 = "Domainless "+tmp2;
		else
		    tmp1 = tmp2 + " of " + tmp1 + " Domain";
	    }
	} else {
	    tmp1 = "Level " + link->query("level");
	}
	tmp1 = " [" + tmp1 + "]\n";
	msg += tmp1;
    } else msg += "\n";

    // Line 3: Gang allegience: The Machiavellian Menagerie
    // or: The Admin (Leader)
    
	tmp1 = "Gang allegience: ";
	tmp2 = body->query("gang");

	if (tmp2) {
	    mail_stat = GANG_D->get_list_map();
	    if (mail_stat[tmp2] == body->query("name"))
	        tmp1 += "Leader of "+cap_all_words(tmp2);
	    else
	        tmp1 += "Member of "+cap_all_words(tmp2);
	       
	} else {
	    tmp1 += "none";
	}
	
   	msg += tmp1 + "\n";

    // Line 4 : Married to Whoever
    tmp1 = body->query("spouse");
    if (tmp1) {
	tmp1 = capitalize(tmp1);
	msg += "Married to "+tmp1+"\n";
    }

    // Line 5 : A cool line to make it all very pretty.
    msg += LINE2;

    // Line 6: In Real Life: Matthew A. Titmus
    // or: In Real Life: ?
    tmp2 = "In Real Life: ";
    if (tmp3 = (string)link->RNAME)
	tmp2 += extract(tmp3, 0, 22);
    else
	tmp2 += "?";

    msg += "Status: ";
    if (member_group(body->query("name"), "root"))
	msg += "Administrator\n";
    else if (member_group(body->query("name"), "adminaccess"))
	msg += "Elder\n";
    else if (member_group(body->query("name"), "ambassador"))
	msg += "Ambassador\n";
    else if (link->query("wizard"))
	msg += "Immortal\n";
    else
	msg += "Player\n";

    if (body->query("email_visible"))
	tmp1 = "[Public]";
    else
	tmp1 = "[Private]";

    if (adminp(TP) || 
      body->query("name")==TP->query("name")) {
	tmp1 = (string)link->query("email")+" "+tmp1;
    } else {
	if (body->query("email_visible")) {
	    tmp1 = (string)link->query("email");
	} else {
	    tmp1 = "[Private]";
	}
    }

    if (tmp1) msg += "Email address: " + tmp1 + "\n";

    tmp1 = (string)link->query("URL");
    if (tmp1) msg += "URL: " + tmp1 + "\n";

    hibernate = (int)link->query("hibernate");

    if (hibernate && time() < hibernate)
	msg += "\n\t[In hibernation until " + ctime(hibernate) + "]\n\n";

    tmp1 = find_player(who);
    if (tmp1) {
	if (!filter_users(tmp1))
	    tmp1 = 0;
    }

    if (!link->query("last_on"))
	msg += (tmp1 ? "On since: " : "Last on: ") + "Unavailable";
    else
	msg += ((tmp1 && !tmp1->query("npc")) ? "On since: " : "Last on: ") +
	ctime((int)link->query("last_on")) ;

    if (wizardp(TP)) 
	msg += ( " from " + (string)link->query("ip") + " \n" );
    else
	msg += "\n";

    if (tmp1) {
	tmp1 = query_idle_string(tmp1, 1);
	if (strlen(tmp1) > 0)
	    msg += tmp1 + "\n";
    }

    mail_stat = (mapping)MAILBOX_D->mail_status(who);
    if (mail_stat["unread"])
	msg += sprintf("%s has not read %d of their %d piece%s of mail.\n",
	  capitalize(who), mail_stat["unread"], mail_stat["total"],
	  (mail_stat["total"] == 1 ? "" : "s"));
    else {
	msg += "No unread mail" ;
	if(this_player()) {
	    if (adminp(getuid(this_player()))) {
		//  msg += " ("+mail_stat["total"]+" pieces)" ;
		msg += sprintf(" (%d piece%s)", mail_stat["total"], (mail_stat["total"] == 1 ? "" : "s"));
	    }
	}
	msg += ".\n" ;
    }

    if (link->query("wizard")) {
	tmp1 = user_path(who) + ".project";
	if (file_size(tmp1) >= 0)
	    msg += "Project: " + read_file(tmp1);

	tmp1 = user_path(who) + ".plan";
	if (file_size(tmp1) >= 0) {
	    msg += "Plan:\n" + read_file(tmp1);
	} else {
	    msg += "No Plan.\n";
	}
    } else {
	if (body->query("session"))
	    tmp1 = iwrap("Session: "+body->query("session"));
	else
	    tmp1 = "No Session.\n";

	msg += tmp1;
    }

    msg += LINE1;

    if (!find_player(who) || !interactive(find_player(who))) {
	link->remove();
	// Some names like .foo weren't getting away.
	if(link) destruct(link);
	if(link) log_file("fingerdest",sprintf("Connection of %s not "+
		"dested by finger daemon, on %s.\n", link->query("name"), 
		ctime(time())));

	if(body) destruct(body);
	if(body) log_file("fingerdest",sprintf("Connection of %s not "+
		"dested by finger daemon, on %s.\n", body->query("name"), 
		ctime(time())));
    }

    return "\n" + msg + "\n";
}
Beispiel #25
0
	return 0;
    }
    if(!archp(this_player()) && (string)this_player()->query_position() != "mentor") {
	notify_fail("You are not allowed to sponsor anyone!\n");
	return 0;
    }
    who->set_level(1);
    seteuid(UID_ADVANCE);
    who->set_position("immortal");
    seteuid(UID_ARCHSAVE);
    write_file("/adm/etc/sponsor", str+" ("+(string)this_player()->query_name()+
	":"+ctime(time())+")\n");
    seteuid(getuid());
    message("info", sprintf("You are now a full immortal!\nYour home "
      "directory is %s.", user_path(str)), who);
    message("info", sprintf("%s is now a full immortal!", capitalize(str)),
      users(), ({ who }));
    seteuid(UID_CRESAVE);
    mkdir("/wizards/"+lower_case(str));
    write_file(user_path(str)+"workroom.c", read_file("/std/obj/workroom.c"));
    seteuid(getuid());
    return 1;
}

void help() {
    write("Syntax: <sponsor [player]>\n\n"+
	"Mentors and above may use this command to sponsor new immortals\n"+
	"from level 20 immortality to level 21, and it makes the directory\n"+
	"as well.\n");
}