diff options
author | bbs <bbs@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-05-20 09:51:01 +0800 |
---|---|---|
committer | bbs <bbs@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-05-20 09:51:01 +0800 |
commit | 95c883dbfd9319b317477e2aef4a46ccff212249 (patch) | |
tree | ed9b72917d60ad96f4fa846208aa860809ca1be9 | |
parent | 93a38cf8278f1bc0904ea561aa12e840361e12d8 (diff) | |
download | pttbbs-95c883dbfd9319b317477e2aef4a46ccff212249.tar pttbbs-95c883dbfd9319b317477e2aef4a46ccff212249.tar.gz pttbbs-95c883dbfd9319b317477e2aef4a46ccff212249.tar.bz2 pttbbs-95c883dbfd9319b317477e2aef4a46ccff212249.tar.lz pttbbs-95c883dbfd9319b317477e2aef4a46ccff212249.tar.xz pttbbs-95c883dbfd9319b317477e2aef4a46ccff212249.tar.zst pttbbs-95c883dbfd9319b317477e2aef4a46ccff212249.zip |
search_ulist_userid()
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@883 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/bbs.c | 8 | ||||
-rw-r--r-- | mbbsd/cache.c | 27 |
2 files changed, 33 insertions, 2 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 01324b22..7129703e 100644 --- a/mbbsd/bbs.c +++ b/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/mbbsd/cache.c b/mbbsd/cache.c index 3a011825..a5c6c43c 100644 --- a/mbbsd/cache.c +++ b/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) |