Mercurial > noffle
annotate src/configfile.c @ 269:b3a2f710fe2c noffle
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
server yielded the lock to another server.
author | bears |
---|---|
date | Fri, 25 Oct 2002 12:04:57 +0100 |
parents | 0340b9c17edc |
children | 18d6c61ed4e7 |
rev | line source |
---|---|
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1 /* |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
2 configfile.c |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
3 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
4 The following macros must be set, when compiling this file: |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
5 CONFIGFILE |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
6 SPOOLDIR |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
7 VERSION |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
8 |
249 | 9 $Id: configfile.c 381 2002-05-14 14:25:45Z mirkol $ |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
10 */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
11 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
12 #if HAVE_CONFIG_H |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
13 #include <config.h> |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
14 #endif |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
15 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
16 #include <ctype.h> |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
17 #include <limits.h> |
128 | 18 #include <regex.h> |
197
24d4cd032da5
[svn] * AUTHORS,INSTALL,NEWS,README,TODO,docs/NOTES,src/client.c,src/protocol.c,
bears
parents:
195
diff
changeset
|
19 #include "configfile.h" |
128 | 20 #include "filter.h" |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
21 #include "itemlist.h" |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
22 #include "log.h" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
23 #include "util.h" |
54
125d79c9e586
[svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents:
43
diff
changeset
|
24 #include "portable.h" |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
25 #include "wildmat.h" |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
26 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
27 typedef struct |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
28 { |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
29 int numGroup; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
30 int maxGroup; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
31 char **groups; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
32 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
33 GroupEntry; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
34 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
35 struct GroupEnum |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
36 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
37 GroupEntry *groupEntry; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
38 int groupIdx; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
39 }; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
40 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
41 typedef struct |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
42 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
43 char *name; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
44 char *user; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
45 char *pass; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
46 GroupEntry getgroups; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
47 GroupEntry omitgroups; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
48 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
49 ServEntry; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
50 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
51 typedef struct |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
52 { |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
53 char *pattern; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
54 int days; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
55 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
56 ExpireEntry; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
57 |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
58 typedef struct |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
59 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
60 char *pattern; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
61 char *mode; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
62 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
63 AutoSubscribeModeEntry; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
64 |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
65 struct |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
66 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
67 /* Compile time options */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
68 const char *spoolDir; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
69 const char *version; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
70 /* Options from the config file */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
71 int maxFetch; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
72 int autoUnsubscribeDays; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
73 int threadFollowTime; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
74 int connectTimeout; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
75 Bool autoSubscribe; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
76 Bool autoUnsubscribe; |
82 | 77 Bool infoAlways; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
78 Bool replaceMsgId; |
195
76460d98b2fb
[svn] * noffle.conf.example,docs/noffle.conf.5,src/configfile.h,src/configfile.c,
bears
parents:
194
diff
changeset
|
79 Str hostnameMsgId; |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
80 Bool postLocal; |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
81 Str defaultAutoSubscribeMode; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
82 Str mailTo; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
83 int defaultExpire; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
84 int numServ; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
85 int maxServ; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
86 ServEntry *serv; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
87 int servIdx; /* for server enumeration */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
88 int numExpire; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
89 int maxExpire; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
90 ExpireEntry *expire; |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
91 int numAutoSubscribeMode; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
92 int maxAutoSubscribeMode; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
93 AutoSubscribeModeEntry *autoSubscribeMode; |
111 | 94 Str pathHeader; |
150
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
95 Str fromDomain; |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
96 Str organization; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
97 } config = |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
98 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
99 SPOOLDIR, /* spoolDir */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
100 VERSION, /* version */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
101 300, /* maxFetch */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
102 30, /* autoUnsubscribeDays */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
103 7, /* threadFollowTime */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
104 30, /* connectTimeout */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
105 FALSE, /* autoSubscribe */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
106 FALSE, /* autoUnsubscribe */ |
82 | 107 TRUE, /* infoAlways */ |
222
bf290632d29e
[svn] * src/post.c: Always replace message ID in posted message if existing
bears
parents:
212
diff
changeset
|
108 FALSE, /* replaceMsgId */ |
195
76460d98b2fb
[svn] * noffle.conf.example,docs/noffle.conf.5,src/configfile.h,src/configfile.c,
bears
parents:
194
diff
changeset
|
109 "", /* hostnameMsgId */ |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
110 FALSE, /* postLocal */ |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
111 "over", /* defaultAutoSubscribeMode */ |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
112 "", /* mailTo */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
113 14, /* defaultExpire */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
114 0, /* numServ */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
115 0, /* maxServ */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
116 NULL, /* serv */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
117 0, /* servIdx */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
118 0, /* numExpire */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
119 0, /* maxExpire */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
120 NULL, /* expire */ |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
121 0, /* numAutoSubscribeMode */ |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
122 0, /* maxAutoSubscribeMode */ |
111 | 123 NULL, /* autoSubscribeMode */ |
150
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
124 "", /* pathHeader */ |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
125 "", /* fromDomain */ |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
126 "" /* organization */ |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
127 }; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
128 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
129 const char * Cfg_spoolDir( void ) { return config.spoolDir; } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
130 const char * Cfg_version( void ) { return config.version; } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
131 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
132 int Cfg_maxFetch( void ) { return config.maxFetch; } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
133 int Cfg_autoUnsubscribeDays( void ) { return config.autoUnsubscribeDays; } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
134 int Cfg_threadFollowTime( void ) { return config.threadFollowTime; } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
135 int Cfg_connectTimeout( void ) { return config.connectTimeout; } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
136 Bool Cfg_autoUnsubscribe( void ) { return config.autoUnsubscribe; } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
137 Bool Cfg_autoSubscribe( void ) { return config.autoSubscribe; } |
82 | 138 Bool Cfg_infoAlways( void ) { return config.infoAlways; } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
139 Bool Cfg_replaceMsgId( void ) { return config.replaceMsgId; } |
195
76460d98b2fb
[svn] * noffle.conf.example,docs/noffle.conf.5,src/configfile.h,src/configfile.c,
bears
parents:
194
diff
changeset
|
140 const char * Cfg_hostnameMsgId( void ) { return config.hostnameMsgId; } |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
141 Bool Cfg_postLocal( void ) { return config.postLocal; } |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
142 const char * Cfg_defaultAutoSubscribeMode( void ) { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
143 return config.defaultAutoSubscribeMode; } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
144 const char * Cfg_mailTo( void ) { return config.mailTo; } |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
145 int Cfg_defaultExpire( void ) { return config.defaultExpire; } |
111 | 146 const char * Cfg_pathHeader( void ) { return config.pathHeader; } |
150
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
147 const char * Cfg_fromDomain( void ) { return config.fromDomain; } |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
148 const char * Cfg_organization( void ) { return config.organization; } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
149 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
150 void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
151 Cfg_beginServEnum( void ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
152 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
153 config.servIdx = 0; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
154 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
155 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
156 Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
157 Cfg_nextServ( Str name ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
158 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
159 if ( config.servIdx >= config.numServ ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
160 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
161 strcpy( name, config.serv[ config.servIdx ].name ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
162 ++config.servIdx; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
163 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
164 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
165 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
166 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
167 searchServ( const char *name, int *idx ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
168 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
169 int i; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
170 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
171 for ( i = 0; i < config.numServ; ++i ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
172 if ( strcmp( name, config.serv[ i ].name ) == 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
173 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
174 *idx = i; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
175 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
176 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
177 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
178 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
179 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
180 Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
181 Cfg_servListContains( const char *name ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
182 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
183 int idx; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
184 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
185 return searchServ( name, &idx ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
186 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
187 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
188 Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
189 Cfg_servIsPreferential( const char *name1, const char *name2 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
190 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
191 Bool exists1, exists2; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
192 int idx1, idx2; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
193 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
194 exists1 = searchServ( name1, &idx1 ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
195 exists2 = searchServ( name2, &idx2 ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
196 if ( exists1 && exists2 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
197 return ( idx1 < idx2 ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
198 if ( exists1 && ! exists2 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
199 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
200 /* ( ! exists1 && exists2 ) || ( ! exists1 && ! exists2 ) */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
201 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
202 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
203 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
204 void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
205 Cfg_authInfo( const char *name, Str user, Str pass ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
206 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
207 int idx; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
208 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
209 if ( searchServ( name, &idx ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
210 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
211 strcpy( user, config.serv[ idx ].user ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
212 strcpy( pass, config.serv[ idx ].pass ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
213 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
214 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
215 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
216 user[ 0 ] = '\0'; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
217 pass[ 0 ] = '\0'; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
218 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
219 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
220 |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
221 int |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
222 Cfg_expire( const char *grp ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
223 { |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
224 int i, res; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
225 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
226 for ( i = 0; i < config.numExpire; i++ ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
227 if ( Wld_match( grp, config.expire[ i ].pattern ) ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
228 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
229 res = config.expire[ i ].days; |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
230 Log_dbg( LOG_DBG_CONFIG, |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
231 "Custom expire period %d for group %s", |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
232 res, grp ); |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
233 return res; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
234 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
235 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
236 return Cfg_defaultExpire(); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
237 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
238 |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
239 const char * |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
240 Cfg_autoSubscribeMode( const char *grp ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
241 { |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
242 int i; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
243 const char *res; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
244 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
245 for ( i = 0; i < config.numAutoSubscribeMode; i++ ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
246 if ( Wld_match( grp, config.autoSubscribeMode[ i ].pattern ) ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
247 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
248 res = config.autoSubscribeMode[ i ].mode; |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
249 Log_dbg( LOG_DBG_CONFIG, |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
250 "Custom auto subscribe mode %s for group %s", |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
251 res, grp ); |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
252 return res; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
253 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
254 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
255 return Cfg_defaultAutoSubscribeMode(); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
256 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
257 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
258 GroupEnum * |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
259 new_GetGrEn( const char *name ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
260 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
261 GroupEnum *res; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
262 int servIdx; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
263 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
264 res = (GroupEnum *) malloc( sizeof( GroupEnum ) ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
265 if ( res == NULL ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
266 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
267 Log_err( "Malloc of GroupEnum failed." ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
268 exit( EXIT_FAILURE ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
269 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
270 if ( ! searchServ( name, &servIdx ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
271 res->groupEntry = NULL; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
272 else |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
273 res->groupEntry = &config.serv[ servIdx ].getgroups; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
274 GrEn_first( res ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
275 return res; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
276 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
277 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
278 GroupEnum * |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
279 new_OmitGrEn( const char *name ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
280 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
281 GroupEnum *res; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
282 int servIdx; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
283 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
284 res = (GroupEnum *) malloc( sizeof( GroupEnum ) ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
285 if ( res == NULL ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
286 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
287 Log_err( "Malloc of GroupEnum failed." ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
288 exit( EXIT_FAILURE ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
289 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
290 if ( ! searchServ( name, &servIdx ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
291 res->groupEntry = NULL; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
292 else |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
293 res->groupEntry = &config.serv[ servIdx ].omitgroups; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
294 GrEn_first( res ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
295 return res; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
296 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
297 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
298 void |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
299 del_GrEn( GroupEnum *ge ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
300 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
301 free(ge); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
302 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
303 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
304 void |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
305 GrEn_first( GroupEnum *ge ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
306 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
307 ge->groupIdx = 0; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
308 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
309 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
310 const char * |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
311 GrEn_next( GroupEnum *ge ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
312 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
313 if ( ge->groupEntry == NULL || |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
314 ge->groupIdx >= ge->groupEntry->numGroup ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
315 return NULL; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
316 return ge->groupEntry->groups[ ge->groupIdx++ ]; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
317 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
318 |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
319 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
320 logSyntaxErr( const char *line ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
321 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
322 Log_err( "Syntax error in config file: %s", line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
323 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
324 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
325 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
326 getBool( Bool *variable, const char *line ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
327 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
328 Str value, name, lowerLn; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
329 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
330 strcpy( lowerLn, line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
331 Utl_toLower( lowerLn ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
332 if ( sscanf( lowerLn, "%s %s", name, value ) != 2 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
333 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
334 logSyntaxErr( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
335 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
336 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
337 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
338 if ( strcmp( value, "yes" ) == 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
339 *variable = TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
340 else if ( strcmp( value, "no" ) == 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
341 *variable = FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
342 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
343 Log_err( "Error in config file %s must be yes or no", name ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
344 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
345 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
346 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
347 getInt( int *variable, int min, int max, const char *line ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
348 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
349 int value; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
350 Str name; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
351 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
352 if ( sscanf( line, "%s %d", name, &value ) != 2 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
353 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
354 logSyntaxErr( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
355 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
356 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
357 if ( value < min || value > max ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
358 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
359 Log_err( "Range error in config file %s [%d,%d]", name, min, max ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
360 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
361 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
362 *variable = value; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
363 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
364 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
365 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
366 getStr( char *variable, const char *line ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
367 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
368 Str dummy; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
369 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
370 if ( sscanf( line, "%s %s", dummy, variable ) != 2 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
371 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
372 logSyntaxErr( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
373 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
374 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
375 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
376 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
377 static void |
150
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
378 getText( Str variable, const char *line ) |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
379 { |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
380 const char *l; |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
381 |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
382 /* Skip command */ |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
383 l = Utl_restOfLn( line, 1 ); |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
384 Utl_cpyStr( variable, l ); |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
385 } |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
386 |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
387 static void |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
388 getServ( const char *line ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
389 { |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
390 Str dummy, name, user, pass; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
391 int r, len; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
392 ServEntry entry; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
393 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
394 memset( &entry, 0, sizeof( entry ) ); |
190
47569cf4ad4a
[svn] fix bug with missing initialization of user name and passwd
enz
parents:
185
diff
changeset
|
395 user[ 0 ] = pass[ 0 ] = '\0'; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
396 r = sscanf( line, "%s %s %s %s", |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
397 dummy, name, user, pass ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
398 if ( r < 2 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
399 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
400 logSyntaxErr( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
401 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
402 } |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
403 len = strlen( name ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
404 /* To make server name more definit, it is made lowercase and |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
405 port is removed, if it is the default port */ |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
406 if ( len > 4 && strcmp( name + len - 4, ":119" ) == 0 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
407 name[ len - 4 ] = '\0'; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
408 Utl_toLower( name ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
409 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
410 Utl_allocAndCpy( &entry.name, name ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
411 Utl_allocAndCpy( &entry.user, user ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
412 Utl_allocAndCpy( &entry.pass, pass ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
413 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
414 if ( config.maxServ < config.numServ + 1 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
415 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
416 if ( ! ( config.serv = realloc( config.serv, |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
417 ( config.maxServ + 5 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
418 * sizeof( ServEntry ) ) ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
419 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
420 Log_err( "Could not realloc server list" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
421 exit( EXIT_FAILURE ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
422 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
423 config.maxServ += 5; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
424 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
425 config.serv[ config.numServ++ ] = entry; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
426 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
427 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
428 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
429 getExpire( const char *line ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
430 { |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
431 Str dummy, pattern; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
432 ExpireEntry entry; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
433 int days; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
434 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
435 if ( sscanf( line, "%s %s %d", dummy, pattern, &days ) != 3 ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
436 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
437 logSyntaxErr( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
438 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
439 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
440 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
441 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
442 if ( days < 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
443 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
444 Log_err( "Expire days error in '%s': must be integer > 0", |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
445 line, days ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
446 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
447 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
448 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
449 Utl_toLower( pattern ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
450 Utl_allocAndCpy( &entry.pattern, pattern ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
451 entry.days = days; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
452 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
453 if ( config.maxExpire < config.numExpire + 1 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
454 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
455 if ( ! ( config.expire = realloc( config.expire, |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
456 ( config.maxExpire + 5 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
457 * sizeof( ExpireEntry ) ) ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
458 { |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
459 Log_err( "Could not realloc expire list" ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
460 exit( EXIT_FAILURE ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
461 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
462 config.maxExpire += 5; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
463 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
464 config.expire[ config.numExpire++ ] = entry; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
465 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
466 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
467 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
468 static void |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
469 getGroups( char *line, Bool isGet ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
470 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
471 const char *name; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
472 ItemList *patterns; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
473 const char *pattern; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
474 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
475 if ( config.numServ == 0 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
476 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
477 Log_err( "No current server in %s", line ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
478 return; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
479 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
480 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
481 name = line; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
482 /* Skip over name and terminate it */ |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
483 while ( line[ 0 ] != '\0' && ! isspace( line[ 0 ] ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
484 line++; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
485 if ( line[ 0 ] == '\0' ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
486 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
487 logSyntaxErr( name ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
488 return; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
489 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
490 line[ 0 ] = '\0'; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
491 line++; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
492 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
493 patterns = new_Itl( line, " ," ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
494 for( pattern = Itl_first( patterns ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
495 pattern != NULL; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
496 pattern = Itl_next( patterns ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
497 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
498 GroupEntry *g; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
499 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
500 if ( isGet ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
501 g = &config.serv[ config.numServ - 1 ].getgroups; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
502 else |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
503 g = &config.serv[ config.numServ - 1 ].omitgroups; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
504 if ( g->maxGroup < g->numGroup + 1 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
505 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
506 if ( ! ( g->groups = realloc( g->groups, |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
507 ( g->maxGroup + 5 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
508 * sizeof( char * ) ) ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
509 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
510 Log_err( "Could not realloc group list" ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
511 exit( EXIT_FAILURE ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
512 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
513 g->maxGroup += 5; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
514 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
515 Utl_allocAndCpy( &g->groups[ g->numGroup++ ], pattern ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
516 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
517 del_Itl( patterns) ; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
518 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
519 |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
520 static void |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
521 getDebugMask( char *line ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
522 { |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
523 const char *name; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
524 ItemList *maskNames; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
525 const char *maskName; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
526 unsigned mask; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
527 |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
528 name = line; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
529 /* Skip over name and terminate it */ |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
530 while ( line[ 0 ] != '\0' && ! isspace( line[ 0 ] ) ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
531 line++; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
532 if ( line[ 0 ] == '\0' ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
533 { |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
534 logSyntaxErr( name ); |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
535 return; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
536 } |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
537 line[ 0 ] = '\0'; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
538 line++; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
539 |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
540 mask = LOG_DBG_NONE; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
541 maskNames = new_Itl( line, " ," ); |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
542 for( maskName = Itl_first( maskNames ); |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
543 maskName != NULL; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
544 maskName = Itl_next( maskNames ) ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
545 { |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
546 if ( strcmp( maskName, "all" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
547 mask = LOG_DBG_ALL; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
548 else if ( strcmp( maskName, "none" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
549 mask = LOG_DBG_NONE; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
550 else if ( strcmp( maskName, "config" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
551 mask |= LOG_DBG_CONFIG; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
552 else if ( strcmp( maskName, "control" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
553 mask |= LOG_DBG_CONTROL; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
554 else if ( strcmp( maskName, "expire" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
555 mask |= LOG_DBG_EXPIRE; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
556 else if ( strcmp( maskName, "fetch" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
557 mask |= LOG_DBG_FETCH; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
558 else if ( strcmp( maskName, "filter" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
559 mask |= LOG_DBG_FILTER; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
560 else if ( strcmp( maskName, "newsbase" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
561 mask |= LOG_DBG_NEWSBASE; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
562 else if ( strcmp( maskName, "noffle" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
563 mask |= LOG_DBG_NOFFLE; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
564 else if ( strcmp( maskName, "post" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
565 mask |= LOG_DBG_POST; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
566 else if ( strcmp( maskName, "protocol" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
567 mask |= LOG_DBG_PROTOCOL; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
568 else if ( strcmp( maskName, "requests" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
569 mask |= LOG_DBG_REQUESTS; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
570 else if ( strcmp( maskName, "server" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
571 mask |= LOG_DBG_SERVER; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
572 else |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
573 logSyntaxErr( line ); |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
574 } |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
575 del_Itl( maskNames) ; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
576 Log_setDbgMask( mask ); |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
577 } |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
578 |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
579 static Bool |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
580 isValidAutoSubscribeMode( const char *mode ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
581 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
582 return strcmp( mode, "full" ) == 0 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
583 || strcmp( mode, "thread" ) == 0 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
584 || strcmp( mode, "over" ) == 0 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
585 || strcmp( mode, "off" ) == 0; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
586 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
587 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
588 static void |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
589 getAutoSubscribeMode( const char *line ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
590 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
591 Str dummy, pattern, mode; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
592 AutoSubscribeModeEntry entry; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
593 int items; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
594 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
595 items = sscanf( line, "%s %s %s", dummy, pattern, mode ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
596 if ( items == 2 ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
597 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
598 /* Backwards compat. default-auto-subscribe-mode */ |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
599 Utl_cpyStr( mode, pattern ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
600 Utl_toLower( mode ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
601 if ( ! isValidAutoSubscribeMode( mode ) ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
602 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
603 logSyntaxErr( line ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
604 return; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
605 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
606 strcpy( config.defaultAutoSubscribeMode, mode ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
607 return; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
608 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
609 else if ( items != 3 ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
610 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
611 logSyntaxErr( line ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
612 return; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
613 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
614 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
615 Utl_toLower( mode ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
616 if ( ! isValidAutoSubscribeMode( mode ) ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
617 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
618 logSyntaxErr( line ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
619 return; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
620 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
621 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
622 Utl_toLower( pattern ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
623 Utl_allocAndCpy( &entry.pattern, pattern ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
624 Utl_allocAndCpy( &entry.mode, mode ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
625 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
626 if ( config.maxAutoSubscribeMode < config.numAutoSubscribeMode + 1 ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
627 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
628 if ( ! ( config.autoSubscribeMode = |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
629 realloc( config.autoSubscribeMode, |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
630 ( config.maxAutoSubscribeMode + 5 ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
631 * sizeof( AutoSubscribeModeEntry ) ) ) ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
632 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
633 Log_err( "Could not realloc auto subscribe mode list" ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
634 exit( EXIT_FAILURE ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
635 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
636 config.maxAutoSubscribeMode += 5; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
637 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
638 config.autoSubscribeMode[ config.numAutoSubscribeMode++ ] = entry; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
639 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
640 |
128 | 641 static const char * |
642 getToken( const char *line, Str value ) | |
643 { | |
644 Bool isQuoted; | |
645 char quoteChar; | |
646 Bool seenEscape; | |
647 char *maxVal; | |
648 | |
649 while ( *line != '\0' && isspace( *line ) ) | |
650 line++; | |
651 if ( *line == '\0' ) | |
652 return NULL; | |
653 | |
654 maxVal = &value[ MAXCHAR ]; | |
655 isQuoted = ( *line == '\'' || *line == '"' ); | |
656 if ( isQuoted ) | |
657 { | |
658 quoteChar = *line; | |
659 line++; | |
660 | |
661 seenEscape = FALSE; | |
662 while ( *line != '\0' | |
663 && ( *line != quoteChar || seenEscape ) | |
664 && value < maxVal ) | |
665 { | |
666 if ( seenEscape ) | |
667 { | |
668 *value++ = *line; | |
669 seenEscape = FALSE; | |
670 } | |
671 else | |
672 { | |
673 if ( *line == '\\' ) | |
674 seenEscape = TRUE; | |
675 else | |
676 *value++ = *line; | |
677 } | |
678 line++; | |
679 } | |
680 | |
681 if ( *line == quoteChar ) | |
682 line++; | |
683 } | |
684 else | |
685 { | |
686 while ( *line != '\0' && ! isspace( *line ) && value < maxVal ) | |
687 *value++ = *line++; | |
688 } | |
689 *value = '\0'; | |
690 return line; | |
691 } | |
692 | |
249 | 693 /* very simple date parser. |
694 * examples: | |
695 * now+ | |
696 */ | |
697 static Bool | |
698 get_simpledate( time_t *timeoffsetp, FilterRuleDateEnumType *vartimep, const char *val) | |
699 { | |
700 float timef; | |
701 | |
702 if ( ! strncasecmp( val, "invalid", 7 ) ) | |
703 { | |
704 *vartimep = INVALID; | |
705 return TRUE; | |
706 } | |
707 else if ( ! strncasecmp( val, "now", 3 ) ) | |
708 { | |
709 val += 3; | |
710 *vartimep = NOW; | |
711 } | |
712 else if ( ! strncasecmp( val, "lastupdate", 10 ) ) | |
713 { | |
714 val += 10; | |
715 *vartimep = LASTUPDATE; | |
716 } | |
717 else | |
718 { | |
719 *vartimep = FIXED; | |
720 *timeoffsetp = Utl_parseNewsDate( val ); | |
721 if ( *timeoffsetp == (time_t) -1 ) | |
722 return FALSE; | |
723 else | |
724 return TRUE; | |
725 } | |
726 /* NOW, LASTUPDATE +/- number of days. */ | |
727 timef = atof( val ) * 86400.0 ; /* 24 * 60 * 60 == 86400 */ | |
728 | |
729 /* let's assume more than 10 years of timeoffset are a mistake. */ | |
730 if ( timef > 31536000.0 || timef < -31536000.0 ) | |
731 return FALSE; | |
732 *timeoffsetp = (time_t) timef; | |
733 /* Todo: check if any garbage follows. */ | |
734 return TRUE; | |
735 } | |
736 | |
128 | 737 static void |
738 getFilter( const char *line ) | |
739 { | |
740 Str ruleBuf, value; | |
741 const char *l; | |
742 char *p, *ruleName; | |
743 Filter *f; | |
744 FilterRule rule; | |
745 Bool seenAction; | |
746 | |
747 f = new_Filter(); | |
748 | |
749 /* Skip "filter" */ | |
750 l = Utl_restOfLn( line, 1 ); | |
751 seenAction = FALSE; | |
752 | |
753 for(;;) | |
754 { | |
755 while ( *l != '\0' && isspace( *l ) ) | |
756 l++; | |
757 | |
758 if ( *l == '\0' ) | |
759 break; | |
760 | |
761 /* Get the rule title */ | |
762 p = ruleBuf; | |
763 while ( *l != '\0' && *l != '=' && *l != '<' && *l != '>' ) | |
764 *p++ = *l++; | |
765 *p = '\0'; | |
766 ruleName = Utl_stripWhiteSpace( ruleBuf ); | |
767 Utl_toLower( ruleName ); | |
768 | |
769 if ( *ruleName == '\0' ) | |
770 goto synErr; | |
771 | |
772 /* Do we know this rule? */ | |
773 if ( strcmp( ruleName, "group" ) == 0 ) | |
774 rule.type = RULE_NEWSGROUP; | |
775 else if ( strcmp( ruleName, "subject" ) == 0 ) | |
776 rule.type = RULE_SUBJECT; | |
249 | 777 else if ( strcmp( ruleName, "reference" ) == 0 ) |
778 rule.type = RULE_REFERENCE; | |
128 | 779 else if ( strcmp( ruleName, "from" ) == 0 ) |
780 rule.type = RULE_FROM; | |
781 else if ( strcmp( ruleName, "msgid" ) == 0 ) | |
782 rule.type = RULE_MSGID; | |
783 else if ( strcmp( ruleName, "bytes" ) == 0 ) | |
249 | 784 rule.type = RULE_BYTES_EQ; |
128 | 785 else if ( strcmp( ruleName, "lines" ) == 0 ) |
249 | 786 rule.type = RULE_LINES_EQ; |
128 | 787 else if ( strcmp( ruleName, "refs" ) == 0 ) |
249 | 788 rule.type = RULE_NOREFS_EQ; |
128 | 789 else if ( strcmp( ruleName, "xposts" ) == 0 ) |
249 | 790 rule.type = RULE_XPOSTS_EQ; |
212 | 791 else if ( strcmp( ruleName, "post-status" ) == 0 ) |
792 rule.type = RULE_POST_STATUS; | |
249 | 793 else if ( strcmp( ruleName, "date" ) == 0 ) |
794 rule.type = RULE_DATE_EQ; | |
795 /* date<lastupdate-12 equals older=lastupdate-12 | |
796 * date>now+1.5 equals newer=now+1.5 | |
797 * date=now equals older=now+1 AND newer=now-1 | |
798 * Stupid people like Mirko keep making mistakes | |
799 * if they're forced using date< or date>. | |
800 */ | |
801 else if ( strcmp( ruleName, "older" ) == 0 ) | |
802 rule.type = RULE_DATE_LT; | |
803 else if ( strcmp( ruleName, "newer" ) == 0 ) | |
804 rule.type = RULE_DATE_GT; | |
805 | |
128 | 806 else if ( strcmp( ruleName, "action" ) != 0 ) |
807 goto synErr; | |
808 | |
249 | 809 if ( rule.type == RULE_BYTES_EQ || |
810 rule.type == RULE_LINES_EQ || | |
811 rule.type == RULE_NOREFS_EQ || | |
812 rule.type == RULE_XPOSTS_EQ || | |
813 rule.type == RULE_DATE_EQ ) | |
128 | 814 { |
249 | 815 if ( *l == '<' ) |
816 rule.type--; | |
128 | 817 else if ( *l == '>' ) |
249 | 818 rule.type++; |
819 else if ( *l != '=' ) | |
128 | 820 goto synErr; |
821 } | |
822 else if ( *l != '=' ) | |
823 goto synErr; | |
824 | |
825 /* Skip past '=' (or '>' or '<') */ | |
826 l++; | |
827 | |
828 /* OK, we now have a valid rule. What value? */ | |
829 l = getToken( l, value ); | |
830 if ( l == NULL ) | |
831 goto synErr; | |
832 | |
833 if ( strcmp( ruleName, "action" ) == 0 ) | |
834 { | |
835 if ( seenAction ) | |
836 goto synErr; | |
837 | |
838 Utl_toLower( value ); | |
839 if ( strcmp( value, "full" ) == 0 ) | |
840 f->action = FILTER_FULL; | |
841 else if ( strcmp( value, "over" ) == 0 ) | |
842 f->action = FILTER_XOVER; | |
843 else if ( strcmp( value, "thread" ) == 0 ) | |
844 f->action = FILTER_THREAD; | |
845 else if ( strcmp( value, "discard" ) == 0 ) | |
846 f->action = FILTER_DISCARD; | |
194
a4e9a20e50e5
[svn] * docs/noffle.conf.5,src/configfile.c,src/filter.h,src/filter.c:
bears
parents:
190
diff
changeset
|
847 else if ( strcmp( value, "default" ) == 0 ) |
a4e9a20e50e5
[svn] * docs/noffle.conf.5,src/configfile.c,src/filter.h,src/filter.c:
bears
parents:
190
diff
changeset
|
848 f->action = FILTER_DEFAULT; |
128 | 849 seenAction = TRUE; |
850 } | |
851 else if ( rule.type == RULE_NEWSGROUP ) | |
852 Utl_allocAndCpy( &rule.data.grp, value ); | |
853 else if ( rule.type >= RULE_SUBJECT && rule.type <= RULE_MSGID ) | |
854 { | |
855 if ( regcomp( &rule.data.regex, value, REG_EXTENDED ) != 0 ) | |
856 goto synErr; | |
857 } | |
212 | 858 else if (rule.type == RULE_POST_STATUS ) |
249 | 859 { |
212 | 860 if ( ( strcmp( value, "yes" ) == 0 ) || \ |
861 ( strcmp( value, "no" ) == 0 ) || \ | |
862 ( strncmp( value, "mod", 3 ) == 0 ) ) | |
863 /* no need to type out "moderated" */ | |
864 rule.data.postAllow = value[0]; /* 'y','n' or 'm' */ | |
865 else | |
866 goto synErr; | |
249 | 867 } |
868 else if ( rule.type == RULE_DATE_LT || | |
869 rule.type == RULE_DATE_EQ || | |
870 rule.type == RULE_DATE_GT ) | |
871 { | |
872 if ( !get_simpledate( &rule.data.reftime.timeoffset, &rule.data.reftime.vartime, value ) ) | |
873 goto synErr; | |
874 if ( rule.type != RULE_DATE_EQ && | |
875 rule.data.reftime.vartime == INVALID ) | |
876 goto synErr; | |
877 } | |
128 | 878 else |
879 { | |
880 char * endVal; | |
134 | 881 int suffix; |
128 | 882 |
883 rule.data.amount = strtoul( value, &endVal, 0 ); | |
134 | 884 suffix = tolower( *endVal ); |
885 if ( suffix == 'k' || suffix == 'm' ) | |
886 { | |
887 rule.data.amount *= 1024; | |
888 if ( suffix == 'm' ) | |
889 rule.data.amount *= 1024; | |
890 endVal++; | |
891 } | |
128 | 892 if ( *endVal != '\0' && ! isspace( *endVal ) ) |
893 goto synErr; | |
894 } | |
895 | |
896 if ( strcmp( ruleName, "action" ) != 0 ) | |
897 { | |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
898 Log_dbg( LOG_DBG_CONFIG, |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
899 "Adding rule type %d value %s", |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
900 rule.type, value ); |
128 | 901 Flt_addRule( f, rule ); |
902 } | |
903 } | |
904 | |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
905 Log_dbg( LOG_DBG_CONFIG, "Adding filter, action %d", f->action ); |
128 | 906 Flt_addFilter( f ); |
907 return; | |
908 | |
909 synErr: | |
910 logSyntaxErr( line ); | |
911 return; | |
912 } | |
913 | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
914 void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
915 Cfg_read( void ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
916 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
917 char *p; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
918 FILE *f; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
919 Str file, line, lowerLine, name, s; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
920 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
921 snprintf( file, MAXCHAR, CONFIGFILE ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
922 if ( ! ( f = fopen( file, "r" ) ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
923 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
924 Log_err( "Cannot read %s", file ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
925 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
926 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
927 while ( fgets( line, MAXCHAR, f ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
928 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
929 p = Utl_stripWhiteSpace( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
930 Utl_stripComment( p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
931 Utl_cpyStr( lowerLine, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
932 Utl_toLower( lowerLine ); |
128 | 933 p = lowerLine; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
934 if ( *p == '\0' ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
935 continue; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
936 if ( sscanf( p, "%s", name ) != 1 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
937 Log_err( "Syntax error in %s: %s", file, line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
938 else if ( strcmp( "max-fetch", name ) == 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
939 getInt( &config.maxFetch, 0, INT_MAX, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
940 else if ( strcmp( "auto-unsubscribe-days", name ) == 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
941 getInt( &config.autoUnsubscribe, -1, INT_MAX, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
942 else if ( strcmp( "thread-follow-time", name ) == 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
943 getInt( &config.threadFollowTime, 0, INT_MAX, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
944 else if ( strcmp( "connect-timeout", name ) == 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
945 getInt( &config.connectTimeout, 0, INT_MAX, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
946 else if ( strcmp( "default-expire", name ) == 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
947 getInt( &config.defaultExpire, 0, INT_MAX, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
948 else if ( strcmp( "auto-subscribe", name ) == 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
949 getBool( &config.autoSubscribe, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
950 else if ( strcmp( "auto-unsubscribe", name ) == 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
951 getBool( &config.autoUnsubscribe, p ); |
82 | 952 else if ( strcmp( "info-always-unread", name ) == 0 ) |
953 getBool( &config.infoAlways, p ); | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
954 else if ( strcmp( "replace-messageid", name ) == 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
955 getBool( &config.replaceMsgId, p ); |
195
76460d98b2fb
[svn] * noffle.conf.example,docs/noffle.conf.5,src/configfile.h,src/configfile.c,
bears
parents:
194
diff
changeset
|
956 else if ( strcmp( "hostname", name ) == 0 ) |
76460d98b2fb
[svn] * noffle.conf.example,docs/noffle.conf.5,src/configfile.h,src/configfile.c,
bears
parents:
194
diff
changeset
|
957 /* use line, do not change to lowercase */ |
76460d98b2fb
[svn] * noffle.conf.example,docs/noffle.conf.5,src/configfile.h,src/configfile.c,
bears
parents:
194
diff
changeset
|
958 getStr( config.hostnameMsgId, line ); |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
959 else if ( strcmp( "post-locally", name ) == 0 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
960 getBool( &config.postLocal, p ); |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
961 else if ( strcmp( "default-auto-subscribe-mode", name ) == 0 ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
962 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
963 getStr( s, p ); |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
964 if ( ! isValidAutoSubscribeMode( s ) ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
965 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
966 logSyntaxErr( line ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
967 return; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
968 } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
969 else |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
970 strcpy( config.defaultAutoSubscribeMode, s ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
971 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
972 else if ( strcmp( "mail-to", name ) == 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
973 getStr( config.mailTo, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
974 else if ( strcmp( "expire", name ) == 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
975 getExpire( p ); |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
976 else if ( strcmp( "auto-subscribe-mode", name ) == 0 ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
977 getAutoSubscribeMode( p ); |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
978 else if ( strcmp( "log-debug", name ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
979 getDebugMask( p ); |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
980 else if ( strcmp( "getgroups", name ) == 0 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
981 getGroups( p, TRUE ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
982 else if ( strcmp( "omitgroups", name ) == 0 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
983 getGroups( p, FALSE ); |
150
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
984 else if ( strcmp( "path-header", name ) == 0 ) |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
985 getStr( config.pathHeader, p ); |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
986 else if ( strcmp( "from-domain", name ) == 0 ) |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
987 getStr( config.fromDomain, p ); |
128 | 988 /* The following need line because they may have uppercase data */ |
150
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
989 else if ( strcmp( "organization", name ) == 0 ) |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
990 getText( config.organization, line ); |
128 | 991 else if ( strcmp( "server", name ) == 0 ) |
992 getServ( line ); | |
993 else if ( strcmp( "filter", name ) == 0 ) | |
994 getFilter( line ); | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
995 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
996 Log_err( "Unknown config option: %s", name ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
997 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
998 fclose( f ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
999 if ( ! config.numServ ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1000 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1001 Log_err( "Config file contains no server" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1002 exit( EXIT_FAILURE ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1003 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1004 } |