Mercurial > noffle
annotate src/configfile.c @ 128:8897b7e3b108 noffle
[svn] Add article filtering
author | bears |
---|---|
date | Wed, 09 Aug 2000 22:19:17 +0100 |
parents | 6f681d41734c |
children | 7dfbb1c20a81 |
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 |
128 | 9 $Id: configfile.c 189 2000-08-09 21:19:17Z 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; |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
80 Bool postLocal; |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
81 Str defaultAutoSubscribeMode; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
82 Str mailTo; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
83 int defaultExpire; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
84 int numServ; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
85 int maxServ; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
86 ServEntry *serv; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
87 int servIdx; /* for server enumeration */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
88 int numExpire; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
89 int maxExpire; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
90 ExpireEntry *expire; |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
91 int numAutoSubscribeMode; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
92 int maxAutoSubscribeMode; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
93 AutoSubscribeModeEntry *autoSubscribeMode; |
111 | 94 Str pathHeader; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
95 } config = |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
96 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
97 SPOOLDIR, /* spoolDir */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
98 VERSION, /* version */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
99 300, /* maxFetch */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
100 30, /* autoUnsubscribeDays */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
101 7, /* threadFollowTime */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
102 30, /* connectTimeout */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
103 FALSE, /* autoSubscribe */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
104 FALSE, /* autoUnsubscribe */ |
82 | 105 TRUE, /* infoAlways */ |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
106 TRUE, /* replaceMsgId */ |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
107 FALSE, /* postLocal */ |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
108 "over", /* defaultAutoSubscribeMode */ |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
109 "", /* mailTo */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
110 14, /* defaultExpire */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
111 0, /* numServ */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
112 0, /* maxServ */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
113 NULL, /* serv */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
114 0, /* servIdx */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
115 0, /* numExpire */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
116 0, /* maxExpire */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
117 NULL, /* expire */ |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
118 0, /* numAutoSubscribeMode */ |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
119 0, /* maxAutoSubscribeMode */ |
111 | 120 NULL, /* autoSubscribeMode */ |
121 "" /* pathHeader */ | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
122 }; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
123 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
124 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
|
125 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
|
126 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
127 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
|
128 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
|
129 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
|
130 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
|
131 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
|
132 Bool Cfg_autoSubscribe( void ) { return config.autoSubscribe; } |
82 | 133 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
|
134 Bool Cfg_replaceMsgId( void ) { return config.replaceMsgId; } |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
135 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
|
136 const char * Cfg_defaultAutoSubscribeMode( void ) { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
137 return config.defaultAutoSubscribeMode; } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
138 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
|
139 int Cfg_defaultExpire( void ) { return config.defaultExpire; } |
111 | 140 const char * Cfg_pathHeader( void ) { return config.pathHeader; } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
141 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
142 void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
143 Cfg_beginServEnum( void ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
144 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
145 config.servIdx = 0; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
146 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
147 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
148 Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
149 Cfg_nextServ( Str name ) |
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 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
|
152 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
153 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
|
154 ++config.servIdx; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
155 return TRUE; |
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 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
158 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
159 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
|
160 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
161 int i; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
162 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
163 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
|
164 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
|
165 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
166 *idx = i; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
167 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
168 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
169 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
170 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
171 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
172 Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
173 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
|
174 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
175 int idx; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
176 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
177 return searchServ( name, &idx ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
178 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
179 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
180 Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
181 Cfg_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
|
182 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
183 Bool exists1, exists2; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
184 int idx1, idx2; |
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 exists1 = searchServ( name1, &idx1 ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
187 exists2 = searchServ( name2, &idx2 ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
188 if ( exists1 && exists2 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
189 return ( idx1 < idx2 ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
190 if ( exists1 && ! exists2 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
191 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
192 /* ( ! exists1 && exists2 ) || ( ! exists1 && ! exists2 ) */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
193 return FALSE; |
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 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
196 void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
197 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
|
198 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
199 int idx; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
200 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
201 if ( searchServ( name, &idx ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
202 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
203 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
|
204 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
|
205 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
206 else |
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 user[ 0 ] = '\0'; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
209 pass[ 0 ] = '\0'; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
210 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
211 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
212 |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
213 int |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
214 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
|
215 { |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
216 int i, res; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
217 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
218 for ( i = 0; i < config.numExpire; i++ ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
219 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
|
220 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
221 res = config.expire[ i ].days; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
222 Log_dbg( "Custom expire period %d for group %s", res, grp ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
223 return res; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
224 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
225 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
226 return Cfg_defaultExpire(); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
227 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
228 |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
229 const char * |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
230 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
|
231 { |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
232 int i; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
233 const char *res; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
234 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
235 for ( i = 0; i < config.numAutoSubscribeMode; i++ ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
236 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
|
237 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
238 res = config.autoSubscribeMode[ i ].mode; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
239 Log_dbg( "Custom auto subscribe mode %s for group %s", res, grp ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
240 return res; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
241 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
242 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
243 return Cfg_defaultAutoSubscribeMode(); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
244 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
245 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
246 GroupEnum * |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
247 new_GetGrEn( const char *name ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
248 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
249 GroupEnum *res; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
250 int servIdx; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
251 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
252 res = (GroupEnum *) malloc( sizeof( GroupEnum ) ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
253 if ( res == NULL ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
254 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
255 Log_err( "Malloc of GroupEnum failed." ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
256 exit( EXIT_FAILURE ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
257 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
258 if ( ! searchServ( name, &servIdx ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
259 res->groupEntry = NULL; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
260 else |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
261 res->groupEntry = &config.serv[ servIdx ].getgroups; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
262 GrEn_first( res ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
263 return res; |
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 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
266 GroupEnum * |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
267 new_OmitGrEn( const char *name ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
268 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
269 GroupEnum *res; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
270 int servIdx; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
271 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
272 res = (GroupEnum *) malloc( sizeof( GroupEnum ) ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
273 if ( res == NULL ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
274 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
275 Log_err( "Malloc of GroupEnum failed." ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
276 exit( EXIT_FAILURE ); |
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 if ( ! searchServ( name, &servIdx ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
279 res->groupEntry = NULL; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
280 else |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
281 res->groupEntry = &config.serv[ servIdx ].omitgroups; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
282 GrEn_first( res ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
283 return res; |
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 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
286 void |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
287 del_GrEn( GroupEnum *ge ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
288 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
289 free(ge); |
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 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
292 void |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
293 GrEn_first( GroupEnum *ge ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
294 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
295 ge->groupIdx = 0; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
296 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
297 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
298 const char * |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
299 GrEn_next( GroupEnum *ge ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
300 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
301 if ( ge->groupEntry == NULL || |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
302 ge->groupIdx >= ge->groupEntry->numGroup ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
303 return NULL; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
304 return ge->groupEntry->groups[ ge->groupIdx++ ]; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
305 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
306 |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
307 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
308 logSyntaxErr( const char *line ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
309 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
310 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
|
311 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
312 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
313 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
314 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
|
315 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
316 Str value, name, lowerLn; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
317 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
318 strcpy( lowerLn, line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
319 Utl_toLower( lowerLn ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
320 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
|
321 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
322 logSyntaxErr( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
323 return; |
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 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
|
327 *variable = TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
328 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
|
329 *variable = FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
330 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
331 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
|
332 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
333 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
334 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
335 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
|
336 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
337 int value; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
338 Str name; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
339 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
340 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
|
341 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
342 logSyntaxErr( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
343 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
344 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
345 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
|
346 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
347 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
|
348 return; |
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 *variable = value; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
351 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
352 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
353 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
354 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
|
355 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
356 Str dummy; |
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 ( 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
|
359 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
360 logSyntaxErr( line ); |
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 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
364 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
365 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
366 getServ( const char *line ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
367 { |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
368 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
|
369 int r, len; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
370 ServEntry entry; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
371 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
372 memset( &entry, 0, sizeof( entry ) ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
373 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
|
374 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
|
375 if ( r < 2 ) |
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 logSyntaxErr( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
378 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
379 } |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
380 len = strlen( name ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
381 /* 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
|
382 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
|
383 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
|
384 name[ len - 4 ] = '\0'; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
385 Utl_toLower( name ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
386 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
387 Utl_allocAndCpy( &entry.name, name ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
388 Utl_allocAndCpy( &entry.user, user ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
389 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
|
390 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
391 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
|
392 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
393 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
|
394 ( config.maxServ + 5 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
395 * sizeof( ServEntry ) ) ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
396 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
397 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
|
398 exit( EXIT_FAILURE ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
399 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
400 config.maxServ += 5; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
401 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
402 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
|
403 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
404 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
405 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
406 getExpire( const char *line ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
407 { |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
408 Str dummy, pattern; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
409 ExpireEntry entry; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
410 int days; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
411 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
412 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
|
413 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
414 logSyntaxErr( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
415 return; |
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 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
418 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
419 if ( days < 0 ) |
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( "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
|
422 line, days ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
423 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
424 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
425 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
426 Utl_toLower( pattern ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
427 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
|
428 entry.days = days; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
429 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
430 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
|
431 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
432 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
|
433 ( config.maxExpire + 5 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
434 * sizeof( ExpireEntry ) ) ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
435 { |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
436 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
|
437 exit( EXIT_FAILURE ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
438 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
439 config.maxExpire += 5; |
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 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
|
442 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
443 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
444 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
445 static void |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
446 getGroups( char *line, Bool isGet ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
447 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
448 const char *name; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
449 ItemList *patterns; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
450 const char *pattern; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
451 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
452 if ( config.numServ == 0 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
453 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
454 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
|
455 return; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
456 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
457 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
458 name = line; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
459 /* Skip over name and terminate it */ |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
460 while ( line[ 0 ] != '\0' && ! isspace( line[ 0 ] ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
461 line++; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
462 if ( line[ 0 ] == '\0' ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
463 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
464 logSyntaxErr( name ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
465 return; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
466 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
467 line[ 0 ] = '\0'; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
468 line++; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
469 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
470 patterns = new_Itl( line, " ," ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
471 for( pattern = Itl_first( patterns ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
472 pattern != NULL; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
473 pattern = Itl_next( patterns ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
474 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
475 GroupEntry *g; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
476 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
477 if ( isGet ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
478 g = &config.serv[ config.numServ - 1 ].getgroups; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
479 else |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
480 g = &config.serv[ config.numServ - 1 ].omitgroups; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
481 if ( g->maxGroup < g->numGroup + 1 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
482 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
483 if ( ! ( g->groups = realloc( g->groups, |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
484 ( g->maxGroup + 5 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
485 * sizeof( char * ) ) ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
486 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
487 Log_err( "Could not realloc group list" ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
488 exit( EXIT_FAILURE ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
489 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
490 g->maxGroup += 5; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
491 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
492 Utl_allocAndCpy( &g->groups[ g->numGroup++ ], pattern ); |
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 del_Itl( patterns) ; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
495 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
496 |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
497 static Bool |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
498 isValidAutoSubscribeMode( const char *mode ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
499 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
500 return strcmp( mode, "full" ) == 0 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
501 || strcmp( mode, "thread" ) == 0 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
502 || strcmp( mode, "over" ) == 0 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
503 || strcmp( mode, "off" ) == 0; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
504 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
505 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
506 static void |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
507 getAutoSubscribeMode( const char *line ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
508 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
509 Str dummy, pattern, mode; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
510 AutoSubscribeModeEntry entry; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
511 int items; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
512 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
513 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
|
514 if ( items == 2 ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
515 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
516 /* Backwards compat. default-auto-subscribe-mode */ |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
517 Utl_cpyStr( mode, pattern ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
518 Utl_toLower( mode ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
519 if ( ! isValidAutoSubscribeMode( mode ) ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
520 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
521 logSyntaxErr( line ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
522 return; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
523 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
524 strcpy( config.defaultAutoSubscribeMode, mode ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
525 return; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
526 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
527 else if ( items != 3 ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
528 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
529 logSyntaxErr( line ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
530 return; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
531 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
532 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
533 Utl_toLower( mode ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
534 if ( ! isValidAutoSubscribeMode( mode ) ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
535 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
536 logSyntaxErr( line ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
537 return; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
538 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
539 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
540 Utl_toLower( pattern ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
541 Utl_allocAndCpy( &entry.pattern, pattern ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
542 Utl_allocAndCpy( &entry.mode, mode ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
543 |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
544 if ( config.maxAutoSubscribeMode < config.numAutoSubscribeMode + 1 ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
545 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
546 if ( ! ( config.autoSubscribeMode = |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
547 realloc( config.autoSubscribeMode, |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
548 ( config.maxAutoSubscribeMode + 5 ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
549 * sizeof( AutoSubscribeModeEntry ) ) ) ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
550 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
551 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
|
552 exit( EXIT_FAILURE ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
553 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
554 config.maxAutoSubscribeMode += 5; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
555 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
556 config.autoSubscribeMode[ config.numAutoSubscribeMode++ ] = entry; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
557 } |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
558 |
128 | 559 static const char * |
560 getToken( const char *line, Str value ) | |
561 { | |
562 Bool isQuoted; | |
563 char quoteChar; | |
564 Bool seenEscape; | |
565 char *maxVal; | |
566 | |
567 while ( *line != '\0' && isspace( *line ) ) | |
568 line++; | |
569 if ( *line == '\0' ) | |
570 return NULL; | |
571 | |
572 maxVal = &value[ MAXCHAR ]; | |
573 isQuoted = ( *line == '\'' || *line == '"' ); | |
574 if ( isQuoted ) | |
575 { | |
576 quoteChar = *line; | |
577 line++; | |
578 | |
579 seenEscape = FALSE; | |
580 while ( *line != '\0' | |
581 && ( *line != quoteChar || seenEscape ) | |
582 && value < maxVal ) | |
583 { | |
584 if ( seenEscape ) | |
585 { | |
586 *value++ = *line; | |
587 seenEscape = FALSE; | |
588 } | |
589 else | |
590 { | |
591 if ( *line == '\\' ) | |
592 seenEscape = TRUE; | |
593 else | |
594 *value++ = *line; | |
595 } | |
596 line++; | |
597 } | |
598 | |
599 if ( *line == quoteChar ) | |
600 line++; | |
601 } | |
602 else | |
603 { | |
604 while ( *line != '\0' && ! isspace( *line ) && value < maxVal ) | |
605 *value++ = *line++; | |
606 } | |
607 *value = '\0'; | |
608 return line; | |
609 } | |
610 | |
611 static void | |
612 getFilter( const char *line ) | |
613 { | |
614 Str ruleBuf, value; | |
615 const char *l; | |
616 char *p, *ruleName; | |
617 Filter *f; | |
618 FilterRule rule; | |
619 Bool seenAction; | |
620 | |
621 f = new_Filter(); | |
622 | |
623 /* Skip "filter" */ | |
624 l = Utl_restOfLn( line, 1 ); | |
625 seenAction = FALSE; | |
626 | |
627 for(;;) | |
628 { | |
629 while ( *l != '\0' && isspace( *l ) ) | |
630 l++; | |
631 | |
632 if ( *l == '\0' ) | |
633 break; | |
634 | |
635 /* Get the rule title */ | |
636 p = ruleBuf; | |
637 while ( *l != '\0' && *l != '=' && *l != '<' && *l != '>' ) | |
638 *p++ = *l++; | |
639 *p = '\0'; | |
640 ruleName = Utl_stripWhiteSpace( ruleBuf ); | |
641 Utl_toLower( ruleName ); | |
642 | |
643 if ( *ruleName == '\0' ) | |
644 goto synErr; | |
645 | |
646 /* Do we know this rule? */ | |
647 if ( strcmp( ruleName, "group" ) == 0 ) | |
648 rule.type = RULE_NEWSGROUP; | |
649 else if ( strcmp( ruleName, "subject" ) == 0 ) | |
650 rule.type = RULE_SUBJECT; | |
651 else if ( strcmp( ruleName, "from" ) == 0 ) | |
652 rule.type = RULE_FROM; | |
653 else if ( strcmp( ruleName, "msgid" ) == 0 ) | |
654 rule.type = RULE_MSGID; | |
655 else if ( strcmp( ruleName, "bytes" ) == 0 ) | |
656 rule.type = RULE_BYTES_LT; | |
657 else if ( strcmp( ruleName, "lines" ) == 0 ) | |
658 rule.type = RULE_LINES_LT; | |
659 else if ( strcmp( ruleName, "refs" ) == 0 ) | |
660 rule.type = RULE_NOREFS_LT; | |
661 else if ( strcmp( ruleName, "xposts" ) == 0 ) | |
662 rule.type = RULE_XPOSTS_LT; | |
663 else if ( strcmp( ruleName, "action" ) != 0 ) | |
664 goto synErr; | |
665 | |
666 if ( rule.type == RULE_BYTES_LT || | |
667 rule.type == RULE_LINES_LT || | |
668 rule.type == RULE_NOREFS_LT || | |
669 rule.type == RULE_XPOSTS_LT ) | |
670 { | |
671 if ( *l == '=' ) | |
672 rule.type += 1; | |
673 else if ( *l == '>' ) | |
674 rule.type += 2; | |
675 else if ( *l != '<' ) | |
676 goto synErr; | |
677 } | |
678 else if ( *l != '=' ) | |
679 goto synErr; | |
680 | |
681 /* Skip past '=' (or '>' or '<') */ | |
682 l++; | |
683 | |
684 /* OK, we now have a valid rule. What value? */ | |
685 l = getToken( l, value ); | |
686 if ( l == NULL ) | |
687 goto synErr; | |
688 | |
689 if ( strcmp( ruleName, "action" ) == 0 ) | |
690 { | |
691 if ( seenAction ) | |
692 goto synErr; | |
693 | |
694 Utl_toLower( value ); | |
695 if ( strcmp( value, "full" ) == 0 ) | |
696 f->action = FILTER_FULL; | |
697 else if ( strcmp( value, "over" ) == 0 ) | |
698 f->action = FILTER_XOVER; | |
699 else if ( strcmp( value, "thread" ) == 0 ) | |
700 f->action = FILTER_THREAD; | |
701 else if ( strcmp( value, "discard" ) == 0 ) | |
702 f->action = FILTER_DISCARD; | |
703 seenAction = TRUE; | |
704 } | |
705 else if ( rule.type == RULE_NEWSGROUP ) | |
706 Utl_allocAndCpy( &rule.data.grp, value ); | |
707 else if ( rule.type >= RULE_SUBJECT && rule.type <= RULE_MSGID ) | |
708 { | |
709 if ( regcomp( &rule.data.regex, value, REG_EXTENDED ) != 0 ) | |
710 goto synErr; | |
711 } | |
712 else | |
713 { | |
714 char * endVal; | |
715 | |
716 rule.data.amount = strtoul( value, &endVal, 0 ); | |
717 if ( *endVal != '\0' && ! isspace( *endVal ) ) | |
718 goto synErr; | |
719 } | |
720 | |
721 if ( strcmp( ruleName, "action" ) != 0 ) | |
722 { | |
723 Log_dbg( "Adding rule type %d value %s", rule.type, value ); | |
724 Flt_addRule( f, rule ); | |
725 } | |
726 } | |
727 | |
728 Log_dbg( "Adding filter, action %d", f->action ); | |
729 Flt_addFilter( f ); | |
730 return; | |
731 | |
732 synErr: | |
733 logSyntaxErr( line ); | |
734 return; | |
735 } | |
736 | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
737 void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
738 Cfg_read( void ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
739 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
740 char *p; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
741 FILE *f; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
742 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
|
743 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
744 snprintf( file, MAXCHAR, CONFIGFILE ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
745 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
|
746 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
747 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
|
748 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
749 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
750 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
|
751 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
752 p = Utl_stripWhiteSpace( line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
753 Utl_stripComment( p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
754 Utl_cpyStr( lowerLine, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
755 Utl_toLower( lowerLine ); |
128 | 756 p = lowerLine; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
757 if ( *p == '\0' ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
758 continue; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
759 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
|
760 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
|
761 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
|
762 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
|
763 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
|
764 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
|
765 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
|
766 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
|
767 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
|
768 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
|
769 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
|
770 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
|
771 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
|
772 getBool( &config.autoSubscribe, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
773 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
|
774 getBool( &config.autoUnsubscribe, p ); |
82 | 775 else if ( strcmp( "info-always-unread", name ) == 0 ) |
776 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
|
777 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
|
778 getBool( &config.replaceMsgId, p ); |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
779 else if ( strcmp( "post-locally", name ) == 0 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
780 getBool( &config.postLocal, p ); |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
781 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
|
782 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
783 getStr( s, p ); |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
784 if ( ! isValidAutoSubscribeMode( s ) ) |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
785 { |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
786 logSyntaxErr( line ); |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
787 return; |
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
788 } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
789 else |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
790 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
|
791 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
792 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
|
793 getStr( config.mailTo, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
794 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
|
795 getExpire( p ); |
104
402300614185
[svn] Remove expire enum, add Cfg_expire(grp). Rename Cfg_autoSubscribeMode()
bears
parents:
88
diff
changeset
|
796 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
|
797 getAutoSubscribeMode( p ); |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
798 else if ( strcmp( "getgroups", name ) == 0 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
799 getGroups( p, TRUE ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
800 else if ( strcmp( "omitgroups", name ) == 0 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
82
diff
changeset
|
801 getGroups( p, FALSE ); |
128 | 802 /* The following need line because they may have uppercase data */ |
803 else if ( strcmp( "server", name ) == 0 ) | |
804 getServ( line ); | |
805 else if ( strcmp( "path-header", name ) == 0 ) | |
806 getStr( config.pathHeader, p ); | |
807 else if ( strcmp( "filter", name ) == 0 ) | |
808 getFilter( line ); | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
809 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
810 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
|
811 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
812 fclose( f ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
813 if ( ! config.numServ ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
814 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
815 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
|
816 exit( EXIT_FAILURE ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
817 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
818 } |