summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/proto.h22
-rw-r--r--mbbsd/bbs.c24
-rw-r--r--mbbsd/fav.c5
-rw-r--r--mbbsd/pfterm.c6
-rw-r--r--mbbsd/record.c36
-rw-r--r--mbbsd/screen.c26
-rw-r--r--mbbsd/xyz.c1
7 files changed, 102 insertions, 18 deletions
diff --git a/include/proto.h b/include/proto.h
index 5136abaa..c46c9791 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -574,7 +574,7 @@ ChessInfo* reversi_replay(FILE* fp);
/* screen/pfterm (ncurses-like) */
void initscr (void);
int resizeterm (int rows, int cols);
-void getyx (int *y, int *x);
+void getyx (int *py, int *px);
void move (int y, int x);
void clear (void);
void clrtoeol (void);
@@ -598,6 +598,7 @@ void outns(const char *str, int n);
void outstr(const char *str); // prepare and print a complete non-ANSI string.
int inansistr(char *str, int n);
void move_ansi(int y, int x);
+void getyx_ansi(int *py, int *px);
void region_scroll_up(int top, int bottom);
// deprecated
void standout(void);
@@ -605,6 +606,15 @@ void standend(void);
#define HAVE_GRAYOUT
void grayout(int start, int end, int level);
+/* AIDS */
+typedef uint64_t aidu_t;
+aidu_t fn2aidu(char *fn);
+char *aidu2aidc(char *buf, aidu_t aidu);
+char *aidu2fn(char *buf, aidu_t aidu);
+aidu_t aidc2aidu(char *aidc);
+int search_aidu(char *bfile, aidu_t aidu);
+/* end of AIDS */
+
/* stuff */
#define isprint2(ch) ((ch & 0x80) || isprint(ch))
#define not_alpha(ch) (ch < 'A' || (ch > 'Z' && ch < 'a') || ch > 'z')
@@ -631,6 +641,7 @@ int is_BM(const char *list);
void setbdir(char *buf, const char *boardname);
void setbfile(char *buf, const char *boardname, const char *fname);
void setbnfile(char *buf, const char *boardname, const char *fname, int n);
+void setaidfile(char *buf, const char *bn, aidu_t aidu);
char *subject(char *title);
int is_validuserid(const char *id);
void setdirpath(char *buf, const char *direct, const char *fname);
@@ -659,15 +670,6 @@ void pressanykey_or_callangel(void);
#endif
void syncnow(void);
-/* AIDS */
-typedef uint64_t aidu_t;
-aidu_t fn2aidu(char *fn);
-char *aidu2aidc(char *buf, aidu_t aidu);
-char *aidu2fn(char *buf, aidu_t aidu);
-aidu_t aidc2aidu(char *aidc);
-int search_aidu(char *bfile, aidu_t aidu);
-/* end of AIDS */
-
/* syspost */
int post_msg(const char* bname, const char* title, const char *msg, const char* author);
int post_file(const char *bname, const char *title, const char *filename, const char *author);
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 87b6f140..5ad31a9f 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1568,7 +1568,9 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
// you should disable pre-unlinking
unlink(genbuf);
Rename(fpath, genbuf);
+
fhdr->modified = dasht(genbuf);
+ strlcpy(fhdr->title, save_title, sizeof(fhdr->title));
if (fhdr->modified > 0)
{
@@ -3204,40 +3206,46 @@ view_postinfo(int ent, const fileheader_t * fhdr, const char *direct, int crs_ln
outc(' '); outs(ANSI_CLRTOEND);
move(area_l, 0);
- prints(" ┌───────────────────────────────────┐\n");
+ prints("┌─────────────────────────────────────┐\n");
aidu = fn2aidu((char *)fhdr->filename);
if(aidu > 0)
{
char aidc[10];
+ int y, x;
aidu2aidc(aidc, aidu);
- prints(" │ 此篇文章的" AID_DISPLAYNAME "為: "
- ANSI_COLOR(1) "#%s" ANSI_RESET " (%s) [%s]\n",
+ prints("│ " AID_DISPLAYNAME ": "
+ ANSI_COLOR(1) "#%s" ANSI_RESET " (%s) [%s] ",
aidc, currboard && currboard[0] ? currboard : "未知",
MYHOSTNAME);
+ getyx_ansi(&y, &x);
+ x = 75 - x;
+ if (x > 1)
+ prints("%.*s ", x, fhdr->title);
+ outs("\n");
}
else
{
- prints(" │\n");
+ prints("│\n");
}
if(fhdr->filemode & FILE_ANONYMOUS)
/* When the file is anonymous posted, fhdr->multi.anon_uid is author.
* see do_general() */
- prints(" │ 匿名管理編號: %d (同一人號碼會一樣)",
+ prints("│ 匿名管理編號: %d (同一人號碼會一樣)",
fhdr->multi.anon_uid + (int)currutmp->pid);
else {
int m = query_file_money(fhdr);
if(m < 0)
- prints(" │ 特殊文章,無價格記錄。");
+ prints("│ 特殊文章,無價格記錄");
else
- prints(" │ 這一篇文章值 %d 銀", m);
+ prints("│ 這一篇文章值 %d 銀", m);
}
prints("\n");
- prints(" └───────────────────────────────────┘\n");
+ prints("└─────────────────────────────────────┘\n");
/* 印對話框的右邊界 */
{
diff --git a/mbbsd/fav.c b/mbbsd/fav.c
index fae372df..5e851a54 100644
--- a/mbbsd/fav.c
+++ b/mbbsd/fav.c
@@ -1222,6 +1222,11 @@ void reginit_fav(void)
if (bid > 0) fav_add_board(bid);
#endif
+#ifdef GLOBAL_ASKBOARD
+ bid = getbnum(GLOBAL_ASKBOARD);
+ if (bid > 0) fav_add_board(bid);
+#endif
+
fav_save();
}
diff --git a/mbbsd/pfterm.c b/mbbsd/pfterm.c
index 08dec655..2d405311 100644
--- a/mbbsd/pfterm.c
+++ b/mbbsd/pfterm.c
@@ -2289,6 +2289,12 @@ move_ansi(int y, int x)
}
void
+getyx_ansi(int *y, int *x)
+{
+ getyx(y, x);
+}
+
+void
region_scroll_up(int top, int bottom)
{
int i;
diff --git a/mbbsd/record.c b/mbbsd/record.c
index 37d15870..17811fb8 100644
--- a/mbbsd/record.c
+++ b/mbbsd/record.c
@@ -626,3 +626,39 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char *
return 0;
}
+
+void
+setaidfile(char *buf, const char *bn, aidu_t aidu)
+{
+ // try to load by AID
+ int bid = 0;
+ int n = 0, fd = 0;
+ char bfpath[PATHLEN] = "";
+ boardheader_t *bh = NULL;
+ fileheader_t fh;
+
+ buf[0] = 0;
+ bid = getbnum(bn);
+
+ if (bid <= 0) return;
+ assert(0<=bid-1 && bid-1<MAX_BOARD);
+ bh = getbcache(bid);
+ if (!HasBoardPerm(bh)) return;
+
+ setbfile(bfpath, bh->brdname, FN_DIR);
+ n = search_aidu(bfpath, aidu);
+
+ if (n < 0) return;
+ fd = open(bfpath, O_RDONLY);
+ if (fd < 0) return;
+
+ lseek(fd, n*sizeof(fileheader_t), SEEK_SET);
+ memset(&fh, 0, sizeof(fh));
+ if (read(fd, &fh, sizeof(fh)) > 0)
+ {
+ setbfile(buf, bh->brdname, fh.filename);
+ if (!dashf(buf))
+ buf[0] = 0;
+ }
+ close(fd);
+}
diff --git a/mbbsd/screen.c b/mbbsd/screen.c
index 25ec5c22..76a4f34f 100644
--- a/mbbsd/screen.c
+++ b/mbbsd/screen.c
@@ -96,6 +96,32 @@ getyx(int *y, int *x)
*x = cur_col;
}
+void
+getyx_ansi(int *py, int *px)
+{
+ // take ANSI length in consideration
+ register screenline_t *slp;
+ int y = cur_ln, x = cur_col;
+ char c = 0;
+
+ if (y < 0) y = 0;
+ if (y >= t_lines) y = t_lines -1;
+ if (x < 0) x = 0;
+ if (x >= ANSILINELEN) x = ANSILINELEN -1;
+
+ *py = y; *px = x;
+
+ if (y >= scr_lns || x < 1)
+ return;
+
+ slp = &big_picture[y];
+ if (slp->len < 1)
+ return;
+ c = slp->data[x];
+ *px += (strlen((char*)slp->data) - strlen_noansi((char*)slp->data));
+ slp->data[x] = c;
+}
+
static inline
screenline_t* GetCurrentLine(){
register int i = cur_ln + roll;
diff --git a/mbbsd/xyz.c b/mbbsd/xyz.c
index f33d32fe..6de0f0a5 100644
--- a/mbbsd/xyz.c
+++ b/mbbsd/xyz.c
@@ -207,6 +207,7 @@ note(void)
if ((foo = fopen(".note", "a")) == NULL)
return 0;
+ unlink(fn_note_ans); // remove first to prevent mmap(pmore) crash
if ((fp = fopen(fn_note_ans, "w")) == NULL) {
fclose(fp);
return 0;