--- lbbs/src/article_del.c 2025/06/15 04:45:13 1.1 +++ lbbs/src/article_del.c 2025/07/02 04:17:33 1.6 @@ -16,10 +16,11 @@ #include "article_del.h" #include "database.h" -#include "log.h" #include "io.h" +#include "log.h" #include "screen.h" #include "user_priv.h" +#include #include int article_del(const SECTION_LIST *p_section, const ARTICLE *p_article) @@ -39,20 +40,33 @@ int article_del(const SECTION_LIST *p_se log_error("NULL pointer error\n"); } + if (p_article->excerption) // Delete is not allowed + { + clearscr(); + moveto(1, 1); + prints("该文章无法被删除,请联系版主。"); + press_any_key(); + + return 0; + } + clearscr(); moveto(1, 1); - prints("Ҫɾ£(Y), (N) [N]: "); + prints("真的要删除文章?(Y)是, (N)否 [N]: "); iflush(); for (ch = 0; !SYS_server_exit; ch = igetch_t(MAX_DELAY_TIME)) { switch (toupper(ch)) { + case KEY_NULL: + case KEY_TIMEOUT: + goto cleanup; case CR: igetch_reset(); case KEY_ESC: case 'N': - goto cleanup; + return 0; case 'Y': break; default: // Invalid selection @@ -62,6 +76,11 @@ int article_del(const SECTION_LIST *p_se break; } + if (SYS_server_exit) // Do not save data on shutdown + { + goto cleanup; + } + db = db_open(); if (db == NULL) { @@ -117,7 +136,7 @@ int article_del(const SECTION_LIST *p_se clearscr(); moveto(1, 1); - prints("ѱɾԺˢб"); + prints("该文章已被删除,请稍后刷新列表。"); press_any_key(); goto cleanup; @@ -127,7 +146,7 @@ int article_del(const SECTION_LIST *p_se { clearscr(); moveto(1, 1); - prints("޷ɾϵ"); + prints("该文章无法被删除,请联系版主。"); press_any_key(); goto cleanup; @@ -211,7 +230,7 @@ int article_del(const SECTION_LIST *p_se clearscr(); moveto(1, 1); - prints("ɾɹ%dˢб", BBS_section_list_load_interval); + prints("删除成功,请在%d秒后刷新列表。", BBS_section_list_load_interval); press_any_key(); ret = 1; // Success