summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-09-12 22:13:27 +0800
committerscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-09-12 22:13:27 +0800
commit034d58797eec19da098234a8c2626987081d9d48 (patch)
treec1cb879d5911cf94768a92c9408cb42143034754
parent535e458a1b28ecdf69dddcace060807e462980fd (diff)
downloadpttbbs-034d58797eec19da098234a8c2626987081d9d48.tar
pttbbs-034d58797eec19da098234a8c2626987081d9d48.tar.gz
pttbbs-034d58797eec19da098234a8c2626987081d9d48.tar.bz2
pttbbs-034d58797eec19da098234a8c2626987081d9d48.tar.lz
pttbbs-034d58797eec19da098234a8c2626987081d9d48.tar.xz
pttbbs-034d58797eec19da098234a8c2626987081d9d48.tar.zst
pttbbs-034d58797eec19da098234a8c2626987081d9d48.zip
Personal chess country data query done.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2194 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/talk.c8
-rw-r--r--mbbsd/user.c35
-rw-r--r--mbbsd/var.c10
-rw-r--r--util/chesscountry.c18
4 files changed, 66 insertions, 5 deletions
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 209852de..40d44668 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -2343,6 +2343,14 @@ userlist(void)
case 'S': /* 顯示好友描述 */
show_mode = (show_mode+1) % MAX_SHOW_MODE;
+#ifdef CHESSCOUNTRY
+ if (show_mode == 2)
+ user_query_mode = 1;
+ else if (show_mode == 3)
+ user_query_mode = 2;
+ else
+ user_query_mode = 0;
+#endif /* defined(CHESSCOUNTRY) */
redrawall = redraw = 1;
break;
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 819595a8..e2813c77 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -749,6 +749,41 @@ showplans(char *uid)
{
char genbuf[200];
+#ifdef CHESSCOUNTRY
+ if (user_query_mode) {
+ char *photo_name[2] = { "photo_fivechess", "photo_cchess" };
+ int i = 0;
+ FILE *fp;
+
+ sethomefile(genbuf, uid, photo_name[user_query_mode - 1]);
+ if ((fp = fopen(genbuf, "r")) != NULL)
+ {
+ char photo[6][256];
+ int kingdom_bid = 0;
+
+ move(7, 0);
+ while (i < 12 && fgets(genbuf, 256, fp))
+ {
+ genbuf[strlen(genbuf) - 1] = 0;
+ if (i < 6) /* 讀照片檔 */
+ strcpy(photo[i], genbuf);
+ else if (i == 6)
+ kingdom_bid = atoi(genbuf);
+ else
+ prints("%s %s\n", photo[i - 7], genbuf);
+
+ i++;
+ }
+
+ /* 棋國國徽 */
+ setapath(genbuf, bcache[kingdom_bid - 1].brdname);
+ strlcat(genbuf, "/chess_ensign", sizeof(genbuf));
+ show_file(genbuf, 12, 10, ONLY_COLOR);
+ return;
+ }
+ }
+#endif /* defined(CHESSCOUNTRY) */
+
sethomefile(genbuf, uid, fn_plans);
if (!show_file(genbuf, 7, MAX_QUERYLINES, ONLY_COLOR))
prints("《個人名片》%s 目前沒有名片", uid);
diff --git a/mbbsd/var.c b/mbbsd/var.c
index f7062848..8bcd145c 100644
--- a/mbbsd/var.c
+++ b/mbbsd/var.c
@@ -396,6 +396,16 @@ int chc_lefttime;
int chc_my, chc_turn, chc_selected, chc_firststep;
char chc_warnmsg[64], *chc_mateid;
+/* user.c */
+#ifdef CHESSCOUNTRY
+int user_query_mode;
+/*
+ * user_query_mode = 0 simple data
+ * = 1 gomoku chess country data
+ * = 2 chc chess country data
+ */
+#endif /* defined(CHESSCOUNTRY) */
+
/* screen.c */
#define scr_lns t_lines
#define scr_cols ANSILINELEN
diff --git a/util/chesscountry.c b/util/chesscountry.c
index 453636ee..35851083 100644
--- a/util/chesscountry.c
+++ b/util/chesscountry.c
@@ -9,7 +9,7 @@
#include "bbs.h"
/* Number of minutes of files' mtime before now will be rescanned. */
-#define UPDATE_FREQUENCY (30)
+// #define UPDATE_FREQUENCY (30)
void
f_suck6(FILE* fp, char* fname)
@@ -28,6 +28,8 @@ f_suck6(FILE* fp, char* fname)
}
fclose(sfp);
}
+ while (count++ < 6)
+ fputc('\n', fp);
}
int
@@ -35,10 +37,9 @@ main(void)
{
FILE *fp, *ftmp;
int i = 0, num;
- //char *currboard[3] = {"CCK-CHUHEN", "CCK-GENERAL", "CCK-FREE"};
- //char *kingdom[3] = {"楚漢皇朝", "將帥帝聯", "逍遙王朝"};
+ // char *currboard[3] = {"CCK-CHUHEN", "CCK-GENERAL", "CCK-FREE"};
+ // char *kingdom[3] = {"楚漢皇朝", "將帥帝聯", "逍遙王朝"};
char file1[80], file2[80], str[256];
- struct stat st;
time_t dtime;
boardheader_t brd;
int brdfd;
@@ -47,6 +48,8 @@ main(void)
setuid(BBSUID);
chdir(BBSHOME);
+ attach_SHM();
+
time(&dtime);
if ((brdfd = open(BBSHOME "/" FN_BOARD, O_RDONLY)) == -1){
@@ -60,6 +63,8 @@ main(void)
const char* chess_name = 0;
char kingdom_name[256];
int bid;
+ // struct stat st;
+
switch(brd.chesscountry){
case CHESSCODE_FIVE:
photo_fname = "photo_fivechess";
@@ -77,8 +82,12 @@ main(void)
setapath(str, brd.brdname);
sprintf(file1, "%s/chess_list", str);
+ printf("apath = %s\n", str);
+
+ /*
if (stat(file1, &st) == 0 && st.st_mtime > (dtime - UPDATE_FREQUENCY * 60))
continue;
+ */
sprintf(file2, "%s/chess_list.tmp", str);
if ((ftmp = fopen(file2, "w")) == NULL)
@@ -143,7 +152,6 @@ main(void)
if (!strcmp(item.title + 3, name))
{
sethomefile(buf, userid, photo_fname);
- //sprintf(buf, "home/%c/%s/photo_cchess", userid[0], userid);
if ((fp1 = fopen(buf, "w")))
{
sprintf(buf, "%s/chess_photo/%s", str, item.filename);