diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-05-13 16:00:07 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-05-13 16:00:07 +0800 |
commit | 9671494643c68203da5fcf777a3c61720d29000a (patch) | |
tree | bbdcf044d7dcbbd172f6f0a2ed65316e7b981565 | |
parent | 8601b22b64b7f524e299773a6915bbedb5f78ab4 (diff) | |
download | pttbbs-9671494643c68203da5fcf777a3c61720d29000a.tar pttbbs-9671494643c68203da5fcf777a3c61720d29000a.tar.gz pttbbs-9671494643c68203da5fcf777a3c61720d29000a.tar.bz2 pttbbs-9671494643c68203da5fcf777a3c61720d29000a.tar.lz pttbbs-9671494643c68203da5fcf777a3c61720d29000a.tar.xz pttbbs-9671494643c68203da5fcf777a3c61720d29000a.tar.zst pttbbs-9671494643c68203da5fcf777a3c61720d29000a.zip |
WARNING: THIS PATCHSET CHANGED SHM STRUCTURE. PLEASE READ UPDATING CAREFULLY.
- (internal) change IP/from sorting mechanism.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4307 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | UPDATING | 10 | ||||
-rw-r--r-- | include/pttstruct.h | 2 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 9 | ||||
-rw-r--r-- | mbbsd/talk.c | 9 | ||||
-rw-r--r-- | util/shmctl.c | 3 |
5 files changed, 21 insertions, 12 deletions
@@ -14,6 +14,14 @@ $Id$ https://opensvn.csie.org/traccgi/pttbbs/changeset/2273 ----------------------------------------------------------------------------- +r4306: [SHM/from_alias] +故鄉從此版起有所調整。 +原 from_alias 改成 from_ip 方便直接照 IP 排序。 (SHM 大小理應沒有變動) +currutmp->from 改為純顯示用。 +為正確排序也避免舊 talk.c 把 from_ip 拿去查 from_alias 的表, +在安裝此 patch 後請記得重編 shmctl 跟 mbbsd 並關站後重新執行 shmctl。 + + r4194: [PASSWD/STRUCT] *** PASSWD 調整: 此板把 r3968 的空間拿來放職業與電話了, 請關站並執行 upgrade/r4194_passwd 昇級。 @@ -34,7 +42,7 @@ r4151: [REGISTER] r4132: [REGISTER] upgrade/r4132_reglog2db.py 可以幫助你把 register.log 轉換成 sqlite3 資料庫。 -未來將利用這個資料庫進行認證資料的重建。 +未來可利用這個資料庫進行認證資料的重建。 (r4194 有較簡易的重建工具) r4051: [CONF] 所有的 GLOBAL_* 板名定義現全改為 BN_* diff --git a/include/pttstruct.h b/include/pttstruct.h index bfb3453d..b4873c67 100644 --- a/include/pttstruct.h +++ b/include/pttstruct.h @@ -328,7 +328,7 @@ typedef struct userinfo_t { char userid[IDLEN + 1]; char nickname[24]; char from[27]; /* machine name the user called in from */ - int from_alias; + in_addr_t from_ip; // was: int from_alias; char sex; char nonuse[4]; /* diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index f907eae8..d3868532 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -962,6 +962,9 @@ setup_utmp(int mode) uinfo.sex = cuser.sex % 8; uinfo.lastact = time(NULL); + // only enable this after you've really changed talk.c to NOT use from_alias. + uinfo.from_ip = inet_addr(fromhost); + strlcpy(uinfo.userid, cuser.userid, sizeof(uinfo.userid)); strlcpy(uinfo.nickname, cuser.nickname, sizeof(uinfo.nickname)); strlcpy(uinfo.from, fromhost, sizeof(uinfo.from)); @@ -1024,7 +1027,11 @@ setup_utmp(int mode) } } # else // !FROMD - currutmp->from_alias = where(fromhost); + { + int desc = where(fromhost); + if (desc > 0) + strlcpy(currutmp->from, SHM->home_desc[desc], sizeof(currutmp->from)); + } # endif // !FROMD #endif // WHERE diff --git a/mbbsd/talk.c b/mbbsd/talk.c index 1fc2085c..3ff0c00e 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -1970,14 +1970,7 @@ descript(int show_mode, const userinfo_t * uentp, int diff) return friend_descript(uentp, description, sizeof(description)); case 0: return (((uentp->pager != PAGER_DISABLE && uentp->pager != PAGER_ANTIWB && diff) || - HasUserPerm(PERM_SYSOP)) ? -#ifdef WHERE - uentp->from_alias ? SHM->home_desc[uentp->from_alias] : - uentp->from -#else - uentp->from -#endif - : "*"); + HasUserPerm(PERM_SYSOP)) ? uentp->from : "*"); case 2: snprintf(description, sizeof(description), "%4d/%4d/%2d %c", uentp->five_win, diff --git a/util/shmctl.c b/util/shmctl.c index 4e8c0ef1..4a1a2a4c 100644 --- a/util/shmctl.c +++ b/util/shmctl.c @@ -280,7 +280,8 @@ cmputmpidle(const void * i, const void * j) static int cmputmpfrom(const void * i, const void * j) { - return strncmp(SHM->uinfo[*(int*)i].from, SHM->uinfo[*(int*)j].from, sizeof(SHM->uinfo[0].from)); + // desc sorted + return -(SHM->uinfo[*(int*)i].from_ip - SHM->uinfo[*(int*)j].from_ip); } static int |