annotate src/fetch.c @ 154:b2a4f839affd noffle

[svn] Use sendmail instead of mail
author enz
date Tue, 05 Dec 2000 19:30:50 +0000
parents 8e350d558c98
children 22b81617d427
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1 /*
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
2 fetch.c
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
3
154
b2a4f839affd [svn] Use sendmail instead of mail
enz
parents: 139
diff changeset
4 $Id: fetch.c 235 2000-12-05 19:30:50Z enz $
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 <stdio.h>
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
12 #include "fetch.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
13 #include <errno.h>
54
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 43
diff changeset
14
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 43
diff changeset
15 #if TIME_WITH_SYS_TIME
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 43
diff changeset
16 #include <sys/time.h>
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
17 #include <time.h>
54
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 43
diff changeset
18 #else
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 43
diff changeset
19 #if HAVE_SYS_TIME_H
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 43
diff changeset
20 #include <sys/time.h>
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 43
diff changeset
21 #else
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 43
diff changeset
22 #include <time.h>
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 43
diff changeset
23 #endif
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 43
diff changeset
24 #endif
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 43
diff changeset
25
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
26 #include <signal.h>
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
27 #include "client.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
28 #include "configfile.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
29 #include "content.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
30 #include "dynamicstring.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
31 #include "fetchlist.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
32 #include "request.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
33 #include "group.h"
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
34 #include "lock.h"
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
35 #include "log.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
36 #include "outgoing.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
37 #include "protocol.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
38 #include "pseudo.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
39 #include "util.h"
54
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 43
diff changeset
40 #include "portable.h"
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
41
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
42 #define MAX_ARTICLE_CMDS_QUEUED 20
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
43
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
44 struct Fetch
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
45 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
46 Bool ready;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
47 Str serv;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
48 } fetch = { FALSE, "" };
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 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
51 connectToServ( const char *name )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
52 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
53 Log_inf( "Fetch from '%s'", name );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
54 if ( ! Client_connect( name ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
55 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
56 Log_err( "Could not connect to %s", name );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
57 return FALSE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
58 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
59 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
60 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
61
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
62 void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
63 Fetch_getNewGrps( void )
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 time_t t;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
66 Str file;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
67
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
68 ASSERT( fetch.ready );
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
69 snprintf( file, MAXCHAR, "%s/lastupdate.%s",
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
70 Cfg_spoolDir(), fetch.serv );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
71 if ( ! Utl_getStamp( &t, file ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
72 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
73 Log_err( "Cannot read %s. Please run noffle --query groups", file );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
74 return;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
75 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
76 Log_inf( "Updating groupinfo" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
77 Client_getNewgrps( &t );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
78 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
79
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
80 /* Databases open on entry, closed on exit. */
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
81 static void
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
82 fetchNewArts( const char *name, FetchMode mode )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
83 {
102
38b0a1532a37 [svn] Only track remote message no when subscribed
bears
parents: 79
diff changeset
84 int next, first, last;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
85
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
86 if ( ! Client_changeToGrp( name ) )
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 Log_err( "Could not change to group %s", name );
129
6b2b93288caa [svn] Fix potential lock bug
bears
parents: 127
diff changeset
89 if ( Lock_gotLock() )
6b2b93288caa [svn] Fix potential lock bug
bears
parents: 127
diff changeset
90 Lock_closeDatabases();
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
91 return;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
92 }
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
93 Client_rmtFirstLast( &first, &last );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
94 Cont_read( name );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
95 next = Grp_rmtNext( name );
102
38b0a1532a37 [svn] Only track remote message no when subscribed
bears
parents: 79
diff changeset
96 if ( next == GRP_RMT_NEXT_NOT_SUBSCRIBED )
38b0a1532a37 [svn] Only track remote message no when subscribed
bears
parents: 79
diff changeset
97 next = first;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
98 if ( next == last + 1 )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
99 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
100 Log_inf( "No new articles in %s", name );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
101 Cont_write();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
102 Grp_setFirstLast( name, Cont_first(), Cont_last() );
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
103 Lock_closeDatabases();
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
104 return;
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 if ( first == 0 && last == 0 )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
107 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
108 Log_inf( "No articles in %s", name );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
109 Cont_write();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
110 Grp_setFirstLast( name, Cont_first(), Cont_last() );
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
111 Lock_closeDatabases();
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
112 return;
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 if ( next > last + 1 )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
115 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
116 Log_err( "Article number inconsistent (%s rmt=%lu-%lu, next=%lu)",
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
117 name, first, last, next );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
118 Pseudo_cntInconsistent( name, first, last, next );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
119 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
120 else if ( next < first )
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 Log_inf( "Missing articles (%s first=%lu next=%lu)",
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
123 name, first, next );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
124 Pseudo_missArts( name, first, next );
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 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
127 first = next;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
128 if ( last - first > Cfg_maxFetch() )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
129 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
130 Log_ntc( "Cutting number of overviews to %lu", Cfg_maxFetch() );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
131 first = last - Cfg_maxFetch() + 1;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
132 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
133 Log_inf( "Getting remote overviews %lu-%lu for group %s",
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
134 first, last, name );
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
135 Lock_closeDatabases();
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
136 Client_getOver( name, first, last, mode );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
137 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
138
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
139 void
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
140 Fetch_getNewArts( const char *name, FetchMode mode )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
141 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
142 if ( ! Lock_openDatabases() )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
143 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
144 Log_err( "Could not open message base" );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
145 return;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
146 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
147 fetchNewArts( name, mode );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
148 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
149
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
150 void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
151 Fetch_updateGrps( void )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
152 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
153 FetchMode mode;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
154 int i, size;
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
155 const char *name;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
156
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
157 ASSERT( fetch.ready );
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
158 if ( ! Lock_openDatabases() )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
159 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
160 Log_err( "Could not open message base" );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
161 return;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
162 }
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
163 Fetchlist_read();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
164 size = Fetchlist_size();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
165 for ( i = 0; i < size; ++i )
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 Fetchlist_element( &name, &mode, i );
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
168 if ( strcmp( Grp_server( name ), fetch.serv ) == 0 )
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
169 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
170 fetchNewArts( name, mode );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
171 if ( ! Lock_openDatabases() )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
172 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
173 Log_err( "Could not open message base" );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
174 return;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
175 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
176 }
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
177 }
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
178 Lock_closeDatabases();
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
179 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
180
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
181 static void
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
182 fetchMessageList( const char *list, int *artcnt, int artmax )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
183 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
184 const char *p;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
185 Str msgId;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
186
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
187 ASSERT( Lock_gotLock() );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
188 Client_retrieveArtList( list, artcnt, artmax );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
189 p = list;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
190 while ( ( p = Utl_getLn( msgId, p ) ) )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
191 Req_remove( fetch.serv, msgId );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
192 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
193
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
194 void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
195 Fetch_getReq_( void )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
196 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
197 Str msgId;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
198 DynStr *list;
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
199 DynStr *fetchList;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
200 const char *p;
120
05f50c1761d9 [svn] Applied patch from Matija Nalis:
enz
parents: 102
diff changeset
201 int count = 0, artcnt = 0, artmax = 0;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
202
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
203 ASSERT( fetch.ready );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
204 Log_dbg( "Retrieving articles marked for download" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
205 list = new_DynStr( 10000 );
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
206 fetchList = new_DynStr( 1000 );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
207 if ( list == NULL || fetchList == NULL )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
208 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
209 if ( list != NULL )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
210 del_DynStr( list );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
211 Log_err( "Out of memory in Fetch_get_Req_");
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
212 return;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
213 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
214
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
215 /*
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
216 * Get all waiting message IDs for this server. We copy into a master
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
217 * list as the requests file will be closed and re-opened during the
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
218 * fetch and the position therein will be lost.
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
219 */
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
220 if ( ! Lock_openDatabases() )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
221 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
222 Log_err( "Could not open message base" );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
223 return;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
224 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
225
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
226 if ( Req_first( fetch.serv, msgId ) )
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
227 {
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
228 do
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
229 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
230 DynStr_appLn( list, msgId );
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
231 artmax++;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
232 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
233 while ( Req_next( msgId ) );
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
234 Log_inf( "%d TOTAL messages to download", artmax);
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
235 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
236
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
237 /* Retrieve in groups of up to size MAX_ARTICLE_CMDS_QUEUED. */
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
238 p = DynStr_str( list );
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
239 while ( ( p = Utl_getLn( msgId, p ) ) != NULL )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
240 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
241 DynStr_appLn( fetchList, msgId );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
242 if ( ++count % MAX_ARTICLE_CMDS_QUEUED == 0 )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
243 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
244 fetchMessageList( DynStr_str( fetchList ), &artcnt, artmax );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
245 DynStr_clear( fetchList );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
246 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
247 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
248 fetchMessageList( DynStr_str( fetchList ), &artcnt, artmax );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
249
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
250 del_DynStr( fetchList );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
251 del_DynStr( list );
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
252 Lock_closeDatabases();
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
253 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
254
79
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
255 static void
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
256 returnArticleToSender( const char *sender, const char *reason,
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
257 const char *article )
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
258 {
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
259 int ret;
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
260 Str cmd;
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
261 FILE *f;
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
262 sig_t lastHandler;
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
263
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
264 Log_err( "Return article to '%s' by mail", sender );
154
b2a4f839affd [svn] Use sendmail instead of mail
enz
parents: 139
diff changeset
265 snprintf( cmd, MAXCHAR, "%s -t -oi", SENDMAILPROG);
79
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
266 lastHandler = signal( SIGPIPE, SIG_IGN );
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
267 f = popen( cmd, "w" );
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
268 if ( f == NULL )
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
269 Log_err( "Invocation of '%s' failed (%s)", cmd, strerror( errno ) );
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
270 else
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
271 {
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
272 fprintf( f,
154
b2a4f839affd [svn] Use sendmail instead of mail
enz
parents: 139
diff changeset
273 "To: %s\n"
b2a4f839affd [svn] Use sendmail instead of mail
enz
parents: 139
diff changeset
274 "Subject: [ NOFFLE: Posting failed ]\n"
b2a4f839affd [svn] Use sendmail instead of mail
enz
parents: 139
diff changeset
275 "\n"
79
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
276 "\t[ NOFFLE: POSTING OF ARTICLE FAILED ]\n"
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
277 "\n"
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
278 "\t[ The posting of your article failed. ]\n"
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
279 "\t[ Reason of failure at remote server: ]\n"
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
280 "\n"
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
281 "\t[ %s ]\n"
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
282 "\n"
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
283 "\t[ Full article text has been appended. ]\n"
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
284 "\n"
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
285 "%s"
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
286 ".\n",
154
b2a4f839affd [svn] Use sendmail instead of mail
enz
parents: 139
diff changeset
287 sender,
79
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
288 reason, article );
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
289 ret = pclose( f );
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
290 if ( ret != EXIT_SUCCESS )
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
291 Log_err( "'%s' exit value %d", cmd, ret );
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
292 signal( SIGPIPE, lastHandler );
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
293 }
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
294 }
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
295
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
296 void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
297 Fetch_postArts( void )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
298 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
299 DynStr *s;
79
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
300 Str msgId, errStr, sender;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
301 const char *txt;
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 s = new_DynStr( 10000 );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
304 if ( Out_first( fetch.serv, msgId, s ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
305 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
306 Log_inf( "Posting articles" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
307 do
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 txt = DynStr_str( s );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
310 Out_remove( fetch.serv, msgId );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
311 if ( ! Client_postArt( msgId, txt, errStr ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
312 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
313 Utl_cpyStr( sender, Cfg_mailTo() );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
314 if ( strcmp( sender, "" ) == 0
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
315 && ! Prt_searchHeader( txt, "SENDER", sender )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
316 && ! Prt_searchHeader( txt, "X-NOFFLE-X-SENDER",
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
317 sender ) /* see server.c */
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
318 && ! Prt_searchHeader( txt, "FROM", sender ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
319 Log_err( "Article %s has no From/Sender/X-Sender field",
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
320 msgId );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
321 else
79
28aeb0b93509 [svn] Extracted function in Fetch_postArts for returning failed postings to sender
enz
parents: 61
diff changeset
322 returnArticleToSender( sender, errStr, txt );
43
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 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
325 while ( Out_next( msgId, s ) );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
326 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
327 del_DynStr( s );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
328 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
329
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
330 Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
331 Fetch_init( const char *serv )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
332 {
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
333 Lock_closeDatabases();
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
334 if ( ! connectToServ( serv ) )
139
8e350d558c98 [svn] Fixed a bug in Fetch_init, that triggered
enz
parents: 129
diff changeset
335 {
8e350d558c98 [svn] Fixed a bug in Fetch_init, that triggered
enz
parents: 129
diff changeset
336 Lock_openDatabases();
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
337 return FALSE;
139
8e350d558c98 [svn] Fixed a bug in Fetch_init, that triggered
enz
parents: 129
diff changeset
338 }
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
339 Utl_cpyStr( fetch.serv, serv );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
340 fetch.ready = TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
341 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
342 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
343
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
344 void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
345 Fetch_close()
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
346 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
347 Client_disconnect();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
348 fetch.ready = FALSE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
349 Log_inf( "Fetch from '%s' finished", fetch.serv );
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 120
diff changeset
350 Lock_openDatabases();
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
351 }