annotate src/configfile.c @ 500:614a3177b15c noffle tip

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