//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; }
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, "[1;44m"); else strcpy(col2, "[1;40m"); if ( uentp->invisible ) strcpy(col, "[1;36m"); else if ( tmpmode == POSTING || tmpmode == MARKET ) strcpy(col,"[1;32m"); else if ( tmpmode == FIVE || tmpmode == BBSNET) strcpy(col,"[1;33m"); else strcpy(col,"[1m"); if(doTalk) { prints("(%d) 状态: %s%s%-10s[m, 来自: %.20s[1m\n", num, col, col2, ModeType(tmpmode), (uentp->from[22]!='H'||hisfriend(uentp))?uentp->from:BBSIP_DOT); } else { prints("%s%s%-10s[1;37;40m ",col, col2,ModeType(tmpmode)); if ((num) % 5 == 0) outc('\n'); } } } if (show) outc('\n'); return num; }