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

Contents of /lbbs/src/article_post.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Thu Jun 12 12:53:49 2025 UTC (9 months ago) by sysadm
Branch: MAIN
Changes since 1.1: +43 -0 lines
Content type: text/x-csrc
Update

1 /***************************************************************************
2 article_post.c - description
3 -------------------
4 copyright : (C) 2004-2025 by Leaflet
5 email : leaflet@leafok.com
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 3 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #include "article_post.h"
18 #include "article_cache.h"
19 #include "editor.h"
20 #include "screen.h"
21 #include "log.h"
22
23 int article_post(SECTION_LIST *p_section, ARTICLE *p_article, ARTICLE_POST_TYPE type)
24 {
25 ARTICLE_CACHE cache;
26 EDITOR_DATA *p_editor_data;
27
28 log_common("Debug: sid=%d aid=%d type=%d\n",
29 p_section->sid, (p_article == NULL ? 0 : p_article->aid), type);
30
31 switch (type)
32 {
33 case ARTICLE_POST_NEW:
34 p_editor_data = editor_data_load("");
35 if (p_editor_data == NULL)
36 {
37 log_error("editor_data_load() error\n");
38 return -2;
39 }
40 break;
41 case ARTICLE_POST_EDIT:
42 case ARTICLE_POST_REPLY:
43 if (article_cache_load(&cache, VAR_ARTICLE_CACHE_DIR, p_article) < 0)
44 {
45 log_error("article_cache_load(aid=%d, cid=%d) error\n", p_article->aid, p_article->cid);
46 return -2;
47 }
48 p_editor_data = editor_data_load(cache.p_data);
49 if (p_editor_data == NULL)
50 {
51 log_error("editor_data_load(aid=%d, cid=%d) error\n", p_article->aid, p_article->cid);
52 return -2;
53 }
54 if (article_cache_unload(&cache) < 0)
55 {
56 log_error("article_cache_unload(aid=%d, cid=%d) error\n", p_article->aid, p_article->cid);
57 return -2;
58 }
59 break;
60 default:
61 log_error("Unsupported type=%d\n", type);
62 return -1;
63 }
64
65 editor_display(p_editor_data);
66
67 // editor_data_save(p_editor_data, p_data_new, data_new_len);
68
69 editor_data_cleanup(p_editor_data);
70
71 return 0;
72 }

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