Skip to content

Commit 43e5426

Browse files
committed
Rewrite title with "Re: Re: " prefix into "Re: ... "
1 parent ab0e55f commit 43e5426

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/section_list_display.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ static int section_list_draw_items(int page_id, ARTICLE *p_articles[], int artic
6161
int eol;
6262
int len;
6363
int i;
64+
size_t j;
6465
char article_flag;
6566
int is_viewed;
6667
time_t tm_now;
@@ -111,7 +112,26 @@ static int section_list_draw_items(int page_id, ARTICLE *p_articles[], int artic
111112
strncpy(title_f, (p_articles[i]->tid == 0 ? "● " : ""), sizeof(title_f) - 1);
112113
title_f[sizeof(title_f) - 1] = '\0';
113114
strncat(title_f, (p_articles[i]->transship ? "[转载]" : ""), sizeof(title_f) - 1 - strnlen(title_f, sizeof(title_f)));
114-
strncat(title_f, p_articles[i]->title, sizeof(title_f) - 1 - strnlen(title_f, sizeof(title_f)));
115+
116+
// Rewrite title with "Re: Re: " prefix into "Re: ... "
117+
j = 0;
118+
if (p_articles[i]->tid != 0)
119+
{
120+
while (strncmp(p_articles[i]->title + j, "Re: ", strlen("Re: ")) == 0)
121+
{
122+
j += strlen("Re: ");
123+
}
124+
if (j >= strlen("Re: Re: "))
125+
{
126+
strncat(title_f, "Re: ... ", sizeof(title_f) - 1 - strnlen(title_f, sizeof(title_f)));
127+
}
128+
else
129+
{
130+
j = 0;
131+
}
132+
}
133+
strncat(title_f, p_articles[i]->title + j, sizeof(title_f) - 1 - strnlen(title_f, sizeof(title_f)));
134+
115135
len = split_line(title_f, 47 - (display_nickname ? 8 : 0), &eol, &title_f_len, 1);
116136
if (title_f[len] != '\0')
117137
{

0 commit comments

Comments
 (0)