From d961ad0c11580ffc52bf44bdf2c5676677a5b58b Mon Sep 17 00:00:00 2001 From: bbs Date: Tue, 20 May 2003 01:51:01 +0000 Subject: search_ulist_userid() git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk@883 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/mbbsd/bbs.c | 8 +++++++- pttbbs/mbbsd/cache.c | 27 ++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c index 01324b22..7129703e 100644 --- a/pttbbs/mbbsd/bbs.c +++ b/pttbbs/mbbsd/bbs.c @@ -1,4 +1,4 @@ -/* $Id: bbs.c,v 1.94 2003/05/18 13:42:55 victor Exp $ */ +/* $Id: bbs.c,v 1.95 2003/05/20 01:51:01 bbs Exp $ */ #include "bbs.h" static int recommend(int ent, fileheader_t * fhdr, char *direct); @@ -170,10 +170,16 @@ readdoent(int num, fileheader_t * ent) if (!strncmp(title, "[¤½§i]", 6)) special = 1; +#if 1 + if (!strchr(ent->owner, '.') && !SHM->GV2.e.noonlineuser && + (uentp = search_ulist_userid(ent->owner)) && isvisible(currutmp, uentp)) + isonline = 1; +#else if (!strchr(ent->owner, '.') && (uid = searchuser(ent->owner)) && !SHM->GV2.e.noonlineuser && (uentp = search_ulist(uid)) && isvisible(currutmp, uentp)) isonline = 1; +#endif if (strncmp(currtitle, title, TTLEN)) prints("%6d %c\033[1;32m%c\033[m%-6s\033[%dm%-13.12s\033[m%s " diff --git a/pttbbs/mbbsd/cache.c b/pttbbs/mbbsd/cache.c index 3a011825..a5c6c43c 100644 --- a/pttbbs/mbbsd/cache.c +++ b/pttbbs/mbbsd/cache.c @@ -1,4 +1,4 @@ -/* $Id: cache.c,v 1.60 2003/02/27 05:52:51 in2 Exp $ */ +/* $Id: cache.c,v 1.61 2003/05/20 01:51:01 bbs Exp $ */ #include "bbs.h" #ifndef __FreeBSD__ @@ -432,6 +432,31 @@ search_ulistn(int uid, int unum) } return 0; } +userinfo_t * +search_ulist_userid(char *userid) +{ + register int i = 0, j, start = 0, end = SHM->UTMPnumber - 1; + register userinfo_t **ulist; + if (end == -1) + return NULL; + ulist = SHM->sorted[SHM->currsorted][0]; + for (i = ((start + end) / 2);; i = (start + end) / 2) { + j = strcasecmp(userid, ulist[i]->userid); + if (!j) { + return (userinfo_t *) (ulist[i]); + } + if (end == start) { + break; + } else if (i == start) { + i = end; + start = end; + } else if (j > 0) + start = i; + else + end = i; + } + return 0; +} int count_logins(int uid, int show) -- cgit v1.2.3