| 21 |
#include "io.h" |
#include "io.h" |
| 22 |
#include "screen.h" |
#include "screen.h" |
| 23 |
#include "log.h" |
#include "log.h" |
| 24 |
|
#include "user_priv.h" |
| 25 |
|
#include "article_view_log.h" |
| 26 |
#include "str_process.h" |
#include "str_process.h" |
| 27 |
#include <time.h> |
#include <time.h> |
| 28 |
#include <sys/param.h> |
#include <sys/param.h> |
| 51 |
int len; |
int len; |
| 52 |
int i; |
int i; |
| 53 |
char article_flag; |
char article_flag; |
| 54 |
|
int is_viewed; |
| 55 |
time_t tm_now; |
time_t tm_now; |
| 56 |
|
|
| 57 |
time(&tm_now); |
time(&tm_now); |
| 60 |
|
|
| 61 |
for (i = 0; i < article_count; i++) |
for (i = 0; i < article_count; i++) |
| 62 |
{ |
{ |
| 63 |
article_flag = ' '; |
if (p_articles[i]->uid == BBS_priv.uid) |
| 64 |
|
{ |
| 65 |
|
is_viewed = 1; |
| 66 |
|
} |
| 67 |
|
else |
| 68 |
|
{ |
| 69 |
|
is_viewed = article_view_log_is_viewed(p_articles[i]->aid, &BBS_article_view_log); |
| 70 |
|
if (is_viewed < 0) |
| 71 |
|
{ |
| 72 |
|
log_error("article_view_log_is_viewed(aid=%d) error\n", p_articles[i]->aid); |
| 73 |
|
is_viewed = 0; |
| 74 |
|
} |
| 75 |
|
} |
| 76 |
|
|
| 77 |
|
article_flag = (is_viewed ? ' ' : 'N'); |
| 78 |
|
|
| 79 |
if (p_articles[i]->excerption) |
if (p_articles[i]->excerption) |
| 80 |
{ |
{ |
| 81 |
article_flag = 'm'; |
article_flag = (is_viewed ? 'm' : 'M'); |
| 82 |
} |
} |
| 83 |
else if (p_articles[i]->lock) |
else if (p_articles[i]->lock && is_viewed) |
| 84 |
{ |
{ |
| 85 |
article_flag = 'x'; |
article_flag = 'x'; |
| 86 |
} |
} |
| 434 |
break; |
break; |
| 435 |
} |
} |
| 436 |
|
|
| 437 |
ret = display_data(cache.p_data, cache.line_total, cache.line_offsets, 1, 0, |
ret = display_data(cache.p_data, cache.line_total, cache.line_offsets, 0, |
| 438 |
display_article_key_handler, DATA_READ_HELP); |
display_article_key_handler, DATA_READ_HELP); |
| 439 |
|
|
| 440 |
if (article_cache_unload(&cache) < 0) |
if (article_cache_unload(&cache) < 0) |
| 443 |
break; |
break; |
| 444 |
} |
} |
| 445 |
|
|
| 446 |
|
// Update article_view_log |
| 447 |
|
if (article_view_log_set_viewed(p_articles[selected_index]->aid, &BBS_article_view_log) < 0) |
| 448 |
|
{ |
| 449 |
|
log_error("article_view_log_set_viewed(aid=%d) error\n", p_articles[selected_index]->aid); |
| 450 |
|
} |
| 451 |
|
|
| 452 |
switch (ret) |
switch (ret) |
| 453 |
{ |
{ |
| 454 |
case KEY_UP: |
case KEY_UP: |