/[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.56 by sysadm, Sat Oct 18 12:06:10 2025 UTC Revision 1.58 by sysadm, Wed Oct 29 01:48:46 2025 UTC
# Line 30  Line 30 
30  #include "section_list_loader.h"  #include "section_list_loader.h"
31  #include "screen.h"  #include "screen.h"
32  #include "str_process.h"  #include "str_process.h"
33    #include "user_info_display.h"
34  #include "user_priv.h"  #include "user_priv.h"
35  #include <string.h>  #include <string.h>
36  #include <time.h>  #include <time.h>
# Line 50  enum select_cmd_t Line 51  enum select_cmd_t
51          EDIT_ARTICLE,          EDIT_ARTICLE,
52          DELETE_ARTICLE,          DELETE_ARTICLE,
53          QUERY_ARTICLE,          QUERY_ARTICLE,
54            QUERY_USER,
55          SET_FAVOR_ARTICLE,          SET_FAVOR_ARTICLE,
56          UNSET_FAVOR_ARTICLE,          UNSET_FAVOR_ARTICLE,
57          FIRST_TOPIC_ARTICLE,          FIRST_TOPIC_ARTICLE,
# Line 262  static enum select_cmd_t section_list_se Line 264  static enum select_cmd_t section_list_se
264    
265                  switch (ch)                  switch (ch)
266                  {                  {
267                  case KEY_NULL:                   // broken pipe                  case KEY_NULL: // broken pipe
268                          log_error("KEY_NULL\n");                          log_error("KEY_NULL\n");
269                          return EXIT_SECTION;                          return EXIT_SECTION;
270                  case KEY_TIMEOUT:                  case KEY_TIMEOUT:
# Line 305  static enum select_cmd_t section_list_se Line 307  static enum select_cmd_t section_list_se
307                                  return QUERY_ARTICLE;                                  return QUERY_ARTICLE;
308                          }                          }
309                          break;                          break;
310                    case Ctrl('A'):
311                            if (item_count > 0)
312                            {
313                                    return QUERY_USER;
314                            }
315                            break;
316                  case 'F':                  case 'F':
317                          if (item_count > 0)                          if (item_count > 0)
318                          {                          {
# Line 549  int section_list_display(const char *sna Line 557  int section_list_display(const char *sna
557          ARTICLE article_new;          ARTICLE article_new;
558          int page_id_cur;          int page_id_cur;
559          const ARTICLE *p_article_locate;          const ARTICLE *p_article_locate;
560            USER_INFO user_info;
561    
562          p_section = section_list_find_by_name(sname);          p_section = section_list_find_by_name(sname);
563          if (p_section == NULL)          if (p_section == NULL)
# Line 566  int section_list_display(const char *sna Line 575  int section_list_display(const char *sna
575    
576          section_index = get_section_index(p_section);          section_index = get_section_index(p_section);
577    
578          if ((ret = section_list_rd_lock(p_section)) < 0)          if (get_section_info(p_section, NULL, stitle, master_list) < 0)
         {  
                 log_error("section_list_rd_lock(sid = 0) error\n");  
                 return -2;  
         }  
   
         strncpy(stitle, p_section->stitle, sizeof(stitle) - 1);  
         stitle[sizeof(stitle) - 1] = '\0';  
         strncpy(master_list, p_section->master_list, sizeof(master_list) - 1);  
         master_list[sizeof(master_list) - 1] = '\0';  
   
         if ((ret = section_list_rd_unlock(p_section)) < 0)  
579          {          {
580                  log_error("section_list_rd_unlock(sid = 0) error\n");                  log_error("get_section_info(sid=%d) error\n", p_section->sid);
581                  return -2;                  return -4;
582          }          }
583    
584          if (aid == 0)          if (aid == 0)
# Line 940  int section_list_display(const char *sna Line 938  int section_list_display(const char *sna
938                          if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0)                          if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0)
939                          {                          {
940                                  log_error("section_list_draw_screen() error\n");                                  log_error("section_list_draw_screen() error\n");
941                                    return -2;
942                            }
943                            break;
944                    case QUERY_USER:
945                            if ((ret = query_user_info_by_uid(p_articles[selected_index]->uid, &user_info)) < 0)
946                            {
947                                    log_error("query_user_info_by_uid(uid=%d) error\n", p_articles[selected_index]->uid);
948                                    return -2;
949                            }
950                            else if (ret == 0)
951                            {
952                                    clearscr();
953                                    prints("该用户已升天");
954                                    press_any_key();
955                            }
956                            else if (user_info_display(&user_info) < 0) // && ret > 0
957                            {
958                                    log_error("user_info_display(uid=%d) error\n", p_articles[selected_index]->uid);
959                            }
960    
961                            if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0)
962                            {
963                                    log_error("section_list_draw_screen() error\n");
964                                  return -2;                                  return -2;
965                          }                          }
966                          break;                          break;


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

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