summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-03-24 18:28:24 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-03-24 18:28:24 +0800
commit4670a39b82ad53300228038a48b38ec885292af1 (patch)
treeafd6e581892712e801ce5c2bbb365800d571a753 /mbbsd
parentfb2f93c605084a78c85deacfa4fe91194f4d387e (diff)
downloadpttbbs-4670a39b82ad53300228038a48b38ec885292af1.tar
pttbbs-4670a39b82ad53300228038a48b38ec885292af1.tar.gz
pttbbs-4670a39b82ad53300228038a48b38ec885292af1.tar.bz2
pttbbs-4670a39b82ad53300228038a48b38ec885292af1.tar.lz
pttbbs-4670a39b82ad53300228038a48b38ec885292af1.tar.xz
pttbbs-4670a39b82ad53300228038a48b38ec885292af1.tar.zst
pttbbs-4670a39b82ad53300228038a48b38ec885292af1.zip
show Welcome_login before login initialization.
(when system load is heavy, users will be blocked in Welcome_login instead of Welcome) git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@710 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/mbbsd.c81
1 files changed, 41 insertions, 40 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 3aee5ce4..00e4fa7a 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1,4 +1,4 @@
-/* $Id: mbbsd.c,v 1.67 2003/03/15 12:06:39 in2 Exp $ */
+/* $Id: mbbsd.c,v 1.68 2003/03/24 10:28:24 in2 Exp $ */
#include "bbs.h"
#define SOCKET_QLEN 4
@@ -231,7 +231,7 @@ abort_bbs_debug(int sig)
static void
mysrand()
{
- srand(time(NULL) + currutmp->pid); /* 時間跟 pid 當 rand 的 seed */
+ srand(time(NULL) + getpid()); /* 時間跟 pid 當 rand 的 seed */
}
int
@@ -757,12 +757,41 @@ user_login()
char genbuf[200];
struct tm *ptime, *tmp;
time_t now;
- int a;
- /*** Heat:廣告詞
- char *ADV[] = {
- "7/17 @LIVE 亂彈, 何欣穗 的 入場卷要送給 ptt 的愛用者!",
- "欲知詳情請看 PttAct 板!!",
- }; ***/
+ int a, ifbirth;
+
+ /* get local time */
+ time(&now);
+ ptime = localtime(&now);
+
+ /* 初始化: random number 增加user跟時間的差異 */
+ mysrand();
+
+ /* show welcome_login */
+ ifbirth = (ptime->tm_mday == cuser.day &&
+ ptime->tm_mon + 1 == cuser.month);
+ if (ifbirth)
+ more("etc/Welcome_birth", NA);
+ else {
+#ifndef MULTI_WELCOME_LOGIN
+ more("etc/Welcome_login", NA);
+#else
+ char buf[80];
+ int nScreens;
+
+ for (nScreens = 0; nScreens < 5; ++nScreens) {
+ snprintf(buf, sizeof(buf), "etc/Welcome_login.%d", nScreens);
+ if (access(buf, 0) < 0)
+ break;
+ }
+ if (nScreens == 0) {
+ //multi screen error ?
+ more("etc/Welcome_login", NA);
+ } else {
+ snprintf(buf, sizeof(buf), "etc/Welcome_login.%d", (int)login_start_time % nScreens);
+ more(buf, NA);
+ }
+#endif
+ }
log_usies("ENTER", fromhost);
setproctitle("%s: %s", margs, cuser.userid);
@@ -772,13 +801,10 @@ user_login()
strlcpy(water[0].userid, " 全部 ", sizeof(water[0].userid));
/* 初始化 uinfo、flag、mode */
setup_utmp(LOGIN);
- mysrand(); /* 初始化: random number 增加user跟時間的差異 */
currmode = MODE_STARTED;
enter_uflag = cuser.uflag;
+ currutmp->birth = ifbirth;
- /* get local time */
- time(&now);
- ptime = localtime(&now);
tmp = localtime(&cuser.lastlogin);
if ((a = SHM->UTMPnumber) > SHM->max_user) {
SHM->max_user = a;
@@ -787,35 +813,10 @@ user_login()
init_brdbuf();
brc_initial(DEFAULT_BOARD);
set_board();
- /* 畫面處理開始 */
- if (!(HAS_PERM(PERM_SYSOP) && HAS_PERM(PERM_DENYPOST)) && !currutmp->invisible)
+
+ if (!(HAS_PERM(PERM_SYSOP) && HAS_PERM(PERM_DENYPOST)) &&
+ !currutmp->invisible)
do_aloha("<<上站通知>> -- 我來啦!");
- if (ptime->tm_mday == cuser.day && ptime->tm_mon + 1 == cuser.month) {
- more("etc/Welcome_birth", NA);
- currutmp->birth = 1;
- } else {
-#ifdef MULTI_WELCOME_LOGIN
- char buf[80];
- int nScreens;
- for (nScreens = 0; nScreens < 10; ++nScreens) {
- snprintf(buf, sizeof(buf), "etc/Welcome_login.%d", nScreens);
- if (access(buf, 0) < 0)
- break;
- }
- if (nScreens == 0) {
- //multi screen error ?
- more("etc/Welcome_login", NA);
- } else {
- snprintf(buf, sizeof(buf), "etc/Welcome_login.%d", (int)login_start_time % nScreens);
- more(buf, NA);
- }
-#else
- more("etc/Welcome_login", NA);
-#endif
- //pressanykey();
- //more("etc/CSIE_Week", NA);
- currutmp->birth = 0;
- }
if (cuser.userlevel) { /* not guest */
move(t_lines - 4, 0);