summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-09-07 02:34:37 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-09-07 02:34:37 +0800
commit2b3c33fbb42fa07b52f30524813d28e2bcb4f800 (patch)
treeeb1c1f2a9283d64e9496b48067f7d1cdfae576d1
parent112b1cb2cbc36a3fee05c69517bb4f7428cd7e2c (diff)
downloadpttbbs-2b3c33fbb42fa07b52f30524813d28e2bcb4f800.tar
pttbbs-2b3c33fbb42fa07b52f30524813d28e2bcb4f800.tar.gz
pttbbs-2b3c33fbb42fa07b52f30524813d28e2bcb4f800.tar.bz2
pttbbs-2b3c33fbb42fa07b52f30524813d28e2bcb4f800.tar.lz
pttbbs-2b3c33fbb42fa07b52f30524813d28e2bcb4f800.tar.xz
pttbbs-2b3c33fbb42fa07b52f30524813d28e2bcb4f800.tar.zst
pttbbs-2b3c33fbb42fa07b52f30524813d28e2bcb4f800.zip
verbose message when login.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3133 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/friend.c1
-rw-r--r--mbbsd/mbbsd.c46
-rw-r--r--mbbsd/talk.c37
3 files changed, 73 insertions, 11 deletions
diff --git a/mbbsd/friend.c b/mbbsd/friend.c
index f9945253..e313f026 100644
--- a/mbbsd/friend.c
+++ b/mbbsd/friend.c
@@ -294,6 +294,7 @@ void friend_load(int type)
if (currutmp->friendtotal)
logout_friend_online(currutmp);
+
login_friend_online();
}
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index cb783a6c..52f56977 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -633,19 +633,44 @@ login_query(void)
outs("本系統目前無法以 new 註冊, 請用 guest 進入\n");
continue;
#endif
- } else if (uid[0] == '\0'){
+ } else if (uid[0] == '\0') {
+
outs(err_uid);
- } else if (strcasecmp(uid, STR_GUEST)) {
+
+ } else if (strcasecmp(uid, STR_GUEST) == 0) { /* guest */
+
+ if (initcuser(uid)< 1) exit (0) ;
+ cuser.userlevel = 0;
+ cuser.uflag = PAGER_FLAG | BRDSORT_FLAG | MOVIE_FLAG;
+ mkuserdir(cuser.userid);
+ break;
+
+ } else {
+
+ /* normal user */
getdata(21, 0, MSG_PASSWD,
passbuf, sizeof(passbuf), NOECHO);
passbuf[8] = '\0';
+ move (22, 0); clrtoeol();
+ outs("正在檢查密碼...");
+ move(22, 0); refresh();
+ /* prepare for later */
+ clrtoeol();
+
if( initcuser(uid) < 1 || !cuser.userid[0] ||
!checkpasswd(cuser.passwd, passbuf) ){
+
logattempt(cuser.userid , '-');
outs(ERR_PASSWD);
+
} else {
+
logattempt(cuser.userid, ' ');
+ outs("密碼正確! 開始登入系統...");
+ move(22, 0); refresh();
+ clrtoeol();
+
if (strcasecmp(str_sysop, cuser.userid) == 0){
#ifdef NO_SYSOP_ACCOUNT
exit(0);
@@ -660,12 +685,6 @@ login_query(void)
}
break;
}
- } else { /* guest */
- if (initcuser(uid)< 1) exit (0) ;
- cuser.userlevel = 0;
- cuser.uflag = PAGER_FLAG | BRDSORT_FLAG | MOVIE_FLAG;
- mkuserdir(cuser.userid);
- break;
}
}
multi_user_check();
@@ -853,7 +872,9 @@ setup_utmp(int mode)
// XXX 不用每 20 才檢查吧
if (!(cuser.numlogins % 20) && cuser.userlevel & PERM_BM)
check_BM(); /* Ptt 自動取下離職板主權力 */
+
#ifndef _BBS_UTIL_C_
+ /* Very, very slow friend_load. */
if( strcmp(cuser.userid, STR_GUEST) != 0 ) // guest 不處理好友
friend_load(0);
nice(3);
@@ -1019,7 +1040,10 @@ user_login(void)
if (!(HasUserPerm(PERM_SYSOP) && HasUserPerm(PERM_SYSOPHIDE)) &&
!currutmp->invisible)
+ {
+ /* do_aloha is costly. do it later? */
do_aloha("<<上站通知>> -- 我來啦!");
+ }
if (SHM->loginmsg.pid){
if(search_ulist_pid(SHM->loginmsg.pid))
@@ -1027,6 +1051,7 @@ user_login(void)
else
SHM->loginmsg.pid=0;
}
+
if (cuser.userlevel) { /* not guest */
move(t_lines - 4, 0);
clrtobot();
@@ -1042,7 +1067,9 @@ user_login(void)
check_register();
record_lasthost(fromhost);
restore_backup();
- } else if (!strcmp(cuser.userid, STR_GUEST)) {
+
+ } else if (strcmp(cuser.userid, STR_GUEST) == 0) { /* guest */
+
init_guest_info();
#if 0 // def DBCSAWARE
u_detectDBCSAwareEvilClient();
@@ -1053,6 +1080,7 @@ user_login(void)
pressanykey();
check_mailbox_quota();
}
+
if(ptime.tm_yday!=lasttime.tm_yday)
STATINC(STAT_TODAYLOGIN_MAX);
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 3b7beab5..3cdf126f 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -218,39 +218,72 @@ reverse_friend_stat(int stat)
return stat1;
}
+void verbose_progress(int em, int *i, int *dir, int max)
+{
+ *i += *dir;
+ if (*dir > 0)
+ {
+ write(1, (em ? "=>\b" : ".>\b") , 3);
+ } else {
+ write(1, (em ? "-\b\b<\b" : "'\b\b<\b"), 5);
+ }
+
+ if (*i >= max || *i <= 0)
+ *dir *= -1;
+}
+
void login_friend_online(void)
{
userinfo_t *uentp;
int i, stat, stat1;
int offset = (int)(currutmp - &SHM->uinfo[0]);
+
#ifdef OUTTACACHE
int sfd;
+
+ int iBar = 0, barMax = t_columns/2, dir = 1;
+
+ /* OUTTACACHE is TOO slow, let's prompt user here. */
+ move(b_lines-2, 0); clrtobot();
+ outs("\n正在更新與同步線上使用者及好友名單,系統負荷量大時會需時較久...\n");
+ refresh();
+
+ verbose_progress(0, &iBar, &dir, barMax);
if( (sfd = toconnect(OUTTACACHEHOST, OUTTACACHEPORT)) > 0 ){
+
+ verbose_progress(0, &iBar, &dir, barMax);
if( towrite(sfd, &offset, sizeof(offset)) > 0 &&
towrite(sfd, &currutmp->uid, sizeof(currutmp->uid)) > 0 &&
towrite(sfd, currutmp->friend, sizeof(currutmp->friend)) > 0 &&
towrite(sfd, currutmp->reject, sizeof(currutmp->reject)) > 0 ){
+
ocfs_t fs;
while( currutmp->friendtotal < MAX_FRIEND &&
toread(sfd, &fs, sizeof(fs)) > 0 )
- if( SHM->uinfo[fs.index].uid == fs.uid ){
+ {
+ verbose_progress(0, &iBar, &dir, barMax);
+ if( SHM->uinfo[fs.index].uid == fs.uid )
+ {
currutmp->friend_online[currutmp->friendtotal++]
= fs.friendstat;
/* XXX: race here */
if( SHM->uinfo[fs.index].friendtotal < MAX_FRIEND )
SHM->uinfo[fs.index].friend_online[ SHM->uinfo[fs.index].friendtotal++ ] = fs.rfriendstat;
}
+ }
+ verbose_progress(1, &iBar, &dir, barMax);
/* 要把剩下的收完, 要不然會卡死 utmpserver */
if( currutmp->friendtotal == MAX_FRIEND )
while( toread(sfd, &fs, sizeof(fs)) > 0 )
- ;
+ verbose_progress(1, &iBar, &dir, barMax);
close(sfd);
return;
}
close(sfd);
}
#endif
+
for (i = 0; i < SHM->UTMPnumber && currutmp->friendtotal < MAX_FRIEND; i++) {
uentp = (&SHM->uinfo[SHM->sorted[SHM->currsorted][0][i]]);
if (uentp && uentp->uid && (stat = set_friend_bit(currutmp, uentp))) {