annotate src/configfile.c @ 150:1c7303c71f66 noffle

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