25de886242cb5b256bb4cdeb44f5804cc583347c
[fms.git] / src / optionssetup.cpp
1 #include "../include/optionssetup.h"\r
2 #include "../include/db/sqlite3db.h"\r
3 \r
4 #include <Poco/Message.h>\r
5 \r
6 #include <string>\r
7 #include <sstream>\r
8 \r
9 void SetupDefaultOptions()\r
10 {\r
11         // OptionValue should always be inserted as a string, even if the option really isn't a string - just to keep the field data type consistent\r
12 \r
13         std::ostringstream tempstr;     // must set tempstr to "" between db inserts\r
14         SQLite3DB::DB *db=SQLite3DB::DB::Instance();\r
15         SQLite3DB::Statement st=db->Prepare("INSERT INTO tblOption(Option,OptionValue) VALUES(?,?);");\r
16         SQLite3DB::Statement upd=db->Prepare("UPDATE tblOption SET Section=?, SortOrder=?, ValidValues=?, OptionDescription=? WHERE Option=?;");\r
17         int order=0;\r
18 \r
19         // LogLevel\r
20         tempstr.str("");\r
21         tempstr << Poco::Message::PRIO_DEBUG;\r
22         st.Bind(0,"LogLevel");\r
23         st.Bind(1,tempstr.str());\r
24         st.Step();\r
25         st.Reset();\r
26         upd.Bind(0,"Program");\r
27         upd.Bind(1,order++);\r
28         upd.Bind(2,"1|1 - Fatal Errors|2|2 - Critical Errors|3|3 - Errors|4|4 - Warnings|5|5 - Notices|6|6 - Informational Messages|7|7 - Debug Messages|8|8 - Trace Messages");\r
29         upd.Bind(3,"The maximum logging level that will be written to file.  Higher levels will include all messages from the previous levels.");\r
30         upd.Bind(4,"LogLevel");\r
31         upd.Step();\r
32         upd.Reset();\r
33 \r
34         st.Bind(0,"VacuumOnStartup");\r
35         st.Bind(1,"false");\r
36         st.Step();\r
37         st.Reset();\r
38         upd.Bind(0,"Program");\r
39         upd.Bind(1,order++);\r
40         upd.Bind(2,"true|true|false|false");\r
41         upd.Bind(3,"VACUUM the database every time FMS starts.  This will defragment the free space in the database and create a smaller database file.  Vacuuming the database can be CPU and disk intensive.");\r
42         upd.Bind(4,"VacuumOnStartup");\r
43         upd.Step();\r
44         upd.Reset();\r
45 \r
46         st.Bind(0,"MessageBase");\r
47         st.Bind(1,"fms");\r
48         st.Step();\r
49         st.Reset();\r
50         upd.Bind(0,"Program");\r
51         upd.Bind(1,order++);\r
52         upd.Bind(2);\r
53         upd.Bind(3,"A unique string shared by all clients who want to communicate with each other.  This should not be changed unless you want to create your own separate communications network.");\r
54         upd.Bind(4,"MessageBase");\r
55         upd.Step();\r
56         upd.Reset();\r
57 \r
58         st.Bind(0,"FMSVersionKey");\r
59         st.Bind(1,"USK@0npnMrqZNKRCRoGojZV93UNHCMN-6UU3rRSAmP6jNLE,~BG-edFtdCC1cSH4O3BWdeIYa8Sw5DfyrSV-TKdO5ec,AQACAAE/fmsversion/");\r
60         st.Step();\r
61         st.Reset();\r
62         upd.Bind(0,"Program");\r
63         upd.Bind(1,order++);\r
64         upd.Bind(2);\r
65         upd.Bind(3,"The USK key which contains information about the latest version of FMS.");\r
66         upd.Bind(4,"FMSVersionKey");\r
67         upd.Step();\r
68         upd.Reset();\r
69 \r
70         st.Bind(0,"FMSVersionEdition");\r
71         st.Bind(1,"3");\r
72         st.Step();\r
73         st.Reset();\r
74         upd.Bind(0,"Program");\r
75         upd.Bind(1,order++);\r
76         upd.Bind(2);\r
77         upd.Bind(3,"The latest found edition of the FMS version USK.");\r
78         upd.Bind(4,"FMSVersionEdition");\r
79         upd.Step();\r
80         upd.Reset();\r
81 \r
82         // StartNNTP\r
83         st.Bind(0,"StartNNTP");\r
84         st.Bind(1,"true");\r
85         st.Step();\r
86         st.Reset();\r
87         upd.Bind(0,"NNTP Server");\r
88         upd.Bind(1,order++);\r
89         upd.Bind(2,"true|true|false|false");\r
90         upd.Bind(3,"Start NNTP server.");\r
91         upd.Bind(4,"StartNNTP");\r
92         upd.Step();\r
93         upd.Reset();\r
94 \r
95         // NNTPListenPort\r
96         st.Bind(0,"NNTPListenPort");\r
97         st.Bind(1,"1119");\r
98         st.Step();\r
99         st.Reset();\r
100         upd.Bind(0,"NNTP Server");\r
101         upd.Bind(1,order++);\r
102         upd.Bind(2);\r
103         upd.Bind(3,"The port that the NNTP service will listen for incoming connections.");\r
104         upd.Bind(4,"NNTPListenPort");\r
105         upd.Step();\r
106         upd.Reset();\r
107 \r
108         // NNTPBindAddresses\r
109         st.Bind(0,"NNTPBindAddresses");\r
110         st.Bind(1,"localhost");\r
111         st.Step();\r
112         st.Reset();\r
113         upd.Bind(0,"NNTP Server");\r
114         upd.Bind(1,order++);\r
115         upd.Bind(2);\r
116         upd.Bind(3,"A comma separated list of valid IPv4 or IPv6 addresses/hostnames that the NNTP service will try to bind to.");\r
117         upd.Bind(4,"NNTPBindAddresses");\r
118         upd.Step();\r
119         upd.Reset();\r
120 \r
121         st.Bind(0,"NNTPAllowPost");\r
122         st.Bind(1,"true");\r
123         st.Step();\r
124         st.Reset();\r
125         upd.Bind(0,"NNTP Server");\r
126         upd.Bind(1,order++);\r
127         upd.Bind(2,"true|true|false|false");\r
128         upd.Bind(3,"Allow posting messages from NNTP.  Setting to false will make the newsgroups read only.");\r
129         upd.Bind(4,"NNTPAllowPost");\r
130         upd.Step();\r
131         upd.Reset();\r
132 \r
133         st.Bind(0,"StartHTTP");\r
134         st.Bind(1,"true");\r
135         st.Step();\r
136         st.Reset();\r
137         upd.Bind(0,"HTTP Server");\r
138         upd.Bind(1,order++);\r
139         upd.Bind(2,"true|true|false|false");\r
140         upd.Bind(3,"Start HTTP server.  WARNING: If you turn this off, you won't be able to access the administration pages.");\r
141         upd.Bind(4,"StartHTTP");\r
142         upd.Step();\r
143         upd.Reset();\r
144 \r
145         st.Bind(0,"HTTPListenPort");\r
146         st.Bind(1,"8080");\r
147         st.Step();\r
148         st.Reset();\r
149         upd.Bind(0,"HTTP Server");\r
150         upd.Bind(1,order++);\r
151         upd.Bind(2);\r
152         upd.Bind(3,"Port HTTP server will listen on.");\r
153         upd.Bind(4,"HTTPListenPort");\r
154         upd.Step();\r
155         upd.Reset();\r
156 \r
157         st.Bind(0,"HTTPAccessControl");\r
158         st.Bind(1,"-0.0.0.0/0,+127.0.0.1");\r
159         st.Step();\r
160         st.Reset();\r
161         upd.Bind(0,"HTTP Server");\r
162         upd.Bind(1,order++);\r
163         upd.Bind(2);\r
164         upd.Bind(3,"Comma separated list of addresses and/or subnet masks that are allowed access to the administration pages.  Default is localhost only. + allows a host, - denies a host.");\r
165         upd.Bind(4,"HTTPAccessControl");\r
166         upd.Step();\r
167         upd.Reset();\r
168 \r
169         // StartFreenetUpdater\r
170         st.Bind(0,"StartFreenetUpdater");\r
171         st.Bind(1,"true");\r
172         st.Step();\r
173         st.Reset();\r
174         upd.Bind(0,"Freenet Connection");\r
175         upd.Bind(1,order++);\r
176         upd.Bind(2,"true|true|false|false");\r
177         upd.Bind(3,"Set to true to start the Freenet Updater thread and connect to Freenet.  Set to false to prevent communication with Freenet.");\r
178         upd.Bind(4,"StartFreenetUpdater");\r
179         upd.Step();\r
180         upd.Reset();\r
181 \r
182         // FCPHost\r
183         st.Bind(0,"FCPHost");\r
184         st.Bind(1,"127.0.0.1");\r
185         st.Step();\r
186         st.Reset();\r
187         upd.Bind(0,"Freenet Connection");\r
188         upd.Bind(1,order++);\r
189         upd.Bind(2);\r
190         upd.Bind(3,"Host name or address of Freenet node.");\r
191         upd.Bind(4,"FCPHost");\r
192         upd.Step();\r
193         upd.Reset();\r
194 \r
195         // FCPPort\r
196         st.Bind(0,"FCPPort");\r
197         st.Bind(1,"9481");\r
198         st.Step();\r
199         st.Reset();\r
200         upd.Bind(0,"Freenet Connection");\r
201         upd.Bind(1,order++);\r
202         upd.Bind(2);\r
203         upd.Bind(3,"The port that Freenet is listening for FCP connections on.");\r
204         upd.Bind(4,"FCPPort");\r
205         upd.Step();\r
206         upd.Reset();\r
207 \r
208         st.Bind(0,"FProxyPort");\r
209         st.Bind(1,"8888");\r
210         st.Step();\r
211         st.Reset();\r
212         upd.Bind(0,"Freenet Connection");\r
213         upd.Bind(1,order++);\r
214         upd.Bind(2);\r
215         upd.Bind(3,"The port that Freenet is listening for http connections on.");\r
216         upd.Bind(4,"FProxyPort");\r
217         upd.Step();\r
218         upd.Reset();\r
219 \r
220         st.Bind(0,"MaxIdentityRequests");\r
221         st.Bind(1,"5");\r
222         st.Step();\r
223         st.Reset();\r
224         upd.Bind(0,"Requests");\r
225         upd.Bind(1,order++);\r
226         upd.Bind(2);\r
227         upd.Bind(3,"Maximum number of concurrent requests for new Identity xml files");\r
228         upd.Bind(4,"MaxIdentityRequests");\r
229         upd.Step();\r
230         upd.Reset();\r
231 \r
232         st.Bind(0,"MaxIdentityIntroductionRequests");\r
233         st.Bind(1,"5");\r
234         st.Step();\r
235         st.Reset();\r
236         upd.Bind(0,"Requests");\r
237         upd.Bind(1,order++);\r
238         upd.Bind(2);\r
239         upd.Bind(3,"Maximum number of concurrent identities requesting IdentityIntroduction xml files.  Each identity may have multiple requests pending.");\r
240         upd.Bind(4,"MaxIdentityIntroductionRequests");\r
241         upd.Step();\r
242         upd.Reset();\r
243 \r
244         st.Bind(0,"MaxIntroductionPuzzleRequests");\r
245         st.Bind(1,"5");\r
246         st.Step();\r
247         st.Reset();\r
248         upd.Bind(0,"Requests");\r
249         upd.Bind(1,order++);\r
250         upd.Bind(2);\r
251         upd.Bind(3,"Maximum number of concurrent requests for new IntroductionPuzzle xml files");\r
252         upd.Bind(4,"MaxIntroductionPuzzleRequests");\r
253         upd.Step();\r
254         upd.Reset();\r
255 \r
256         st.Bind(0,"MaxTrustListRequests");\r
257         st.Bind(1,"5");\r
258         st.Step();\r
259         st.Reset();\r
260         upd.Bind(0,"Requests");\r
261         upd.Bind(1,order++);\r
262         upd.Bind(2);\r
263         upd.Bind(3,"Maximum number of concurrent requests for new Trust Lists");\r
264         upd.Bind(4,"MaxTrustListRequests");\r
265         upd.Step();\r
266         upd.Reset();\r
267 \r
268         st.Bind(0,"MaxMessageListRequests");\r
269         st.Bind(1,"5");\r
270         st.Step();\r
271         st.Reset();\r
272         upd.Bind(0,"Requests");\r
273         upd.Bind(1,order++);\r
274         upd.Bind(2);\r
275         upd.Bind(3,"Maximum number of concurrent requests for new Message Lists");\r
276         upd.Bind(4,"MaxMessageListRequests");\r
277         upd.Step();\r
278         upd.Reset();\r
279 \r
280         st.Bind(0,"MaxMessageRequests");\r
281         st.Bind(1,"20");\r
282         st.Step();\r
283         st.Reset();\r
284         upd.Bind(0,"Requests");\r
285         upd.Bind(1,order++);\r
286         upd.Bind(2);\r
287         upd.Bind(3,"Maximum number of concurrent requests for new Messages");\r
288         upd.Bind(4,"MaxMessageRequests");\r
289         upd.Step();\r
290         upd.Reset();\r
291 \r
292         st.Bind(0,"MaxBoardListRequests");\r
293         st.Bind(1,"5");\r
294         st.Step();\r
295         st.Reset();\r
296         upd.Bind(0,"Requests");\r
297         upd.Bind(1,order++);\r
298         upd.Bind(2);\r
299         upd.Bind(3,"The maximum number of concurrent requests for new Board Lists.  Set to 0 to disable.");\r
300         upd.Bind(4,"MaxBoardListRequests");\r
301         upd.Step();\r
302         upd.Reset();\r
303 \r
304         st.Bind(0,"MinLocalMessageTrust");\r
305         st.Bind(1,"50");\r
306         st.Step();\r
307         st.Reset();\r
308         upd.Bind(0,"Trust");\r
309         upd.Bind(1,order++);\r
310         upd.Bind(2);\r
311         upd.Bind(3,"Specifies a local message trust level that a peer must have before its messages will be downloaded.");\r
312         upd.Bind(4,"MinLocalMessageTrust");\r
313         upd.Step();\r
314         upd.Reset();\r
315 \r
316         st.Bind(0,"MinPeerMessageTrust");\r
317         st.Bind(1,"30");\r
318         st.Step();\r
319         st.Reset();\r
320         upd.Bind(0,"Trust");\r
321         upd.Bind(1,order++);\r
322         upd.Bind(2);\r
323         upd.Bind(3,"Specifies a peer message trust level that a peer must have before its messages will be downloaded.");\r
324         upd.Bind(4,"MinPeerMessageTrust");\r
325         upd.Step();\r
326         upd.Reset();\r
327 \r
328         st.Bind(0,"MinLocalTrustListTrust");\r
329         st.Bind(1,"50");\r
330         st.Step();\r
331         st.Reset();\r
332         upd.Bind(0,"Trust");\r
333         upd.Bind(1,order++);\r
334         upd.Bind(2);\r
335         upd.Bind(3,"Specifies a local trust list trust level that a peer must have before its trust list will be included in the weighted average.  Any peers below this number will be excluded from the results.");\r
336         upd.Bind(4,"MinLocalTrustListTrust");\r
337         upd.Step();\r
338         upd.Reset();\r
339 \r
340         st.Bind(0,"MinPeerTrustListTrust");\r
341         st.Bind(1,"30");\r
342         st.Step();\r
343         st.Reset();\r
344         upd.Bind(0,"Trust");\r
345         upd.Bind(1,order++);\r
346         upd.Bind(2);\r
347         upd.Bind(3,"Specifies a peer trust list trust level that a peer must have before its trust list will be included in the weighted average.  Any peers below this number will be excluded from the results.");\r
348         upd.Bind(4,"MinPeerTrustListTrust");\r
349         upd.Step();\r
350         upd.Reset();\r
351 \r
352         st.Bind(0,"LocalTrustOverridesPeerTrust");\r
353         st.Bind(1,"false");\r
354         st.Step();\r
355         st.Reset();\r
356         upd.Bind(0,"Trust");\r
357         upd.Bind(1,order++);\r
358         upd.Bind(2,"true|true|false|false");\r
359         upd.Bind(3,"Set to true if you want your local trust levels to override the peer levels when determining which identities you will poll.");\r
360         upd.Bind(4,"LocalTrustOverridesPeerTrust");\r
361         upd.Step();\r
362         upd.Reset();\r
363 \r
364         st.Bind(0,"MessageDownloadMaxDaysBackward");\r
365         st.Bind(1,"5");\r
366         st.Step();\r
367         st.Reset();\r
368         upd.Bind(0,"Messages");\r
369         upd.Bind(1,order++);\r
370         upd.Bind(2);\r
371         upd.Bind(3,"The maximum number of days backward that messages will be downloaded from each identity");\r
372         upd.Bind(4,"MessageDownloadMaxDaysBackward");\r
373         upd.Step();\r
374         upd.Reset();\r
375 \r
376         st.Bind(0,"MessageListDaysBackward");\r
377         st.Bind(1,"5");\r
378         st.Step();\r
379         st.Reset();\r
380         upd.Bind(0,"Messages");\r
381         upd.Bind(1,order++);\r
382         upd.Bind(2);\r
383         upd.Bind(3,"The number of days backward that messages you have inserted will appear in your MessageLists");\r
384         upd.Bind(4,"MessageListDaysBackward");\r
385         upd.Step();\r
386         upd.Reset();\r
387 \r
388         st.Bind(0,"MaxPeerMessagesPerDay");\r
389         st.Bind(1,"200");\r
390         st.Step();\r
391         st.Reset();\r
392         upd.Bind(0,"Messages");\r
393         upd.Bind(1,order++);\r
394         upd.Bind(2);\r
395         upd.Bind(3,"The maximum number of messages you will download from each peer on a given day.");\r
396         upd.Bind(4,"MaxPeerMessagesPerDay");\r
397         upd.Step();\r
398         upd.Reset();\r
399 \r
400         st.Bind(0,"MaxBoardsPerMessage");\r
401         st.Bind(1,"8");\r
402         st.Step();\r
403         st.Reset();\r
404         upd.Bind(0,"Messages");\r
405         upd.Bind(1,order++);\r
406         upd.Bind(2);\r
407         upd.Bind(3,"The maximum number of boards a received message may be sent to.  Boards over this limit will be ignored.");\r
408         upd.Bind(4,"MaxBoardsPerMessage");\r
409         upd.Step();\r
410         upd.Reset();\r
411 \r
412         st.Bind(0,"SaveMessagesFromNewBoards");\r
413         st.Bind(1,"true");\r
414         st.Step();\r
415         st.Reset();\r
416         upd.Bind(0,"Messages");\r
417         upd.Bind(1,order++);\r
418         upd.Bind(2,"true|true|false|false");\r
419         upd.Bind(3,"Set to true to automatically save messages posted to new boards.  Set to false to ignore messages to new boards.");\r
420         upd.Bind(4,"SaveMessagesFromNewBoards");\r
421         upd.Step();\r
422         upd.Reset();\r
423 \r
424         st.Bind(0,"ChangeMessageTrustOnReply");\r
425         st.Bind(1,"0");\r
426         st.Step();\r
427         st.Reset();\r
428         upd.Bind(0,"Messages");\r
429         upd.Bind(1,order++);\r
430         upd.Bind(2);\r
431         upd.Bind(3,"How much the local message trust level of an identity should change when you reply to one of their messages.");\r
432         upd.Bind(4,"ChangeMessageTrustOnReply");\r
433         upd.Step();\r
434         upd.Reset();\r
435 \r
436         st.Bind(0,"AddNewPostFromIdentities");\r
437         st.Bind(1,"false");\r
438         st.Step();\r
439         st.Reset();\r
440         upd.Bind(0,"Messages");\r
441         upd.Bind(1,order++);\r
442         upd.Bind(2,"true|true|false|false");\r
443         upd.Bind(3,"Set to true to automatically create new identities when you send a message using a new name.  If you set this to false, posting messages will fail until you manually create the identity.");\r
444         upd.Bind(4,"AddNewPostFromIdentities");\r
445         upd.Step();\r
446         upd.Reset();\r
447 \r
448         st.Bind(0,"DeleteMessagesOlderThan");\r
449         st.Bind(1,"180");\r
450         st.Step();\r
451         st.Reset();\r
452         upd.Bind(0,"Messages");\r
453         upd.Bind(1,order++);\r
454         upd.Bind(2);\r
455         upd.Bind(3,"Automatically delete messages older than this many days.");\r
456         upd.Bind(4,"DeleteMessagesOlderThan");\r
457         upd.Step();\r
458         upd.Reset();\r
459 \r
460 }\r