Mercurial > noffle
annotate src/configfile.c @ 195:76460d98b2fb noffle
[svn] * noffle.conf.example,docs/noffle.conf.5,src/configfile.h,src/configfile.c,
src/protocol.c: Add new config item 'hostname' to specify the part after
the @ in message IDs generated by Noffle. Patch submitted by Mirko Liss.
author | bears |
---|---|
date | Tue, 30 Oct 2001 13:16:40 +0000 |
parents | a4e9a20e50e5 |
children | 24d4cd032da5 |
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 |
195
76460d98b2fb
[svn] * noffle.conf.example,docs/noffle.conf.5,src/configfile.h,src/configfile.c,
bears
parents:
194
diff
changeset
|
9 $Id: configfile.c 314 2001-10-30 13:16:40Z bears $ |
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 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
16 #include "configfile.h" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
17 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
18 #include <ctype.h> |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
19 #include <limits.h> |
128 | 20 #include <regex.h> |
21 #include "filter.h" | |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
22 #include "itemlist.h" |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
23 #include "log.h" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
24 #include "util.h" |
54
125d79c9e586
[svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents:
43
diff
changeset
|
25 #include "portable.h" |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
26 #include "wildmat.h" |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
27 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
28 typedef struct |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
29 { |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
30 int numGroup; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
31 int maxGroup; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
32 char **groups; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
33 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
34 GroupEntry; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
35 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
36 struct GroupEnum |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
37 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
38 GroupEntry *groupEntry; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
39 int groupIdx; |
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 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
42 typedef struct |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
43 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
44 char *name; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
45 char *user; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
46 char *pass; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
47 GroupEntry getgroups; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
48 GroupEntry omitgroups; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
49 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
50 ServEntry; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
51 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
52 typedef struct |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
53 { |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
54 char *pattern; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
55 int days; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
56 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
57 ExpireEntry; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
58 |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
59 typedef struct |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
60 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
61 char *pattern; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
62 char *mode; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
63 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
64 AutoSubscribeModeEntry; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
65 |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
66 struct |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
67 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
68 /* Compile time options */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
69 const char *spoolDir; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
70 const char *version; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
71 /* 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
|
72 int maxFetch; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
73 int autoUnsubscribeDays; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
74 int threadFollowTime; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
75 int connectTimeout; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
76 Bool autoSubscribe; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
77 Bool autoUnsubscribe; |
82 | 78 Bool infoAlways; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
79 Bool replaceMsgId; |
195
76460d98b2fb
[svn] * noffle.conf.example,docs/noffle.conf.5,src/configfile.h,src/configfile.c,
bears
parents:
194
diff
changeset
|
80 Str hostnameMsgId; |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
81 Bool postLocal; |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
82 Str defaultAutoSubscribeMode; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
83 Str mailTo; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
84 int defaultExpire; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
85 int numServ; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
86 int maxServ; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
87 ServEntry *serv; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
88 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
|
89 int numExpire; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
90 int maxExpire; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
91 ExpireEntry *expire; |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
92 int numAutoSubscribeMode; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
93 int maxAutoSubscribeMode; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
94 AutoSubscribeModeEntry *autoSubscribeMode; |
111 | 95 Str pathHeader; |
150
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
96 Str fromDomain; |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
97 Str organization; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
98 } config = |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
99 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
100 SPOOLDIR, /* spoolDir */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
101 VERSION, /* version */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
102 300, /* maxFetch */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
103 30, /* autoUnsubscribeDays */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
104 7, /* threadFollowTime */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
105 30, /* connectTimeout */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
106 FALSE, /* autoSubscribe */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
107 FALSE, /* autoUnsubscribe */ |
82 | 108 TRUE, /* infoAlways */ |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
109 TRUE, /* replaceMsgId */ |
195
76460d98b2fb
[svn] * noffle.conf.example,docs/noffle.conf.5,src/configfile.h,src/configfile.c,
bears
parents:
194
diff
changeset
|
110 "", /* hostnameMsgId */ |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
111 FALSE, /* postLocal */ |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
112 "over", /* defaultAutoSubscribeMode */ |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
113 "", /* mailTo */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
114 14, /* defaultExpire */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
115 0, /* numServ */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
116 0, /* maxServ */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
117 NULL, /* serv */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
118 0, /* servIdx */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
119 0, /* numExpire */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
120 0, /* maxExpire */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
121 NULL, /* expire */ |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
122 0, /* numAutoSubscribeMode */ |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
123 0, /* maxAutoSubscribeMode */ |
111 | 124 NULL, /* autoSubscribeMode */ |
150
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
125 "", /* pathHeader */ |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
126 "", /* fromDomain */ |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
127 "" /* organization */ |
43
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 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
130 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
|
131 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
|
132 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
133 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
|
134 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
|
135 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
|
136 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
|
137 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
|
138 Bool Cfg_autoSubscribe( void ) { return config.autoSubscribe; } |
82 | 139 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
|
140 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
|
141 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
|
142 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
|
143 const char * Cfg_defaultAutoSubscribeMode( void ) { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
144 return config.defaultAutoSubscribeMode; } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
145 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
|
146 int Cfg_defaultExpire( void ) { return config.defaultExpire; } |
111 | 147 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
|
148 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
|
149 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
|
150 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
151 void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
152 Cfg_beginServEnum( void ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
153 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
154 config.servIdx = 0; |
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 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
157 Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
158 Cfg_nextServ( Str name ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
159 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
160 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
|
161 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
162 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
|
163 ++config.servIdx; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
164 return TRUE; |
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 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
167 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
168 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
|
169 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
170 int i; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
171 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
172 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
|
173 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
|
174 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
175 *idx = i; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
176 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
177 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
178 return FALSE; |
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 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
181 Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
182 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
|
183 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
184 int idx; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
185 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
186 return searchServ( name, &idx ); |
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 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
189 Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
190 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
|
191 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
192 Bool exists1, exists2; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
193 int idx1, idx2; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
194 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
195 exists1 = searchServ( name1, &idx1 ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
196 exists2 = searchServ( name2, &idx2 ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
197 if ( exists1 && exists2 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
198 return ( idx1 < idx2 ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
199 if ( exists1 && ! exists2 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
200 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
201 /* ( ! exists1 && exists2 ) || ( ! exists1 && ! exists2 ) */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
202 return FALSE; |
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 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
205 void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
206 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
|
207 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
208 int idx; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
209 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
210 if ( searchServ( name, &idx ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
211 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
212 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
|
213 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
|
214 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
215 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
216 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
217 user[ 0 ] = '\0'; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
218 pass[ 0 ] = '\0'; |
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 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
221 |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
222 int |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
223 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
|
224 { |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
225 int i, res; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
226 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
227 for ( i = 0; i < config.numExpire; i++ ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
228 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
|
229 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
230 res = config.expire[ i ].days; |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
231 Log_dbg( LOG_DBG_CONFIG, |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
232 "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
|
233 res, grp ); |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
234 return res; |
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 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
237 return Cfg_defaultExpire(); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
238 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
239 |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
240 const char * |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
241 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
|
242 { |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
243 int i; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
244 const char *res; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
245 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
246 for ( i = 0; i < config.numAutoSubscribeMode; i++ ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
247 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
|
248 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
249 res = config.autoSubscribeMode[ i ].mode; |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
250 Log_dbg( LOG_DBG_CONFIG, |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
251 "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
|
252 res, grp ); |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
253 return res; |
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 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
256 return Cfg_defaultAutoSubscribeMode(); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
257 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
258 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
259 GroupEnum * |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
260 new_GetGrEn( const char *name ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
261 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
262 GroupEnum *res; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
263 int servIdx; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
264 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
265 res = (GroupEnum *) malloc( sizeof( GroupEnum ) ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
266 if ( res == NULL ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
267 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
268 Log_err( "Malloc of GroupEnum failed." ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
269 exit( EXIT_FAILURE ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
270 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
271 if ( ! searchServ( name, &servIdx ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
272 res->groupEntry = NULL; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
273 else |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
274 res->groupEntry = &config.serv[ servIdx ].getgroups; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
275 GrEn_first( res ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
276 return res; |
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 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
279 GroupEnum * |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
280 new_OmitGrEn( const char *name ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
281 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
282 GroupEnum *res; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
283 int servIdx; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
284 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
285 res = (GroupEnum *) malloc( sizeof( GroupEnum ) ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
286 if ( res == NULL ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
287 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
288 Log_err( "Malloc of GroupEnum failed." ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
289 exit( EXIT_FAILURE ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
290 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
291 if ( ! searchServ( name, &servIdx ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
292 res->groupEntry = NULL; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
293 else |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
294 res->groupEntry = &config.serv[ servIdx ].omitgroups; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
295 GrEn_first( res ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
296 return res; |
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 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
299 void |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
300 del_GrEn( GroupEnum *ge ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
301 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
302 free(ge); |
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 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
305 void |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
306 GrEn_first( GroupEnum *ge ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
307 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
308 ge->groupIdx = 0; |
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 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
311 const char * |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
312 GrEn_next( GroupEnum *ge ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
313 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
314 if ( ge->groupEntry == NULL || |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
315 ge->groupIdx >= ge->groupEntry->numGroup ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
316 return NULL; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
317 return ge->groupEntry->groups[ ge->groupIdx++ ]; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
318 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
319 |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
320 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
321 logSyntaxErr( const char *line ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
322 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
323 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
|
324 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
325 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
326 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
327 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
|
328 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
329 Str value, name, lowerLn; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
330 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
331 strcpy( lowerLn, line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
332 Utl_toLower( lowerLn ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
333 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
|
334 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
335 logSyntaxErr( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
336 return; |
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 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
339 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
|
340 *variable = TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
341 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
|
342 *variable = FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
343 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
344 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
|
345 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
346 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
347 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
348 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
|
349 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
350 int value; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
351 Str name; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
352 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
353 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
|
354 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
355 logSyntaxErr( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
356 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
357 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
358 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
|
359 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
360 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
|
361 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
362 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
363 *variable = value; |
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 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
366 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
367 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
|
368 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
369 Str dummy; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
370 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
371 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
|
372 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
373 logSyntaxErr( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
374 return; |
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 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
378 static void |
150
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
379 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
|
380 { |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
381 const char *l; |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
382 |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
383 /* Skip command */ |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
384 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
|
385 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
|
386 } |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
387 |
1c7303c71f66
[svn] * src/protocol.c: Fix bug in Prt_getLn if we should read a line
bears
parents:
134
diff
changeset
|
388 static void |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
389 getServ( const char *line ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
390 { |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
391 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
|
392 int r, len; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
393 ServEntry entry; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
394 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
395 memset( &entry, 0, sizeof( entry ) ); |
190
47569cf4ad4a
[svn] fix bug with missing initialization of user name and passwd
enz
parents:
185
diff
changeset
|
396 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
|
397 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
|
398 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
|
399 if ( r < 2 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
400 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
401 logSyntaxErr( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
402 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
403 } |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
404 len = strlen( name ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
405 /* 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
|
406 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
|
407 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
|
408 name[ len - 4 ] = '\0'; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
409 Utl_toLower( name ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
410 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
411 Utl_allocAndCpy( &entry.name, name ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
412 Utl_allocAndCpy( &entry.user, user ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
413 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
|
414 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
415 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
|
416 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
417 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
|
418 ( config.maxServ + 5 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
419 * sizeof( ServEntry ) ) ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
420 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
421 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
|
422 exit( EXIT_FAILURE ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
423 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
424 config.maxServ += 5; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
425 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
426 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
|
427 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
428 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
429 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
430 getExpire( const char *line ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
431 { |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
432 Str dummy, pattern; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
433 ExpireEntry entry; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
434 int days; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
435 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
436 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
|
437 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
438 logSyntaxErr( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
439 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
440 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
441 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
442 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
443 if ( days < 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
444 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
445 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
|
446 line, days ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
447 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
448 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
449 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
450 Utl_toLower( pattern ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
451 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
|
452 entry.days = days; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
453 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
454 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
|
455 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
456 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
|
457 ( config.maxExpire + 5 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
458 * sizeof( ExpireEntry ) ) ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
459 { |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
460 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
|
461 exit( EXIT_FAILURE ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
462 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
463 config.maxExpire += 5; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
464 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
465 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
|
466 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
467 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
468 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
469 static void |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
470 getGroups( char *line, Bool isGet ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
471 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
472 const char *name; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
473 ItemList *patterns; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
474 const char *pattern; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
475 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
476 if ( config.numServ == 0 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
477 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
478 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
|
479 return; |
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 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
482 name = line; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
483 /* Skip over name and terminate it */ |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
484 while ( line[ 0 ] != '\0' && ! isspace( line[ 0 ] ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
485 line++; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
486 if ( line[ 0 ] == '\0' ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
487 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
488 logSyntaxErr( name ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
489 return; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
490 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
491 line[ 0 ] = '\0'; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
492 line++; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
493 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
494 patterns = new_Itl( line, " ," ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
495 for( pattern = Itl_first( patterns ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
496 pattern != NULL; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
497 pattern = Itl_next( patterns ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
498 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
499 GroupEntry *g; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
500 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
501 if ( isGet ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
502 g = &config.serv[ config.numServ - 1 ].getgroups; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
503 else |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
504 g = &config.serv[ config.numServ - 1 ].omitgroups; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
505 if ( g->maxGroup < g->numGroup + 1 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
506 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
507 if ( ! ( g->groups = realloc( g->groups, |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
508 ( g->maxGroup + 5 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
509 * sizeof( char * ) ) ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
510 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
511 Log_err( "Could not realloc group list" ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
512 exit( EXIT_FAILURE ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
513 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
514 g->maxGroup += 5; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
515 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
516 Utl_allocAndCpy( &g->groups[ g->numGroup++ ], pattern ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
517 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
518 del_Itl( patterns) ; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
519 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
520 |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
521 static void |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
522 getDebugMask( char *line ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
523 { |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
524 const char *name; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
525 ItemList *maskNames; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
526 const char *maskName; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
527 unsigned mask; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
528 |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
529 name = line; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
530 /* Skip over name and terminate it */ |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
531 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
|
532 line++; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
533 if ( line[ 0 ] == '\0' ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
534 { |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
535 logSyntaxErr( name ); |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
536 return; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
537 } |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
538 line[ 0 ] = '\0'; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
539 line++; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
540 |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
541 mask = LOG_DBG_NONE; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
542 maskNames = new_Itl( line, " ," ); |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
543 for( maskName = Itl_first( maskNames ); |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
544 maskName != NULL; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
545 maskName = Itl_next( maskNames ) ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
546 { |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
547 if ( strcmp( maskName, "all" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
548 mask = LOG_DBG_ALL; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
549 else if ( strcmp( maskName, "none" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
550 mask = LOG_DBG_NONE; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
551 else if ( strcmp( maskName, "config" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
552 mask |= LOG_DBG_CONFIG; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
553 else if ( strcmp( maskName, "control" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
554 mask |= LOG_DBG_CONTROL; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
555 else if ( strcmp( maskName, "expire" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
556 mask |= LOG_DBG_EXPIRE; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
557 else if ( strcmp( maskName, "fetch" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
558 mask |= LOG_DBG_FETCH; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
559 else if ( strcmp( maskName, "filter" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
560 mask |= LOG_DBG_FILTER; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
561 else if ( strcmp( maskName, "newsbase" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
562 mask |= LOG_DBG_NEWSBASE; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
563 else if ( strcmp( maskName, "noffle" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
564 mask |= LOG_DBG_NOFFLE; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
565 else if ( strcmp( maskName, "post" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
566 mask |= LOG_DBG_POST; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
567 else if ( strcmp( maskName, "protocol" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
568 mask |= LOG_DBG_PROTOCOL; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
569 else if ( strcmp( maskName, "requests" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
570 mask |= LOG_DBG_REQUESTS; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
571 else if ( strcmp( maskName, "server" ) == 0 ) |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
572 mask |= LOG_DBG_SERVER; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
573 else |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
574 logSyntaxErr( line ); |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
575 } |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
576 del_Itl( maskNames) ; |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
577 Log_setDbgMask( mask ); |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
578 } |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
579 |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
580 static Bool |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
581 isValidAutoSubscribeMode( const char *mode ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
582 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
583 return strcmp( mode, "full" ) == 0 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
584 || strcmp( mode, "thread" ) == 0 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
585 || strcmp( mode, "over" ) == 0 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
586 || strcmp( mode, "off" ) == 0; |
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 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
589 static void |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
590 getAutoSubscribeMode( const char *line ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
591 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
592 Str dummy, pattern, mode; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
593 AutoSubscribeModeEntry entry; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
594 int items; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
595 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
596 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
|
597 if ( items == 2 ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
598 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
599 /* Backwards compat. default-auto-subscribe-mode */ |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
600 Utl_cpyStr( mode, pattern ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
601 Utl_toLower( mode ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
602 if ( ! isValidAutoSubscribeMode( mode ) ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
603 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
604 logSyntaxErr( line ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
605 return; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
606 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
607 strcpy( config.defaultAutoSubscribeMode, mode ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
608 return; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
609 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
610 else if ( items != 3 ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
611 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
612 logSyntaxErr( line ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
613 return; |
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 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
616 Utl_toLower( mode ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
617 if ( ! isValidAutoSubscribeMode( mode ) ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
618 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
619 logSyntaxErr( line ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
620 return; |
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 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
623 Utl_toLower( pattern ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
624 Utl_allocAndCpy( &entry.pattern, pattern ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
625 Utl_allocAndCpy( &entry.mode, mode ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
626 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
627 if ( config.maxAutoSubscribeMode < config.numAutoSubscribeMode + 1 ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
628 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
629 if ( ! ( config.autoSubscribeMode = |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
630 realloc( config.autoSubscribeMode, |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
631 ( config.maxAutoSubscribeMode + 5 ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
632 * sizeof( AutoSubscribeModeEntry ) ) ) ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
633 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
634 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
|
635 exit( EXIT_FAILURE ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
636 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
637 config.maxAutoSubscribeMode += 5; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
638 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
639 config.autoSubscribeMode[ config.numAutoSubscribeMode++ ] = entry; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
640 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
641 |
128 | 642 static const char * |
643 getToken( const char *line, Str value ) | |
644 { | |
645 Bool isQuoted; | |
646 char quoteChar; | |
647 Bool seenEscape; | |
648 char *maxVal; | |
649 | |
650 while ( *line != '\0' && isspace( *line ) ) | |
651 line++; | |
652 if ( *line == '\0' ) | |
653 return NULL; | |
654 | |
655 maxVal = &value[ MAXCHAR ]; | |
656 isQuoted = ( *line == '\'' || *line == '"' ); | |
657 if ( isQuoted ) | |
658 { | |
659 quoteChar = *line; | |
660 line++; | |
661 | |
662 seenEscape = FALSE; | |
663 while ( *line != '\0' | |
664 && ( *line != quoteChar || seenEscape ) | |
665 && value < maxVal ) | |
666 { | |
667 if ( seenEscape ) | |
668 { | |
669 *value++ = *line; | |
670 seenEscape = FALSE; | |
671 } | |
672 else | |
673 { | |
674 if ( *line == '\\' ) | |
675 seenEscape = TRUE; | |
676 else | |
677 *value++ = *line; | |
678 } | |
679 line++; | |
680 } | |
681 | |
682 if ( *line == quoteChar ) | |
683 line++; | |
684 } | |
685 else | |
686 { | |
687 while ( *line != '\0' && ! isspace( *line ) && value < maxVal ) | |
688 *value++ = *line++; | |
689 } | |
690 *value = '\0'; | |
691 return line; | |
692 } | |
693 | |
694 static void | |
695 getFilter( const char *line ) | |
696 { | |
697 Str ruleBuf, value; | |
698 const char *l; | |
699 char *p, *ruleName; | |
700 Filter *f; | |
701 FilterRule rule; | |
702 Bool seenAction; | |
703 | |
704 f = new_Filter(); | |
705 | |
706 /* Skip "filter" */ | |
707 l = Utl_restOfLn( line, 1 ); | |
708 seenAction = FALSE; | |
709 | |
710 for(;;) | |
711 { | |
712 while ( *l != '\0' && isspace( *l ) ) | |
713 l++; | |
714 | |
715 if ( *l == '\0' ) | |
716 break; | |
717 | |
718 /* Get the rule title */ | |
719 p = ruleBuf; | |
720 while ( *l != '\0' && *l != '=' && *l != '<' && *l != '>' ) | |
721 *p++ = *l++; | |
722 *p = '\0'; | |
723 ruleName = Utl_stripWhiteSpace( ruleBuf ); | |
724 Utl_toLower( ruleName ); | |
725 | |
726 if ( *ruleName == '\0' ) | |
727 goto synErr; | |
728 | |
729 /* Do we know this rule? */ | |
730 if ( strcmp( ruleName, "group" ) == 0 ) | |
731 rule.type = RULE_NEWSGROUP; | |
732 else if ( strcmp( ruleName, "subject" ) == 0 ) | |
733 rule.type = RULE_SUBJECT; | |
734 else if ( strcmp( ruleName, "from" ) == 0 ) | |
735 rule.type = RULE_FROM; | |
736 else if ( strcmp( ruleName, "msgid" ) == 0 ) | |
737 rule.type = RULE_MSGID; | |
738 else if ( strcmp( ruleName, "bytes" ) == 0 ) | |
739 rule.type = RULE_BYTES_LT; | |
740 else if ( strcmp( ruleName, "lines" ) == 0 ) | |
741 rule.type = RULE_LINES_LT; | |
742 else if ( strcmp( ruleName, "refs" ) == 0 ) | |
743 rule.type = RULE_NOREFS_LT; | |
744 else if ( strcmp( ruleName, "xposts" ) == 0 ) | |
745 rule.type = RULE_XPOSTS_LT; | |
746 else if ( strcmp( ruleName, "action" ) != 0 ) | |
747 goto synErr; | |
748 | |
749 if ( rule.type == RULE_BYTES_LT || | |
750 rule.type == RULE_LINES_LT || | |
751 rule.type == RULE_NOREFS_LT || | |
752 rule.type == RULE_XPOSTS_LT ) | |
753 { | |
754 if ( *l == '=' ) | |
755 rule.type += 1; | |
756 else if ( *l == '>' ) | |
757 rule.type += 2; | |
758 else if ( *l != '<' ) | |
759 goto synErr; | |
760 } | |
761 else if ( *l != '=' ) | |
762 goto synErr; | |
763 | |
764 /* Skip past '=' (or '>' or '<') */ | |
765 l++; | |
766 | |
767 /* OK, we now have a valid rule. What value? */ | |
768 l = getToken( l, value ); | |
769 if ( l == NULL ) | |
770 goto synErr; | |
771 | |
772 if ( strcmp( ruleName, "action" ) == 0 ) | |
773 { | |
774 if ( seenAction ) | |
775 goto synErr; | |
776 | |
777 Utl_toLower( value ); | |
778 if ( strcmp( value, "full" ) == 0 ) | |
779 f->action = FILTER_FULL; | |
780 else if ( strcmp( value, "over" ) == 0 ) | |
781 f->action = FILTER_XOVER; | |
782 else if ( strcmp( value, "thread" ) == 0 ) | |
783 f->action = FILTER_THREAD; | |
784 else if ( strcmp( value, "discard" ) == 0 ) | |
785 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
|
786 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
|
787 f->action = FILTER_DEFAULT; |
128 | 788 seenAction = TRUE; |
789 } | |
790 else if ( rule.type == RULE_NEWSGROUP ) | |
791 Utl_allocAndCpy( &rule.data.grp, value ); | |
792 else if ( rule.type >= RULE_SUBJECT && rule.type <= RULE_MSGID ) | |
793 { | |
794 if ( regcomp( &rule.data.regex, value, REG_EXTENDED ) != 0 ) | |
795 goto synErr; | |
796 } | |
797 else | |
798 { | |
799 char * endVal; | |
134 | 800 int suffix; |
128 | 801 |
802 rule.data.amount = strtoul( value, &endVal, 0 ); | |
134 | 803 suffix = tolower( *endVal ); |
804 if ( suffix == 'k' || suffix == 'm' ) | |
805 { | |
806 rule.data.amount *= 1024; | |
807 if ( suffix == 'm' ) | |
808 rule.data.amount *= 1024; | |
809 endVal++; | |
810 } | |
128 | 811 if ( *endVal != '\0' && ! isspace( *endVal ) ) |
812 goto synErr; | |
813 } | |
814 | |
815 if ( strcmp( ruleName, "action" ) != 0 ) | |
816 { | |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
817 Log_dbg( LOG_DBG_CONFIG, |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
818 "Adding rule type %d value %s", |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
819 rule.type, value ); |
128 | 820 Flt_addRule( f, rule ); |
821 } | |
822 } | |
823 | |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
824 Log_dbg( LOG_DBG_CONFIG, "Adding filter, action %d", f->action ); |
128 | 825 Flt_addFilter( f ); |
826 return; | |
827 | |
828 synErr: | |
829 logSyntaxErr( line ); | |
830 return; | |
831 } | |
832 | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
833 void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
834 Cfg_read( void ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
835 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
836 char *p; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
837 FILE *f; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
838 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
|
839 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
840 snprintf( file, MAXCHAR, CONFIGFILE ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
841 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
|
842 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
843 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
|
844 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
845 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
846 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
|
847 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
848 p = Utl_stripWhiteSpace( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
849 Utl_stripComment( p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
850 Utl_cpyStr( lowerLine, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
851 Utl_toLower( lowerLine ); |
128 | 852 p = lowerLine; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
853 if ( *p == '\0' ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
854 continue; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
855 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
|
856 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
|
857 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
|
858 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
|
859 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
|
860 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
|
861 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
|
862 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
|
863 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
|
864 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
|
865 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
|
866 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
|
867 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
|
868 getBool( &config.autoSubscribe, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
869 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
|
870 getBool( &config.autoUnsubscribe, p ); |
82 | 871 else if ( strcmp( "info-always-unread", name ) == 0 ) |
872 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
|
873 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
|
874 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
|
875 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
|
876 /* 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
|
877 getStr( config.hostnameMsgId, line ); |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
878 else if ( strcmp( "post-locally", name ) == 0 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
879 getBool( &config.postLocal, p ); |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
880 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
|
881 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
882 getStr( s, p ); |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
883 if ( ! isValidAutoSubscribeMode( s ) ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
884 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
885 logSyntaxErr( line ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
886 return; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
887 } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
888 else |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
889 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
|
890 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
891 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
|
892 getStr( config.mailTo, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
893 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
|
894 getExpire( p ); |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
895 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
|
896 getAutoSubscribeMode( p ); |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
150
diff
changeset
|
897 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
|
898 getDebugMask( p ); |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
899 else if ( strcmp( "getgroups", name ) == 0 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
900 getGroups( p, TRUE ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
901 else if ( strcmp( "omitgroups", name ) == 0 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
902 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
|
903 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
|
904 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
|
905 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
|
906 getStr( config.fromDomain, p ); |
128 | 907 /* 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
|
908 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
|
909 getText( config.organization, line ); |
128 | 910 else if ( strcmp( "server", name ) == 0 ) |
911 getServ( line ); | |
912 else if ( strcmp( "filter", name ) == 0 ) | |
913 getFilter( line ); | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
914 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
915 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
|
916 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
917 fclose( f ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
918 if ( ! config.numServ ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
919 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
920 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
|
921 exit( EXIT_FAILURE ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
922 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
923 } |