Mercurial > noffle
annotate src/client.c @ 185:fed1334d766b noffle
[svn] * src/client.c: Change variable only used on constant to 'const'.
* src/filter.c: Add a couple of 'return's after ASSERT() to remove
compiler warnings about functions needing returns.
* NEWS,TODO,configure,configure.in,noffle.conf.example,docs/NOTES,
docs/noffle.conf.5,src/client.c,src/configfile.c,src/content.c,
src/control.c,src/database.c,src/fetch.c,src/fetchlist.c,src/filter.c,
src/group.c,src/lock.c,src/log.c,src/log.h,src/noffle.c,src/outgoing.c,
src/post.c,src/protocol.c,src/request.c,src/server.c,src/util.c:
Debug logging is always compiled and selected via noffle.conf. All debug
logs are classified as all, none, config, control, expire, fetch,
filter, newsbase, noffle, post, protocol, requests and server.
author | bears |
---|---|
date | Sun, 05 Aug 2001 09:24:22 +0100 |
parents | c912e8288164 |
children | 166008a80f03 |
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 client.c |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
3 |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
4 $Id: client.c 300 2001-08-05 08:24:22Z bears $ |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
5 */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
6 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
7 #if HAVE_CONFIG_H |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
8 #include <config.h> |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
9 #endif |
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 #include "client.h" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
12 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
13 #include <stdio.h> |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
14 #include <arpa/inet.h> |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
15 #include <ctype.h> |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
16 #include <netdb.h> |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
17 #include <netinet/in.h> |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
18 #include <signal.h> |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
19 #include <stdarg.h> |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
20 #include <sys/socket.h> |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
21 #include <unistd.h> |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
22 #include "configfile.h" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
23 #include "content.h" |
95 | 24 #include "control.h" |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
25 #include "dynamicstring.h" |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
26 #include "filter.h" |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
27 #include "group.h" |
67
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
28 #include "itemlist.h" |
127 | 29 #include "lock.h" |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
30 #include "log.h" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
31 #include "over.h" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
32 #include "protocol.h" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
33 #include "pseudo.h" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
34 #include "request.h" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
35 #include "util.h" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
36 #include "wildmat.h" |
54
125d79c9e586
[svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents:
48
diff
changeset
|
37 #include "portable.h" |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
38 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
39 /* |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
40 Some newsgroups names are reserved for server-specific or server |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
41 pseudo groups. We don't want to fetch them. For example, INN |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
42 keeps all its control messages in a 'control' hierarchy, and |
103 | 43 used the "to." hierarchy for dark and mysterious purposes I think |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
44 are to do with newsfeeds. The recommended restrictions are documented |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
45 in C.Lindsay, "News Article Format", <draft-ietf-usefor-article-03.txt>. |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
46 */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
47 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
48 struct ForbiddenGroupName |
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 const char *pattern; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
51 Bool match; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
52 } forbiddenGroupNames[] = |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
53 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
54 { "*.*", FALSE }, /* Single component */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
55 { "control.*", TRUE }, /* control.* groups */ |
103 | 56 { "to.*", TRUE }, /* to.* groups */ |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
57 { "*.all", TRUE }, /* 'all' as a component */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
58 { "*.all.*", TRUE }, |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
59 { "all.*", TRUE }, |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
60 { "*.ctl", TRUE }, /* 'ctl' as a component */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
61 { "*.ctl.*", TRUE }, |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
62 { "ctl.*", TRUE } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
63 }; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
64 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
65 struct |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
66 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
67 FILE* in; /* Receiving socket from server */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
68 FILE* out; /* Sending socket to server */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
69 Str lastCmd; /* Last command line */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
70 Str lastStat; /* Response from server to last command */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
71 Str grp; /* Selected group */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
72 int rmtFirst; /* First article of current group at server */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
73 int rmtLast; /* Last article of current group at server */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
74 Bool auth; /* Authetication already done? */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
75 Str serv; /* Remote server name */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
76 } client = { NULL, NULL, "", "", "", 1, 0, FALSE, "" }; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
77 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
78 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
79 logBreakDown( void ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
80 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
81 Log_err( "Connection to remote server lost " |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
82 "(article numbers could be inconsistent)" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
83 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
84 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
85 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
86 getLn( Str line ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
87 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
88 Bool r; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
89 |
144
8b9366fc1361
[svn] Added timeout to Prt_getLn to avoid Noffle hanging if the
enz
parents:
130
diff
changeset
|
90 r = Prt_getLn( line, client.in, Cfg_connectTimeout() ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
91 if ( ! r ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
92 logBreakDown(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
93 return r; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
94 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
95 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
96 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
97 getTxtLn( Str line, Bool *err ) |
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 Bool r; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
100 |
144
8b9366fc1361
[svn] Added timeout to Prt_getLn to avoid Noffle hanging if the
enz
parents:
130
diff
changeset
|
101 r = Prt_getTxtLn( line, err, client.in, Cfg_connectTimeout() ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
102 if ( *err ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
103 logBreakDown(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
104 return r; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
105 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
106 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
107 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
108 putTxtBuf( const char *buf ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
109 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
110 Prt_putTxtBuf( buf, client.out ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
111 fflush( client.out ); |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
112 Log_dbg( LOG_DBG_PROTOCOL, "[S FLUSH]" ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
113 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
114 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
115 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
116 putEndOfTxt( void ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
117 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
118 Prt_putEndOfTxt( client.out ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
119 fflush( client.out ); |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
120 Log_dbg( LOG_DBG_PROTOCOL, "[S FLUSH]" ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
121 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
122 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
123 static Bool |
157
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
124 putCmdLn( const char *line ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
125 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
126 Bool err; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
127 unsigned int n; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
128 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
129 strcpy( client.lastCmd, line ); |
157
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
130 strcpy( client.lastStat, "[no status available]" ); |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
131 Log_dbg( LOG_DBG_PROTOCOL, "[S] %s", line ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
132 n = fprintf( client.out, "%s\r\n", line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
133 err = ( n != strlen( line ) + 2 ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
134 if ( err ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
135 logBreakDown();; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
136 return ! err; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
137 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
138 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
139 static Bool |
157
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
140 putCmd( const char *fmt, ... ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
141 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
142 Str line; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
143 va_list ap; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
144 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
145 va_start( ap, fmt ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
146 vsnprintf( line, MAXCHAR, fmt, ap ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
147 va_end( ap ); |
157
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
148 if ( ! putCmdLn( line ) ) |
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
149 return FALSE; |
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
150 fflush( client.out ); |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
151 Log_dbg( LOG_DBG_PROTOCOL, "[S FLUSH]" ); |
157
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
152 return TRUE; |
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
153 } |
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
154 |
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
155 static Bool |
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
156 putCmdNoFlush( const char *fmt, ... ) |
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
157 { |
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
158 Str line; |
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
159 va_list ap; |
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
160 |
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
161 va_start( ap, fmt ); |
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
162 vsnprintf( line, MAXCHAR, fmt, ap ); |
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
163 va_end( ap ); |
976ff791c7ec
[svn] Extract common code from putCmd and putCmdNoFlush,
enz
parents:
144
diff
changeset
|
164 return putCmdLn( line ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
165 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
166 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
167 static int getStat( void ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
168 |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
169 static int |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
170 performAuth( void ) |
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 int stat; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
173 Str user, pass; |
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 Cfg_authInfo( client.serv, user, pass ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
176 if ( strcmp( user, "" ) == 0 ) |
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 Log_err( "No username for authentication set" ); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
179 return STAT_AUTH_REQUIRED; |
43
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 putCmd( "AUTHINFO USER %s", user ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
182 stat = getStat(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
183 if ( stat == STAT_AUTH_ACCEPTED ) |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
184 return stat; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
185 else if ( stat != STAT_MORE_AUTH_REQUIRED ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
186 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
187 Log_err( "Username rejected. Server stat: %s", client.lastStat ); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
188 return stat; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
189 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
190 if ( strcmp( pass, "" ) == 0 ) |
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 Log_err( "No password for authentication set" ); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
193 return STAT_AUTH_REQUIRED; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
194 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
195 putCmd( "AUTHINFO PASS %s", pass ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
196 stat = getStat(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
197 if ( stat != STAT_AUTH_ACCEPTED ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
198 Log_err( "Password rejected. Server status: %s", client.lastStat ); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
199 return stat; |
43
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 static int |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
203 getStat( void ) |
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 result; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
206 Str lastCmd; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
207 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
208 if ( ! getLn( client.lastStat ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
209 result = STAT_PROGRAM_FAULT; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
210 else if ( sscanf( client.lastStat, "%d", &result ) != 1 ) |
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 Log_err( "Invalid server status: %s", client.lastStat ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
213 result = STAT_PROGRAM_FAULT; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
214 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
215 if ( result == STAT_AUTH_REQUIRED && ! client.auth ) |
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 client.auth = TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
218 strcpy( lastCmd, client.lastCmd ); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
219 result = performAuth(); |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
220 if ( result == STAT_AUTH_ACCEPTED ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
221 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
222 putCmd( lastCmd ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
223 return getStat(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
224 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
225 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
226 return result; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
227 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
228 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
229 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
230 connectAlarm( int sig ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
231 { |
74 | 232 UNUSED( sig ); |
233 | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
234 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
235 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
236 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
237 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
238 connectWithTimeout( int sock, const struct sockaddr *servAddr, |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
239 socklen_t addrLen ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
240 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
241 sig_t oldHandler; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
242 int r, to; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
243 |
164
94f2e5607772
[svn] * src/client.c,src/protocol.c,src/util.h,src/util.c: Common up
bears
parents:
157
diff
changeset
|
244 oldHandler = Utl_installSignalHandler( SIGALRM, connectAlarm ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
245 if ( oldHandler == SIG_ERR ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
246 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
247 Log_err( "client.c:connectWithTimeout: signal failed." ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
248 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
249 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
250 to = Cfg_connectTimeout(); |
74 | 251 if ( alarm( ( unsigned int ) to ) != 0 ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
252 Log_err( "client.c:connectWithTimeout: Alarm was already set." ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
253 r = connect( sock, servAddr, addrLen ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
254 alarm( 0 ); |
164
94f2e5607772
[svn] * src/client.c,src/protocol.c,src/util.h,src/util.c: Common up
bears
parents:
157
diff
changeset
|
255 Utl_installSignalHandler( SIGALRM, oldHandler ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
256 return ( r >= 0 ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
257 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
258 |
127 | 259 static DynStr * |
260 collectTxt( void ) | |
261 { | |
262 DynStr *res; | |
263 Str line; | |
264 Bool err; | |
265 | |
266 res = new_DynStr(2048); | |
267 if ( res == NULL ) | |
268 return NULL; | |
269 | |
270 while ( getTxtLn( line, &err ) && ! err ) | |
271 DynStr_appLn( res, line ); | |
272 | |
273 if ( err ) | |
274 { | |
275 del_DynStr( res ); | |
276 return NULL; | |
277 } | |
278 else | |
279 return res; | |
280 } | |
281 | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
282 Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
283 Client_connect( const char *serv ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
284 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
285 unsigned short int port; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
286 int sock, i; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
287 unsigned int stat; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
288 struct hostent *hp; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
289 char *pStart, *pColon; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
290 Str host, s; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
291 struct sockaddr_in sIn; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
292 |
127 | 293 ASSERT( client.in == NULL && client.out == NULL ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
294 client.auth = FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
295 Utl_cpyStr( s, serv ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
296 pStart = Utl_stripWhiteSpace( s ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
297 pColon = strstr( pStart, ":" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
298 if ( pColon == NULL ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
299 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
300 strcpy( host, pStart ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
301 port = 119; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
302 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
303 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
304 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
305 *pColon = '\0'; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
306 strcpy( host, pStart ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
307 if ( sscanf( pColon + 1, "%hi", &port ) != 1 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
308 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
309 Log_err( "Syntax error in server name: '%s'", serv ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
310 return FALSE;; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
311 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
312 if ( port <= 0 || port > 65535 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
313 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
314 Log_err( "Invalid port number %hi. Must be in [1, 65535]", port ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
315 return FALSE;; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
316 } |
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 memset( (void *)&sIn, 0, sizeof( sIn ) ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
319 hp = gethostbyname( host ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
320 if ( hp ) |
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 for ( i = 0; (hp->h_addr_list)[ i ]; ++i ) |
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 sIn.sin_family = hp->h_addrtype; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
325 sIn.sin_port = htons( port ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
326 sIn.sin_addr = *( (struct in_addr *)hp->h_addr_list[ i ] ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
327 sock = socket( AF_INET, SOCK_STREAM, 0 ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
328 if ( sock < 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
329 break; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
330 if ( ! connectWithTimeout( sock, (struct sockaddr *)&sIn, |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
331 sizeof( sIn ) ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
332 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
333 close( sock ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
334 break; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
335 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
336 if ( ! ( client.out = fdopen( sock, "w" ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
337 || ! ( client.in = fdopen( dup( sock ), "r" ) ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
338 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
339 if ( client.out != NULL ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
340 fclose( client.out ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
341 close( sock ); |
127 | 342 client.in = client.out = NULL; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
343 break; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
344 } |
172 | 345 Utl_cpyStr( client.serv, serv ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
346 stat = getStat(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
347 if ( stat == STAT_READY_POST_ALLOW || |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
348 stat == STAT_READY_NO_POST_ALLOW ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
349 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
350 /* INN needs a MODE READER before it will permit POST. */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
351 putCmd( "MODE READER" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
352 stat = getStat(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
353 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
354 switch( stat ) { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
355 case STAT_READY_POST_ALLOW: |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
356 case STAT_READY_NO_POST_ALLOW: |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
357 Log_inf( "Connected to %s:%d", |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
358 inet_ntoa( sIn.sin_addr ), port ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
359 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
360 default: |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
361 Log_err( "Bad server stat %d", stat ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
362 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
363 shutdown( fileno( client.out ), 0 ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
364 fclose( client.in ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
365 fclose( client.out ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
366 close( sock ); |
127 | 367 client.in = client.out = NULL; |
43
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 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
371 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
372 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
373 static Bool |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
374 isGetGroup( const char *name ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
375 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
376 GroupEnum *ge; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
377 Bool emptyList; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
378 const char *pattern; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
379 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
380 emptyList = TRUE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
381 ge = new_GetGrEn( client.serv ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
382 while ( ( pattern = GrEn_next( ge ) ) != NULL ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
383 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
384 emptyList = FALSE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
385 if ( Wld_match( name, pattern ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
386 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
387 del_GrEn( ge ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
388 return TRUE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
389 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
390 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
391 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
392 del_GrEn( ge ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
393 return emptyList; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
394 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
395 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
396 static Bool |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
397 isOmitGroup( const char *name ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
398 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
399 GroupEnum *ge; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
400 const char *pattern; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
401 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
402 ge = new_OmitGrEn( client.serv ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
403 while ( ( pattern = GrEn_next( ge ) ) != NULL ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
404 if ( Wld_match( name, pattern ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
405 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
406 del_GrEn( ge ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
407 return TRUE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
408 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
409 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
410 del_GrEn( ge ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
411 return FALSE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
412 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
413 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
414 static Bool |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
415 isForbiddenGroupName( const char *name ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
416 { |
58
b4e6f7f96135
[svn] Add some intermediate variables for easier debugging in needsMark().
enz
parents:
57
diff
changeset
|
417 size_t i; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
418 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
419 for ( i = 0; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
420 i < sizeof( forbiddenGroupNames ) / |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
421 sizeof( struct ForbiddenGroupName ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
422 i++ ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
423 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
424 /* Negate result of Wld_match to ensure it is 1 or 0. */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
425 if ( forbiddenGroupNames[i].match != |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
426 ( ! Wld_match( name, forbiddenGroupNames[i].pattern ) ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
427 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
428 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
429 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
430 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
431 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
432 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
433 static void |
127 | 434 processGrps( const char *lines, Bool noServerPattern ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
435 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
436 char postAllow; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
437 int first, last; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
438 Str grp, line, file; |
127 | 439 Bool groupupdate; |
440 | |
441 ASSERT( ! Lock_gotLock() ); | |
442 if ( ! Lock_openDatabases() ) | |
443 return; | |
444 | |
445 groupupdate = FALSE; | |
446 while ( ( lines = Utl_getLn( line, lines) ) != NULL ) | |
43
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 ( sscanf( line, "%s %d %d %c", |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
449 grp, &last, &first, &postAllow ) != 4 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
450 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
451 Log_err( "Unknown reply to LIST or NEWGROUPS: %s", line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
452 continue; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
453 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
454 if ( isForbiddenGroupName( grp ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
455 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
456 Log_inf( "Group %s forbidden", grp ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
457 continue; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
458 } |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
459 if ( noServerPattern && ! isGetGroup( grp ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
460 continue; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
461 if ( isOmitGroup( grp ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
462 continue; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
463 if ( ! Grp_exists( grp ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
464 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
465 Log_inf( "Registering new group '%s'", grp ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
466 Grp_create( grp ); |
48 | 467 /* Start local numbering with remote first number to avoid |
468 new numbering at the readers if noffle is re-installed */ | |
469 if ( first != 0 ) | |
470 Grp_setFirstLast( grp, first, first - 1 ); | |
471 else | |
472 Grp_setFirstLast( grp, 1, 0 ); | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
473 Grp_setServ( grp, client.serv ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
474 Grp_setPostAllow( grp, postAllow ); |
127 | 475 groupupdate = TRUE; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
476 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
477 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
478 { |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
58
diff
changeset
|
479 if ( Cfg_servIsPreferential( client.serv, Grp_server( grp ) ) ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
480 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
481 Log_inf( "Changing server for '%s': '%s'->'%s'", |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
58
diff
changeset
|
482 grp, Grp_server( grp ), client.serv ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
483 Grp_setServ( grp, client.serv ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
484 Grp_setRmtNext( grp, first ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
485 Grp_setPostAllow( grp, postAllow ); |
127 | 486 groupupdate = TRUE; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
487 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
488 else |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
489 Log_dbg( LOG_DBG_FETCH, |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
490 "Group %s is already fetched from %s", |
127 | 491 grp, Grp_server( grp ) ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
492 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
493 } |
127 | 494 |
495 snprintf( file, MAXCHAR, "%s/lastupdate.%s", | |
496 Cfg_spoolDir(), client.serv ); | |
497 Utl_stamp( file ); | |
498 if ( groupupdate ) | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
499 { |
127 | 500 snprintf( file, MAXCHAR, "%s/groupinfo.lastupdate", |
501 Cfg_spoolDir() ); | |
502 Utl_stamp( file ); | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
503 } |
127 | 504 Lock_closeDatabases(); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
505 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
506 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
507 void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
508 Client_disconnect( void ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
509 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
510 if ( putCmd( "QUIT" ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
511 getStat(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
512 fclose( client.in ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
513 fclose( client.out ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
514 client.in = client.out = NULL; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
515 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
516 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
517 static Bool |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
518 doGetGrps( const char *pattern, Bool *noServerPattern ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
519 { |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
520 Str cmd; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
521 int stat; |
127 | 522 DynStr *response; |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
523 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
524 Utl_cpyStr( cmd, "LIST ACTIVE" ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
525 if ( pattern[ 0 ] != '\0' ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
526 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
527 Utl_catStr( cmd, " " ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
528 Utl_catStr( cmd, pattern ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
529 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
530 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
531 *noServerPattern = FALSE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
532 if ( ! putCmd( cmd ) ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
533 return FALSE; |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
534 stat = getStat(); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
535 if ( stat == STAT_PROGRAM_FAULT ) |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
536 return FALSE; |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
537 |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
538 /* |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
539 * Try LIST instead of LIST ACTIVE in case server doesn't |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
540 * support LIST ACTIVE. |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
541 */ |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
542 if ( pattern[ 0 ] != '\0' && stat != STAT_GRPS_FOLLOW ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
543 { |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
544 *noServerPattern = TRUE; |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
545 if ( ! putCmd( "LIST" ) ) |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
546 return FALSE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
547 stat = getStat(); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
548 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
549 if ( stat != STAT_GRPS_FOLLOW ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
550 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
551 Log_err( "%s failed: %s", cmd, client.lastStat ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
552 return FALSE; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
553 } |
127 | 554 |
555 response = collectTxt(); | |
556 if ( response == NULL ) | |
557 return FALSE; | |
558 | |
559 processGrps( DynStr_str( response ), *noServerPattern ); | |
560 del_DynStr( response ); | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
561 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
562 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
563 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
564 Bool |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
565 Client_getGrps( void ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
566 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
567 GroupEnum *ge; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
568 const char *pattern; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
569 Bool doneOne, noServerPattern, res; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
570 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
571 Log_inf( "Getting groups" ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
572 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
573 doneOne = FALSE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
574 res = TRUE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
575 ge = new_GetGrEn( client.serv ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
576 while ( res && ( pattern = GrEn_next( ge ) ) != NULL ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
577 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
578 res = doGetGrps( pattern, &noServerPattern ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
579 doneOne = TRUE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
580 if ( noServerPattern ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
581 break; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
582 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
583 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
584 if ( ! doneOne ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
585 res = doGetGrps( "", &noServerPattern ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
586 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
587 del_GrEn( ge ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
588 return res; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
589 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
590 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
591 static Bool |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
592 doGetDsc( const char *pattern, Bool *noServerPattern ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
593 { |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
594 Str name, line, dsc, cmd; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
595 int stat; |
127 | 596 DynStr *response; |
597 const char *lines; | |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
598 Bool result; |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
599 |
127 | 600 ASSERT( ! Lock_gotLock() ); |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
601 Utl_cpyStr( cmd, "LIST NEWSGROUPS" ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
602 if ( pattern[ 0 ] != '\0' ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
603 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
604 Utl_catStr( cmd, " " ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
605 Utl_catStr( cmd, pattern ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
606 } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
607 |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
608 *noServerPattern = FALSE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
609 if ( ! putCmd( cmd ) ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
610 return FALSE; |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
611 stat = getStat(); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
612 if ( stat == STAT_PROGRAM_FAULT ) |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
613 return FALSE; |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
614 |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
615 /* Try without pattern in case server doesn't support patterns. */ |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
616 if ( pattern[ 0 ] != '\0' && stat != STAT_GRPS_FOLLOW ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
617 { |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
618 *noServerPattern = TRUE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
619 if ( !putCmd( "LIST NEWSGROUPS" ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
620 return FALSE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
621 stat = getStat(); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
622 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
623 if ( stat != STAT_GRPS_FOLLOW ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
624 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
625 Log_err( "%s failed: %s", cmd, client.lastStat ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
626 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
627 } |
127 | 628 |
629 response = collectTxt(); | |
630 if ( response == NULL ) | |
631 return FALSE; | |
632 | |
633 if ( ! Lock_openDatabases() ) | |
634 return FALSE; | |
635 | |
636 lines = DynStr_str( response ); | |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
637 result = TRUE; |
127 | 638 while ( ( lines = Utl_getLn( line, lines) ) != NULL ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
639 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
640 if ( sscanf( line, "%s", name ) != 1 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
641 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
642 Log_err( "Unknown reply to LIST NEWSGROUPS: %s", line ); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
643 result = FALSE; |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
644 break; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
645 } |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
646 if ( *noServerPattern && ! isGetGroup( name ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
647 continue; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
648 strcpy( dsc, Utl_restOfLn( line, 1 ) ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
649 if ( Grp_exists( name ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
650 { |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
651 Log_dbg( LOG_DBG_FETCH, "Description of %s: %s", name, dsc ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
652 Grp_setDsc( name, dsc ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
653 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
654 } |
127 | 655 Lock_closeDatabases(); |
656 del_DynStr( response ); | |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
657 return result; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
658 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
659 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
660 Bool |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
661 Client_getDsc( void ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
662 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
663 GroupEnum *ge; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
664 const char *pattern; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
665 Bool doneOne, noServerPattern, res; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
666 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
667 Log_inf( "Querying group descriptions" ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
668 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
669 doneOne = FALSE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
670 res = TRUE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
671 ge = new_GetGrEn( client.serv ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
672 while ( res && ( pattern = GrEn_next( ge ) ) != NULL ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
673 { |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
674 res = doGetDsc( pattern, &noServerPattern ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
675 doneOne = TRUE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
676 if ( noServerPattern ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
677 break; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
678 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
679 |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
680 if ( res && ! doneOne ) |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
681 res = doGetDsc( "", &noServerPattern ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
682 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
683 del_GrEn( ge ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
684 return res; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
685 } |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
686 |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
687 Bool |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
688 Client_getNewgrps( const time_t *lastTime ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
689 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
690 Str s; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
691 const char *p; |
127 | 692 DynStr *response; |
182
a43a528cfbe7
[svn] * src/client.c: Only return failure getting NEWGROUPS if the connection
bears
parents:
180
diff
changeset
|
693 int stat; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
694 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
695 ASSERT( *lastTime > 0 ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
696 strftime( s, MAXCHAR, "%Y%m%d %H%M00", gmtime( lastTime ) ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
697 /* |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
698 Do not use century for working with old server software until 2000. |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
699 According to newest IETF draft, this is still valid after 2000. |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
700 (directly using %y in fmt string causes a Y2K compiler warning) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
701 */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
702 p = s + 2; |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
703 if ( ! putCmd( "NEWGROUPS %s GMT", p ) ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
704 return FALSE; |
182
a43a528cfbe7
[svn] * src/client.c: Only return failure getting NEWGROUPS if the connection
bears
parents:
180
diff
changeset
|
705 stat = getStat(); |
a43a528cfbe7
[svn] * src/client.c: Only return failure getting NEWGROUPS if the connection
bears
parents:
180
diff
changeset
|
706 if ( stat != STAT_NEW_GRP_FOLLOW ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
707 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
708 Log_err( "NEWGROUPS command failed: %s", client.lastStat ); |
182
a43a528cfbe7
[svn] * src/client.c: Only return failure getting NEWGROUPS if the connection
bears
parents:
180
diff
changeset
|
709 |
a43a528cfbe7
[svn] * src/client.c: Only return failure getting NEWGROUPS if the connection
bears
parents:
180
diff
changeset
|
710 /* |
a43a528cfbe7
[svn] * src/client.c: Only return failure getting NEWGROUPS if the connection
bears
parents:
180
diff
changeset
|
711 * If NEWGROUPS fails, it isn't necessarily fatal. You can do |
a43a528cfbe7
[svn] * src/client.c: Only return failure getting NEWGROUPS if the connection
bears
parents:
180
diff
changeset
|
712 * a periodic noffle --query groups to refresh your group list. |
a43a528cfbe7
[svn] * src/client.c: Only return failure getting NEWGROUPS if the connection
bears
parents:
180
diff
changeset
|
713 * So only return failure here if the status indicates the link |
a43a528cfbe7
[svn] * src/client.c: Only return failure getting NEWGROUPS if the connection
bears
parents:
180
diff
changeset
|
714 * itself failed. |
a43a528cfbe7
[svn] * src/client.c: Only return failure getting NEWGROUPS if the connection
bears
parents:
180
diff
changeset
|
715 * |
a43a528cfbe7
[svn] * src/client.c: Only return failure getting NEWGROUPS if the connection
bears
parents:
180
diff
changeset
|
716 * In particular, older versions of NNTPcache have a Y2K bug that |
a43a528cfbe7
[svn] * src/client.c: Only return failure getting NEWGROUPS if the connection
bears
parents:
180
diff
changeset
|
717 * stops NEWGROUPS working. |
a43a528cfbe7
[svn] * src/client.c: Only return failure getting NEWGROUPS if the connection
bears
parents:
180
diff
changeset
|
718 */ |
a43a528cfbe7
[svn] * src/client.c: Only return failure getting NEWGROUPS if the connection
bears
parents:
180
diff
changeset
|
719 return ( stat != STAT_PROGRAM_FAULT ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
720 } |
127 | 721 |
722 response = collectTxt(); | |
723 if ( response == NULL ) | |
724 return FALSE; | |
725 | |
726 processGrps( DynStr_str( response ), TRUE ); | |
727 del_DynStr( response ); | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
728 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
729 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
730 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
731 static const char * |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
732 readField( Str result, const char *p ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
733 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
734 size_t len; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
735 char *r; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
736 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
737 if ( ! p ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
738 return NULL; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
739 r = result; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
740 *r = '\0'; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
741 len = 0; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
742 while ( *p != '\t' && *p != '\n' ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
743 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
744 if ( ! *p ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
745 return p; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
746 *(r++) = *(p++); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
747 ++len; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
748 if ( len >= MAXCHAR - 1 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
749 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
750 *r = '\0'; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
751 Log_err( "Field in overview too long: %s", r ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
752 return ++p; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
753 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
754 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
755 *r = '\0'; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
756 return ++p; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
757 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
758 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
759 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
760 parseOvLn( Str line, int *numb, Str subj, Str from, |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
761 Str date, Str msgId, Str ref, size_t *bytes, size_t *lines ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
762 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
763 const char *p; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
764 Str t; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
765 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
766 p = readField( t, line ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
767 if ( sscanf( t, "%d", numb ) != 1 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
768 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
769 p = readField( subj, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
770 p = readField( from, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
771 p = readField( date, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
772 p = readField( msgId, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
773 p = readField( ref, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
774 p = readField( t, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
775 *bytes = 0; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
776 *lines = 0; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
777 if ( sscanf( t, "%d", bytes ) != 1 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
778 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
779 p = readField( t, p ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
780 if ( sscanf( t, "%d", lines ) != 1 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
781 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
782 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
783 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
784 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
785 static const char* |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
786 nextXref( const char *pXref, Str grp, int *numb ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
787 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
788 Str s; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
789 const char *pColon, *src; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
790 char *dst; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
791 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
792 src = pXref; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
793 while ( *src && isspace( *src ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
794 ++src; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
795 dst = s; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
796 while ( *src && ! isspace( *src ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
797 *(dst++) = *(src++); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
798 *dst = '\0'; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
799 if ( strlen( s ) == 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
800 return NULL; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
801 pColon = strstr( s, ":" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
802 if ( ! pColon || sscanf( pColon + 1, "%d", numb ) != 1 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
803 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
804 Log_err( "Corrupt Xref at position '%s'", pXref ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
805 return NULL; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
806 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
807 Utl_cpyStrN( grp, s, pColon - s ); |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
808 Log_dbg( LOG_DBG_FETCH, |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
809 "client.c: nextXref: grp '%s' numb %lu", |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
810 grp, numb ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
811 return src; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
812 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
813 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
814 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
815 needsMark( const char *ref ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
816 { |
67
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
817 Bool interesting, result; |
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
818 const char *msgId; |
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
819 int status; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
820 time_t lastAccess, nowTime; |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
821 double threadFollowTime, maxTime, timeSinceLastAccess; |
67
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
822 ItemList *itl; |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
823 const double secPerDay = 24.0 * 3600.0; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
824 |
127 | 825 ASSERT( Lock_gotLock() ); |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
826 Log_dbg( LOG_DBG_FETCH, "Checking references '%s' for thread mode", ref ); |
67
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
827 result = FALSE; |
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
828 itl = new_Itl( ref, " \t" ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
829 nowTime = time( NULL ); |
57
84e32c84666b
[svn] add some intermediate variables for easier debugging
enz
parents:
54
diff
changeset
|
830 threadFollowTime = (double)Cfg_threadFollowTime(); |
67
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
831 maxTime = threadFollowTime * secPerDay; |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
832 Log_dbg( LOG_DBG_FETCH, "Max time = %.0f", maxTime ); |
67
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
833 for ( msgId = Itl_first( itl ); msgId != NULL; msgId = Itl_next( itl ) ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
834 { |
67
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
835 /* |
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
836 References does not have to contain only Message IDs, |
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
837 but often it does, so we look up every item in the database. |
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
838 */ |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
839 if ( Db_contains( msgId ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
840 { |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
58
diff
changeset
|
841 status = Db_status( msgId ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
842 lastAccess = Db_lastAccess( msgId ); |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
58
diff
changeset
|
843 interesting = ( status & DB_INTERESTING ); |
67
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
844 timeSinceLastAccess = difftime( nowTime, lastAccess ); |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
845 Log_dbg( LOG_DBG_FETCH, |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
846 "Msg ID '%s': since last access = %.0f, interesting = %s", |
67
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
847 msgId, timeSinceLastAccess, ( interesting ? "y" : "n" ) ); |
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
848 if ( interesting && timeSinceLastAccess <= maxTime ) |
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
849 { |
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
850 result = TRUE; |
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
851 break; |
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
852 } |
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
853 } |
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
854 else |
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
855 { |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
856 Log_dbg( LOG_DBG_FETCH, "MsgID '%s': not in database.", msgId ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
857 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
858 } |
67
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
859 del_Itl( itl ); |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
860 Log_dbg( LOG_DBG_FETCH, |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
861 "Article %s marking for download.", |
67
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
862 ( result ? "needs" : "doesn't need" ) ); |
2e47992d7f5c
[svn] Rewrote needsMark(): use itemlist.h, more debugging output.
enz
parents:
61
diff
changeset
|
863 return result; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
864 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
865 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
866 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
867 prepareEntry( Over *ov ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
868 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
869 Str g, t; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
870 const char *msgId, *p, *xref; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
871 int n; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
872 |
127 | 873 ASSERT( Lock_gotLock() ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
874 msgId = Ov_msgId( ov ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
875 if ( Pseudo_isGeneralInfo( msgId ) ) |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
876 Log_dbg( LOG_DBG_FETCH, "Skipping general info '%s'", msgId ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
877 else if ( Db_contains( msgId ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
878 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
879 xref = Db_xref( msgId ); |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
880 Log_dbg( LOG_DBG_FETCH, |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
881 "Entry '%s' already in db with Xref '%s'", |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
882 msgId, xref ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
883 p = nextXref( xref, g, &n ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
884 if ( p == NULL ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
885 Log_err( "Overview with no group in Xref '%s'", msgId ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
886 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
887 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
888 /* TODO: This code block seems unnessesary. Can we remove it? */ |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
58
diff
changeset
|
889 if ( Cfg_servIsPreferential( client.serv, Grp_server( g ) ) ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
890 { |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
891 Log_dbg( LOG_DBG_FETCH, |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
892 "Changing first server for '%s' from '%s' to '%s'", |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
58
diff
changeset
|
893 msgId, Grp_server( g ), client.serv ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
894 snprintf( t, MAXCHAR, "%s:%d %s", |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
895 client.grp, Ov_numb( ov ), xref ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
896 Db_setXref( msgId, t ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
897 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
898 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
899 { |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
900 Log_dbg( LOG_DBG_FETCH, |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
901 "Adding '%s' to Xref of '%s'", g, msgId ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
902 snprintf( t, MAXCHAR, "%s %s:%d", |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
903 xref, client.grp, Ov_numb( ov ) ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
904 Db_setXref( msgId, t ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
905 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
906 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
907 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
908 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
909 { |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
910 Log_dbg( LOG_DBG_FETCH, "Preparing '%s' in database", msgId ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
911 Db_prepareEntry( ov, client.grp, Ov_numb( ov ) ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
912 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
913 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
914 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
915 Bool |
127 | 916 Client_getOver( const char *grp, int rmtFirst, int rmtLast, FetchMode mode ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
917 { |
127 | 918 size_t nbytes, nlines; |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
919 int rmtNumb, groupsNumb, oldLast, cntMarked; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
920 Over *ov; |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
921 Str line, subj, from, date, msgId, ref, groups; |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
922 DynStr *response, *newsgroups; |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
923 const char *lines, *groupLines; |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
924 char *p; |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
925 FilterAction action; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
926 |
127 | 927 ASSERT( ! Lock_gotLock() ); |
928 ASSERT( strcmp( grp, "" ) != 0 ); | |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
929 |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
930 /* Do we need the article Newsgroups: for filtering? */ |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
931 if ( Flt_getNewsgroups() ) |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
932 { |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
933 if ( ! putCmd( "XHDR Newsgroups %lu-%lu", rmtFirst, rmtLast ) ) |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
934 return FALSE; |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
935 if ( getStat() != STAT_HEAD_FOLLOWS ) |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
936 { |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
937 Log_err( "XHDR command failed: %s", client.lastStat ); |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
938 return FALSE; |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
939 } |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
940 |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
941 Log_dbg( LOG_DBG_FETCH, |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
942 "Requesting Newsgroups headers for remote %lu-%lu", |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
943 rmtFirst, rmtLast ); |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
944 |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
945 newsgroups = collectTxt(); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
946 if ( newsgroups == NULL ) |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
947 return FALSE; |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
948 |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
949 groupLines = DynStr_str( newsgroups ); |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
950 } |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
951 else |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
952 { |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
953 groupLines = NULL; |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
954 newsgroups = NULL; |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
955 } |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
956 |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
957 if ( ! putCmd( "XOVER %lu-%lu", rmtFirst, rmtLast ) ) |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
958 { |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
959 del_DynStr( newsgroups ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
960 return FALSE; |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
961 } |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
962 |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
963 if ( getStat() != STAT_OVERS_FOLLOW ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
964 { |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
965 del_DynStr( newsgroups ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
966 Log_err( "XOVER command failed: %s", client.lastStat ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
967 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
968 } |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
969 Log_dbg( LOG_DBG_FETCH, |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
970 "Requesting overview for remote %lu-%lu", |
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
971 rmtFirst, rmtLast ); |
127 | 972 |
973 response = collectTxt(); | |
974 if ( response == NULL ) | |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
975 { |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
976 del_DynStr( newsgroups ); |
127 | 977 return FALSE; |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
978 } |
127 | 979 |
980 if ( ! Lock_openDatabases() ) | |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
981 { |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
982 del_DynStr( newsgroups ); |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
983 del_DynStr( response ); |
127 | 984 return FALSE; |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
985 } |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
986 |
127 | 987 Cont_read( grp ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
988 oldLast = Cont_last(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
989 cntMarked = 0; |
127 | 990 lines = DynStr_str( response ); |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
991 while ( ( lines = Utl_getLn( line, lines ) ) != NULL ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
992 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
993 if ( ! parseOvLn( line, &rmtNumb, subj, from, date, msgId, ref, |
127 | 994 &nbytes, &nlines ) ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
995 Log_err( "Bad overview line: %s", line ); |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
996 else if ( Cont_find( msgId ) >= 0 ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
74
diff
changeset
|
997 Log_inf( "Already have '%s'", msgId ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
998 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
999 { |
127 | 1000 ov = new_Over( subj, from, date, msgId, ref, nbytes, nlines ); |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1001 groupsNumb = 0; |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1002 p = NULL; |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1003 if ( groupLines != NULL ) |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1004 { |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1005 do |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1006 { |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1007 groupLines = Utl_getLn( groups, groupLines ); |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1008 groupsNumb = strtoul( groups, &p, 10 ); |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1009 } while ( groupLines != NULL |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1010 && p > groups |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1011 && groupsNumb < rmtNumb ); |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1012 if ( groupsNumb != rmtNumb ) |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1013 p = NULL; |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1014 } |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1015 |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1016 action = Flt_checkFilters( grp, p, ov, mode ); |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1017 if ( action == FILTER_DISCARD ) |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1018 continue; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1019 Cont_app( ov ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1020 prepareEntry( ov ); |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1021 if ( action == FILTER_FULL |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1022 || ( action == FILTER_THREAD && needsMark( ref ) ) ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1023 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1024 Req_add( client.serv, msgId ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1025 ++cntMarked; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1026 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1027 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1028 Grp_setRmtNext( client.grp, rmtNumb + 1 ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1029 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1030 if ( oldLast != Cont_last() ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1031 Log_inf( "Added %s %lu-%lu", client.grp, oldLast + 1, Cont_last() ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1032 Log_inf( "%u articles marked for download in %s", cntMarked, client.grp ); |
127 | 1033 Cont_write(); |
1034 Grp_setFirstLast( grp, Cont_first(), Cont_last() ); | |
1035 Lock_closeDatabases(); | |
1036 del_DynStr( response ); | |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1037 del_DynStr( newsgroups ); |
127 | 1038 return TRUE; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1039 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1040 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1041 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1042 retrievingFailed( const char* msgId, const char *reason ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1043 { |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
58
diff
changeset
|
1044 int status; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1045 |
127 | 1046 ASSERT( ! Lock_gotLock() ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1047 Log_err( "Retrieving of %s failed: %s", msgId, reason ); |
127 | 1048 if ( ! Lock_openDatabases() ) |
1049 return; | |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
58
diff
changeset
|
1050 status = Db_status( msgId ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1051 Pseudo_retrievingFailed( msgId, reason ); |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
58
diff
changeset
|
1052 Db_setStatus( msgId, status | DB_RETRIEVING_FAILED ); |
127 | 1053 Lock_closeDatabases(); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1054 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1055 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1056 static Bool |
120 | 1057 retrieveAndStoreArt( const char *msgId, int artcnt, int artmax ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1058 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1059 Bool err; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1060 DynStr *s = NULL; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1061 |
127 | 1062 ASSERT( ! Lock_gotLock() ); |
120 | 1063 Log_inf( "[%d/%d] Retrieving %s", artcnt, artmax, msgId ); |
127 | 1064 err = TRUE; |
1065 | |
1066 s = collectTxt(); | |
1067 if ( s != NULL ) | |
95 | 1068 { |
1069 const char *txt; | |
127 | 1070 |
95 | 1071 txt = DynStr_str( s ); |
127 | 1072 if ( ! Lock_openDatabases() ) |
1073 { | |
1074 del_DynStr( s ); | |
1075 retrievingFailed( msgId, "Can't open message base" ); | |
1076 return FALSE; | |
1077 } | |
1078 | |
95 | 1079 err = ! Db_storeArt( msgId, txt ); |
1080 if ( ! err ) | |
1081 { | |
102 | 1082 Str supersedeIds; |
1083 | |
1084 if ( Prt_searchHeader( txt, "Supersedes", supersedeIds ) ) | |
1085 { | |
1086 ItemList *ids; | |
103 | 1087 const char *supersededMsgId; |
95 | 1088 |
102 | 1089 ids = new_Itl( supersedeIds, " \n\t" ); |
103 | 1090 for ( supersededMsgId = Itl_first( ids ); |
1091 supersededMsgId != NULL; | |
1092 supersededMsgId = Itl_next( ids ) ) | |
1093 Ctrl_cancel( supersededMsgId ); | |
102 | 1094 del_Itl( ids ); |
1095 } | |
95 | 1096 } |
127 | 1097 Lock_closeDatabases(); |
1098 del_DynStr( s ); | |
95 | 1099 } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1100 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1101 retrievingFailed( msgId, "Connection broke down" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1102 return ! err; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1103 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1104 |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1105 Bool |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1106 Client_retrieveArt( const char *msgId ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1107 { |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1108 Bool res = FALSE; |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1109 |
127 | 1110 ASSERT( Lock_gotLock() ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1111 if ( ! Db_contains( msgId ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1112 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1113 Log_err( "Article '%s' not prepared in database. Skipping.", msgId ); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1114 return TRUE; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1115 } |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
58
diff
changeset
|
1116 if ( ! ( Db_status( msgId ) & DB_NOT_DOWNLOADED ) ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1117 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1118 Log_inf( "Article '%s' already retrieved. Skipping.", msgId ); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1119 return TRUE; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1120 } |
127 | 1121 |
1122 Lock_closeDatabases(); | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1123 if ( ! putCmd( "ARTICLE %s", msgId ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1124 retrievingFailed( msgId, "Connection broke down" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1125 else if ( getStat() != STAT_ART_FOLLOWS ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1126 retrievingFailed( msgId, client.lastStat ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1127 else |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1128 res = retrieveAndStoreArt( msgId, 0, 0 ); |
164
94f2e5607772
[svn] * src/client.c,src/protocol.c,src/util.h,src/util.c: Common up
bears
parents:
157
diff
changeset
|
1129 Lock_openDatabases(); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1130 return res; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1131 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1132 |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1133 Bool |
120 | 1134 Client_retrieveArtList( const char *list, int *artcnt, int artmax ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1135 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1136 Str msgId; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1137 DynStr *s; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1138 const char *p; |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1139 Bool res; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1140 |
127 | 1141 ASSERT( Lock_gotLock() ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1142 Log_inf( "Retrieving article list" ); |
58
b4e6f7f96135
[svn] Add some intermediate variables for easier debugging in needsMark().
enz
parents:
57
diff
changeset
|
1143 s = new_DynStr( (int)strlen( list ) ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1144 p = list; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1145 while ( ( p = Utl_getLn( msgId, p ) ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1146 if ( ! Db_contains( msgId ) ) |
123
ec190bad201b
[svn] Applied patch from M.Nalis for fixing a small problem with
enz
parents:
120
diff
changeset
|
1147 Log_err( "[%d/%d] Skipping retrieving of %s (not prepared in database)", |
ec190bad201b
[svn] Applied patch from M.Nalis for fixing a small problem with
enz
parents:
120
diff
changeset
|
1148 ++(*artcnt), artmax, msgId ); |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
58
diff
changeset
|
1149 else if ( ! ( Db_status( msgId ) & DB_NOT_DOWNLOADED ) ) |
123
ec190bad201b
[svn] Applied patch from M.Nalis for fixing a small problem with
enz
parents:
120
diff
changeset
|
1150 Log_inf( "[%d/%d] Skipping %s (already retrieved)", ++(*artcnt), artmax, msgId ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1151 else if ( ! putCmdNoFlush( "ARTICLE %s", msgId ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1152 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1153 retrievingFailed( msgId, "Connection broke down" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1154 del_DynStr( s ); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1155 return FALSE; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1156 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1157 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1158 DynStr_appLn( s, msgId ); |
127 | 1159 |
1160 Lock_closeDatabases(); | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1161 fflush( client.out ); |
185
fed1334d766b
[svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents:
183
diff
changeset
|
1162 Log_dbg( LOG_DBG_PROTOCOL, "[S FLUSH]" ); |
127 | 1163 |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1164 p = DynStr_str( s ); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1165 res = TRUE; |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1166 while ( res && ( p = Utl_getLn( msgId, p ) ) ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1167 { |
183
c912e8288164
[svn] * src/client.c: Only bail out of fetching multiple articles if the
bears
parents:
182
diff
changeset
|
1168 switch( getStat() ) |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1169 { |
183
c912e8288164
[svn] * src/client.c: Only bail out of fetching multiple articles if the
bears
parents:
182
diff
changeset
|
1170 case STAT_ART_FOLLOWS: |
c912e8288164
[svn] * src/client.c: Only bail out of fetching multiple articles if the
bears
parents:
182
diff
changeset
|
1171 res = retrieveAndStoreArt( msgId, ++(*artcnt), artmax ); |
c912e8288164
[svn] * src/client.c: Only bail out of fetching multiple articles if the
bears
parents:
182
diff
changeset
|
1172 break; |
c912e8288164
[svn] * src/client.c: Only bail out of fetching multiple articles if the
bears
parents:
182
diff
changeset
|
1173 |
c912e8288164
[svn] * src/client.c: Only bail out of fetching multiple articles if the
bears
parents:
182
diff
changeset
|
1174 case STAT_PROGRAM_FAULT: |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1175 res = FALSE; |
183
c912e8288164
[svn] * src/client.c: Only bail out of fetching multiple articles if the
bears
parents:
182
diff
changeset
|
1176 /* Fall through */ |
c912e8288164
[svn] * src/client.c: Only bail out of fetching multiple articles if the
bears
parents:
182
diff
changeset
|
1177 |
c912e8288164
[svn] * src/client.c: Only bail out of fetching multiple articles if the
bears
parents:
182
diff
changeset
|
1178 default: |
c912e8288164
[svn] * src/client.c: Only bail out of fetching multiple articles if the
bears
parents:
182
diff
changeset
|
1179 retrievingFailed( msgId, client.lastStat ); |
c912e8288164
[svn] * src/client.c: Only bail out of fetching multiple articles if the
bears
parents:
182
diff
changeset
|
1180 break; |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1181 } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1182 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1183 del_DynStr( s ); |
127 | 1184 Lock_openDatabases(); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1185 return res; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1186 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1187 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1188 Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1189 Client_changeToGrp( const char* name ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1190 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1191 unsigned int stat; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1192 int estimatedNumb, first, last; |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1193 Bool res; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1194 |
127 | 1195 ASSERT( Lock_gotLock() ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1196 if ( ! Grp_exists( name ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1197 return FALSE; |
130
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1198 Lock_closeDatabases(); |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1199 res = putCmd( "GROUP %s", name ); |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1200 res = res && ( getStat() == STAT_GRP_SELECTED ); |
d6c006a27ffe
[svn] Add article fetching and fix potential lock bug
bears
parents:
127
diff
changeset
|
1201 if ( ! Lock_openDatabases() || ! res ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1202 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1203 if ( sscanf( client.lastStat, "%u %d %d %d", |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1204 &stat, &estimatedNumb, &first, &last ) != 4 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1205 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1206 Log_err( "Bad server response to GROUP: %s", client.lastStat ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1207 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1208 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1209 Utl_cpyStr( client.grp, name ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1210 client.rmtFirst = first; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1211 client.rmtLast = last; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1212 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1213 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1214 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1215 void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1216 Client_rmtFirstLast( int *first, int *last ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1217 { |
127 | 1218 ASSERT( Lock_gotLock() ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1219 *first = client.rmtFirst; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1220 *last = client.rmtLast; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1221 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1222 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1223 Bool |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1224 Client_postArt( const char *msgId, const char *artTxt, Str errStr ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1225 { |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1226 int stat; |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1227 |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1228 errStr[0] = '\0'; |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1229 |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1230 if ( ! putCmd( "POST" ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1231 return FALSE; |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1232 stat = getStat(); |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1233 if ( stat == STAT_PROGRAM_FAULT ) |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1234 return FALSE; |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1235 else if ( stat != STAT_SEND_ART ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1236 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1237 Log_err( "Posting of %s not allowed: %s", msgId, client.lastStat ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1238 strcpy( errStr, client.lastStat ); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1239 return TRUE; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1240 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1241 putTxtBuf( artTxt ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1242 putEndOfTxt(); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1243 stat = getStat(); |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1244 if ( stat == STAT_PROGRAM_FAULT ) |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1245 return FALSE; |
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1246 else if ( stat != STAT_POST_OK ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1247 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1248 Log_err( "Posting of %s failed: %s", msgId, client.lastStat ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1249 strcpy( errStr, client.lastStat ); |
180
09ca6eb5c7ff
[svn] * TODO,src/client.c,src/client.h,src/fetch.c,src/fetch.h,src/noffle.c:
bears
parents:
172
diff
changeset
|
1250 return TRUE; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1251 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1252 Log_inf( "Posted %s (Status: %s)", msgId, client.lastStat ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1253 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1254 } |