diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-04-10 04:31:50 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-04-10 04:31:50 +0800 |
commit | 2be2268af61905f408f33f2a4d439829ca23a0be (patch) | |
tree | d4b2439cc9ffb1ef5a6a3596c0d4824b84f733ba /mbbsd | |
parent | bee171e6635b88aa65c696f4ff2665cddf886e48 (diff) | |
download | pttbbs-2be2268af61905f408f33f2a4d439829ca23a0be.tar pttbbs-2be2268af61905f408f33f2a4d439829ca23a0be.tar.gz pttbbs-2be2268af61905f408f33f2a4d439829ca23a0be.tar.bz2 pttbbs-2be2268af61905f408f33f2a4d439829ca23a0be.tar.lz pttbbs-2be2268af61905f408f33f2a4d439829ca23a0be.tar.xz pttbbs-2be2268af61905f408f33f2a4d439829ca23a0be.tar.zst pttbbs-2be2268af61905f408f33f2a4d439829ca23a0be.zip |
fix logout_friend()
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@93 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/cache.c | 4 | ||||
-rw-r--r-- | mbbsd/friend.c | 5 | ||||
-rw-r--r-- | 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 <stdio.h> #include <stdlib.h> #include <string.h> @@ -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 <stdio.h> #include <string.h> #include <stdlib.h> @@ -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 <stdio.h> #include <string.h> #include <errno.h> @@ -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; k<ui->friendtotal && (int)(ui->friend_online[k] & 0xFFFFFF) !=offset; k++); if(k<ui->friendtotal){ @@ -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; } |