summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-17 18:30:52 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-17 18:30:52 +0800
commitd9108233ecee950fcc9aa1f0599f28adfd204537 (patch)
tree709e2f6db13c9f43ee8ac5a7f9ce226834ba8965 /mbbsd
parent3fb29022e04342c0a6c9112d578f44ae736c7e00 (diff)
downloadpttbbs-d9108233ecee950fcc9aa1f0599f28adfd204537.tar
pttbbs-d9108233ecee950fcc9aa1f0599f28adfd204537.tar.gz
pttbbs-d9108233ecee950fcc9aa1f0599f28adfd204537.tar.bz2
pttbbs-d9108233ecee950fcc9aa1f0599f28adfd204537.tar.lz
pttbbs-d9108233ecee950fcc9aa1f0599f28adfd204537.tar.xz
pttbbs-d9108233ecee950fcc9aa1f0599f28adfd204537.tar.zst
pttbbs-d9108233ecee950fcc9aa1f0599f28adfd204537.zip
edit: exp - upload file
screen/grayout: add bold out option (-1) git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3702 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/edit.c79
-rw-r--r--mbbsd/screen.c6
2 files changed, 83 insertions, 2 deletions
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index b44f8c70..a5044dc5 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -1634,6 +1634,10 @@ browse_sigs:
#endif
}
+#ifdef EXP_EDIT_UPLOAD
+static void upload_file(void);
+#endif // EXP_EDIT_UPLOAD
+
static int
write_file(char *fpath, int saveheader, int *islocal, char *mytitle)
{
@@ -1666,6 +1670,11 @@ write_file(char *fpath, int saveheader, int *islocal, char *mytitle)
read_tmpbuf(-1);
case 'e':
return KEEP_EDITING;
+#ifdef EXP_EDIT_UPLOAD
+ case 'u':
+ upload_file();
+ return KEEP_EDITING;
+#endif // EXP_EDIT_UPLOAD
case 'w':
write_tmpbuf();
return KEEP_EDITING;
@@ -2764,6 +2773,76 @@ phone_mode_filter(char ch)
return 0;
}
+#ifdef EXP_EDIT_UPLOAD
+
+static void
+upload_file(void)
+{
+ size_t szdata = 0;
+ int c = 1;
+ char promptmsg = 0;
+
+ clear();
+ block_cancel();
+ stand_title("上傳文字檔案");
+ move(3,0);
+ outs("利用本服務您可以上傳較大的文字檔。\n"
+ "\n"
+ "上傳期間您打的字暫時不會出現在螢幕上,除了 Ctrl-U 會被轉換為 ANSI \n"
+ "控制碼的 ESC 外,其它特殊鍵一律沒有作用。\n"
+ "\n"
+ "請在您的電腦本機端複製好內容後貼上即可開始傳送。\n");
+
+ do {
+ // if (promptmsg)
+ {
+ move(10, 0); clrtobot();
+ prints("\n\n資料接收中... %u 位元組。\n", (unsigned int)szdata);
+ outs(ANSI_COLOR(1)
+ "◆全部完成後按下 End 或 ^X/^Q/^C 即可回到編輯畫面。"
+ ANSI_RESET "\n");
+ promptmsg = 0;
+ }
+
+ c = igetch();
+ if (c < 0x100 && isprint2(c))
+ {
+ insert_char(c);
+ szdata ++;
+ }
+ else if (c == Ctrl('U') || c == ESC_CHR)
+ {
+ insert_char(ESC_CHR);
+ szdata ++;
+ }
+ else if (c == Ctrl('I'))
+ {
+ insert_tab();
+ szdata ++;
+ }
+ else if (c == '\r' || c == '\n')
+ {
+ split(curr_buf->currline, curr_buf->currpnt);
+ curr_buf->oldcurrline = curr_buf->currline;
+ szdata ++;
+ promptmsg = 1;
+ }
+
+ if (!promptmsg)
+ promptmsg = (szdata && szdata % 1024 == 0);
+
+ // all other keys are ignored.
+ } while (c != KEY_END && c != Ctrl('X') &&
+ c != Ctrl('C') && c != Ctrl('Q'));
+
+ move(12, 0);
+ prints("傳送結束: 收到 %u 位元組。", (unsigned int)szdata);
+ vmsgf("回到編輯畫面");
+}
+
+#endif // EXP_EDIT_UPLOAD
+
+
/* 編輯處理:主程式、鍵盤處理 */
int
vedit2(char *fpath, int saveheader, int *islocal, int textOnly)
diff --git a/mbbsd/screen.c b/mbbsd/screen.c
index 853d3110..941ad015 100644
--- a/mbbsd/screen.c
+++ b/mbbsd/screen.c
@@ -608,7 +608,7 @@ standend(void)
}
// level:
-// -1 - black (not implemented)
+// -1 - bold out
// 0 - dark text
// 1 - text
// 2 - no highlight (not implemented)
@@ -661,13 +661,15 @@ grayout_lines(int y, int end, int level)
switch(level)
{
case 0: // dark text
+ case -1:// bold text
// basically, in current system slp->data will
// not exceed t_columns. buffer overflow is impossible.
// but to make it more robust, let's quick check here.
// of course, t_columns should always be far smaller.
if (strlen((char*)slp->data) > t_columns)
slp->data[t_columns] = 0;
- strcpy((char*)slp->data, ANSI_COLOR(1;30;40));
+ strcpy((char*)slp->data,
+ level < 0 ? ANSI_COLOR(1) : ANSI_COLOR(1;30;40));
strcat((char*)slp->data, buf);
strcat((char*)slp->data, ANSI_RESET ANSI_CLRTOEND);
slp->len = strlen((char*)slp->data);