OSDN Git Service

Add thread search from all boards.
[ntch/develop.git] / src / inc / _2ch / model_2ch.h
1 /* Copyright 2013 Akira Ohta (akohta001@gmail.com)
2     This file is part of ntch.
3
4     The ntch is free software: you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation, either version 3 of the License, or
7     (at your option) any later version.
8
9     The ntch is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with ntch.  If not, see <http://www.gnu.org/licenses/>.
16     
17 */
18 #ifndef _MODEL_2CH_H_
19 #define _MODEL_2CH_H_
20
21 #include "utils/nt_std_t.h"
22
23 typedef struct tag_nt_category_t *nt_category_tp;
24 typedef struct tag_nt_category_t{
25         wchar_t *name;
26         nt_link_tp boardlistp;
27 } nt_category_t;
28
29
30 typedef struct tag_nt_board_t *nt_board_tp;
31 typedef struct tag_nt_board_t{
32         wchar_t *name;
33         wchar_t *address;
34         nt_link_tp threadlistp;
35 } nt_board_t;
36
37 typedef struct tag_nt_thread_t *nt_thread_tp;
38 typedef struct tag_nt_thread_t{
39         wchar_t *name;
40         wchar_t *file_name;
41         int seq_no;
42         int num_res;
43         nt_link_tp reslistp;
44 } nt_thread_t;
45
46 typedef struct tag_nt_res_t *nt_res_tp;
47 typedef struct tag_nt_res_t{
48         int seq_no;
49         wchar_t *name;
50         wchar_t *mail;
51         wchar_t *misc;
52         wchar_t *msg;
53 } nt_res_t;
54
55 typedef struct tag_nt_2ch_model_t *nt_2ch_model_tp;
56 typedef struct tag_nt_2ch_model_t{
57         
58         nt_link_tp categorylistp;
59         
60 } nt_2ch_model_t;
61
62 typedef struct tag_nt_write_data_t *nt_write_data_tp;
63 typedef struct tag_nt_write_data_t
64 {
65         char *name;
66         char *mail;
67         char *msg;
68         wchar_t *status_msg;
69         wchar_t *result_html;
70         nt_link_tp cookies;
71 } nt_write_data_t;
72
73
74 typedef struct tag_nt_2ch_selected_item_t *nt_2ch_selected_item_tp;
75 typedef struct tag_nt_2ch_selected_item_t{
76         nt_category_tp selected_categoryp;
77         nt_board_tp selected_boardp;
78         nt_thread_tp selected_threadp;
79 }nt_2ch_selected_item_t;
80
81
82 extern nt_write_data_tp nt_write_data_alloc();
83 extern void nt_write_data_free(nt_write_data_tp ptr);
84
85 extern nt_2ch_model_tp nt_2ch_model_alloc();
86 extern nt_category_tp nt_category_alloc(
87                 nt_2ch_model_tp modelp, const wchar_t *name);
88 extern nt_board_tp nt_board_alloc( nt_category_tp categoryp, 
89                 const wchar_t *name, const wchar_t *addressp);
90 extern nt_thread_tp nt_thread_alloc(
91                 nt_link_tp *threadlistpp, const wchar_t *name,
92                 const wchar_t *file_name, int num_res);
93 extern nt_res_tp nt_res_alloc(nt_thread_tp      threadp, 
94                 const wchar_t *name, const wchar_t *mail, 
95                 const wchar_t *misc, const wchar_t *msg);
96 extern nt_board_tp nt_get_board_by_name(
97                 nt_2ch_model_tp modelp, const wchar_t *board_name, nt_category_tp *categorypp);
98 extern nt_board_tp nt_get_board_by_address_match(
99                 nt_2ch_model_tp modelp, const wchar_t *param);
100 extern void nt_2ch_model_free(nt_2ch_model_tp ptr);
101 extern void nt_category_free(nt_category_tp ptr);
102 extern void nt_board_free(nt_board_tp ptr);
103 extern void nt_board_children_free(nt_board_tp ptr);
104 extern void nt_thread_free(nt_thread_tp ptr);
105 extern void nt_thread_children_free(nt_thread_tp ptr);
106 extern void nt_res_free(nt_res_tp ptr);
107
108 extern BOOL parse_board_menu(nt_2ch_model_tp modelp,
109                 const wchar_t *linep);
110 extern BOOL parse_board(nt_board_tp boardp, const wchar_t *linep);
111 extern BOOL parse_thread(nt_thread_tp boardp, const wchar_t *linep);
112
113 extern void nt_set_selected_board(nt_2ch_selected_item_tp selectp,
114                 nt_category_tp categoryp, nt_board_tp boardp);
115 extern void nt_set_selected_thread(
116                 nt_2ch_selected_item_tp selectp, nt_thread_tp threadp);
117
118 extern nt_thread_tp nt_get_thread_by_seq_no(
119                 nt_link_tp thread_list, int seq_no);
120 extern nt_thread_tp nt_get_thread_by_dat_name(
121                 nt_link_tp thread_list, const wchar_t *dat_name);
122 extern wchar_t* nt_read_thread_title(nt_board_tp boardp,
123                 const wchar_t *dat_name);
124 extern wchar_t* parse_thread_title(const wchar_t *linep);
125
126 #endif /* _MODEL_2CH_H_ */