summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authormhsin <mhsin@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-17 19:49:15 +0800
committermhsin <mhsin@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-17 19:49:15 +0800
commit16bf63475770e642a94d5d617b000f025846fddf (patch)
treef1d0951f3dc073cb1ad6f612db883786f2884a06 /mbbsd
parentd9108233ecee950fcc9aa1f0599f28adfd204537 (diff)
downloadpttbbs-16bf63475770e642a94d5d617b000f025846fddf.tar
pttbbs-16bf63475770e642a94d5d617b000f025846fddf.tar.gz
pttbbs-16bf63475770e642a94d5d617b000f025846fddf.tar.bz2
pttbbs-16bf63475770e642a94d5d617b000f025846fddf.tar.lz
pttbbs-16bf63475770e642a94d5d617b000f025846fddf.tar.xz
pttbbs-16bf63475770e642a94d5d617b000f025846fddf.tar.zst
pttbbs-16bf63475770e642a94d5d617b000f025846fddf.zip
* Enhanced AID query UI.
* Use aidu_t(uint64_t) for AIDus. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3703 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/bbs.c67
-rw-r--r--mbbsd/read.c6
-rw-r--r--mbbsd/stuff.c33
3 files changed, 68 insertions, 38 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index bec7484c..1d10941d 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -3110,51 +3110,80 @@ lock_post(int ent, fileheader_t * fhdr, const char *direct)
}
static int
-view_postinfo(int ent, const fileheader_t * fhdr, const char *direct)
+view_postinfo(int ent, const fileheader_t * fhdr, const char *direct, int crs_ln)
{
- unsigned long aidu = 0;
+ aidu_t aidu = 0;
+ int l = crs_ln + 3; /* line of cursor */
+ int area_l = l + 1;
+ const int area_lines = 7;
+
+ if((area_l + area_lines > b_lines) || /* 下面放不下 */
+ (l >= (b_lines * 2 / 3))) /* 略超過畫面 2/3 */
+ area_l -= (area_lines + 1);
if(fhdr->filename[0] == '.')
return DONOTHING;
- move(17, 0);
- clrtobot();
- prints("-------------------------------------------------------------------------------\n");
- prints("\n%7d", ent);
- prints(" %-13.12s", fhdr->owner);
- prints(" %s\n\n", fhdr->title);
+ grayout_lines(0, MIN(l - 1, area_l), 0);
+ grayout_lines(MAX(l + 1 + 1, area_l + area_lines), b_lines, 0);
+
+ /* 清除文章的前一行或後一行 */
+ if(area_l > l)
+ move(l - 1, 0);
+ else
+ move(l + 1, 0);
+ clrtoeol();
+
+ move(area_l, 0);
+ clrtoline(area_l + area_lines);
+
+ if(area_l > l)
+ prints(" ↖\n");
+ prints(" ┌───────────────────────────────────┐\n");
+ prints(" │\n");
- aidu = fn2aidu(fhdr->filename);
+ aidu = fn2aidu((char *)fhdr->filename);
if(aidu > 0)
{
char aidc[10];
aidu2aidc(aidc, aidu);
-#ifdef DEBUG
- prints(" fn: %s\n", fhdr->filename);
- prints("AIDu: %012lX\n", aidu);
- prints("AIDc: %s\n", aidc);
-#endif
- prints(" 此篇文章的" AID_DISPLAYNAME "為: " ANSI_COLOR(1) "#%s" ANSI_RESET "\n", aidc);
+ prints(" │ 此篇文章的" AID_DISPLAYNAME "為: " ANSI_COLOR(1) "#%s" ANSI_RESET "\n", aidc);
}
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");
+ if(area_l < l)
+ prints(" ↙\n");
+ /* 印對話框的右邊界 */
+ {
+ int i;
+
+ for(i = 1; i < area_lines - 2; i ++)
+ {
+ move_ansi(area_l + i + (area_l > l), 76);
+ prints("│");
+ }
}
{
int r = pressanykey();
diff --git a/mbbsd/read.c b/mbbsd/read.c
index 883f75d5..8cbd81b4 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -731,7 +731,7 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
case '#':
{
char aidc[100];
- unsigned long aidu = 0;
+ aidu_t aidu = 0;
char dirfile[PATHLEN];
char *sp;
int n = -1;
@@ -1076,12 +1076,12 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem,
else if( num > 0 ){
sprintf(direct,"%s.bottom", currdirect);
mode= (*func)(num, &headers[locmem->crs_ln-locmem->top_ln],
- direct);
+ direct, locmem->crs_ln - locmem->top_ln);
}
else
mode = (*func)(locmem->crs_ln,
&headers[locmem->crs_ln - locmem->top_ln],
- currdirect);
+ currdirect, locmem->crs_ln - locmem->top_ln);
if(mode == READ_SKIP)
mode = lastmode;
diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c
index af55ca01..b5b18645 100644
--- a/mbbsd/stuff.c
+++ b/mbbsd/stuff.c
@@ -663,12 +663,13 @@ uintbsearch(const unsigned int key, const unsigned int *base0, const int nmemb)
return (NULL);
}
-unsigned long fn2aidu(char *fn)
+/* AIDS */
+aidu_t fn2aidu(char *fn)
{
- unsigned long aidu = 0;
- unsigned long type = 0;
- unsigned long v1 = 0;
- unsigned long v2 = 0;
+ aidu_t aidu = 0;
+ aidu_t type = 0;
+ aidu_t v1 = 0;
+ aidu_t v2 = 0;
char *sp = fn;
if(fn == NULL)
@@ -709,12 +710,12 @@ unsigned long fn2aidu(char *fn)
/* IMPORTANT:
* size of buf must be at least 8+1 bytes
*/
-char *aidu2aidc(char *buf, unsigned long aidu)
+char *aidu2aidc(char *buf, aidu_t aidu)
{
const char aidu2aidc_table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_";
const int aidu2aidc_tablesize = sizeof(aidu2aidc_table) - 1;
char *sp = buf + 8;
- unsigned long v;
+ aidu_t v;
*(sp --) = '\0';
while(sp >= buf)
@@ -731,11 +732,11 @@ char *aidu2aidc(char *buf, unsigned long aidu)
/* IMPORTANT:
* size of fn must be at least FNLEN bytes
*/
-char *aidu2fn(char *fn, unsigned long aidu)
+char *aidu2fn(char *fn, aidu_t aidu)
{
- unsigned long type = ((aidu >> 44) & 0xf);
- unsigned long v1 = ((aidu >> 12) & 0xffffffff);
- unsigned long v2 = (aidu & 0xfff);
+ aidu_t type = ((aidu >> 44) & 0xf);
+ aidu_t v1 = ((aidu >> 12) & 0xffffffff);
+ aidu_t v2 = (aidu & 0xfff);
if(fn == NULL)
return NULL;
@@ -744,17 +745,17 @@ char *aidu2fn(char *fn, unsigned long aidu)
return fn;
}
-unsigned long aidc2aidu(char *aidc)
+aidu_t aidc2aidu(char *aidc)
{
char *sp = aidc;
- unsigned long aidu = 0;
+ aidu_t aidu = 0;
if(aidc == NULL)
return 0;
while(*sp != '\0' && /* ignore trailing spaces */ *sp != ' ')
{
- unsigned long v = 0;
+ aidu_t v = 0;
/* FIXME: 查表法會不會比較快? */
if(*sp >= '0' && *sp <= '9')
v = *sp - '0';
@@ -776,7 +777,7 @@ unsigned long aidc2aidu(char *aidc)
return aidu;
}
-int search_aidu(char *bfile, unsigned long aidu)
+int search_aidu(char *bfile, aidu_t aidu)
{
char fn[FNLEN];
int fd;
@@ -816,4 +817,4 @@ int search_aidu(char *bfile, unsigned long aidu)
return (found ? pos : (lastpos ? lastpos : -1));
}
-
+/* end of AIDS */