diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-07-03 19:41:14 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-07-03 19:41:14 +0800 |
commit | 728bd7471eb48701106ef65af331a0173a5d3903 (patch) | |
tree | 5614ac5380eb4aa86037040a66133dd2d0516a2d /mbbsd/user.c | |
parent | bec891156b90f32fb98e7375cad40aeaae174dec (diff) | |
download | pttbbs-728bd7471eb48701106ef65af331a0173a5d3903.tar pttbbs-728bd7471eb48701106ef65af331a0173a5d3903.tar.gz pttbbs-728bd7471eb48701106ef65af331a0173a5d3903.tar.bz2 pttbbs-728bd7471eb48701106ef65af331a0173a5d3903.tar.lz pttbbs-728bd7471eb48701106ef65af331a0173a5d3903.tar.xz pttbbs-728bd7471eb48701106ef65af331a0173a5d3903.tar.zst pttbbs-728bd7471eb48701106ef65af331a0173a5d3903.zip |
- multi-signature browsing mode
- song order: quick abort
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2881 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/user.c')
-rw-r--r-- | mbbsd/user.c | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/mbbsd/user.c b/mbbsd/user.c index 448664ec..ac8af2da 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -997,30 +997,46 @@ showplans(const char *uid) prints("《個人名片》%s 目前沒有名片", uid); } +/* + * return value: how many items displayed */ int -showsignature(char *fname, int *j) +showsignature(char *fname, int *j, SigInfo *si) { FILE *fp; char buf[256]; - int i, num = 0; + int i, lines = scr_lns; char ch; clear(); move(2, 0); + lines -= 3; + setuserfile(fname, "sig.0"); *j = strlen(fname) - 1; + si->total = 0; + si->max = 0; for (ch = '1'; ch <= '9'; ch++) { fname[*j] = ch; if ((fp = fopen(fname, "r"))) { - prints(ANSI_COLOR(36) "【 簽名檔.%c 】" ANSI_RESET "\n", ch); - for (i = 0; i < MAX_SIGLINES && fgets(buf, sizeof(buf), fp); i++) - outs(buf); - num++; + si->total ++; + si->max = ch - '1'; + if(lines > 0 && si->max >= si->show_start) + { + prints(ANSI_COLOR(36) "【 簽名檔.%c 】" ANSI_RESET "\n", ch); + lines--; + if(lines > MAX_SIGLINES/2) + si->show_max = si->max; + for (i = 0; lines > 0 && i < MAX_SIGLINES && + fgets(buf, sizeof(buf), fp) != NULL; i++) + outs(buf), lines--; + } fclose(fp); } } - return num; + if(lines > 0) + si->show_max = si->max; + return si->max; } int @@ -1028,18 +1044,33 @@ u_editsig(void) { int aborted; char ans[4]; - int j; - char genbuf[200]; + int j, browsing = 0; + char genbuf[MAXPATHLEN]; + SigInfo si; - showsignature(genbuf, &j); + memset(&si, 0, sizeof(si)); - getdata(0, 0, "簽名檔 (E)編輯 (D)刪除 (Q)取消?[Q] ", +browse_sigs: + + showsignature(genbuf, &j, &si); + getdata(0, 0, (browsing || (si.max > si.show_max)) ? + "簽名檔 (E)編輯 (D)刪除 (N)翻頁 (Q)取消?[Q] ": + "簽名檔 (E)編輯 (D)刪除 (Q)取消?[Q] ", ans, sizeof(ans), LCECHO); + if(ans[0] == 'n') + { + si.show_start = si.show_max + 1; + if(si.show_start > si.max) + si.show_start = 0; + browsing = 1; + goto browse_sigs; + } + aborted = 0; if (ans[0] == 'd') aborted = 1; - if (ans[0] == 'e') + else if (ans[0] == 'e') aborted = 2; if (aborted) { |