/[LeafOK_CVS]/lbbs/src/section_list_display.c
ViewVC logotype

Diff of /lbbs/src/section_list_display.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.52 by sysadm, Tue Oct 14 06:28:54 2025 UTC Revision 1.53 by sysadm, Wed Oct 15 01:05:18 2025 UTC
# Line 15  Line 15 
15   ***************************************************************************/   ***************************************************************************/
16    
17  #include "article_cache.h"  #include "article_cache.h"
18    #include "article_favor.h"
19  #include "article_op.h"  #include "article_op.h"
20  #include "article_post.h"  #include "article_post.h"
21  #include "article_view_log.h"  #include "article_view_log.h"
# Line 49  enum select_cmd_t Line 50  enum select_cmd_t
50          EDIT_ARTICLE,          EDIT_ARTICLE,
51          DELETE_ARTICLE,          DELETE_ARTICLE,
52          QUERY_ARTICLE,          QUERY_ARTICLE,
53            SET_FAVOR_ARTICLE,
54            UNSET_FAVOR_ARTICLE,
55          FIRST_TOPIC_ARTICLE,          FIRST_TOPIC_ARTICLE,
56          LAST_TOPIC_ARTICLE,          LAST_TOPIC_ARTICLE,
57          SCAN_NEW_ARTICLE,          SCAN_NEW_ARTICLE,
# Line 68  static int section_list_draw_items(int p Line 71  static int section_list_draw_items(int p
71          size_t j;          size_t j;
72          char article_flag;          char article_flag;
73          int is_viewed;          int is_viewed;
74            int is_favor;
75          time_t tm_now;          time_t tm_now;
76    
77          time(&tm_now);          time(&tm_now);
# Line 90  static int section_list_draw_items(int p Line 94  static int section_list_draw_items(int p
94                          }                          }
95                  }                  }
96    
97                    if (p_articles[i]->tid == 0)
98                    {
99                            is_favor = article_favor_check(p_articles[i]->aid, &BBS_article_favor);
100                            if (is_favor < 0)
101                            {
102                                    log_error("article_favor_check(aid=%d) error\n", p_articles[i]->aid);
103                                    is_favor = 0;
104                            }
105                    }
106                    else
107                    {
108                            is_favor = 0;
109                    }
110    
111                  if (p_articles[i]->excerption)                  if (p_articles[i]->excerption)
112                  {                  {
113                          article_flag = (is_viewed ? 'm' : 'M');                          article_flag = (is_viewed ? 'm' : 'M');
# Line 145  static int section_list_draw_items(int p Line 163  static int section_list_draw_items(int p
163                  moveto(4 + i, 1);                  moveto(4 + i, 1);
164                  if (i >= ontop_start_offset)                  if (i >= ontop_start_offset)
165                  {                  {
166                          prints("   \033[1;33m[提示]\033[m %c %s%*s %s %s%s\033[m",                          prints("   \033[1;33m[提示]\033[m%c%c %s%*s %s %s%s\033[m",
167                                       (is_favor ? '@' : ' '),
168                                     article_flag,                                     article_flag,
169                                     (display_nickname ? p_articles[i]->nickname : p_articles[i]->username),                                     (display_nickname ? p_articles[i]->nickname : p_articles[i]->username),
170                                     (display_nickname ? BBS_nickname_max_len / 2 - str_length(p_articles[i]->nickname, 1)                                     (display_nickname ? BBS_nickname_max_len / 2 - str_length(p_articles[i]->nickname, 1)
# Line 161  static int section_list_draw_items(int p Line 180  static int section_list_draw_items(int p
180                  }                  }
181                  else                  else
182                  {                  {
183                          prints("  %s%7d\033[m %c %s%*s %s %s%s\033[m",                          prints("  %s%7d\033[m%c%c %s%*s %s %s%s\033[m",
184                                     (p_articles[i]->aid == section_topic_view_tid                                     (p_articles[i]->aid == section_topic_view_tid
185                                                  ? "\033[1;33m"                                                  ? "\033[1;33m"
186                                                  : (p_articles[i]->tid == section_topic_view_tid                                                  : (p_articles[i]->tid == section_topic_view_tid
187                                                             ? "\033[1;36m"                                                             ? "\033[1;36m"
188                                                             : "")),                                                             : "")),
189                                     p_articles[i]->aid,                                     p_articles[i]->aid,
190                                       (is_favor ? '@' : ' '),
191                                     article_flag,                                     article_flag,
192                                     (display_nickname ? p_articles[i]->nickname : p_articles[i]->username),                                     (display_nickname ? p_articles[i]->nickname : p_articles[i]->username),
193                                     (display_nickname ? BBS_nickname_max_len / 2 - str_length(p_articles[i]->nickname, 1)                                     (display_nickname ? BBS_nickname_max_len / 2 - str_length(p_articles[i]->nickname, 1)
# Line 281  static enum select_cmd_t section_list_se Line 301  static enum select_cmd_t section_list_se
301                                  return QUERY_ARTICLE;                                  return QUERY_ARTICLE;
302                          }                          }
303                          break;                          break;
304                    case 'F':
305                            if (item_count > 0)
306                            {
307                                    return SET_FAVOR_ARTICLE;
308                            }
309                            break;
310                    case '-':
311                            if (item_count > 0)
312                            {
313                                    return UNSET_FAVOR_ARTICLE;
314                            }
315                            break;
316                  case KEY_HOME:                  case KEY_HOME:
317                          *p_page_id = 0;                          *p_page_id = 0;
318                  case 'P':                  case 'P':
# Line 907  int section_list_display(const char *sna Line 939  int section_list_display(const char *sna
939                                  return -2;                                  return -2;
940                          }                          }
941                          break;                          break;
942                    case SET_FAVOR_ARTICLE:
943                            ret = article_favor_set(p_articles[selected_index]->tid == 0
944                                                                                    ? p_articles[selected_index]->aid
945                                                                                    : p_articles[selected_index]->tid,
946                                                                            &BBS_article_favor, 1);
947                            if (ret < 0)
948                            {
949                                    log_error("article_favor_set(aid=%d, 1) error\n",
950                                                      p_articles[selected_index]->tid == 0 ? p_articles[selected_index]->aid : p_articles[selected_index]->tid);
951                            }
952                            break;
953                    case UNSET_FAVOR_ARTICLE:
954                            ret = article_favor_set(p_articles[selected_index]->tid == 0
955                                                                                    ? p_articles[selected_index]->aid
956                                                                                    : p_articles[selected_index]->tid,
957                                                                            &BBS_article_favor, 0);
958                            if (ret < 0)
959                            {
960                                    log_error("article_favor_set(aid=%d, 0) error\n",
961                                                      p_articles[selected_index]->tid == 0 ? p_articles[selected_index]->aid : p_articles[selected_index]->tid);
962                            }
963                            break;
964                  case FIRST_TOPIC_ARTICLE:                  case FIRST_TOPIC_ARTICLE:
965                  case LAST_TOPIC_ARTICLE:                  case LAST_TOPIC_ARTICLE:
966                          page_id_cur = page_id;                          page_id_cur = page_id;


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1