summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/cal.c21
-rw-r--r--mbbsd/edit.c36
-rw-r--r--mbbsd/mail.c3
-rw-r--r--mbbsd/user.c55
4 files changed, 92 insertions, 23 deletions
diff --git a/mbbsd/cal.c b/mbbsd/cal.c
index bf4572b6..26cce228 100644
--- a/mbbsd/cal.c
+++ b/mbbsd/cal.c
@@ -134,20 +134,35 @@ osong(const char *defaultid)
clrtobot();
prints("親愛的 %s 歡迎來到歐桑自動點歌系統\n", cuser.userid);
trans_buffer[0] = '\0';
+
if (!defaultid) {
- getdata(13, 0, "要點給誰呢:[可直接按 Enter 先選歌]",
+
+ getdata(13, 0, "要點給誰呢: [另可按 "
+ ANSI_COLOR(1) "Enter" ANSI_RESET
+ " 先選歌或是輸入 " ANSI_COLOR(1) "n" ANSI_RESET
+ " 離開]",
destid, sizeof(destid), DOECHO);
while (!destid[0]) {
+
a_menu("點歌歌本", SONGBOOK, 0, trans_buffer);
clear();
- getdata(13, 0, "要點給誰呢:[可按 Enter 重新選歌]",
+ getdata(13, 0, "要點給誰呢: [另可按 "
+ ANSI_COLOR(1) "Enter" ANSI_RESET
+ " 先選歌或是輸入 " ANSI_COLOR(1) "n" ANSI_RESET
+ " 離開]",
destid, sizeof(destid), DOECHO);
}
+ if (destid[1] == 0 &&
+ (destid[0] == 'n' || destid[0] == 'N'))
+ {
+ unlockutmpmode();
+ return 0;
+ }
} else
strlcpy(destid, defaultid, sizeof(destid));
/* Heat:點歌者匿名功能 */
- getdata(14, 0, "要匿名嗎?[y/n]:", ano, sizeof(ano), LCECHO);
+ getdata(14, 0, "要匿名嗎?[y/N]:", ano, sizeof(ano), LCECHO);
if (!destid[0]) {
unlockutmpmode();
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index e1a1fa74..bcc8e28e 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -1445,11 +1445,10 @@ void
addsignature(FILE * fp, int ifuseanony)
{
FILE *fs;
- int i, num;
+ int i;
char buf[WRAPMARGIN + 1];
char fpath[STRLEN];
- static char msg[] = "請選擇簽名檔 (1-9, 0=不加 X=隨機)[X]: ";
char ch;
if (!strcmp(cuser.userid, STR_GUEST)) {
@@ -1458,10 +1457,33 @@ addsignature(FILE * fp, int ifuseanony)
return;
}
if (!ifuseanony) {
- num = showsignature(fpath, &i);
- if (num){
- msg[34] = ch = isdigit(cuser.signature) ? cuser.signature : 'X';
- getdata(0, 0, msg, buf, 4, DOECHO);
+
+ int browsing = 0;
+ SigInfo si;
+ memset(&si, 0, sizeof(si));
+
+browse_sigs:
+ showsignature(fpath, &i, &si);
+
+ if (si.max > 0){
+ unsigned char msg[64];
+
+ ch = isdigit(cuser.signature) ? cuser.signature : 'X';
+ sprintf(msg,
+ (browsing || (si.max > si.show_max)) ?
+ "請選擇簽名檔 (1-9, 0=不加 n=翻頁 x=隨機)[%c]: ":
+ "請選擇簽名檔 (1-9, 0=不加 x=隨機)[%c]: ",
+ ch);
+ getdata(0, 0, msg, buf, 4, LCECHO);
+
+ if(buf[0] == 'n')
+ {
+ si.show_start = si.show_max + 1;
+ if(si.show_start > si.max)
+ si.show_start = 0;
+ browsing = 1;
+ goto browse_sigs;
+ }
if (!buf[0])
buf[0] = ch;
@@ -1469,7 +1491,7 @@ addsignature(FILE * fp, int ifuseanony)
if (isdigit((int)buf[0]))
ch = buf[0];
else
- ch = '1' + random() % num;
+ ch = '1' + random() % si.max;
cuser.signature = buf[0];
if (ch != '0') {
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index f58293bb..300f2e96 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -1471,7 +1471,8 @@ send_inner_mail(const char *fpath, const char *title, const char *receiver)
sethomepath(genbuf, rightid);
stampfile(genbuf, &mymail);
if (!strcmp(rightid, cuser.userid)) {
- strlcpy(mymail.owner, "[" BBSNAME "]", sizeof(mymail.owner));
+ /* Using BBSNAME may be too loooooong. */
+ strlcpy(mymail.owner, "[站內]", sizeof(mymail.owner));
mymail.filemode = FILE_READ;
} else
strlcpy(mymail.owner, cuser.userid, sizeof(mymail.owner));
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) {