summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-08 00:02:42 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-08 00:02:42 +0800
commit210b4a599fe77453e97a29496aa055cc8c5a229e (patch)
treefe5ba8f67e92aa302e0dff44ba4194ea0a02229e
parent657d43f453ffa4360d8716c49006bdd3297f86b4 (diff)
downloadpttbbs-210b4a599fe77453e97a29496aa055cc8c5a229e.tar
pttbbs-210b4a599fe77453e97a29496aa055cc8c5a229e.tar.gz
pttbbs-210b4a599fe77453e97a29496aa055cc8c5a229e.tar.bz2
pttbbs-210b4a599fe77453e97a29496aa055cc8c5a229e.tar.lz
pttbbs-210b4a599fe77453e97a29496aa055cc8c5a229e.tar.xz
pttbbs-210b4a599fe77453e97a29496aa055cc8c5a229e.tar.zst
pttbbs-210b4a599fe77453e97a29496aa055cc8c5a229e.zip
* remove jungo.c and toplazyBBM.c.
ptt don't use these code 3 years. and we don't want to maintain these code. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4518 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--sample/crontab1
-rw-r--r--util/Makefile6
-rw-r--r--util/jungo.c194
-rw-r--r--util/toplazyBBM.c185
-rw-r--r--util/toplazyBBM.sh3
5 files changed, 3 insertions, 386 deletions
diff --git a/sample/crontab b/sample/crontab
index 71521202..49b04f55 100644
--- a/sample/crontab
+++ b/sample/crontab
@@ -74,7 +74,6 @@
# ???
10 7 * * * bin/buildAnnounce
#10 7 * * * bin/toplazyBM.sh
-#10 7 * * * bin/toplazyBBM.sh
#*/5 * * * * bin/shmsweep
#*/10 * * * * bin/userlist
diff --git a/util/Makefile b/util/Makefile
index 2570bc0b..c74ba2e1 100644
--- a/util/Makefile
+++ b/util/Makefile
@@ -16,10 +16,10 @@ MBBSD_OBJS= \
# 下面這些程式, 會被 compile 並且和 $(UTIL_OBJS) 聯結
CPROG_WITH_UTIL= \
boardlist BM_money post poststat \
- jungo account birth deluserfile \
+ account birth deluserfile \
expire mandex horoscope broadcast \
openvice openticket topusr \
- yearsold toplazyBM toplazyBBM writemoney \
+ yearsold toplazyBM writemoney \
reaper buildAnnounce inndBM mailangel \
outmail chkhbf merge_dir \
angel gamblegive \
@@ -40,7 +40,7 @@ PROGS= ${CPROG_WITH_UTIL} ${CPROG_WITHOUT_UTIL} ${CPP_WITH_UTIL}\
shmctl \
BM_money.sh backpasswd.sh mailog.sh opendice.sh \
openticket.sh stock.sh topsong.sh weather.sh \
- stock.perl weather.perl toplazyBM.sh toplazyBBM.sh \
+ stock.perl weather.perl toplazyBM.sh \
dailybackup.pl tarqueue.pl waterball.pl filtermail.pl \
getbackup.pl udnnews.pl rebuildaloha.pl
diff --git a/util/jungo.c b/util/jungo.c
deleted file mode 100644
index 5c034f26..00000000
--- a/util/jungo.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* $Id$ */
-#define _UTIL_C_
-#include "bbs.h"
-
-#define OUTFILE BBSHOME "/etc/toplazyBBM"
-#define FIREFILE BBSHOME "/etc/topfireBBM"
-
-extern boardheader_t *bcache;
-extern int numboards;
-
-boardheader_t allbrd[MAX_BOARD];
-typedef struct lostbm {
- char *bmname;
- char *title;
- char *ctitle;
- int lostdays;
-} lostbm;
-lostbm lostbms[MAX_BOARD];
-
-typedef struct BMarray{
- char *bmname;
- int flag;
-} BMArray;
-BMArray bms[3];
-
-int bmlostdays_cmp(const void *va, const void *vb)
-{
- lostbm *a=(lostbm *)va, *b=(lostbm *)vb;
- if (a->lostdays > b->lostdays) return -1;
- else if (a->lostdays == b->lostdays) return 0;
- else return 1;
-}
-
-int LINK(char* src, char* dst){
- char cmd[200];
- if(symlink(src,dst) == -1)
- {
- sprintf(cmd, "/bin/cp -R %s %s", src, dst);
- return system(cmd);
- }
- return 0;
-}
-
-int main(int argc, char *argv[])
-{
- int bmid, i, j=0;
- FILE *inf, *firef;
-
- attach_SHM();
- resolve_boards();
-
- if(passwd_init())
- exit(1);
-
- memcpy(allbrd,bcache,numboards*sizeof(boardheader_t));
-
- /* write out the target file */
-
- inf = fopen(OUTFILE, "w+");
- if(inf == NULL){
- printf("open file error : %s\n", OUTFILE);
- exit(1);
- }
- firef = fopen(FIREFILE, "w+");
- if(firef == NULL){
- printf("open file error : %s\n", FIREFILE);
- fclose(inf);
- exit(1);
- }
-
- fprintf(inf, "警告: 小組長若於一個月未上站,將予於免職\n");
- fprintf(inf,
- "看板名稱 "
- " 小組長 幾天沒來啦\n"
- "---------------------------------------------------"
- "-------------------\n");
-
- fprintf(firef, "免職小組長\n");
- fprintf(firef,
- "看板名稱 "
- " 小組長 幾天沒來啦\n"
- "---------------------------------------------------"
- "-------------------\n");
-
-
- j = 0 ;
- for (i = 0; i < numboards; i++) {
- char *p, bmbuf[IDLEN * 3 + 3];
- int index = 0, flag = 0, k, n;
- userec_t xuser;
-
- p=strtok(allbrd[i].BM,"/ ");
- if(p)
- do
- {
- if(allbrd[i].brdname[0] == '\0' || (allbrd[i].brdattr & BRD_GROUPBOARD) ==0 ) continue;
- if (*p == '[' ){p[strlen(p)-1]='\0'; p++;}
- bmid=getuser(p, &xuser);
- bms[index].bmname = p;
- bms[index].flag = 0;
- if (((((int)time(NULL)-(int)xuser.lastlogin)/(60*60*24))>=7)
- //&& isalpha(allbrd[i].brdname[0])
- && isalpha(allbrd[i].BM[0])
- && !(xuser.userlevel & PERM_SYSOP))
- {
- lostbms[j].bmname = p;
- lostbms[j].title = allbrd[i].brdname;
- lostbms[j].ctitle = allbrd[i].title;
- lostbms[j].lostdays =
- ((int)time(NULL)-(int)xuser.lastlogin)/(60*60*24);
-
- printf("%s\n", lostbms[j].title);
- //超過六十天 免職
- if(lostbms[j].lostdays > 30){
- xuser.userlevel &= ~PERM_BM;
- bms[index].flag = 1;
- flag = 1;
- }
- j++;
- }
- index++;
- } while((p=strtok(NULL,"/ "))!=NULL);
-
- //從板主名單拿掉名字
-
- if(flag == 1){
- bmbuf[0] = '\0';
- for(k = 0 , n = 0; k < index; k++){
- if(!bms[k].flag){
- if( n++ != 0) strcat(bmbuf, "/");
- strcat(bmbuf, bms[k].bmname);
- }
- }
- strcpy(bcache[i].BM, bmbuf);
- }
-
- }
- qsort(lostbms, j, sizeof(lostbm), bmlostdays_cmp);
-
- //write to the etc/toplazyBBM
- for ( i=0; i<j; i++)
- {
- if( lostbms[i].lostdays > 7){
- fprintf(firef, "%-*.*s%-*.*s%-*.*s%3d天沒上站\n", IDLEN, IDLEN, lostbms[i].title,
- BTLEN-10, BTLEN-10, lostbms[i].ctitle, IDLEN,IDLEN,
- lostbms[i].bmname,lostbms[i].lostdays);
- }else{
- fprintf(inf, "%-*.*s%-*.*s%-*.*s%3d天沒上站\n", IDLEN, IDLEN, lostbms[i].title,
- BTLEN-10, BTLEN-10, lostbms[i].ctitle, IDLEN,IDLEN,
- lostbms[i].bmname,lostbms[i].lostdays);
- }
- }
- fclose(inf);
- fclose(firef);
-
- //printf("Total %d boards.\n", count);
-
- //mail to the users
- for( i=0; i<j; i++)
- {
- fileheader_t mymail;
- char genbuf[200];
- int lostdays;
-
- lostdays = lostbms[i].lostdays;
-
- if( (lostdays != 14) || (lostdays != 21) ) // 14 21 天不發信
- continue;
-
- sprintf(genbuf, BBSHOME "/home/%c/%s", lostbms[i].bmname[0], lostbms[i].bmname);
- stampfile(genbuf, &mymail);
-
- strcpy(mymail.owner, "[" BBSMNAME "警察局]");
-
- if(lostdays <= 60){
- sprintf(mymail.title,
- "\033[32m [小組長免職警告通知] \033[m %s BM %s", lostbms[i].title, lostbms[i].bmname);
- }else{
- sprintf(mymail.title,
- "\033[32m [小組長免職通知] \033[m %s BM %s", lostbms[i].title, lostbms[i].bmname);
- }
- unlink(genbuf);
- if(lostdays <= 60){
- LINK(OUTFILE, genbuf);
- }else{
- LINK(FIREFILE, genbuf);
- }
-
- sprintf(genbuf, BBSHOME "/home/%c/%s/.DIR", lostbms[i].bmname[0], lostbms[i].bmname);
- append_record(genbuf, &mymail, sizeof(mymail));
- }
-
- return 0;
-}
diff --git a/util/toplazyBBM.c b/util/toplazyBBM.c
deleted file mode 100644
index 38f4d55d..00000000
--- a/util/toplazyBBM.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* $Id$ */
-#define _UTIL_C_
-#include "bbs.h"
-
-#define OUTFILE BBSHOME "/etc/toplazyBBM"
-#define FIREFILE BBSHOME "/etc/topfireBBM"
-
-extern boardheader_t *bcache;
-extern int numboards;
-
-boardheader_t allbrd[MAX_BOARD];
-typedef struct lostbm {
- char bmname[IDLEN + 1];
- char *title;
- char *ctitle;
- int lostdays;
-} lostbm;
-lostbm lostbms[MAX_BOARD];
-
-typedef struct BMarray{
- char bmname[IDLEN + 1];
- int flag;
-} BMArray;
-BMArray bms[3];
-
-int bmlostdays_cmp(const void *va, const void *vb)
-{
- lostbm *a=(lostbm *)va, *b=(lostbm *)vb;
- if (a->lostdays > b->lostdays) return -1;
- else if (a->lostdays == b->lostdays) return 0;
- else return 1;
-}
-
-int main(int argc, char *argv[])
-{
- int bmid, i, j=0;
- FILE *inf, *firef;
-
- attach_SHM();
- resolve_boards();
-
- if(passwd_init())
- exit(1);
-
- memcpy(allbrd,bcache,numboards*sizeof(boardheader_t));
-
- /* write out the target file */
- printf("Starting Checking\n");
- inf = fopen(OUTFILE, "w+");
- if(inf == NULL){
- printf("open file error : %s\n", OUTFILE);
- exit(1);
- }
- firef = fopen(FIREFILE, "w+");
- if(firef == NULL){
- printf("open file error : %s\n", FIREFILE);
- exit(1);
- }
-
- fprintf(inf, "警告: 板主若於兩個月未上站,將予於免職\n");
- fprintf(inf,
- "看板名稱 "
- " 板主 幾天沒來啦\n"
- "---------------------------------------------------"
- "-------------------\n");
-
- fprintf(firef, "免職板主\n");
- fprintf(firef,
- "看板名稱 "
- " 板主 幾天沒來啦\n"
- "---------------------------------------------------"
- "-------------------\n");
-
-
- j = 0 ;
- for (i = 0; i < numboards; i++) {
- char *p, bmbuf[IDLEN * 3 + 3];
- int index = 0, flag = 0, k, n;
- userec_t xuser;
- p=strtok(allbrd[i].BM,"/ ");
-
- if(p)
- do
- {
- if(allbrd[i].brdname[0] == '\0' || (allbrd[i].brdattr & BRD_GROUPBOARD) ==0 ) continue;
- if (*p == '[' ){p[strlen(p)-1]='\0'; p++;}
- bmid=getuser(p, &xuser);
- strlcpy(bms[index].bmname, p, sizeof(bms[index].bmname));
- bms[index].flag = 0;
- if (((((int)time(NULL)-(int)xuser.lastlogin)/(60*60*24))>=7)
- //&& isalpha(allbrd[i].brdname[0])
- //&& isalpha(allbrd[i].BM[0])
- && !(xuser.userlevel & PERM_SYSOPHIDE)
- && !(xuser.userlevel & PERM_SYSOP))
- {
- strlcpy(lostbms[j].bmname, p, sizeof(bms[index].bmname));
- lostbms[j].title = allbrd[i].brdname;
- lostbms[j].ctitle = allbrd[i].title;
- lostbms[j].lostdays =
- ((int)time(NULL)-(int)xuser.lastlogin)/(60*60*24);
-
- printf("%s\n", lostbms[j].title);
- //超過六十天 免職
- if(lostbms[j].lostdays > 30){
- xuser.userlevel &= ~PERM_BM;
- bms[index].flag = 1;
- flag = 1;
- }
- j++;
- }
- index++;
- } while((p=strtok(NULL,"/ "))!=NULL);
-
- //從板主名單拿掉名字
-
- if(flag == 1){
- bmbuf[0] = '\0';
- for(k = 0 , n = 0; k < index; k++){
- if(!bms[k].flag){
- if( n++ != 0) strcat(bmbuf, "/");
- strcat(bmbuf, bms[k].bmname);
- }
- }
- strcpy(allbrd[i].BM, bmbuf);
- }
-
- }
- qsort(lostbms, j, sizeof(lostbm), bmlostdays_cmp);
-
- printf("Starting to mail\n");
- //write to the etc/toplazyBBM
- for ( i=0; i<j; i++)
- {
- if( lostbms[i].lostdays > 30){
- fprintf(firef, "%-*.*s%-*.*s%-*.*s%3d天沒上站\n", IDLEN, IDLEN, lostbms[i].title,
- BTLEN-10, BTLEN-10, lostbms[i].ctitle, IDLEN,IDLEN,
- lostbms[i].bmname,lostbms[i].lostdays);
- }else{
- fprintf(inf, "%-*.*s%-*.*s%-*.*s%3d天沒上站\n", IDLEN, IDLEN, lostbms[i].title,
- BTLEN-10, BTLEN-10, lostbms[i].ctitle, IDLEN,IDLEN,
- lostbms[i].bmname,lostbms[i].lostdays);
- }
- }
- fclose(inf);
- fclose(firef);
-
- printf("Total %d boards.\n", j);
-
- //mail to the users
- for( i=0; i<j; i++)
- {
- fileheader_t mymail;
- char genbuf[200];
- int lostdays;
-
- lostdays = lostbms[i].lostdays;
-
- if( (lostdays != 14) || (lostdays != 21) ) // 14 21 天不發信
- continue;
-
- sprintf(genbuf, BBSHOME "/home/%c/%s", lostbms[i].bmname[0], lostbms[i].bmname);
- stampfile(genbuf, &mymail);
-
- strcpy(mymail.owner, "[" BBSMNAME "警察局]");
-
- if(lostdays <= 30){
- sprintf(mymail.title,
- "\033[32m [小組長免職警告通知] \033[m %s BM %s", lostbms[i].title, lostbms[i].bmname);
- }else{
- sprintf(mymail.title,
- "\033[32m [小組長免職通知] \033[m %s BM %s", lostbms[i].title, lostbms[i].bmname);
- }
- unlink(genbuf);
- if(lostdays <= 30){
- Link(OUTFILE, genbuf);
- }else{
- Link(FIREFILE, genbuf);
- }
-
- sprintf(genbuf, BBSHOME "/home/%c/%s/.DIR", lostbms[i].bmname[0], lostbms[i].bmname);
- append_record(genbuf, &mymail, sizeof(mymail));
- }
-
- return 0;
-}
diff --git a/util/toplazyBBM.sh b/util/toplazyBBM.sh
deleted file mode 100644
index d1d94229..00000000
--- a/util/toplazyBBM.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-bin/toplazyBBM
-bin/post Record 懶惰小組長排行榜 [Ptt警察局] etc/toplazyBBM
-bin/post ViolateLaw 今日免職小組長 [Ptt法院] etc/firelazyBBM