diff options
author | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-01-23 15:09:45 +0800 |
---|---|---|
committer | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-01-23 15:09:45 +0800 |
commit | d1d03b072337c249adfaeb5ff936fa2d9065b9c7 (patch) | |
tree | b9a10e4d3796fdeb90f6b061e1574c8a6b55720c | |
parent | 871ceb1fe146ef185d0047df6d2c17afda38e363 (diff) | |
download | pttbbs-d1d03b072337c249adfaeb5ff936fa2d9065b9c7.tar pttbbs-d1d03b072337c249adfaeb5ff936fa2d9065b9c7.tar.gz pttbbs-d1d03b072337c249adfaeb5ff936fa2d9065b9c7.tar.bz2 pttbbs-d1d03b072337c249adfaeb5ff936fa2d9065b9c7.tar.lz pttbbs-d1d03b072337c249adfaeb5ff936fa2d9065b9c7.tar.xz pttbbs-d1d03b072337c249adfaeb5ff936fa2d9065b9c7.tar.zst pttbbs-d1d03b072337c249adfaeb5ff936fa2d9065b9c7.zip |
Allow user to modify their chess country self-description.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2420 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/user.c | 75 | ||||
-rw-r--r-- | util/chesscountry.c | 2 |
2 files changed, 74 insertions, 3 deletions
diff --git a/mbbsd/user.c b/mbbsd/user.c index 721bcfd2..f5ddac6f 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -5,6 +5,17 @@ static char * const sex[8] = { MSG_BIG_BOY, MSG_BIG_GIRL, MSG_LITTLE_BOY, MSG_LITTLE_GIRL, MSG_MAN, MSG_WOMAN, MSG_PLANT, MSG_MIME }; + +#ifdef CHESSCOUNTRY +static const char * const chess_photo_name[2] = { + "photo_fivechess", "photo_cchess" +}; + +static const char * const chess_type[2] = { + "五子棋", "象棋" +}; +#endif + int kill_user(int num) { @@ -97,6 +108,23 @@ user_display(userec_t * u, int real) prints(" 上站文章: %d 次 / %d 篇\n", u->numlogins, u->numposts); +#ifdef CHESSCOUNTRY + { + int i, j; + FILE* fp; + for(i = 0; i < 2; ++i){ + sethomefile(genbuf, u->userid, chess_photo_name[i]); + fp = fopen(genbuf, "r"); + if(fp != NULL){ + for(j = 0; j < 11; ++j) + fgets(genbuf, 200, fp); + fgets(genbuf, 200, fp); + prints("%12s棋國自我描述: %s", chess_type[i], genbuf + 11); + } + } + } +#endif + if (real) { strcpy(genbuf, "bTCPRp#@XWBA#VSM0123456789ABCDEF"); for (diff = 0; diff < 32; diff++) @@ -420,6 +448,50 @@ uinfo_query(userec_t * u, int real, int unum) } #endif +#ifdef CHESSCOUNTRY + { + int j, k; + FILE* fp; + for(j = 0; j < 2; ++j){ + sethomefile(genbuf, u->userid, chess_photo_name[j]); + fp = fopen(genbuf, "r"); + if(fp != NULL){ + FILE* newfp; + char mybuf[200]; + for(k = 0; k < 11; ++k) + fgets(genbuf, 200, fp); + fgets(genbuf, 200, fp); + genbuf[strlen(genbuf) - 1] = 0; + + snprintf(mybuf, 200, "%s棋國自我描述:", chess_type[j]); + getdata_buf(i, 0, mybuf, genbuf + 11, 80 - 11, DOECHO); + ++i; + + sethomefile(mybuf, u->userid, chess_photo_name[j]); + strcat(mybuf, ".new"); + if((newfp = fopen(mybuf, "w")) != NULL){ + rewind(fp); + for(k = 0; k < 11; ++k){ + fgets(mybuf, 200, fp); + fputs(mybuf, newfp); + } + fputs(genbuf, newfp); + fputc('\n', newfp); + + fclose(newfp); + + sethomefile(genbuf, u->userid, chess_photo_name[j]); + sethomefile(mybuf, u->userid, chess_photo_name[j]); + strcat(mybuf, ".new"); + + Rename(mybuf, genbuf); + } + fclose(fp); + } + } + } +#endif + if (real) { int l; if (HAS_PERM(PERM_BBSADM)) { @@ -751,11 +823,10 @@ showplans(char *uid) #ifdef CHESSCOUNTRY if (user_query_mode) { - const char *photo_name[2] = { "photo_fivechess", "photo_cchess" }; int i = 0; FILE *fp; - sethomefile(genbuf, uid, photo_name[user_query_mode - 1]); + sethomefile(genbuf, uid, chess_photo_name[user_query_mode - 1]); if ((fp = fopen(genbuf, "r")) != NULL) { char photo[6][256]; diff --git a/util/chesscountry.c b/util/chesscountry.c index 35851083..345cec8b 100644 --- a/util/chesscountry.c +++ b/util/chesscountry.c @@ -176,7 +176,7 @@ main(void) other[strlen(other) - 1] = 0; fprintf(fp1, "<被誰俘虜> %s", other); } - fprintf(fp1, "\n<自我說明> "); + fprintf(fp1, "\n<自我說明> \n"); fclose(fp1); } } |