summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-05-14 17:46:19 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-05-14 17:46:19 +0800
commitd5ca5ae17d82a49a0308931bf3440328f98b9f21 (patch)
tree26c1d0c48b0d47856ae3c8d97bf6dc01dbf19c5e /mbbsd
parent0dc6c8d14fc8a36ac7ae92b468d63b79d7a1790b (diff)
downloadpttbbs-d5ca5ae17d82a49a0308931bf3440328f98b9f21.tar
pttbbs-d5ca5ae17d82a49a0308931bf3440328f98b9f21.tar.gz
pttbbs-d5ca5ae17d82a49a0308931bf3440328f98b9f21.tar.bz2
pttbbs-d5ca5ae17d82a49a0308931bf3440328f98b9f21.tar.lz
pttbbs-d5ca5ae17d82a49a0308931bf3440328f98b9f21.tar.xz
pttbbs-d5ca5ae17d82a49a0308931bf3440328f98b9f21.tar.zst
pttbbs-d5ca5ae17d82a49a0308931bf3440328f98b9f21.zip
lazily generate �n���� in userlist
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@845 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/talk.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 9e734457..273dd215 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -1,4 +1,4 @@
-/* $Id: talk.c,v 1.107 2003/05/14 08:20:11 in2 Exp $ */
+/* $Id: talk.c,v 1.108 2003/05/14 09:46:19 in2 Exp $ */
#include "bbs.h"
#define QCAST int (*)(const void *, const void *)
@@ -1489,6 +1489,7 @@ descript(int show_mode, userinfo_t * uentp, time_t diff)
* �� (���]�A�O��, �O�ͬO�t�~�ͥX�Ӫ�) ���L friend_online[]�O unorder��.
* �ҥH���n����Ҧ����H���X��, ���s sort �@��.
* �n�Ͱ� (���ۥ��@�観�]�n��+ �O��) �̦h�u�|�� MAX_FRIENDS��
+ * �]�����ͦn�ͰϪ� cost �۷���, "�ण���ʹN���n����"
*
* + �D�n�Ͱ�
* �z�L shmctl utmpsortd , �w�� (�q�`�@���@��) �N�������H���ӦU�ؤ��P����
@@ -1610,13 +1611,19 @@ pickup(pickup_t * currpickup, int pickup_way, int *page,
if (friendtotal == 0)
*myfriend = *friendme = 1;
-
- if (cuser.uflag & FRIEND_FLAG ||
- (pickup_way == 0 && *page * nPickups < MAX_FRIEND)) {
- /*
- * [��! �B��] mode. we need to pickup ALL friends (from currutmp
- * friend_online), sort, and get pickup from right starting position
- */
+
+ /* ���ͦn�Ͱ� */
+ which = *page * nPickups;
+ if( (cuser.uflag & FRIEND_FLAG) || /* �u��ܦn�ͼҦ� */
+ ((pickup_way == 0) && /* [��! �B��] mode */
+ (
+ /* �t�O��, �n�Ͱϳ̦h�u�|�� (friendtotal + �O��) ��*/
+ (currutmp->brc_id && which < (friendtotal +
+ bcache[currutmp->brc_id-1].nuser)) ||
+
+ /* ���t�O��, �̦h�u�|�� friendtotal�� */
+ (!currutmp->brc_id && which < friendtotal)
+ ))) {
pickup_t friends[MAX_FRIEND];
*nfriend = pickup_myfriend(friends, myfriend, friendme, badfriend);
@@ -1626,7 +1633,6 @@ pickup(pickup_t * currpickup, int pickup_way, int *page,
else
*bfriend = 0;
*nfriend += *bfriend;
- which = *page * nPickups;
if (*nfriend > which) {
/* �u���b�n�q�X�~�����n sort */
qsort(friends, *nfriend, sizeof(pickup_t), sort_cmpfriend);