summaryrefslogtreecommitdiffstats
path: root/mbbsd/talk.c
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd/talk.c')
-rw-r--r--mbbsd/talk.c52
1 files changed, 29 insertions, 23 deletions
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 6ed035af..374c3e28 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -243,7 +243,7 @@ void login_friend_online(void)
}
#endif
for (i = 0; i < SHM->UTMPnumber && currutmp->friendtotal < MAX_FRIEND; i++) {
- uentp = (SHM->sorted[SHM->currsorted][0][i]);
+ uentp = (&SHM->uinfo[SHM->sorted[SHM->currsorted][0][i]]);
if (uentp && uentp->uid && (stat = set_friend_bit(currutmp, uentp))) {
stat1 = reverse_friend_stat(stat);
stat <<= 24;
@@ -1785,7 +1785,7 @@ pickup_bfriend(pickup_t * friends, int base)
int currsorted = SHM->currsorted, number = SHM->UTMPnumber;
friends = friends + base;
for (i = 0; i < number && ngets < MAX_FRIEND - base; ++i) {
- uentp = SHM->sorted[currsorted][0][i];
+ uentp = &SHM->uinfo[SHM->sorted[currsorted][0][i]];
/* TODO isvisible() 重複用到了 friend_stat() */
if (uentp && uentp->pid && uentp->brc_id == currutmp->brc_id &&
currutmp != uentp && isvisible(currutmp, uentp) &&
@@ -1806,7 +1806,8 @@ pickup(pickup_t * currpickup, int pickup_way, int *page,
int utmpnumber = SHM->UTMPnumber;
int friendtotal = currutmp->friendtotal;
- userinfo_t **utmp;
+ int *ulist;
+ userinfo_t *u;
int which, sorted_way, size = 0, friend;
if (friendtotal == 0)
@@ -1850,17 +1851,18 @@ pickup(pickup_t * currpickup, int pickup_way, int *page,
if (!(cuser.uflag & FRIEND_FLAG) && size < nPickups) {
sorted_way = ((pickup_way == 0) ? 0 : (pickup_way - 1));
- utmp = SHM->sorted[currsorted][sorted_way];
+ ulist = SHM->sorted[currsorted][sorted_way];
which = *page * nPickups - *nfriend;
if (which < 0)
which = 0;
for (; which < utmpnumber && size < nPickups; which++) {
- friend = friend_stat(currutmp, utmp[which]);
+ u = &SHM->uinfo[ulist[which]];
+ friend = friend_stat(currutmp, u);
/* TODO isvisible() 重複用到了 friend_stat() */
if ((pickup_way ||
- (currutmp != utmp[which] && !(friend & ST_FRIEND))) &&
- isvisible(currutmp, utmp[which])) {
- currpickup[size].ui = utmp[which];
+ (currutmp != u && !(friend & ST_FRIEND))) &&
+ isvisible(currutmp, u)) {
+ currpickup[size].ui = u;
currpickup[size++].friend = friend;
}
}
@@ -2267,12 +2269,11 @@ userlist(void)
if (si >= 0) {
pickup_t friends[MAX_FRIEND + 1];
int nGots, i;
- userinfo_t **utmp =
+ int *ulist =
SHM->sorted[SHM->currsorted]
[((pickup_way == 0) ? 0 : (pickup_way - 1))];
- fi = utmp[si] - &SHM->uinfo[0];
-
+ fi = ulist[si];
nGots = pickup_myfriend(friends, &myfriend,
&friendme, &badfriend);
for (i = 0; i < nGots; ++i)
@@ -2294,10 +2295,14 @@ userlist(void)
}
for( ; fi < nPickups && i < SHM->UTMPnumber ; ++i )
- if( isvisible(currutmp, utmp[i]) ){
- currpickup[fi].ui = utmp[i];
+ {
+ userinfo_t *u;
+ u = &SHM->uinfo[ulist[i]];
+ if( isvisible(currutmp, u) ){
+ currpickup[fi].ui = u;
currpickup[fi++].friend = 0;
}
+ }
skippickup = 1;
}
redrawall = redraw = 1;
@@ -2386,7 +2391,8 @@ userlist(void)
snprintf(msg.last_call_in, sizeof(msg.last_call_in),
"[廣播]%s", genbuf);
for (i = 0; i < SHM->UTMPnumber; ++i) {
- uentp = SHM->sorted[SHM->currsorted][0][i];
+ uentp = &SHM->uinfo[
+ SHM->sorted[SHM->currsorted][0][i]];
if (uentp->pid && kill(uentp->pid, 0) != -1){
int write_pos = uentp->msgcount;
if( write_pos < (MAX_MSGS - 1) ){
@@ -3025,8 +3031,8 @@ FindAngel(void){
nAngel = 0;
j = SHM->currsorted;
for (i = 0; i < SHM->UTMPnumber; ++i)
- if ((SHM->sorted[j][0][i]->userlevel & PERM_ANGEL)
- && (SHM->sorted[j][0][i]->angel & mask) == 0)
+ if ((SHM->uinfo[SHM->sorted[j][0][i]].userlevel & PERM_ANGEL)
+ && (SHM->uinfo[SHM->sorted[j][0][i]].angel & mask) == 0)
++nAngel;
if (nAngel == 0)
@@ -3035,15 +3041,15 @@ FindAngel(void){
choose = rand() % nAngel + 1;
j = SHM->currsorted;
for (i = 0; i < SHM->UTMPnumber && choose; ++i)
- if ((SHM->sorted[j][0][i]->userlevel & PERM_ANGEL)
- && (SHM->sorted[j][0][i]->angel & mask) == 0)
+ if ((SHM->uinfo[SHM->sorted[j][0][i]].userlevel & PERM_ANGEL)
+ && (SHM->uinfo[SHM->sorted[j][0][i]].angel & mask) == 0)
--choose;
- if (choose == 0 && SHM->sorted[j][0][i - 1]->uid != currutmp->uid
- && (SHM->sorted[j][0][i - 1]->userlevel & PERM_ANGEL)
- && ((SHM->sorted[j][0][i - 1]->angel & mask) == 0)
- && !he_reject_me(SHM->sorted[j][0][i - 1]) ){
- strlcpy(cuser.myangel, SHM->sorted[j][0][i - 1]->userid, IDLEN + 1);
+ if (choose == 0 && SHM->uinfo[SHM->sorted[j][0][i - 1]].uid != currutmp->uid
+ && (SHM->uinfo[SHM->sorted[j][0][i - 1]].userlevel & PERM_ANGEL)
+ && ((SHM->uinfo[SHM->sorted[j][0][i - 1]].angel & mask) == 0)
+ && !he_reject_me(&SHM->uinfo[SHM->sorted[j][0][i - 1]]) ){
+ strlcpy(cuser.myangel, SHM->uinfo[SHM->sorted[j][0][i - 1]].userid, IDLEN + 1);
passwd_update(usernum, &cuser);
return 1;
}