annotate src/server.c @ 259:b660fadc1814 noffle

[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS. Do small reorg of some of the timezone sensitive code, and introduce use of timegm(). An implementation is provided for systems without timegm().
author bears
date Wed, 26 Jun 2002 14:30:26 +0100
parents d70e9dd6b308
children 94b7962a0fbe
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 server.c
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
3
259
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
4 $Id: server.c 391 2002-06-26 13:30:26Z 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
54
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 49
diff changeset
11 #if TIME_WITH_SYS_TIME
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 49
diff changeset
12 #include <sys/time.h>
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 49
diff changeset
13 #include <time.h>
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 49
diff changeset
14 #else
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 49
diff changeset
15 #if HAVE_SYS_TIME_H
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 49
diff changeset
16 #include <sys/time.h>
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 49
diff changeset
17 #else
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 49
diff changeset
18 #include <time.h>
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 49
diff changeset
19 #endif
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 49
diff changeset
20 #endif
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 49
diff changeset
21
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
22 #include <stdio.h>
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
23 #include <ctype.h>
69
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
24 #include <errno.h>
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
25 #include <signal.h>
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
26 #include <stdarg.h>
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
27 #include <sys/types.h>
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
28 #include <unistd.h>
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
29 #include "client.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
30 #include "common.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
31 #include "configfile.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
32 #include "content.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
33 #include "database.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
34 #include "dynamicstring.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
35 #include "fetch.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
36 #include "fetchlist.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
37 #include "group.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
38 #include "itemlist.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
39 #include "lock.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
40 #include "log.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
41 #include "online.h"
49
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
42 #include "over.h"
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
43 #include "post.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
44 #include "protocol.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
45 #include "pseudo.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
46 #include "request.h"
197
24d4cd032da5 [svn] * AUTHORS,INSTALL,NEWS,README,TODO,docs/NOTES,src/client.c,src/protocol.c,
bears
parents: 191
diff changeset
47 #include "server.h"
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
48 #include "util.h"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
49 #include "wildmat.h"
54
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 49
diff changeset
50 #include "portable.h"
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
51
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
52 struct
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 Bool running;
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
55 time_t lastServerOpen;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
56 int artPtr;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
57 Str grp; /* selected group, "" if none */
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
58 DynStr *reply;
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
59 Bool eotAfterReply;
155
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
60 Bool groupReady;
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
61 } server = { FALSE, 0L, 0, "", NULL, FALSE, FALSE };
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
62
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
63 typedef struct Cmd
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 const char *name;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
66 const char *syntax;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
67 /* Returns false, if quit cmd */
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
68 Bool (*cmdProc)( char *arg, const struct Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
69 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
70 Cmd;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
71
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
72 static Bool doArt( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
73 static Bool doBody( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
74 static Bool doGrp( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
75 static Bool doHead( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
76 static Bool doHelp( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
77 static Bool doIhave( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
78 static Bool doLast( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
79 static Bool doList( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
80 static Bool doListgrp( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
81 static Bool doMode( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
82 static Bool doNewgrps( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
83 static Bool doNext( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
84 static Bool doPost( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
85 static Bool doSlave( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
86 static Bool doStat( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
87 static Bool doQuit( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
88 static Bool doXhdr( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
89 static Bool doXpat( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
90 static Bool doXOver( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
91 static Bool notImplemented( char *arg, const Cmd *cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
92 static void putStat( unsigned int stat, const char *fmt, ... );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
93
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
94 static void closeServer( void );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
95 static Bool initServer( void );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
96
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
97 Cmd commands[] =
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 { "article", "ARTICLE [msg-id|n]", &doArt },
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
100 { "body", "BODY [msg-id|n]", &doBody },
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
101 { "head", "HEAD [msg-id|n]", &doHead },
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
102 { "group", "GROUP grp", &doGrp },
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
103 { "help", "HELP", &doHelp },
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
104 { "ihave", "IHAVE (ignored)", &doIhave },
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
105 { "last", "LAST", &doLast },
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
106 { "list", "LIST [ACTIVE [pat]]|ACTIVE.TIMES [pat]|"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
107 "EXTENSIONS|NEWSGROUPS [pat]|OVERVIEW.FMT", &doList },
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
108 { "listgroup", "LISTGROUP grp", &doListgrp },
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
109 { "mode", "MODE (ignored)", &doMode },
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
110 { "newgroups", "NEWGROUPS [xx]yymmdd hhmmss [GMT]", &doNewgrps },
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
111 { "newnews", "NEWNEWS (not implemented)", &notImplemented },
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
112 { "next", "NEXT", &doNext },
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
113 { "post", "POST", &doPost },
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
114 { "quit", "QUIT", &doQuit },
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
115 { "slave", "SLAVE (ignored)", &doSlave },
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
116 { "stat", "STAT [msg-id|n]", &doStat },
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
117 { "xhdr", "XHDR over-field [msg-id|m[-[n]]]", &doXhdr },
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
118 { "xpat", "XPAT over-field msg-id|m[-[n]] pat", &doXpat },
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
119 { "xover", "XOVER [m[-[n]]]", &doXOver }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
120 };
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 Notice interest in reading this group.
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
124 Automatically subscribe if option set in config file.
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 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
127 noteInterest( void )
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 FetchMode mode;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
130
191
28488e0e3630 [svn] * src/group.h,src/group.c,src/noffle.c,src/server.c: Grp_setLastAccess is
bears
parents: 188
diff changeset
131 Grp_setLastAccess( server.grp );
82
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
132 if ( ! Grp_local ( server.grp ) && ! Online_true() )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
133 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
134 Fetchlist_read();
237
f8a91e2b4060 [svn] * src/fetchlist.h,src/fetchlist.c,src/noffle.c: Provide fetchmode for
bears
parents: 223
diff changeset
135 if ( ! Fetchlist_contains( server.grp, NULL ) )
82
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
136 {
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
137 if ( Cfg_autoSubscribe() )
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
138 {
106
46062d2f9d20 [svn] Auto subscribe mode now group-dependent
bears
parents: 88
diff changeset
139 if ( strcmp( Cfg_autoSubscribeMode( server.grp ), "full" ) == 0 )
82
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
140 mode = FULL;
106
46062d2f9d20 [svn] Auto subscribe mode now group-dependent
bears
parents: 88
diff changeset
141 else if ( strcmp( Cfg_autoSubscribeMode( server.grp ), "thread" ) == 0 )
82
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
142 mode = THREAD;
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
143 else
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
144 mode = OVER;
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
145 Fetchlist_add( server.grp, mode );
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
146 Fetchlist_write();
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
147 Pseudo_autoSubscribed();
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
148 }
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
149 else if ( Cfg_infoAlways() )
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
150 {
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
151 int first, last;
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
152
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
153 /* Ensure new gen info for next time */
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
154 first = Cont_first();
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
155 last = Cont_last();
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
156
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
157 if ( first == last )
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
158 first = last + 1;
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
159
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
160 Grp_setFirstLast( Cont_grp(), first, last );
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
diff changeset
161 }
1eb0cdd17c76 [svn] info-always-unread config/doc/implementation
bears
parents: 74
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 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
164 }
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 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
167 putStat( unsigned int stat, const char *fmt, ... )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
168 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
169 Str s, line;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
170 va_list ap;
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 ASSERT( stat <= 999 );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
173 va_start( ap, fmt );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
174 vsnprintf( s, MAXCHAR, fmt, ap );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
175 va_end( ap );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
176 snprintf( line, MAXCHAR, "%u %s", stat, s );
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
177 DynStr_appLn( server.reply, line );
185
fed1334d766b [svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents: 181
diff changeset
178 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
179 }
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 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
182 putTxtLn( const char *fmt, ... )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
183 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
184 Str line;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
185 va_list ap;
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 va_start( ap, fmt );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
188 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
189 va_end( ap );
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
190 DynStr_appLn( server.reply, line );
43
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
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
193 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
194 putTxtBuf( const char *buf )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
195 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
196 if ( buf )
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
197 DynStr_app( server.reply, buf );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
198 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
199
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
200 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
201 putEndOfTxt( void )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
202 {
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
203 server.eotAfterReply = TRUE;
43
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
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
206 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
207 putSyntax( const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
208 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
209 putStat( STAT_SYNTAX_ERR, "Syntax error. Usage: %s", cmd->syntax );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
210 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
211
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
212 static void
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
213 initOutput( void )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
214 {
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
215 server.reply = new_DynStr( 100 );
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
216 server.eotAfterReply = FALSE;
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
217 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
218
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
219 static void
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
220 sendOutput( void )
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
221 {
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
222 Prt_putTxtBuf( DynStr_str( server.reply ), stdout );
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
223 if ( server.eotAfterReply )
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
224 Prt_putEndOfTxt( stdout );
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
225 fflush( stdout );
185
fed1334d766b [svn] * src/client.c: Change variable only used on constant to 'const'.
bears
parents: 181
diff changeset
226 Log_dbg( LOG_DBG_PROTOCOL, "[S FLUSH]" );
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
227 del_DynStr( server.reply );
43
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
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
230 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
231 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
232 {
144
8b9366fc1361 [svn] Added timeout to Prt_getLn to avoid Noffle hanging if the
enz
parents: 127
diff changeset
233 return Prt_getTxtLn( line, err, stdin, -1 );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
234 }
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 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
237 notImplemented( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
238 {
74
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
239 UNUSED( arg );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
240 UNUSED( cmd );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
241
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
242 putStat( STAT_NO_PERMISSION, "Command not implemented" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
243 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
244 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
245
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
246 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
247 checkNewArts( const char *grp )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
248 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
249 if ( ! Online_true()
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
250 || strcmp( grp, server.grp ) == 0
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
251 || Grp_local( grp )
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
252 || time( NULL ) - Grp_lastAccess( server.grp ) < 1800 )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
253 return;
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
254 if ( Fetch_init( Grp_server( grp ) ) )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
255 {
237
f8a91e2b4060 [svn] * src/fetchlist.h,src/fetchlist.c,src/noffle.c: Provide fetchmode for
bears
parents: 223
diff changeset
256 FetchMode mode;
f8a91e2b4060 [svn] * src/fetchlist.h,src/fetchlist.c,src/noffle.c: Provide fetchmode for
bears
parents: 223
diff changeset
257
f8a91e2b4060 [svn] * src/fetchlist.h,src/fetchlist.c,src/noffle.c: Provide fetchmode for
bears
parents: 223
diff changeset
258 /*
f8a91e2b4060 [svn] * src/fetchlist.h,src/fetchlist.c,src/noffle.c: Provide fetchmode for
bears
parents: 223
diff changeset
259 * See if group is on the fetchlist and if so use that mode.
f8a91e2b4060 [svn] * src/fetchlist.h,src/fetchlist.c,src/noffle.c: Provide fetchmode for
bears
parents: 223
diff changeset
260 * That way we preserve the download semantics for groups on
f8a91e2b4060 [svn] * src/fetchlist.h,src/fetchlist.c,src/noffle.c: Provide fetchmode for
bears
parents: 223
diff changeset
261 * the fetchlist. If the group is not on the fetchlist use
f8a91e2b4060 [svn] * src/fetchlist.h,src/fetchlist.c,src/noffle.c: Provide fetchmode for
bears
parents: 223
diff changeset
262 * OVER to get just the overview info.
f8a91e2b4060 [svn] * src/fetchlist.h,src/fetchlist.c,src/noffle.c: Provide fetchmode for
bears
parents: 223
diff changeset
263 */
f8a91e2b4060 [svn] * src/fetchlist.h,src/fetchlist.c,src/noffle.c: Provide fetchmode for
bears
parents: 223
diff changeset
264 Fetchlist_read();
f8a91e2b4060 [svn] * src/fetchlist.h,src/fetchlist.c,src/noffle.c: Provide fetchmode for
bears
parents: 223
diff changeset
265 if ( ! Fetchlist_contains( grp, &mode ) )
f8a91e2b4060 [svn] * src/fetchlist.h,src/fetchlist.c,src/noffle.c: Provide fetchmode for
bears
parents: 223
diff changeset
266 mode = OVER;
f8a91e2b4060 [svn] * src/fetchlist.h,src/fetchlist.c,src/noffle.c: Provide fetchmode for
bears
parents: 223
diff changeset
267
f8a91e2b4060 [svn] * src/fetchlist.h,src/fetchlist.c,src/noffle.c: Provide fetchmode for
bears
parents: 223
diff changeset
268 Fetch_getNewArts( grp, mode );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
269 Fetch_close();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
270 }
119
f50cc311e29a [svn] Leave online mode, if the connection to a remote server
enz
parents: 115
diff changeset
271 else
f50cc311e29a [svn] Leave online mode, if the connection to a remote server
enz
parents: 115
diff changeset
272 {
f50cc311e29a [svn] Leave online mode, if the connection to a remote server
enz
parents: 115
diff changeset
273 Log_inf( "Connection to server failed. Leaving online mode." );
f50cc311e29a [svn] Leave online mode, if the connection to a remote server
enz
parents: 115
diff changeset
274 Online_set( FALSE );
f50cc311e29a [svn] Leave online mode, if the connection to a remote server
enz
parents: 115
diff changeset
275 }
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
276 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
277
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
278 static void
45
32ba1198c6fa [svn] * Makefile.in, configure, configure.in, docs/Makefile.in, src/Makefile.in:
uh1763
parents: 43
diff changeset
279 postArts( void )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
280 {
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
281 Str s;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
282
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
283 Cfg_beginServEnum();
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
284 while ( Cfg_nextServ( s ) )
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
285 if ( Fetch_init( s ) )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
286 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
287 Fetch_postArts();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
288 Fetch_close();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
289 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
290 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
291
49
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
292 static Bool
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
293 needsPseudoGenInfo( const char *grp )
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
294 {
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
295 return ! ( Grp_local( grp )
237
f8a91e2b4060 [svn] * src/fetchlist.h,src/fetchlist.c,src/noffle.c: Provide fetchmode for
bears
parents: 223
diff changeset
296 || Fetchlist_contains( grp, NULL )
49
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
297 || Online_true() );
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
298 }
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
299
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
300 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
301 readCont( const char *name )
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 Fetchlist_read();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
304 Cont_read( name );
49
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
305 if ( needsPseudoGenInfo( name ) )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
306 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
307 Pseudo_appGeneralInfo();
49
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
308 /* This adds the pseudo message to the overview contents
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
309 but NOT to the group info. If an article gets added,
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
310 the group info will get updated then from the
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
311 contents, so the article number will be preserved.
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
312 Otherwise it will be lost when the content is discarded. */
43
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 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
315
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
316 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
317 changeToGrp( const char *grp )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
318 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
319 checkNewArts( grp );
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
320 Utl_cpyStr( server.grp, grp );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
321 readCont( grp );
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
322 server.artPtr = Cont_first();
155
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
323 server.groupReady = TRUE;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
324 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
325
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
326 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
327 doGrp( char *arg, const Cmd *cmd )
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 int first, last, numb;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
330
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
331 if ( arg[ 0 ] == '\0' )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
332 putSyntax( cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
333 else if ( ! Grp_exists( arg ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
334 putStat( STAT_NO_SUCH_GRP, "No such group" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
335 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
336 {
155
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
337 Utl_cpyStr( server.grp, arg );
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
338 server.groupReady = FALSE;
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
339 server.artPtr = Grp_first( arg );
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
340 first = server.artPtr;
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
341 last = Grp_last( arg );
160
23a53c92d4d7 [svn] apply bug-fix for lazy group loading by Matija Nalis
enz
parents: 155
diff changeset
342
23a53c92d4d7 [svn] apply bug-fix for lazy group loading by Matija Nalis
enz
parents: 155
diff changeset
343 if ( ( first == 0 && last == 0 )
23a53c92d4d7 [svn] apply bug-fix for lazy group loading by Matija Nalis
enz
parents: 155
diff changeset
344 || first > last ) {
23a53c92d4d7 [svn] apply bug-fix for lazy group loading by Matija Nalis
enz
parents: 155
diff changeset
345 changeToGrp( arg );
23a53c92d4d7 [svn] apply bug-fix for lazy group loading by Matija Nalis
enz
parents: 155
diff changeset
346 first = Cont_first();
23a53c92d4d7 [svn] apply bug-fix for lazy group loading by Matija Nalis
enz
parents: 155
diff changeset
347 last = Cont_last();
23a53c92d4d7 [svn] apply bug-fix for lazy group loading by Matija Nalis
enz
parents: 155
diff changeset
348 }
23a53c92d4d7 [svn] apply bug-fix for lazy group loading by Matija Nalis
enz
parents: 155
diff changeset
349
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
350 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
351 || first > last )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
352 first = last = numb = 0;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
353 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
354 numb = last - first + 1;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
355 putStat( STAT_GRP_SELECTED, "%lu %lu %lu %s selected",
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
356 numb, first, last, arg );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
357 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
358 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
359 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
360
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
361 static Bool
155
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
362 loadGrpIfSelected( void )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
363 {
155
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
364 Str group;
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
365 if ( *server.grp == '\0' )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
366 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
367 putStat( STAT_NO_GRP_SELECTED, "No group selected" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
368 return FALSE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
369 }
155
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
370 if ( ! server.groupReady )
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
371 {
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
372 Utl_cpyStr( group, server.grp );
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
373 changeToGrp( group );
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
374 }
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
375 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
376 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
377
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
378 static void
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
379 findServer( const char *msgId, Str result )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
380 {
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
381 const char *p, *pColon, *srv;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
382 Str s, grp;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
383
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
384 Utl_cpyStr( result, "(unknown)" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
385 if ( Db_contains( msgId ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
386 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
387 Utl_cpyStr( s, Db_xref( msgId ) );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
388 p = strtok( s, " \t" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
389 if ( p )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
390 do
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
391 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
392 pColon = strstr( p, ":" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
393 if ( pColon )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
394 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
395 Utl_cpyStrN( grp, p, pColon - p );
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
396 srv = Grp_server( grp );
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
397 if ( Cfg_servIsPreferential( srv, result ) )
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
398 Utl_cpyStr( result, srv );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
399 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
400 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
401 while ( ( p = strtok( NULL, " \t" ) ) );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
402 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
403 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
404
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
405 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
406 retrieveArt( const char *msgId )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
407 {
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
408 Str s;
188
f1bacee93ca6 [svn] * src/client.c,src/client.h,src/fetch.c,src/noffle.c,src/server.c:
bears
parents: 185
diff changeset
409 int stat;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
410
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
411 findServer( msgId, s );
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
412 if ( strcmp( s, "(unknown)" ) == 0
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
413 || strcmp( s, GRP_LOCAL_SERVER_NAME ) == 0 )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
414 return FALSE;
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
415 if ( ! Client_connect( s ) )
119
f50cc311e29a [svn] Leave online mode, if the connection to a remote server
enz
parents: 115
diff changeset
416 {
f50cc311e29a [svn] Leave online mode, if the connection to a remote server
enz
parents: 115
diff changeset
417 Log_inf( "Connection to server failed. Leaving online mode." );
f50cc311e29a [svn] Leave online mode, if the connection to a remote server
enz
parents: 115
diff changeset
418 Online_set( FALSE );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
419 return FALSE;
119
f50cc311e29a [svn] Leave online mode, if the connection to a remote server
enz
parents: 115
diff changeset
420 }
188
f1bacee93ca6 [svn] * src/client.c,src/client.h,src/fetch.c,src/noffle.c,src/server.c:
bears
parents: 185
diff changeset
421 stat = Client_retrieveArt( msgId );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
422 Client_disconnect();
188
f1bacee93ca6 [svn] * src/client.c,src/client.h,src/fetch.c,src/noffle.c,src/server.c:
bears
parents: 185
diff changeset
423 if ( IS_FATAL( stat ) )
f1bacee93ca6 [svn] * src/client.c,src/client.h,src/fetch.c,src/noffle.c,src/server.c:
bears
parents: 185
diff changeset
424 {
f1bacee93ca6 [svn] * src/client.c,src/client.h,src/fetch.c,src/noffle.c,src/server.c:
bears
parents: 185
diff changeset
425 Log_inf( "Server connection failed or newsbase problem. "
f1bacee93ca6 [svn] * src/client.c,src/client.h,src/fetch.c,src/noffle.c,src/server.c:
bears
parents: 185
diff changeset
426 "Leaving online mode." );
f1bacee93ca6 [svn] * src/client.c,src/client.h,src/fetch.c,src/noffle.c,src/server.c:
bears
parents: 185
diff changeset
427 Online_set( FALSE );
f1bacee93ca6 [svn] * src/client.c,src/client.h,src/fetch.c,src/noffle.c,src/server.c:
bears
parents: 185
diff changeset
428 return FALSE;
f1bacee93ca6 [svn] * src/client.c,src/client.h,src/fetch.c,src/noffle.c,src/server.c:
bears
parents: 185
diff changeset
429 }
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
430 return TRUE;
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 Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
434 checkNumb( int numb )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
435 {
155
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
436 if ( ! loadGrpIfSelected() )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
437 return FALSE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
438 if ( ! Cont_validNumb( numb ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
439 {
181
e196de757ecd [svn] * src/server.c: Correct error code given when article requested by
bears
parents: 173
diff changeset
440 putStat( STAT_NO_SUCH_NUMB, "No such article number" );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
441 return FALSE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
442 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
443 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
444 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
445
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
446 /*
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
447 Parse arguments for ARTICLE, BODY, HEAD, STAT commands.
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
448 Return message-ID and article number (0 if unknown).
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
449 */
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
450 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
451 whichId( const char **msgId, int *numb, char *arg )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
452 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
453 const Over *ov;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
454 int n;
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 if ( sscanf( arg, "%d", &n ) == 1 )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
457 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
458 if ( ! checkNumb( n ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
459 return FALSE;
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
460 server.artPtr = n;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
461 ov = Cont_get( n );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
462 *msgId = Ov_msgId( ov );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
463 *numb = n;
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 else if ( strcmp( arg, "" ) == 0 )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
466 {
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
467 if ( ! checkNumb( server.artPtr ) )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
468 return FALSE;
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
469 ov = Cont_get( server.artPtr );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
470 *msgId = Ov_msgId( ov );
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
471 *numb = server.artPtr;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
472 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
473 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
474 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
475 *msgId = arg;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
476 *numb = 0;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
477 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
478 if ( ! Pseudo_isGeneralInfo( *msgId ) && ! Db_contains( *msgId ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
479 {
181
e196de757ecd [svn] * src/server.c: Correct error code given when article requested by
bears
parents: 173
diff changeset
480 putStat( STAT_NO_SUCH_ID, "No such article" );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
481 return FALSE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
482 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
483 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
484 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
485
45
32ba1198c6fa [svn] * Makefile.in, configure, configure.in, docs/Makefile.in, src/Makefile.in:
uh1763
parents: 43
diff changeset
486 static void
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
487 touchArticle( const char *msgId )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
488 {
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
489 int status = Db_status( msgId );
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
490 status |= DB_INTERESTING;
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
491 Db_setStatus( msgId, status );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
492 Db_updateLastAccess( msgId );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
493 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
494
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
495 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
496 touchReferences( const char *msgId )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
497 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
498 Str s;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
499 int len;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
500 char *p;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
501 const char *ref = Db_ref( msgId );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
502
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
503 while ( TRUE )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
504 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
505 p = s;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
506 while ( *ref != '<' )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
507 if ( *(ref++) == '\0' )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
508 return;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
509 len = 0;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
510 while ( *ref != '>' )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
511 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
512 if ( *ref == '\0' || ++len >= MAXCHAR - 1 )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
513 return;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
514 *(p++) = *(ref++);
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 *(p++) = '>';
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
517 *p = '\0';
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
518 if ( Db_contains( s ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
519 touchArticle( s );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
520 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
521 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
522
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
523 static void
241
d70e9dd6b308 [svn] see Changelog Mar 13 2002
mirkol
parents: 237
diff changeset
524 updateArt( const char *msgId )
d70e9dd6b308 [svn] see Changelog Mar 13 2002
mirkol
parents: 237
diff changeset
525 /* retrieve Article if in online mode */
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
526 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
527 int stat;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
528
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
529 touchArticle( msgId );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
530 touchReferences( msgId );
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
531 stat = Db_status( msgId );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
532 if ( Online_true() && ( stat & DB_NOT_DOWNLOADED ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
533 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
534 retrieveArt( msgId );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
535 }
241
d70e9dd6b308 [svn] see Changelog Mar 13 2002
mirkol
parents: 237
diff changeset
536 }
d70e9dd6b308 [svn] see Changelog Mar 13 2002
mirkol
parents: 237
diff changeset
537
d70e9dd6b308 [svn] see Changelog Mar 13 2002
mirkol
parents: 237
diff changeset
538 static void
d70e9dd6b308 [svn] see Changelog Mar 13 2002
mirkol
parents: 237
diff changeset
539 doBodyInDb( const char *msgId )
d70e9dd6b308 [svn] see Changelog Mar 13 2002
mirkol
parents: 237
diff changeset
540 {
d70e9dd6b308 [svn] see Changelog Mar 13 2002
mirkol
parents: 237
diff changeset
541 int stat;
d70e9dd6b308 [svn] see Changelog Mar 13 2002
mirkol
parents: 237
diff changeset
542 Str srv;
d70e9dd6b308 [svn] see Changelog Mar 13 2002
mirkol
parents: 237
diff changeset
543
d70e9dd6b308 [svn] see Changelog Mar 13 2002
mirkol
parents: 237
diff changeset
544 stat = Db_status( msgId );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
545 if ( stat & DB_RETRIEVING_FAILED )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
546 {
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
547 Db_setStatus( msgId, stat & ~DB_RETRIEVING_FAILED );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
548 putTxtBuf( Db_body( msgId ) );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
549 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
550 else if ( stat & DB_NOT_DOWNLOADED )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
551 {
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
552 findServer( msgId, srv );
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
553 if ( Req_contains( srv, msgId ) )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
554 putTxtBuf( Pseudo_alreadyMarkedBody() );
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
555 else if ( strcmp( srv, "(unknown)" ) != 0 &&
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
556 strcmp( srv, GRP_LOCAL_SERVER_NAME ) != 0 &&
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
557 Req_add( srv, msgId ) )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
558 putTxtBuf( Pseudo_markedBody() );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
559 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
560 putTxtBuf( Pseudo_markingFailedBody() );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
561 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
562 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
563 putTxtBuf( Db_body( msgId ) );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
564 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
565
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
566 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
567 doBody( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
568 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
569 const char *msgId;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
570 int numb;
74
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
571
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
572 UNUSED( cmd );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
573
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
574 if ( ! whichId( &msgId, &numb, arg ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
575 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
576 putStat( STAT_BODY_FOLLOWS, "%ld %s Body", numb, msgId );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
577 if ( Pseudo_isGeneralInfo( msgId ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
578 putTxtBuf( Pseudo_generalInfoBody() );
241
d70e9dd6b308 [svn] see Changelog Mar 13 2002
mirkol
parents: 237
diff changeset
579 else
d70e9dd6b308 [svn] see Changelog Mar 13 2002
mirkol
parents: 237
diff changeset
580 {
d70e9dd6b308 [svn] see Changelog Mar 13 2002
mirkol
parents: 237
diff changeset
581 updateArt( msgId );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
582 doBodyInDb( msgId );
241
d70e9dd6b308 [svn] see Changelog Mar 13 2002
mirkol
parents: 237
diff changeset
583 }
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
584 putEndOfTxt();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
585 noteInterest();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
586 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
587 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
588
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
589 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
590 doHeadInDb( const char *msgId )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
591 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
592 putTxtBuf( Db_header( msgId ) );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
593 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
594
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
595 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
596 doHead( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
597 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
598 const char *msgId;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
599 int numb;
74
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
600
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
601 UNUSED( cmd );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
602
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
603 if ( ! whichId( &msgId, &numb, arg ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
604 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
605 putStat( STAT_HEAD_FOLLOWS, "%ld %s Head", numb, msgId );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
606 if ( Pseudo_isGeneralInfo( msgId ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
607 putTxtBuf( Pseudo_generalInfoHead() );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
608 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
609 doHeadInDb( msgId );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
610 putEndOfTxt();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
611 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
612 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
613
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
614 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
615 doArtInDb( const char *msgId )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
616 {
241
d70e9dd6b308 [svn] see Changelog Mar 13 2002
mirkol
parents: 237
diff changeset
617 updateArt( msgId );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
618 doHeadInDb( msgId );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
619 putTxtLn( "" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
620 doBodyInDb( msgId );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
621 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
622
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
623 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
624 doArt( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
625 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
626 const char *msgId;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
627 int numb;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
628
74
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
629 UNUSED( cmd );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
630
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
631 if ( ! whichId( &msgId, &numb, arg ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
632 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
633 putStat( STAT_ART_FOLLOWS, "%ld %s Article", numb, msgId );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
634 if ( Pseudo_isGeneralInfo( msgId ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
635 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
636 putTxtBuf( Pseudo_generalInfoHead() );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
637 putTxtLn( "" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
638 putTxtBuf( Pseudo_generalInfoBody() );
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 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
641 doArtInDb( msgId );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
642 putEndOfTxt();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
643 noteInterest();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
644 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
645 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
646
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
647 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
648 doHelp( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
649 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
650 unsigned int i;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
651
74
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
652 UNUSED( arg );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
653 UNUSED( cmd );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
654
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
655 putStat( STAT_HELP_FOLLOWS, "Help" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
656 putTxtBuf( "\nCommands:\n\n" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
657 for ( i = 0; i < sizeof( commands ) / sizeof( commands[ 0 ] ); ++i )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
658 putTxtLn( "%s", commands[ i ].syntax );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
659 putEndOfTxt();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
660 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
661 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
662
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
663 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
664 doIhave( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
665 {
74
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
666 UNUSED( arg );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
667 UNUSED( cmd );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
668
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
669 putStat( STAT_ART_REJECTED, "Command not used" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
670 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
671 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
672
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
673 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
674 doLast( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
675 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
676 int n;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
677
74
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
678 UNUSED( arg );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
679 UNUSED( cmd );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
680
155
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
681 if ( loadGrpIfSelected() )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
682 {
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
683 n = server.artPtr;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
684 if ( ! Cont_validNumb( n ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
685 putStat( STAT_NO_ART_SELECTED, "No article selected" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
686 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
687 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
688 while ( ! Cont_validNumb( --n ) && n >= Cont_first() );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
689 if ( ! Cont_validNumb( n ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
690 putStat( STAT_NO_PREV_ART, "No previous article" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
691 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
692 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
693 putStat( STAT_ART_RETRIEVED, "%ld %s selected",
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
694 n, Ov_msgId( Cont_get( n ) ) );
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
695 server.artPtr = n;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
696 }
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 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
699 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
700 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
701
173
19e3aa717196 [svn] do not search all groups if group does not
enz
parents: 167
diff changeset
702 static Bool
19e3aa717196 [svn] do not search all groups if group does not
enz
parents: 167
diff changeset
703 containsWildcards( const char *pattern )
19e3aa717196 [svn] do not search all groups if group does not
enz
parents: 167
diff changeset
704 {
19e3aa717196 [svn] do not search all groups if group does not
enz
parents: 167
diff changeset
705 return ( strpbrk( pattern, "?*[\\" ) == NULL ? FALSE : TRUE );
19e3aa717196 [svn] do not search all groups if group does not
enz
parents: 167
diff changeset
706 }
19e3aa717196 [svn] do not search all groups if group does not
enz
parents: 167
diff changeset
707
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
708 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
709 printGroups( const char *pat, void (*printProc)( Str, const char* ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
710 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
711 Str line;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
712 const char *g;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
713
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
714 putStat( STAT_GRPS_FOLLOW, "Groups" );
173
19e3aa717196 [svn] do not search all groups if group does not
enz
parents: 167
diff changeset
715 if ( containsWildcards( pat ) )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
716 {
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
717 if ( Grp_firstGrp( &g ) )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
718 do
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
719 if ( Wld_match( g, pat ) )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
720 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
721 (*printProc)( line, g );
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
722 putTxtLn( line );
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
723 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
724 while ( Grp_nextGrp( &g ) );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
725 }
173
19e3aa717196 [svn] do not search all groups if group does not
enz
parents: 167
diff changeset
726 else if ( Grp_exists( pat ) )
19e3aa717196 [svn] do not search all groups if group does not
enz
parents: 167
diff changeset
727 {
19e3aa717196 [svn] do not search all groups if group does not
enz
parents: 167
diff changeset
728 (*printProc)( line, pat );
19e3aa717196 [svn] do not search all groups if group does not
enz
parents: 167
diff changeset
729 putTxtLn( line );
19e3aa717196 [svn] do not search all groups if group does not
enz
parents: 167
diff changeset
730 }
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
731 putEndOfTxt();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
732 }
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 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
735 printActiveTimes( Str result, const char *grp )
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 snprintf( result, MAXCHAR, "%s %ld", grp, Grp_created( grp ) );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
738 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
739
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
740 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
741 doListActiveTimes( const char *pat )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
742 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
743 printGroups( pat, &printActiveTimes );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
744 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
745
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
746 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
747 printActive( Str result, const char *grp )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
748 {
49
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
749 int last;
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
750
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
751 /* If there will be a pseudo gen info message waiting when we join
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
752 this group, fiddle the group numbers to show it. */
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
753 last = Grp_last( grp );
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
754 if ( needsPseudoGenInfo( grp ) )
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
755 last++;
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
756
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
757 snprintf( result, MAXCHAR, "%s %d %d %c",
49
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
758 grp, last, Grp_first( grp ), Grp_postAllow( grp ) );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
759 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
760
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
761 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
762 doListActive( const char *pat )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
763 {
49
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
764 /* We need to read the fetchlist so we know whether a pseudo
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
765 gen info article needs to be faked when printing the group
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
766 last. */
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
767 Fetchlist_read();
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
768 printGroups( pat, &printActive );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
769 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
770
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
771 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
772 printNewsgrp( Str result, const char *grp )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
773 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
774 snprintf( result, MAXCHAR, "%s %s", grp, Grp_dsc( grp ) );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
775 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
776
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
777 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
778 doListNewsgrps( const char *pat )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
779 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
780 printGroups( pat, &printNewsgrp );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
781 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
782
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
783 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
784 putGrp( const char *name )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
785 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
786 putTxtLn( "%s %lu %lu y", name, Grp_last( name ), Grp_first( name ) );
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
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
789 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
790 doListOverFmt( void )
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 putStat( STAT_GRPS_FOLLOW, "Overview format" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
793 putTxtBuf( "Subject:\n"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
794 "From:\n"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
795 "Date:\n"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
796 "Message-ID:\n"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
797 "References:\n"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
798 "Bytes:\n"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
799 "Lines:\n" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
800 putEndOfTxt();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
801 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
802
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
803 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
804 doListExtensions( void )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
805 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
806 putStat( STAT_CMD_OK, "Extensions" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
807 putTxtBuf( " LISTGROUP\n"
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
808 " XOVER\n" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
809 putEndOfTxt();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
810 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
811
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
812 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
813 doList( char *line, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
814 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
815 Str s, arg;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
816 const char *pat;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
817
259
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
818 if ( sscanf( line, MAXCHAR_FMT, s ) != 1 )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
819 doListActive( "*" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
820 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
821 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
822 Utl_toLower( s );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
823 strcpy( arg, Utl_restOfLn( line, 1 ) );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
824 pat = Utl_stripWhiteSpace( arg );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
825 if ( pat[ 0 ] == '\0' )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
826 pat = "*";
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
827 if ( strcmp( "active", s ) == 0 )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
828 doListActive( pat );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
829 else if ( strcmp( "overview.fmt", s ) == 0 )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
830 doListOverFmt();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
831 else if ( strcmp( "newsgroups", s ) == 0 )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
832 doListNewsgrps( pat );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
833 else if ( strcmp( "active.times", s ) == 0 )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
834 doListActiveTimes( pat );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
835 else if ( strcmp( "extensions", s ) == 0 )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
836 doListExtensions();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
837 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
838 putSyntax( cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
839 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
840 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
841 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
842
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
843 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
844 doListgrp( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
845 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
846 const Over *ov;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
847 int first, last, i;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
848
74
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
849 UNUSED( cmd );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
850
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
851 if ( ! Grp_exists( arg ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
852 putStat( STAT_NO_SUCH_GRP, "No such group" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
853 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
854 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
855 changeToGrp( arg );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
856 first = Cont_first();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
857 last = Cont_last();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
858 putStat( STAT_GRP_SELECTED, "Article list" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
859 for ( i = first; i <= last; ++i )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
860 if ( ( ov = Cont_get( i ) ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
861 putTxtLn( "%lu", i );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
862 putEndOfTxt();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
863 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
864 return TRUE;
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
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
867 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
868 doMode( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
869 {
74
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
870 UNUSED( arg );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
871 UNUSED( cmd );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
872
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
873 putStat( STAT_READY_POST_ALLOW, "Ok" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
874 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
875 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
876
259
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
877 /*
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
878 * Given a time specification (local time or GMT), return a time_t.
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
879 */
69
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
880 static time_t
259
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
881 getTimeInSeconds( int year, int mon, int day,
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
882 int hour, int min, int sec,
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
883 Bool timeIsGMT )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
884 {
64
7250be163ec4 [svn] Avoid compiler warnings about incomplete initializer blocks
enz
parents: 61
diff changeset
885 struct tm t;
69
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
886 time_t result;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
887
69
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
888 ASSERT( year >= 1900 );
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
889 ASSERT( mon >= 1 );
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
890 ASSERT( mon <= 12 );
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
891 ASSERT( day >= 1 );
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
892 ASSERT( day <= 31 );
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
893 ASSERT( hour >= 0 );
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
894 ASSERT( hour <= 23 );
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
895 ASSERT( min >= 0 );
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
896 ASSERT( min <= 59 );
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
897 ASSERT( sec >= 0 );
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
898 ASSERT( sec <= 59 );
64
7250be163ec4 [svn] Avoid compiler warnings about incomplete initializer blocks
enz
parents: 61
diff changeset
899 memset( &t, 0, sizeof( t ) );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
900 t.tm_year = year - 1900;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
901 t.tm_mon = mon - 1;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
902 t.tm_mday = day;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
903 t.tm_hour = hour;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
904 t.tm_min = min;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
905 t.tm_sec = sec;
259
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
906 t.tm_isdst = -1;
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
907 result = timeIsGMT ? Utl_mktimeGMT( &t ) : mktime( &t );
69
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
908 return result;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
909 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
910
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
911
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
912 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
913 doNewgrps( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
914 {
259
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
915 time_t t, now, lastUpdate;
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
916 int year, mon, day, hour, min, sec, len, fields, nowYear;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
917 const char *g;
259
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
918 Str date, timeofday, file, utc;
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
919 Bool timeIsGMT = FALSE;
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
920 struct tm *tm;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
921
259
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
922 fields = sscanf( arg, MAXCHAR_FMT " " MAXCHAR_FMT " " MAXCHAR_FMT,
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
923 date, timeofday, utc );
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
924 if ( fields == 3 )
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
925 {
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
926 Utl_toLower( utc );
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
927 if ( strcmp( utc, "gmt" ) != 0 && strcmp( utc, "utc" ) != 0 )
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
928 {
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
929 putSyntax( cmd );
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
930 return TRUE;
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
931 }
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
932 timeIsGMT = TRUE;
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
933 }
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
934 else if ( fields != 2 )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
935 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
936 putSyntax( cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
937 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
938 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
939 len = strlen( date );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
940 switch ( len )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
941 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
942 case 6:
69
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
943 if ( sscanf( date, "%2d%2d%2d", &year, &mon, &day ) != 3 )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
944 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
945 putSyntax( cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
946 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
947 }
259
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
948 /*
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
949 * As per current IETF draft, year is this century if <= now,
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
950 * else last century.
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
951 */
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
952 now = time( NULL );
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
953 tm = timeIsGMT ? gmtime( &now ) : localtime( &now );
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
954 nowYear = tm->tm_year + 1900;
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
955 year += ( nowYear / 100 ) * 100;
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
956 if ( year % 100 > nowYear % 100 )
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
957 year -= 100;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
958 break;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
959 case 8:
69
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
960 if ( sscanf( date, "%4d%2d%2d", &year, &mon, &day ) != 3 )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
961 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
962 putSyntax( cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
963 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
964 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
965 break;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
966 default:
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
967 putSyntax( cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
968 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
969 }
69
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
970 if ( sscanf( timeofday, "%2d%2d%2d", &hour, &min, &sec ) != 3 )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
971 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
972 putSyntax( cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
973 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
974 }
69
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
975 if ( year < 1970 || mon < 1 || mon > 12 || day < 1 || day > 31
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
976 || hour < 0 || hour > 23 || min < 0 || min > 59
21e778b6c3e9 [svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents: 64
diff changeset
977 || sec < 0 || sec > 60 )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
978 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
979 putSyntax( cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
980 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
981 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
982 snprintf( file, MAXCHAR, "%s/groupinfo.lastupdate", Cfg_spoolDir() );
259
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
983 t = getTimeInSeconds( year, mon, day, hour, min, sec, timeIsGMT );
223
ffb1848a39db [svn] * src/util.c: Improve (correct) error detection when updating
bears
parents: 197
diff changeset
984
ffb1848a39db [svn] * src/util.c: Improve (correct) error detection when updating
bears
parents: 197
diff changeset
985 if ( ! Utl_getStamp( &lastUpdate, file ) )
ffb1848a39db [svn] * src/util.c: Improve (correct) error detection when updating
bears
parents: 197
diff changeset
986 {
ffb1848a39db [svn] * src/util.c: Improve (correct) error detection when updating
bears
parents: 197
diff changeset
987 /* Can't get stamp. Put out error message. */
ffb1848a39db [svn] * src/util.c: Improve (correct) error detection when updating
bears
parents: 197
diff changeset
988 putStat( STAT_PROGRAM_FAULT, "Server error reading %s", file );
ffb1848a39db [svn] * src/util.c: Improve (correct) error detection when updating
bears
parents: 197
diff changeset
989 return TRUE;
ffb1848a39db [svn] * src/util.c: Improve (correct) error detection when updating
bears
parents: 197
diff changeset
990 }
259
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
991
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
992 /* Show timestamp back as news format time for confirmation. */
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
993 Utl_newsDate( t, timeofday );
223
ffb1848a39db [svn] * src/util.c: Improve (correct) error detection when updating
bears
parents: 197
diff changeset
994
259
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
995 putStat( STAT_NEW_GRP_FOLLOW, "New groups since %s", timeofday );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
996
223
ffb1848a39db [svn] * src/util.c: Improve (correct) error detection when updating
bears
parents: 197
diff changeset
997 if ( t == (time_t)-1 || t <= lastUpdate )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
998 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
999 if ( Grp_firstGrp( &g ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1000 do
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1001 if ( Grp_created( g ) > t )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1002 putGrp( g );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1003 while ( Grp_nextGrp( &g ) );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1004 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1005 putEndOfTxt();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1006 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1007 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1008
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1009 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1010 doNext( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1011 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1012 int n;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1013
74
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
1014 UNUSED(arg);
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
1015 UNUSED(cmd);
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
1016
155
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
1017 if ( loadGrpIfSelected() )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1018 {
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
1019 n = server.artPtr;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1020 if ( ! Cont_validNumb( n ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1021 putStat( STAT_NO_ART_SELECTED, "No article selected" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1022 else
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 while ( ! Cont_validNumb( ++n ) && n <= Cont_last() );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1025 if ( ! Cont_validNumb( n ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1026 putStat( STAT_NO_NEXT_ART, "No next article" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1027 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1028 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1029 putStat( STAT_ART_RETRIEVED, "%ld %s selected",
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1030 n, Ov_msgId( Cont_get( n ) ) );
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
1031 server.artPtr = n;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1032 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1033 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1034 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1035 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1036 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1037
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1038 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1039 doPost( char *arg, const Cmd *cmd )
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 DynStr *s;
88
1fcdced0246e [svn] Move posting code to post.c, add command line posting
bears
parents: 85
diff changeset
1042 Str line;
1fcdced0246e [svn] Move posting code to post.c, add command line posting
bears
parents: 85
diff changeset
1043 Bool err;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1044
74
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
1045 UNUSED(arg);
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
1046 UNUSED(cmd);
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
1047
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1048 /*
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1049 * The article may take some time coming in, so release the
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1050 * lock while collecting it.
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1051 */
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1052 putStat( STAT_SEND_ART, "Continue (end with period)" );
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1053 sendOutput();
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1054 closeServer();
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1055
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1056 s = new_DynStr( 10000 );
88
1fcdced0246e [svn] Move posting code to post.c, add command line posting
bears
parents: 85
diff changeset
1057 err = FALSE;
1fcdced0246e [svn] Move posting code to post.c, add command line posting
bears
parents: 85
diff changeset
1058 while ( ! err && getTxtLn( line, &err ) )
1fcdced0246e [svn] Move posting code to post.c, add command line posting
bears
parents: 85
diff changeset
1059 DynStr_appLn( s, line );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1060
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1061 initOutput();
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1062 if ( ! initServer() )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1063 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1064 del_DynStr( s );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1065 return FALSE;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1066 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1067
88
1fcdced0246e [svn] Move posting code to post.c, add command line posting
bears
parents: 85
diff changeset
1068 if ( ! err
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1069 && Post_open( DynStr_str( s ), 0 )
115
3b4db42990e0 [svn] Approved: header, group check before post, all external servers.
bears
parents: 106
diff changeset
1070 && Post_post() )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1071 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1072 putStat( STAT_POST_OK, "Message posted" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1073 if ( Online_true() )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1074 postArts();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1075 }
88
1fcdced0246e [svn] Move posting code to post.c, add command line posting
bears
parents: 85
diff changeset
1076 else
1fcdced0246e [svn] Move posting code to post.c, add command line posting
bears
parents: 85
diff changeset
1077 putStat( STAT_POST_FAILED, "Posting failed" );
1fcdced0246e [svn] Move posting code to post.c, add command line posting
bears
parents: 85
diff changeset
1078 Post_close();
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1079 del_DynStr( s );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1080 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1081 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1082
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1083 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1084 parseRange( const char *s, int *first, int *last, int *numb )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1085 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1086 int r, i;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1087 char* p;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1088 Str t;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1089
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1090 Utl_cpyStr( t, s );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1091 p = Utl_stripWhiteSpace( t );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1092 r = sscanf( p, "%d-%d", first, last );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1093 if ( r < 1 )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1094 {
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
1095 *first = server.artPtr;
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
1096 *last = server.artPtr;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1097 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1098 else if ( r == 1 )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1099 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1100 if ( p[ strlen( p ) - 1 ] == '-' )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1101 *last = Cont_last();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1102 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1103 *last = *first;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1104 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1105 if ( *first < Cont_first() )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1106 *first = Cont_first();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1107 if ( *last > Cont_last() )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1108 *last = Cont_last();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1109 if ( *first > Cont_last() || *last < Cont_first() )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1110 *last = *first - 1;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1111 *numb = 0;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1112 for ( i = *first; i <= *last; ++i )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1113 if ( Cont_validNumb( i ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1114 ++(*numb);
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1115 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1116
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1117 enum XhdrType { SUBJ, FROM, DATE, MSG_ID, REF, BYTES, LINES, XREF, UNKNOWN };
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1118
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1119 static enum XhdrType
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1120 whatXhdrField( const char * fieldname )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1121 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1122 Str name;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1123
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1124 Utl_cpyStr( name, fieldname );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1125 Utl_toLower( name );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1126 if ( strcmp( name, "subject" ) == 0 )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1127 return SUBJ;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1128 else if ( strcmp( name, "from" ) == 0 )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1129 return FROM;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1130 else if ( strcmp( name, "date" ) == 0 )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1131 return DATE;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1132 else if ( strcmp( name, "message-id" ) == 0 )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1133 return MSG_ID;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1134 else if ( strcmp( name, "references" ) == 0 )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1135 return REF;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1136 else if ( strcmp( name, "bytes" ) == 0 )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1137 return BYTES;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1138 else if ( strcmp( name, "lines" ) == 0 )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1139 return LINES;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1140 else if ( strcmp( name, "xref" ) == 0 )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1141 return XREF;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1142 else
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1143 return UNKNOWN;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1144 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1145
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1146 static void
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1147 getXhdrField( enum XhdrType what, const Over * ov, Str res )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1148 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1149 const char * msgId;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1150 Str host;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1151
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1152 switch ( what )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1153 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1154 case SUBJ:
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1155 Utl_cpyStr( res, Ov_subj( ov ) );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1156 break;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1157 case FROM:
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1158 Utl_cpyStr( res, Ov_from( ov ) );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1159 break;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1160 case DATE:
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1161 Utl_cpyStr( res, Ov_date( ov ) );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1162 break;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1163 case MSG_ID:
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1164 Utl_cpyStr( res, Ov_msgId( ov ) );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1165 break;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1166 case REF:
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1167 Utl_cpyStr( res, Ov_ref( ov ) );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1168 break;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1169 case BYTES:
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1170 snprintf( res, MAXCHAR, "%d", Ov_bytes( ov ) );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1171 break;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1172 case LINES:
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1173 snprintf( res, MAXCHAR, "%d", Ov_lines( ov ) );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1174 break;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1175 case XREF:
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1176 msgId = Ov_msgId( ov );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1177 /*
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1178 * Gen info messages don't have an Xref header. When INN is asked
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1179 * for a header that doesn't exist in a message, it reports the
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1180 * header value as '(none)', so do the same.
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1181 */
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1182 if ( Pseudo_isGeneralInfo( msgId ) )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1183 Utl_cpyStr( res, "none" );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1184 else
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1185 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1186 gethostname( host, MAXCHAR );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1187 snprintf( res, MAXCHAR, "%s %s", host, Db_xref( msgId ) );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1188 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1189 break;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1190 default:
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1191 ASSERT( FALSE );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1192 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1193 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1194
49
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1195 /*
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1196 Note this only handles a subset of headers. But they are all
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1197 the headers any newsreader should need to work properly.
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1198
49
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1199 That last sentence will at some stage be proved wrong.
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1200 */
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1201 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1202 doXhdr( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1203 {
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1204 enum XhdrType what;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1205 const char *p;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1206 Str whatStr;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1207
259
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
1208 if ( sscanf( arg, MAXCHAR_FMT, whatStr ) != 1 )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1209 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1210 putSyntax( cmd );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1211 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1212 }
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1213 what = whatXhdrField( whatStr );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1214 if ( what == UNKNOWN )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1215 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1216 putStat( STAT_HEAD_FOLLOWS, "Unknown header (empty list follows)" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1217 putEndOfTxt();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1218 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1219 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1220 p = Utl_restOfLn( arg, 1 );
49
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1221 if ( p[ 0 ] == '<' )
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1222 {
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1223 Over * ov;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1224 Str field;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1225
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1226 /* Argument is message ID */
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1227 ov = Db_over( p );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1228 if ( ov == NULL )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1229 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1230 putStat( STAT_NO_SUCH_ID, "No such article" );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1231 return TRUE;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1232 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1233 putStat( STAT_HEAD_FOLLOWS, "%s header %s", whatStr, p ) ;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1234 getXhdrField( what, ov, field );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1235 putTxtLn( "%s %s", p, field );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1236 del_Over( ov );
49
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1237 }
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1238 else
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1239 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1240 const Over * ov;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1241 int first, last, i, n, numb;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1242 Str field;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1243
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1244 /* Argument is article no. or range */
155
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
1245 if ( ! loadGrpIfSelected() )
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1246 return TRUE;
49
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1247 parseRange( p, &first, &last, &numb );
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1248 if ( numb == 0 )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1249 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1250 putStat( STAT_NO_ART_SELECTED, "No articles selected" );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1251 return TRUE;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1252 }
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1253 putStat( STAT_HEAD_FOLLOWS, "%s header %lu-%lu",
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1254 whatStr, first, last ) ;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1255 for ( i = first; i <= last; ++i )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1256 if ( ( ov = Cont_get( i ) ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1257 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1258 n = Ov_numb( ov );
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1259 getXhdrField( what, ov, field );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1260 putTxtLn( "%lu %s", n, field );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1261 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1262 }
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1263 putEndOfTxt();
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1264 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1265 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1266
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1267 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1268 doXpat( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1269 {
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1270 enum XhdrType what;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1271 Str whatStr, articles, pat;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1272
259
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
1273 if ( sscanf( arg, MAXCHAR_FMT " " MAXCHAR_FMT " " MAXCHAR_FMT,
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
1274 whatStr, articles, pat ) != 3 )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1275 {
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1276 putSyntax( cmd );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1277 return TRUE;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1278 }
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1279 what = whatXhdrField( whatStr );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1280 if ( what == UNKNOWN )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1281 {
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1282 putStat( STAT_HEAD_FOLLOWS, "Unknown header (empty list follows)" );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1283 putEndOfTxt();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1284 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1285 }
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1286 if ( articles[ 0 ] == '<' )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1287 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1288 Over * ov;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1289 Str field;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1290
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1291 /* Argument is message ID */
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1292 ov = Db_over( articles );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1293 if ( ov == NULL )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1294 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1295 putStat( STAT_NO_SUCH_ID, "No such article" );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1296 return TRUE;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1297 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1298 putStat( STAT_HEAD_FOLLOWS, "%s header %s", whatStr, articles ) ;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1299 getXhdrField( what, ov, field );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1300 if ( Wld_match( field, pat ) )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1301 putTxtLn( "%s %s", articles, field );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1302 del_Over( ov );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1303 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1304 else
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1305 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1306 const Over * ov;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1307 Str field;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1308 int first, last, i, n, numb;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1309
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1310 /* Argument is article no. or range */
155
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
1311 if ( ! loadGrpIfSelected() )
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1312 return TRUE;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1313 parseRange( articles, &first, &last, &numb );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1314 if ( numb == 0 )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1315 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1316 putStat( STAT_NO_ART_SELECTED, "No articles selected" );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1317 return TRUE;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1318 }
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1319 putStat( STAT_HEAD_FOLLOWS, "%s header %lu-%lu",
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1320 whatStr, first, last ) ;
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1321 for ( i = first; i <= last; ++i )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1322 if ( ( ov = Cont_get( i ) ) )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1323 {
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1324 n = Ov_numb( ov );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1325 getXhdrField( what, ov, field );
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1326 if ( Wld_match( field, pat ) )
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1327 putTxtLn( "%lu %s", n, field );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1328 }
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1329 }
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1330 putEndOfTxt();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1331 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1332 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1333
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1334 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1335 doSlave( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1336 {
74
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
1337 UNUSED( arg );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
1338 UNUSED( cmd );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
1339
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1340 putStat( STAT_CMD_OK, "Ok" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1341 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1342 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1343
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1344 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1345 doStat( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1346 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1347 const char *msgId;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1348 int numb;
74
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
1349
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
1350 UNUSED( cmd );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1351
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1352 if ( ! whichId( &msgId, &numb, arg ) )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1353 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1354 if ( numb > 0 )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1355 putStat( STAT_ART_RETRIEVED, "%ld %s selected",
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1356 numb, msgId );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1357 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1358 putStat( STAT_ART_RETRIEVED, "0 %s selected", msgId );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1359 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1360 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1361
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1362 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1363 doQuit( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1364 {
74
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
1365 UNUSED( arg );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
1366 UNUSED( cmd );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
1367
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1368 putStat( STAT_GOODBYE, "Goodbye" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1369 return FALSE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1370 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1371
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1372 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1373 doXOver( char *arg, const Cmd *cmd )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1374 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1375 int first, last, i, n;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1376 const Over *ov;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1377
74
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
1378 UNUSED( cmd );
c7df2cc65cc1 [svn] Introduce UNUSED(x) macro
bears
parents: 69
diff changeset
1379
155
22b81617d427 [svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents: 149
diff changeset
1380 if ( ! loadGrpIfSelected() )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1381 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1382 parseRange( arg, &first, &last, &n );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1383 if ( n == 0 )
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
1384 first = last = server.artPtr;
49
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1385 putStat( STAT_OVERS_FOLLOW, "Overview %ld-%ld", first, last );
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1386 for ( i = first; i <= last; ++i )
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1387 if ( ( ov = Cont_get( i ) ) )
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1388 putTxtLn( "%lu\t%s\t%s\t%s\t%s\t%s\t%d\t%d\t",
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1389 Ov_numb( ov ), Ov_subj( ov ), Ov_from( ov ),
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1390 Ov_date( ov ), Ov_msgId( ov ), Ov_ref( ov ),
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1391 Ov_bytes( ov ), Ov_lines( ov ) );
5ecb646acf97 [svn] Article numbering bug fixes
bears
parents: 45
diff changeset
1392 putEndOfTxt();
191
28488e0e3630 [svn] * src/group.h,src/group.c,src/noffle.c,src/server.c: Grp_setLastAccess is
bears
parents: 188
diff changeset
1393 Grp_setLastAccess( server.grp );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1394 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1395 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1396
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1397 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1398 putFatal( const char *fmt, ... )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1399 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1400 va_list ap;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1401 Str s;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1402
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1403 va_start( ap, fmt );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1404 vsnprintf( s, MAXCHAR, fmt, ap );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1405 va_end( ap );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1406 Log_err( s );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1407 putStat( STAT_PROGRAM_FAULT, "%s", s );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1408 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1409
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1410 /* Parse line, execute command and return FALSE, if it was the quit command. */
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1411 static Bool
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1412 parseAndExecute( Str line )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1413 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1414 unsigned int i, n;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1415 Cmd *c;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1416 Str s, arg;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1417 Bool ret;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1418
259
b660fadc1814 [svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents: 241
diff changeset
1419 if ( sscanf( line, MAXCHAR_FMT, s ) == 1 )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1420 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1421 Utl_toLower( s );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1422 strcpy( arg, Utl_restOfLn( line, 1 ) );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1423 n = sizeof( commands ) / sizeof( commands[ 0 ] );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1424 for ( i = 0, c = commands; i < n; ++i, ++c )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1425 if ( strcmp( c->name, s ) == 0 )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1426 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1427 ret = c->cmdProc( Utl_stripWhiteSpace( arg ), c );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1428 return ret;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1429 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1430 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1431 putStat( STAT_NO_SUCH_CMD, "Command not recognized" );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1432 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1433 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1434
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1435 static void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1436 putWelcome( void )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1437 {
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1438 initOutput();
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1439 putStat( STAT_READY_POST_ALLOW, "NNTP server NOFFLE %s",
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1440 Cfg_version() );
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1441 sendOutput();
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1442 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1443
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1444 static Bool
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
1445 initServer( void )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1446 {
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
1447 ASSERT( ! server.running );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1448 if ( ! Lock_openDatabases() )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1449 return FALSE;
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
1450 server.running = TRUE;
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1451 server.lastServerOpen = time( NULL );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1452 return TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1453 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1454
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1455 static void
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
1456 closeServer( void )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1457 {
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
1458 ASSERT( server.running );
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
1459 server.running = FALSE;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1460 Lock_closeDatabases();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1461 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1462
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1463 void
167
7ba337dafb2c [svn] * TODO,content.c,lock.c,server.c,server.h: Remove bug notice re:
bears
parents: 160
diff changeset
1464 Server_flushCache( void )
7ba337dafb2c [svn] * TODO,content.c,lock.c,server.c,server.h: Remove bug notice re:
bears
parents: 160
diff changeset
1465 {
7ba337dafb2c [svn] * TODO,content.c,lock.c,server.c,server.h: Remove bug notice re:
bears
parents: 160
diff changeset
1466 server.groupReady = FALSE;
7ba337dafb2c [svn] * TODO,content.c,lock.c,server.c,server.h: Remove bug notice re:
bears
parents: 160
diff changeset
1467 }
7ba337dafb2c [svn] * TODO,content.c,lock.c,server.c,server.h: Remove bug notice re:
bears
parents: 160
diff changeset
1468
7ba337dafb2c [svn] * TODO,content.c,lock.c,server.c,server.h: Remove bug notice re:
bears
parents: 160
diff changeset
1469 void
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
1470 Server_run( void )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1471 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1472 Bool done;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1473 Str line;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1474
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1475 putWelcome();
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1476 done = FALSE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1477 while ( ! done )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1478 {
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1479 if ( Prt_getLn( line, stdin, -1 ) )
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1480 {
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1481 initOutput();
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1482
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1483 if ( ! initServer() )
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1484 {
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1485 putFatal( "Cannot init server" );
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1486 done = TRUE;
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1487 }
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1488 else
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1489 {
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1490 if ( ! parseAndExecute( line ) )
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1491 done = TRUE;
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1492 }
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1493
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1494 if ( server.running )
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1495 closeServer();
149
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1496
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1497 sendOutput();
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1498 }
bfeea2bc09b6 [svn] Output to buffer, release lock and then send output.
bears
parents: 144
diff changeset
1499 else
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1500 {
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1501 Log_inf( "Client disconnected. Terminating." );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1502 done = TRUE;
127
3c71e28c8eef [svn] Release-1-0 mergedocs/NOTES
bears
parents: 119
diff changeset
1503 }
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1504 }
61
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
1505 if ( server.running )
adf0af5152f7 [svn] Renamed some variables and function names, because they caused compiler
enz
parents: 54
diff changeset
1506 closeServer();
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1507 }