From 2be2268af61905f408f33f2a4d439829ca23a0be Mon Sep 17 00:00:00 2001 From: in2 Date: Tue, 9 Apr 2002 20:31:50 +0000 Subject: fix logout_friend() git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@93 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/cache.c | 4 ++-- mbbsd/friend.c | 5 +++-- mbbsd/talk.c | 20 ++++++++++---------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/mbbsd/cache.c b/mbbsd/cache.c index 374385e3..ad71d35a 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -1,4 +1,4 @@ -/* $Id: cache.c,v 1.6 2002/04/04 18:02:31 ptt Exp $ */ +/* $Id: cache.c,v 1.7 2002/04/09 20:31:50 in2 Exp $ */ #include #include #include @@ -541,7 +541,7 @@ int count_logins(int uid, int show) { void purge_utmp(userinfo_t *uentp) { - logout_friend_online(); + logout_friend_online(uentp); memset(uentp, 0, sizeof(userinfo_t)); } diff --git a/mbbsd/friend.c b/mbbsd/friend.c index d87c4bc9..fef3fabc 100644 --- a/mbbsd/friend.c +++ b/mbbsd/friend.c @@ -1,4 +1,4 @@ -/* $Id: friend.c,v 1.3 2002/04/05 18:49:35 in2 Exp $ */ +/* $Id: friend.c,v 1.4 2002/04/09 20:31:50 in2 Exp $ */ #include #include #include @@ -319,7 +319,8 @@ void friend_load() { fclose(fp); } memcpy(currutmp->reject, myrejects, sizeof(myrejects)); - if(currutmp->friendtotal) logout_friend_online(); + if(currutmp->friendtotal) + logout_friend_online(currutmp); login_friend_online(); } diff --git a/mbbsd/talk.c b/mbbsd/talk.c index d2c6fb8a..1cd94a54 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -1,4 +1,4 @@ -/* $Id: talk.c,v 1.19 2002/04/09 20:10:31 in2 Exp $ */ +/* $Id: talk.c,v 1.20 2002/04/09 20:31:50 in2 Exp $ */ #include #include #include @@ -255,17 +255,17 @@ int login_friend_online(void) return 0; } -int logout_friend_online(void) +int logout_friend_online(userinfo_t *utmp) { int i, j, k; - int offset=(int) (currutmp - &utmpshm->uinfo[0]); + int offset=(int) (utmp - &utmpshm->uinfo[0]); userinfo_t *ui; - while(currutmp->friendtotal){ - i = currutmp->friendtotal-1; - j = (currutmp->friend_online[i] & 0xFFFFFF); - currutmp->friend_online[i]=0; + while(utmp->friendtotal){ + i = utmp->friendtotal-1; + j = (utmp->friend_online[i] & 0xFFFFFF); + utmp->friend_online[i]=0; ui = &utmpshm->uinfo[j]; - if(ui->pid && ui!=currutmp){ + if(ui->pid && ui!=utmp){ for(k=0; kfriendtotal && (int)(ui->friend_online[k] & 0xFFFFFF) !=offset; k++); if(kfriendtotal){ @@ -274,8 +274,8 @@ int logout_friend_online(void) ui->friend_online[ui->friendtotal]=0; } } - currutmp->friendtotal--; - currutmp->friend_online[currutmp->friendtotal]=0; + utmp->friendtotal--; + utmp->friend_online[utmp->friendtotal]=0; } return 0; } -- cgit v1.2.3