自己看吧,KBS应该类似的
int
Q_Goodbye()
{
extern int started;
time_t stay;
char fname[STRLEN], notename[STRLEN];
int logouts, mylogout = NA;
struct userec tmpu;
clear();
prints("\n\n\n\n");
if (USERDEFINE(currentuser, DEF_OUTNOTE)) {
setuserfile(notename, "notes");
if (dashf(notename))
ansimore(notename, YEA);
}
if (USERDEFINE(currentuser, DEF_LOGOUT)) {
setuserfile(fname, "logout");
if (dashf(fname))
mylogout = YEA;
}
if (mylogout) {
logouts = countlogouts(fname);
if (logouts >= 1) {
user_display(fname, (logouts == 1) ? 1 :
(currentuser->numlogins % (logouts)) + 1,
YEA);
}
} else {
if (fill_shmfile(2, "etc/logout", getBBSKey(GOODBYE_SHM))) {
show_goodbyeshm();
}
}
pressreturn();
stay = now_t - login_start_time;
if (started) {
tracelog("%s exitbbs %ld", currentuser->userid, stay);
if ((currentuser->userlevel & PERM_BOARDS)
&& (count_uindex(usernum) == 1))
setbmstatus(0);
}
memcpy(&tmpu, currentuser, sizeof (tmpu));
//多窗口不重复计算上站时间. 检查now_t防止时钟变化导致负的stay
if (count_uindex(usernum) == 1 && now_t > tmpu.lastlogin)
stay = now_t - tmpu.lastlogin;
else
stay = 0;
tmpu.stay += stay;
tmpu.lastlogout = now_t;
tmpu.flags[0] &= ~BRDSORT_MASK;
tmpu.flags[0] |= board_sorttype;
updateuserec(&tmpu, usernum);
if (strcmp(currentuser->userid, "guest") && count_uindex(usernum) == 0) {
FILE *fp;
char buf[STRLEN], *ptr;
if ((fp = fopen("friendbook", "r")) != NULL) {
while (fgets(buf, sizeof (buf), fp) != NULL) {
char uid[14];
ptr = strstr(buf, "@");
if (ptr == NULL) {
del_from_file("friendbook", buf);
continue;
}
ptr++;
strcpy(uid, ptr);
ptr = strstr(uid, "\n");
*ptr = '\0';
if (!strcmp(uid, currentuser->userid))
del_from_file("friendbook", buf);
}
fclose(fp);
}
}
if (started)
u_exit();
started = 0;
exit(0);
}
【 在 Jtr@newsmth.net-SPAM.no (从此信奉单身主义) 的大作中提到: 】
: 好像只有ytht系和Mapple的代码有这个功能。
: 不知道代码是什么……
--
FROM 222.67.4.147