| 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> |
| 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, |
| 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: |
| 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 |
{ |
{ |
| 413 |
case 'H': |
case 'H': |
| 414 |
return SHOW_TOP10; |
return SHOW_TOP10; |
| 415 |
default: |
default: |
| 416 |
|
break; |
| 417 |
} |
} |
| 418 |
|
|
| 419 |
if (old_page_id != *p_page_id) |
if (old_page_id != *p_page_id) |
| 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) |
| 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) |
| 579 |
{ |
{ |
| 580 |
log_error("section_list_rd_lock(sid = 0) error\n"); |
log_error("get_section_info(sid=%d) error\n", p_section->sid); |
| 581 |
return -2; |
return -4; |
|
} |
|
|
|
|
|
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) |
|
|
{ |
|
|
log_error("section_list_rd_unlock(sid = 0) error\n"); |
|
|
return -2; |
|
| 582 |
} |
} |
| 583 |
|
|
| 584 |
if (aid == 0) |
if (aid == 0) |
| 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; |