| 31 |
#include "screen.h" |
#include "screen.h" |
| 32 |
#include "str_process.h" |
#include "str_process.h" |
| 33 |
#include "user_info_display.h" |
#include "user_info_display.h" |
| 34 |
|
#include "user_list_display.h" |
| 35 |
#include "user_priv.h" |
#include "user_priv.h" |
| 36 |
#include <errno.h> |
#include <errno.h> |
| 37 |
#include <string.h> |
#include <string.h> |
| 61 |
SCAN_NEW_ARTICLE, |
SCAN_NEW_ARTICLE, |
| 62 |
VIEW_EX_DIR, |
VIEW_EX_DIR, |
| 63 |
SHOW_TOP10, |
SHOW_TOP10, |
| 64 |
|
SEARCH_USER, |
| 65 |
}; |
}; |
| 66 |
|
|
| 67 |
static int section_list_draw_items(int page_id, ARTICLE *p_articles[], int article_count, int display_nickname, int ontop_start_offset) |
static int section_list_draw_items(int page_id, ARTICLE *p_articles[], int article_count, int display_nickname, int ontop_start_offset) |
| 409 |
return SCAN_NEW_ARTICLE; |
return SCAN_NEW_ARTICLE; |
| 410 |
} |
} |
| 411 |
break; |
break; |
| 412 |
|
case 'u': |
| 413 |
|
return SEARCH_USER; |
| 414 |
case 'h': |
case 'h': |
| 415 |
return SHOW_HELP; |
return SHOW_HELP; |
| 416 |
case 'x': |
case 'x': |
| 563 |
int page_id_cur; |
int page_id_cur; |
| 564 |
const ARTICLE *p_article_locate; |
const ARTICLE *p_article_locate; |
| 565 |
USER_INFO user_info; |
USER_INFO user_info; |
| 566 |
|
char user_intro[BBS_user_intro_max_len]; |
| 567 |
|
|
| 568 |
p_section = section_list_find_by_name(sname); |
p_section = section_list_find_by_name(sname); |
| 569 |
if (p_section == NULL) |
if (p_section == NULL) |
| 666 |
} |
} |
| 667 |
|
|
| 668 |
ret = section_list_select(page_count, article_count, &page_id, &selected_index); |
ret = section_list_select(page_count, article_count, &page_id, &selected_index); |
| 669 |
|
|
| 670 |
switch (ret) |
switch (ret) |
| 671 |
{ |
{ |
| 672 |
case EXIT_SECTION: |
case EXIT_SECTION: |
| 673 |
|
// Update current aid location |
| 674 |
|
if (p_articles[selected_index] != NULL) |
| 675 |
|
{ |
| 676 |
|
section_aid_locations[section_index] = p_articles[selected_index]->aid; |
| 677 |
|
} |
| 678 |
|
else |
| 679 |
|
{ |
| 680 |
|
log_error("p_articles[selected_index=%d] is NULL when exit section [%s]\n", selected_index, sname); |
| 681 |
|
} |
| 682 |
return 0; |
return 0; |
| 683 |
case CHANGE_PAGE: |
case CHANGE_PAGE: |
| 684 |
ret = query_section_articles(p_section, page_id, p_articles, &article_count, &page_count, &ontop_start_offset); |
ret = query_section_articles(p_section, page_id, p_articles, &article_count, &page_count, &ontop_start_offset); |
| 857 |
// Update current topic |
// Update current topic |
| 858 |
section_topic_view_tid = (p_articles[selected_index]->tid == 0 ? p_articles[selected_index]->aid : p_articles[selected_index]->tid); |
section_topic_view_tid = (p_articles[selected_index]->tid == 0 ? p_articles[selected_index]->aid : p_articles[selected_index]->tid); |
| 859 |
|
|
|
// Update current aid location |
|
|
section_aid_locations[section_index] = p_articles[selected_index]->aid; |
|
|
|
|
| 860 |
if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0) |
if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0) |
| 861 |
{ |
{ |
| 862 |
log_error("section_list_draw_screen() error\n"); |
log_error("section_list_draw_screen() error\n"); |
| 955 |
} |
} |
| 956 |
break; |
break; |
| 957 |
case QUERY_USER: |
case QUERY_USER: |
| 958 |
if ((ret = query_user_info_by_uid(p_articles[selected_index]->uid, &user_info)) < 0) |
if ((ret = query_user_info_by_uid(p_articles[selected_index]->uid, &user_info, user_intro, sizeof(user_intro))) < 0) |
| 959 |
{ |
{ |
| 960 |
log_error("query_user_info_by_uid(uid=%d) error\n", p_articles[selected_index]->uid); |
log_error("query_user_info_by_uid(uid=%d) error\n", p_articles[selected_index]->uid); |
| 961 |
return -2; |
return -2; |
| 1052 |
} |
} |
| 1053 |
} |
} |
| 1054 |
break; |
break; |
| 1055 |
|
case SEARCH_USER: |
| 1056 |
|
user_list_search(); |
| 1057 |
|
if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0) |
| 1058 |
|
{ |
| 1059 |
|
log_error("section_list_draw_screen() error\n"); |
| 1060 |
|
return -2; |
| 1061 |
|
} |
| 1062 |
|
break; |
| 1063 |
case SHOW_HELP: |
case SHOW_HELP: |
| 1064 |
// Display help information |
// Display help information |
| 1065 |
display_file(DATA_READ_HELP, 1); |
display_file(DATA_READ_HELP, 1); |