Beispiel #1
0
/*
   讀取推文分數
*/
int read_pushcnt(int fd, int ent, const FILEHEADER *ofhr)
{
	FILEHEADER *fhr = &genfhbuf;

	if (safely_read_dir(NULL, fd, ent, ofhr, fhr))
		return PUSH_ERR;

	return get_pushcnt(fhr);
}
Beispiel #2
0
/*
 * 列印? Index List Lines
 */
void read_entry(int x, void *ent, int idx, int top, int last, int rows)
{
	register int num, len;
	int score;
	unsigned char *str;
	static char chdate[9];
	time_t date;
	struct tm *tm;
	register unsigned char type;
	FILEHEADER *fhr = &(((FILEHEADER *) ent)[top - idx]);

	for (num = top; num <= last && (num - top) < rows; num++, fhr++)
	{
		chk_str(fhr->title);
		chk_str(fhr->owner);

		/* by lmj */
		date = atol((fhr->filename) + 2);
		if (!date)
			sprintf(chdate, "%-8.8s", "unknown");
		else
		{
			tm = localtime(&date);
			sprintf(chdate, "%02d.%02d.%02d",
				tm->tm_year - 11, tm->tm_mon + 1, tm->tm_mday);
		}

		type = fhr->accessed;

		if (in_mail)
		{
			if (type & FILE_RESV)
				type = (type & FILE_READ) ? 'g' : 'G';
			else if (type & FILE_DELE)
				type = (type & FILE_READ) ? 'd' : 'D';
			else if (type & FILE_REPD)
				type = 'r';
			else
				type = (type & FILE_READ) ? ' ' : 'N';
		}
		else if (in_board)
		{
			if (type & FILE_RESV)
				type = (ReadRC_UnRead(fhr)) ? 'G' : 'g';
			else if (type & FILE_DELE)
				type = (ReadRC_UnRead(fhr)) ? 'D' : 'd';
			else {
				switch (ReadRC_UnRead(fhr)) {
				case UNREAD_NEW:
					type = 'N';
					break;
				case UNREAD_MOD:
					type = 'M';
					break;
				default:
					type = ' ';
				}
			}
		}
		else
		{
			/* 若為精華區, 則皆視為已讀過 */
			type = ' ';
		}

		/* 顯示指標區域 */
		outs("   ");

		if (cmp_wlist(artwtop, fhr->filename, strcmp))
			prints("%4d*%c", num, type);
		else
			prints("%4d %c", num, type);

#if USE_THREAD
		if (thr_mode && !art_mode)
		{
			if (fhr->unused_int2 > 1 && fhr->unused_int2 < 10)
				prints(" %d ", fhr->unused_int2);
			else if (fhr->unused_int2 >= 10)
				prints(" %d", fhr->unused_int2);
			else
				outs("   ");
		}
		else
			outs("   ");
#else
		score = get_pushcnt(fhr);
		if (score != PUSH_FIRST) {
			if (score == SCORE_MAX)
				prints("\033[1;31m\xA1\xDB\033[m");
			else if (score > 0)
				prints("\033[1;31m%2.2X\033[m", score);
			else if (score == SCORE_MIN)
				prints("\033[32m\xA3\x58\033[m");
			else if (score < 0)
				prints("\033[32m%2.2X\033[m", 0 - score);
			else
				prints("\033[1;33m 0\033[m");
		} else {
			outs("  ");
		}
#endif

		/* if treausure sub-folder */
		if (fhr->accessed & FILE_TREA)
			prints("  %-11.11s", _msg_read_4);
		else
		{
			len = 11;
			if (curuser.ident == 7 && fhr->ident == 7) {
				outs(_str_marker);
			} else if (fhr->owner[0] == '#') {
				len = 12;
				outs(" ");
			} else {
				outs("  ");
			}

			str = (unsigned char *)fhr->owner;
			while (len > 0 && *str && *str != '@' && *str != '.')
			{
				outc(*str++);
				len--;
			}
			while (len-- > 0)
				outc(' ');
		}

		outs(" ");
		outs(chdate);
		outs(" ");

		if (type == 'd' || type == 'D')
			prints(_msg_read_7, fhr->delby);
		else
		{
			if (memtitle[0] && !strcmp(fhr->title, memtitle))
				outs("#");
			else if (memtitle[0] && !strcmp(fhr->title, memtitle + REPLY_LEN))
				outs("#");
			else
				outs(" ");
#if USE_THREAD
			len = 40;
#else
			len = 42;
#endif
			str = (unsigned char *)fhr->title;
			while (len-- > 0 && *str)
				outc(*str++);
/*
			if (len == -1 && *(str - 1) > 0x80)
				outc(*str);
*/
			outs("");
		}

		outs("\n");
	}
}