--- lbbs/src/article_del.c 2025/06/15 04:47:59 1.2 +++ lbbs/src/article_del.c 2025/06/21 02:15:18 1.5 @@ -16,8 +16,8 @@ #include "article_del.h" #include "database.h" -#include "log.h" #include "io.h" +#include "log.h" #include "screen.h" #include "user_priv.h" #include @@ -40,6 +40,16 @@ 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]: "); @@ -49,11 +59,14 @@ int article_del(const SECTION_LIST *p_se { 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 @@ -63,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) {