summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/bbs.c35
-rw-r--r--mbbsd/board.c15
-rw-r--r--mbbsd/syspost.c4
-rw-r--r--mbbsd/talk.c63
4 files changed, 62 insertions, 55 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 0191bada..9c5d864b 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1,4 +1,4 @@
-/* $Id: bbs.c,v 1.46 2002/06/01 00:40:28 ptt Exp $ */
+/* $Id: bbs.c,v 1.47 2002/06/02 01:55:21 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -15,6 +15,7 @@
#include "proto.h"
extern struct bcache_t *brdshm;
+extern userinfo_t *currutmp;
extern userec_t cuser;
extern void touchdircache(int bid);
extern int TagNum;
@@ -157,10 +158,11 @@ extern char currtitle[TTLEN + 1];
extern int Tagger();
-static void readdoent(int num, fileheader_t *ent) {
- int type,uid;
- char *mark, *title, color,
- special=0, isonline=0;
+static void readdoent(int num, fileheader_t *ent)
+{
+ int type,uid;
+ char *mark, *title, color, special=0, isonline=0;
+ userinfo_t *uentp;
if(ent->recommend>9 || ent->recommend <0 ) ent->recommend=0; //Ptt:暫時
type = brc_unread(ent->filename,brc_num,brc_list) ? '+' : ' ';
@@ -188,8 +190,7 @@ static void readdoent(int num, fileheader_t *ent) {
if(!strncmp(title,"[公告]",6)) special=1;
if(!strchr(ent->owner, '.') && (uid=searchuser(ent->owner)) &&
- search_ulist(uid) &&
- isvisible_uid(uid))
+ (uentp = search_ulist(uid)) && isvisible(currutmp, uentp) )
isonline=1;
if(strncmp(currtitle, title, TTLEN))
@@ -679,20 +680,20 @@ int invalid_brdname(char *brd) {
return 1;
}
return 0;
-}
+}
+
static int b_call_in(int ent, fileheader_t *fhdr, char *direct)
{
- userinfo_t *u=search_ulist (searchuser(fhdr->owner));
- int fri_stat;
- if(u )
- {
- fri_stat= friend_stat(currutmp, u);
- if(isvisible_stat(currutmp, u, fri_stat) &&
- call_in(u, fri_stat))
- return FULLUPDATE;
- }
+ userinfo_t *u = search_ulist(searchuser(fhdr->owner));
+ if( u ){
+ int fri_stat;
+ fri_stat = friend_stat(currutmp, u);
+ if( isvisible_stat(currutmp, u, fri_stat) && call_in(u, fri_stat) )
+ return FULLUPDATE;
+ }
return DONOTHING;
}
+
static void do_reply(fileheader_t *fhdr) {
boardheader_t *bp;
bp = getbcache(currbid);
diff --git a/mbbsd/board.c b/mbbsd/board.c
index 54237fa5..c0fed91c 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -1,4 +1,4 @@
-/* $Id: board.c,v 1.27 2002/06/01 22:08:53 ptt Exp $ */
+/* $Id: board.c,v 1.28 2002/06/02 01:55:21 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -263,8 +263,8 @@ void init_brdbuf() {
close(n);
}
- for(n = 0; n < size; n++)
- favbuf[n] &= ~BRD_TAG;
+ for(n = 0; n < numboards; n++)
+ favbuf[n] &= ~BRD_TAG;
brc_expire_time = login_start_time - 365 * 86400;
}
@@ -430,9 +430,10 @@ static boardstat_t * addnewbrdstat(int n, int state)
return ptr;
}
-static int cmpboardname(boardstat_t *brd, boardstat_t *tmp) {
- return tmp->bh->nuser - brd->bh->nuser;
-}
+static int cmpboardname(const void *brd, const void *tmp)
+{
+ return ((boardstat_t *)tmp)->bh->nuser - ((boardstat_t *)brd)->bh->nuser;
+}
static void load_boards(char *key) {
boardheader_t *bptr = NULL;
@@ -464,7 +465,7 @@ static void load_boards(char *key) {
) continue;
addnewbrdstat(n, state);
if(class_bid==-1)
- qsort(nbrd, brdnum, sizeof(boardstat_t), cmpboardname);
+ qsort(nbrd, brdnum, sizeof(boardstat_t), cmpboardname);
}
}
else
diff --git a/mbbsd/syspost.c b/mbbsd/syspost.c
index 8a30abff..f1a2e70e 100644
--- a/mbbsd/syspost.c
+++ b/mbbsd/syspost.c
@@ -1,4 +1,4 @@
-/* $Id: syspost.c,v 1.8 2002/05/21 05:08:44 lwms Exp $ */
+/* $Id: syspost.c,v 1.9 2002/06/02 01:55:21 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <time.h>
@@ -101,7 +101,7 @@ void give_money_post(char *userid, int money) {
FILE *fp;
fileheader_t fhdr;
time_t now = time(0);
- char genbuf[200], reason[30];
+ char genbuf[200];
strcpy(genbuf, "boards/S/Security");
stampfile(genbuf, &fhdr);
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 6f96a52f..77b8edf5 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -1,4 +1,4 @@
-/* $Id: talk.c,v 1.55 2002/06/01 03:51:36 ptt Exp $ */
+/* $Id: talk.c,v 1.56 2002/06/02 01:55:21 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -91,6 +91,36 @@ static char page_requestor[40];
static char description[30];
static FILE *flog;
+int iswritable_stat(userinfo_t *uentp, int fri_stat)
+{
+ if( uentp == currutmp )
+ return 0;
+
+ if( HAS_PERM(PERM_SYSOP) )
+ return 1;
+
+ if( !HAS_PERM(PERM_LOGINOK) )
+ return 0;
+
+ return (uentp->pager != 3 && (fri_stat & HFM || uentp->pager != 4));
+}
+
+int isvisible_stat(userinfo_t * me, userinfo_t * uentp, int fri_stat)
+{
+ if (uentp->userid[0] == 0)
+ return 0;
+
+ if (PERM_HIDE(uentp) && !(PERM_HIDE(me)))/* 對方紫色隱形而你沒有 */
+ return 0;
+ else if ((me->userlevel & PERM_SYSOP) ||
+ ((fri_stat & HRM) && (fri_stat & HFM)))
+ /* 站長看的見任何人 */
+ return 1;
+
+ if (uentp->invisible && !(me->userlevel & PERM_SEECLOAK)) return 0;
+
+ return !(fri_stat & HRM);
+}
char *modestring(userinfo_t * uentp, int simple)
{
@@ -296,28 +326,6 @@ int friend_stat(userinfo_t *me, userinfo_t * ui)
return hit;
}
-int isvisible_stat(userinfo_t * me, userinfo_t * uentp, int fri_stat)
-{
- if (uentp->userid[0] == 0)
- return 0;
-
- if (PERM_HIDE(uentp) && !(PERM_HIDE(me)))/* 對方紫色隱形而你沒有 */
- return 0;
- else if ((me->userlevel & PERM_SYSOP) ||
- ((fri_stat & HRM) && (fri_stat & HFM)))
- /* 站長看的見任何人 */
- return 1;
-
- if (uentp->invisible && !(me->userlevel & PERM_SEECLOAK)) return 0;
-
- return (fri_stat & HRM) ? 0 : 1;
-}
-
-int isvisible(userinfo_t * me, userinfo_t * uentp)
-{
- return isvisible_stat(currutmp, uentp, friend_stat(me, uentp));
-}
-
int isvisible_uid(int tuid)
{
userinfo_t *uentp;
@@ -1752,18 +1760,15 @@ static void draw_pickup(int drawall, pickup_t *pickup, int pickup_way,
int call_in(userinfo_t *uentp, int fri_stat)
{
- char genbuf[60];
- if( HAS_PERM(PERM_LOGINOK) &&
- uentp->pid != currpid &&
- (HAS_PERM(PERM_SYSOP) ||
- (uentp->pager != 3 &&
- (fri_stat & HFM || uentp->pager != 4))) ){
+ if( iswritable_stat(uentp, fri_stat) ){
+ char genbuf[60];
sprintf(genbuf, "Call-In %s :", uentp->userid);
my_write(uentp->pid, genbuf, uentp->userid, 0, NULL);
return 1;
}
return 0;
}
+
static void userlist(void)
{
/* 使用者名單: