summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-06-02 15:13:34 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-06-02 15:13:34 +0800
commitb4f666e85c89490e8ffe929120bc50bcb40f87e1 (patch)
tree2eae190a79fa2673a2a1efaf7d9481de403319e7 /mbbsd
parentcf4b4dd8042b811fe537ab9a3ab23028ea2a7c49 (diff)
downloadpttbbs-b4f666e85c89490e8ffe929120bc50bcb40f87e1.tar
pttbbs-b4f666e85c89490e8ffe929120bc50bcb40f87e1.tar.gz
pttbbs-b4f666e85c89490e8ffe929120bc50bcb40f87e1.tar.bz2
pttbbs-b4f666e85c89490e8ffe929120bc50bcb40f87e1.tar.lz
pttbbs-b4f666e85c89490e8ffe929120bc50bcb40f87e1.tar.xz
pttbbs-b4f666e85c89490e8ffe929120bc50bcb40f87e1.tar.zst
pttbbs-b4f666e85c89490e8ffe929120bc50bcb40f87e1.zip
board friend
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@275 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/talk.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 77b8edf5..32988a87 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -1,4 +1,4 @@
-/* $Id: talk.c,v 1.56 2002/06/02 01:55:21 in2 Exp $ */
+/* $Id: talk.c,v 1.57 2002/06/02 07:13:34 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -1555,6 +1555,20 @@ static void pickup_myfriend(pickup_t *friends, int *nGots,
qsort(friends, *nGots, sizeof(pickup_t), sort_cmpfriend);
}
+static void pickup_bfriend(pickup_t *friends, int *nGots)
+{
+ userinfo_t *ptr;
+ for( ptr = bcache[currutmp->brc_id - 1].u, *nGots = 0 ;
+ ptr != NULL && *nGots < MAX_FRIEND ;
+ ptr = ptr->nextbfriend ){
+ if( currutmp != ptr && isvisible(currutmp, ptr) ){
+ friends[*nGots].ui = ptr;
+ friends[(*nGots)++].friend = IBH;
+ }
+ }
+ qsort(friends, *nGots, sizeof(pickup_t), sort_cmpfriend);
+}
+
static void pickup(pickup_t *currpickup, int pickup_way, int *page,
int *myfriend, int *friendme)
{
@@ -1564,6 +1578,7 @@ static void pickup(pickup_t *currpickup, int pickup_way, int *page,
int friendtotal= currutmp->friendtotal;
userinfo_t **utmp;
+ static int nFriends, nBoardFriends;
int which, got, sorted_way;
got = 0;
@@ -1572,26 +1587,36 @@ static void pickup(pickup_t *currpickup, int pickup_way, int *page,
*myfriend = *friendme = 1;
if( cuser.uflag & FRIEND_FLAG ||
- (pickup_way == 0 && *page * MAXPICKUP < friendtotal) ){
+ (pickup_way == 0 && *page * MAXPICKUP < (friendtotal + 1)) ){
/* [¶Ù! ªB¤Í] mode.
we need to pickup ALL friends (from currutmp friend_online),
sort, and get pickup from right starting position */
pickup_t friends[MAX_FRIEND + 1];
- int nGots;
- pickup_myfriend(friends, &nGots, myfriend, friendme);
+ pickup_myfriend(friends, &nFriends, myfriend, friendme);
for( which = *page * MAXPICKUP ;
- got < MAXPICKUP && which < nGots ;
+ got < MAXPICKUP && which < nFriends ;
++got, ++which )
currpickup[got] = friends[which];
}
if( !(cuser.uflag & FRIEND_FLAG) ){
+ if( pickup_way == 0 ){
+ /* now pickup board friends */
+ pickup_t friends[MAX_FRIEND + 1];
+ pickup_bfriend(friends, &nBoardFriends);
+ which = *page * MAXPICKUP - nFriends;
+ for( which = (which >= 0 ? which : 0) ;
+ got < MAXPICKUP && which < nBoardFriends ;
+ ++got, ++which )
+ currpickup[got] = friends[which];
+ }
+
sorted_way = ((pickup_way == 0) ? 0 : (pickup_way - 1));
utmp = utmpshm->sorted[currsorted][sorted_way];
- which = *page * MAXPICKUP - currutmp->friendtotal;
+ which = *page * MAXPICKUP - nFriends - nBoardFriends;
for( which = (which >= 0 ? which : 0) ;
got < MAXPICKUP && which < utmpnumber ;
++got, ++which ){