| 1 |
/*************************************************************************** |
/* SPDX-License-Identifier: GPL-3.0-or-later */ |
| 2 |
article_post.c - description |
/* |
| 3 |
------------------- |
* article_post |
| 4 |
copyright : (C) 2004-2025 by Leaflet |
* - user interactive feature to post / modify / reply article |
| 5 |
email : leaflet@leafok.com |
* |
| 6 |
***************************************************************************/ |
* Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com> |
| 7 |
|
*/ |
|
/*************************************************************************** |
|
|
* * |
|
|
* This program is free software; you can redistribute it and/or modify * |
|
|
* it under the terms of the GNU General Public License as published by * |
|
|
* the Free Software Foundation; either version 3 of the License, or * |
|
|
* (at your option) any later version. * |
|
|
* * |
|
|
***************************************************************************/ |
|
| 8 |
|
|
| 9 |
#include "article_cache.h" |
#include "article_cache.h" |
| 10 |
#include "article_post.h" |
#include "article_post.h" |
| 21 |
#include <stdlib.h> |
#include <stdlib.h> |
| 22 |
#include <time.h> |
#include <time.h> |
| 23 |
|
|
| 24 |
#define TITLE_INPUT_MAX_LEN 72 |
enum _article_post_constant_t |
| 25 |
#define ARTICLE_CONTENT_MAX_LEN 1024 * 1024 * 4 // 4MB |
{ |
| 26 |
#define ARTICLE_QUOTE_MAX_LINES 20 |
TITLE_INPUT_MAX_LEN = 72, |
| 27 |
#define ARTICLE_QUOTE_LINE_MAX_LEN 76 |
ARTICLE_QUOTE_MAX_LINES = 20, |
| 28 |
|
MODIFY_DT_MAX_LEN = 50, |
| 29 |
#define MODIFY_DT_MAX_LEN 50 |
}; |
| 30 |
|
|
| 31 |
int article_post(const SECTION_LIST *p_section, ARTICLE *p_article_new) |
int article_post(const SECTION_LIST *p_section, ARTICLE *p_article_new) |
| 32 |
{ |
{ |
| 103 |
ch = 0; |
ch = 0; |
| 104 |
} |
} |
| 105 |
|
|
| 106 |
for (; !SYS_server_exit; ch = igetch_t(MAX_DELAY_TIME)) |
for (; !SYS_server_exit; ch = igetch_t(BBS_max_user_idle_time)) |
| 107 |
{ |
{ |
| 108 |
switch (toupper(ch)) |
switch (toupper(ch)) |
| 109 |
{ |
{ |
| 166 |
prints("(S)发送, (C)取消, (T)更改标题 or (E)再编辑? [S]: "); |
prints("(S)发送, (C)取消, (T)更改标题 or (E)再编辑? [S]: "); |
| 167 |
iflush(); |
iflush(); |
| 168 |
|
|
| 169 |
for (ch = 0; !SYS_server_exit; ch = igetch_t(MAX_DELAY_TIME)) |
for (ch = 0; !SYS_server_exit; ch = igetch_t(BBS_max_user_idle_time)) |
| 170 |
{ |
{ |
| 171 |
switch (toupper(ch)) |
switch (toupper(ch)) |
| 172 |
{ |
{ |
| 517 |
(reply_note ? "关闭" : "开启")); |
(reply_note ? "关闭" : "开启")); |
| 518 |
iflush(); |
iflush(); |
| 519 |
|
|
| 520 |
ch = igetch_t(MAX_DELAY_TIME); |
ch = igetch_t(BBS_max_user_idle_time); |
| 521 |
switch (toupper(ch)) |
switch (toupper(ch)) |
| 522 |
{ |
{ |
| 523 |
case KEY_NULL: |
case KEY_NULL: |
| 843 |
} |
} |
| 844 |
|
|
| 845 |
// Apply LML render to content body |
// Apply LML render to content body |
| 846 |
len = lml_render(row[1], content_f, ARTICLE_CONTENT_MAX_LEN, 0); |
len = lml_render(row[1], content_f, ARTICLE_CONTENT_MAX_LEN, MAX_EDITOR_DATA_LINE_LENGTH - 3, 1); |
| 847 |
content_f[len] = '\0'; |
content_f[len] = '\0'; |
| 848 |
|
|
| 849 |
// Remove control sequence |
// Remove control sequence |
| 853 |
"\n\n【 在 %s (%s) 的大作中提到: 】\n", |
"\n\n【 在 %s (%s) 的大作中提到: 】\n", |
| 854 |
p_article->username, p_article->nickname); |
p_article->username, p_article->nickname); |
| 855 |
|
|
| 856 |
quote_content_lines = split_data_lines(content_f, ARTICLE_QUOTE_LINE_MAX_LEN, line_offsets, ARTICLE_QUOTE_MAX_LINES + 1, 0, NULL); |
quote_content_lines = split_data_lines(content_f, MAX_EDITOR_DATA_LINE_LENGTH - 2, line_offsets, ARTICLE_QUOTE_MAX_LINES + 1, 0, NULL); |
| 857 |
for (i = 0; i < quote_content_lines; i++) |
for (i = 0; i < quote_content_lines; i++) |
| 858 |
{ |
{ |
| 859 |
memcpy(content + len, ": ", 2); // quote line prefix |
memcpy(content + len, ": ", 2); // quote line prefix |
| 915 |
ch = 0; |
ch = 0; |
| 916 |
} |
} |
| 917 |
|
|
| 918 |
for (; !SYS_server_exit; ch = igetch_t(MAX_DELAY_TIME)) |
for (; !SYS_server_exit; ch = igetch_t(BBS_max_user_idle_time)) |
| 919 |
{ |
{ |
| 920 |
switch (toupper(ch)) |
switch (toupper(ch)) |
| 921 |
{ |
{ |
| 975 |
prints("(S)发送, (C)取消, (T)更改标题 or (E)再编辑? [S]: "); |
prints("(S)发送, (C)取消, (T)更改标题 or (E)再编辑? [S]: "); |
| 976 |
iflush(); |
iflush(); |
| 977 |
|
|
| 978 |
for (ch = 0; !SYS_server_exit; ch = igetch_t(MAX_DELAY_TIME)) |
for (ch = 0; !SYS_server_exit; ch = igetch_t(BBS_max_user_idle_time)) |
| 979 |
{ |
{ |
| 980 |
switch (toupper(ch)) |
switch (toupper(ch)) |
| 981 |
{ |
{ |