/[LeafOK_CVS]/lbbs/src/article_post.c
ViewVC logotype

Diff of /lbbs/src/article_post.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.16 by sysadm, Sun Jun 15 03:16:44 2025 UTC Revision 1.20 by sysadm, Mon Jun 16 01:36:56 2025 UTC
# Line 110  int article_post(const SECTION_LIST *p_s Line 110  int article_post(const SECTION_LIST *p_s
110                  {                  {
111                          switch (toupper(ch))                          switch (toupper(ch))
112                          {                          {
113                            case KEY_NULL:
114                            case KEY_TIMEOUT:
115                                    goto cleanup;
116                          case CR:                          case CR:
117                                  igetch_reset();                                  igetch_reset();
118                                  break;                                  break;
# Line 173  int article_post(const SECTION_LIST *p_s Line 176  int article_post(const SECTION_LIST *p_s
176                          {                          {
177                                  switch (toupper(ch))                                  switch (toupper(ch))
178                                  {                                  {
179                                    case KEY_NULL:
180                                    case KEY_TIMEOUT:
181                                            goto cleanup;
182                                  case CR:                                  case CR:
183                                          igetch_reset();                                          igetch_reset();
184                                  case 'S':                                  case 'S':
# Line 201  int article_post(const SECTION_LIST *p_s Line 207  int article_post(const SECTION_LIST *p_s
207                  }                  }
208          }          }
209    
210            if (SYS_server_exit) // Do not save data on shutdown
211            {
212                    goto cleanup;
213            }
214    
215          content = malloc(ARTICLE_CONTENT_MAX_LEN);          content = malloc(ARTICLE_CONTENT_MAX_LEN);
216          if (content == NULL)          if (content == NULL)
217          {          {
# Line 378  int article_post(const SECTION_LIST *p_s Line 389  int article_post(const SECTION_LIST *p_s
389                  goto cleanup;                  goto cleanup;
390          }          }
391    
392            mysql_close(db);
393            db = NULL;
394    
395          clearscr();          clearscr();
396          moveto(1, 1);          moveto(1, 1);
397          prints("发送完成,新文章通常会在%d秒后可见", BBS_section_list_load_interval);          prints("发送完成,新文章通常会在%d秒后可见", BBS_section_list_load_interval);
# Line 471  int article_modify(const SECTION_LIST *p Line 485  int article_modify(const SECTION_LIST *p
485                  content[ARTICLE_CONTENT_MAX_LEN - 1] = '\0';                  content[ARTICLE_CONTENT_MAX_LEN - 1] = '\0';
486    
487                  // Remove control sequence                  // Remove control sequence
488                  len_content = ctrl_seq_filter(content);                  len_content = str_filter(content, 0);
489    
490                  p_editor_data = editor_data_load(content);                  p_editor_data = editor_data_load(content);
491                  if (p_editor_data == NULL)                  if (p_editor_data == NULL)
# Line 503  int article_modify(const SECTION_LIST *p Line 517  int article_modify(const SECTION_LIST *p
517                  {                  {
518                          switch (toupper(ch))                          switch (toupper(ch))
519                          {                          {
520                            case KEY_NULL:
521                            case KEY_TIMEOUT:
522                                    goto cleanup;
523                          case CR:                          case CR:
524                                  igetch_reset();                                  igetch_reset();
525                          case 'S':                          case 'S':
# Line 523  int article_modify(const SECTION_LIST *p Line 540  int article_modify(const SECTION_LIST *p
540                  }                  }
541          }          }
542    
543            if (SYS_server_exit) // Do not save data on shutdown
544            {
545                    goto cleanup;
546            }
547    
548          // Allocate buffers in big size          // Allocate buffers in big size
549          content = malloc(ARTICLE_CONTENT_MAX_LEN);          content = malloc(ARTICLE_CONTENT_MAX_LEN);
550          if (content == NULL)          if (content == NULL)
# Line 653  int article_modify(const SECTION_LIST *p Line 675  int article_modify(const SECTION_LIST *p
675                  goto cleanup;                  goto cleanup;
676          }          }
677    
678            mysql_close(db);
679            db = NULL;
680    
681          clearscr();          clearscr();
682          moveto(1, 1);          moveto(1, 1);
683          prints("修改完成,新内容通常会在%d秒后可见", BBS_section_list_load_interval);          prints("修改完成,新内容通常会在%d秒后可见", BBS_section_list_load_interval);
# Line 716  int article_reply(const SECTION_LIST *p_ Line 741  int article_reply(const SECTION_LIST *p_
741    
742          p_article_new->title[0] = '\0';          p_article_new->title[0] = '\0';
743          snprintf(title_input, sizeof(title_input), "Re: %s", p_article->title);          snprintf(title_input, sizeof(title_input), "Re: %s", p_article->title);
744          len = split_line(title_input, TITLE_INPUT_MAX_LEN, &eol, &display_len);          len = split_line(title_input, TITLE_INPUT_MAX_LEN, &eol, &display_len, 0);
745          title_input[len] = '\0';          title_input[len] = '\0';
746    
747          db = db_open();          db = db_open();
# Line 756  int article_reply(const SECTION_LIST *p_ Line 781  int article_reply(const SECTION_LIST *p_
781    
782          if (topic_locked) // Reply is not allowed          if (topic_locked) // Reply is not allowed
783          {          {
784                    mysql_close(db);
785                    db = NULL;
786    
787                  clearscr();                  clearscr();
788                  moveto(1, 1);                  moveto(1, 1);
789                  prints("该主题谢绝回复");                  prints("该主题谢绝回复");
# Line 806  int article_reply(const SECTION_LIST *p_ Line 834  int article_reply(const SECTION_LIST *p_
834                  content_f[len] = '\0';                  content_f[len] = '\0';
835    
836                  // Remove control sequence                  // Remove control sequence
837                  len = ctrl_seq_filter(content_f);                  len = str_filter(content_f, 0);
838    
839                  len = snprintf(content, ARTICLE_CONTENT_MAX_LEN,                  len = snprintf(content, ARTICLE_CONTENT_MAX_LEN,
840                                             "\n\n【 在 %s (%s) 的大作中提到: 】\n",                                             "\n\n【 在 %s (%s) 的大作中提到: 】\n",
841                                             p_article->username, p_article->nickname);                                             p_article->username, p_article->nickname);
842    
843                  quote_content_lines = split_data_lines(content_f, ARTICLE_QUOTE_LINE_MAX_LEN, line_offsets, ARTICLE_QUOTE_MAX_LINES + 1);                  quote_content_lines = split_data_lines(content_f, ARTICLE_QUOTE_LINE_MAX_LEN, line_offsets, ARTICLE_QUOTE_MAX_LINES + 1, 0);
844                  for (i = 0; i < quote_content_lines; i++)                  for (i = 0; i < quote_content_lines; i++)
845                  {                  {
846                          memcpy(content + len, ": ", 2); // quote line prefix                          memcpy(content + len, ": ", 2); // quote line prefix
847                          len += 2;                          len += 2;
848                          memcpy(content + len, content_f + line_offsets[i], (size_t)(line_offsets[i + 1] - line_offsets[i]));                          memcpy(content + len, content_f + line_offsets[i], (size_t)(line_offsets[i + 1] - line_offsets[i]));
849                          len += (line_offsets[i + 1] - line_offsets[i]);                          len += (line_offsets[i + 1] - line_offsets[i]);
850                            if (content[len - 1] != '\n') // Appennd \n if not exist
851                            {
852                                    content[len] = '\n';
853                                    len++;
854                            }
855                  }                  }
856                  if (content[len - 1] != '\n') // Appennd \n if not exist                  if (content[len - 1] != '\n') // Appennd \n if not exist
857                  {                  {
# Line 872  int article_reply(const SECTION_LIST *p_ Line 905  int article_reply(const SECTION_LIST *p_
905                  {                  {
906                          switch (toupper(ch))                          switch (toupper(ch))
907                          {                          {
908                            case KEY_NULL:
909                            case KEY_TIMEOUT:
910                                    goto cleanup;
911                          case CR:                          case CR:
912                                  igetch_reset();                                  igetch_reset();
913                                  break;                                  break;
# Line 929  int article_reply(const SECTION_LIST *p_ Line 965  int article_reply(const SECTION_LIST *p_
965                          {                          {
966                                  switch (toupper(ch))                                  switch (toupper(ch))
967                                  {                                  {
968                                    case KEY_NULL:
969                                    case KEY_TIMEOUT:
970                                            goto cleanup;
971                                  case CR:                                  case CR:
972                                          igetch_reset();                                          igetch_reset();
973                                  case 'S':                                  case 'S':
# Line 957  int article_reply(const SECTION_LIST *p_ Line 996  int article_reply(const SECTION_LIST *p_
996                  }                  }
997          }          }
998    
999            if (SYS_server_exit) // Do not save data on shutdown
1000            {
1001                    goto cleanup;
1002            }
1003    
1004          content = malloc(ARTICLE_CONTENT_MAX_LEN);          content = malloc(ARTICLE_CONTENT_MAX_LEN);
1005          if (content == NULL)          if (content == NULL)
1006          {          {
# Line 1150  int article_reply(const SECTION_LIST *p_ Line 1194  int article_reply(const SECTION_LIST *p_
1194                  goto cleanup;                  goto cleanup;
1195          }          }
1196    
1197            mysql_close(db);
1198            db = NULL;
1199    
1200          clearscr();          clearscr();
1201          moveto(1, 1);          moveto(1, 1);
1202          prints("发送完成,新文章通常会在%d秒后可见", BBS_section_list_load_interval);          prints("发送完成,新文章通常会在%d秒后可见", BBS_section_list_load_interval);


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1