Beispiel #1
0
//uid的第一位置编号1
struct user_info *
queryUIndex(int uid, struct user_info *reader, int pid, int *pos)
{
	int i, uent, testreject = 0;
	struct user_info *uentp;
	if (uid <= 0 || uid > MAXUSERS) {
		*pos = -1;
		return NULL;
	}
	for (i = 0; i < 6; i++) {
		uent = binfo->uindexshm->user[uid - 1][i];
		if (uent <= 0)
			continue;
		uentp = &binfo->utmpshm->uinfo[uent - 1];
		if (!uentp->active || !uentp->pid || uentp->uid != uid)
			continue;
		if (pid != 0 && uentp->pid != pid)
			continue;
		if (reader && !testreject) {
			if (isreject(uentp, reader)) {
				*pos = -1;
				return NULL;
			}
			testreject = 1;
		}
		if (reader && binfo->utmpshm->uinfo[uent - 1].invisible
		    && !USERPERM(reader, (PERM_SYSOP | PERM_SEECLOAK)))
			continue;
		*pos = uent;
		return uentp;
	}
	*pos = -1;
	return NULL;
}
Beispiel #2
0
int t_search_ulist(struct user_info* uentp, int (*fptr)(), int farg, int show, int doTalk)
{
    int     i, num;
    char col[14];
    char col2[14];
    resolve_utmp();
    num = 0;
    for (i = 0; i < USHM_SIZE; i++)
    {
        *uentp = utmpshm->uinfo[i];
        if ((*fptr) (farg, uentp))
        {
            if (!uentp->active || !uentp->pid || isreject(uentp))
                continue;
            if (  (uentp->invisible==0)||(uentp->uid == usernum)
                    ||(uentp->invisible==1)&&(HAS_PERM(PERM_SYSOP|PERM_SEECLOAK)||canseeme(uentp)))
            {
                num++;
            }
            else
            {
                continue;
            }
            if (!show)
                continue;
            /* Efan: 增加奖章数	*/

#ifdef ALLOW_MEDALS

            if (num == 1)
                prints ("目前 %s 状态如下:   ", uentp->userid);
#else

            if (num == 1)
                prints("目前 %s 状态如下: \n", uentp->userid);
#endif
            //add by bluetent 2002-10-30 begin
            tmpmode=uentp->mode;
            if (tmpmode>20000)
            {
                tmpmode-=20000;
                iswwwmode=1;
            }
            else
            {
                iswwwmode=0;
            };
            //add by bluetent 2002-10-30 end


            if ( uentp->mode>20000)
                strcpy(col2, "");
            else
                strcpy(col2, "");
            if ( uentp->invisible )
                strcpy(col, "");
            else if ( tmpmode == POSTING || tmpmode == MARKET )
                strcpy(col,"");
            else if ( tmpmode == FIVE || tmpmode == BBSNET)
                strcpy(col,"");
            else
                strcpy(col,"");
            if(doTalk)
            {
                prints("(%d) 状态: %s%s%-10s, 来自: %.20s\n",
                       num, col, col2, ModeType(tmpmode),
                       (uentp->from[22]!='H'||hisfriend(uentp))?uentp->from:BBSIP_DOT);
            }
            else
            {
                prints("%s%s%-10s ",col, col2,ModeType(tmpmode));
                if ((num) % 5 == 0)
                    outc('\n');
            }
        }
    }
    if (show)
        outc('\n');
    return num;
}