| 1 |
/*************************************************************************** |
/* SPDX-License-Identifier: GPL-3.0-or-later */ |
| 2 |
article_favor_display.c - description |
/* |
| 3 |
------------------- |
* article_favor_display |
| 4 |
Copyright : (C) 2004-2025 by Leaflet |
* - user interactive feature to display favorite articles |
| 5 |
Email : leaflet@leafok.com |
* |
| 6 |
***************************************************************************/ |
* Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com> |
| 7 |
|
*/ |
| 8 |
/*************************************************************************** |
|
| 9 |
* * |
#ifdef HAVE_CONFIG_H |
| 10 |
* This program is free software; you can redistribute it and/or modify * |
#include "config.h" |
| 11 |
* it under the terms of the GNU General Public License as published by * |
#endif |
|
* the Free Software Foundation; either version 3 of the License, or * |
|
|
* (at your option) any later version. * |
|
|
* * |
|
|
***************************************************************************/ |
|
| 12 |
|
|
| 13 |
#include "article_favor_display.h" |
#include "article_favor_display.h" |
| 14 |
#include "article_view_log.h" |
#include "article_view_log.h" |
| 56 |
return 0; |
return 0; |
| 57 |
} |
} |
| 58 |
|
|
| 59 |
static int article_favor_draw_items(int page_id, ARTICLE *p_articles[], char p_snames[][BBS_section_name_max_len + 1], |
static int article_favor_draw_items(int page_id, const ARTICLE *p_articles[], char p_snames[][BBS_section_name_max_len + 1], |
| 60 |
int article_count, int display_sname) |
int article_count, int display_sname) |
| 61 |
{ |
{ |
| 62 |
char str_time[LINE_BUFFER_LEN]; |
char str_time[LINE_BUFFER_LEN]; |
| 161 |
if (ch != KEY_NULL && ch != KEY_TIMEOUT) |
if (ch != KEY_NULL && ch != KEY_TIMEOUT) |
| 162 |
{ |
{ |
| 163 |
BBS_last_access_tm = time(NULL); |
BBS_last_access_tm = time(NULL); |
| 164 |
|
|
| 165 |
|
// Refresh current action |
| 166 |
|
if (user_online_update(NULL) < 0) |
| 167 |
|
{ |
| 168 |
|
log_error("user_online_update(NULL) error\n"); |
| 169 |
|
} |
| 170 |
} |
} |
| 171 |
|
|
| 172 |
switch (ch) |
switch (ch) |
| 173 |
{ |
{ |
| 174 |
case KEY_NULL: // broken pipe |
case KEY_NULL: // broken pipe |
| 175 |
|
#ifdef _DEBUG |
| 176 |
log_error("KEY_NULL\n"); |
log_error("KEY_NULL\n"); |
| 177 |
|
#endif |
| 178 |
case KEY_ESC: |
case KEY_ESC: |
| 179 |
case KEY_LEFT: |
case KEY_LEFT: |
| 180 |
return EXIT_LIST; // exit list |
return EXIT_LIST; // exit list |
| 181 |
case KEY_TIMEOUT: |
case KEY_TIMEOUT: |
| 182 |
if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME) |
if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time) |
| 183 |
{ |
{ |
| 184 |
log_error("User input timeout\n"); |
log_error("User input timeout\n"); |
| 185 |
return EXIT_LIST; // exit list |
return EXIT_LIST; // exit list |
| 301 |
|
|
| 302 |
char page_info_str[LINE_BUFFER_LEN]; |
char page_info_str[LINE_BUFFER_LEN]; |
| 303 |
char snames[BBS_article_limit_per_page][BBS_section_name_max_len + 1]; |
char snames[BBS_article_limit_per_page][BBS_section_name_max_len + 1]; |
| 304 |
ARTICLE *p_articles[BBS_article_limit_per_page]; |
const ARTICLE *p_articles[BBS_article_limit_per_page]; |
| 305 |
int article_count; |
int article_count; |
| 306 |
int page_count; |
int page_count; |
| 307 |
int page_id = 0; |
int page_id = 0; |