Mercurial > noffle
annotate src/server.c @ 278:a0497ffac49b noffle
[svn] I'm not very good at automake. Redo with automake2.13.
author | bears |
---|---|
date | Sun, 10 Nov 2002 18:49:41 +0000 |
parents | 3477050e8d10 |
children | c02c4eb95f95 |
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 |
271
3477050e8d10
[svn] * src/client.c,src/fetch.c,src/lock.c.src/protocol.c,src/util.h,src/util.c:
bears
parents:
269
diff
changeset
|
4 $Id: server.c 403 2002-11-10 11:32:17Z 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 | 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 | 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 | 94 static void closeServer( void ); |
95 static Bool initServer( void ); | |
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)", ¬Implemented }, |
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 | 117 { "xhdr", "XHDR over-field [msg-id|m[-[n]]]", &doXhdr }, |
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 | 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 | 136 { |
137 if ( Cfg_autoSubscribe() ) | |
138 { | |
106 | 139 if ( strcmp( Cfg_autoSubscribeMode( server.grp ), "full" ) == 0 ) |
82 | 140 mode = FULL; |
106 | 141 else if ( strcmp( Cfg_autoSubscribeMode( server.grp ), "thread" ) == 0 ) |
82 | 142 mode = THREAD; |
143 else | |
144 mode = OVER; | |
145 Fetchlist_add( server.grp, mode ); | |
146 Fetchlist_write(); | |
147 Pseudo_autoSubscribed(); | |
148 } | |
149 else if ( Cfg_infoAlways() ) | |
150 { | |
151 int first, last; | |
152 | |
153 /* Ensure new gen info for next time */ | |
154 first = Cont_first(); | |
155 last = Cont_last(); | |
156 | |
157 if ( first == last ) | |
158 first = last + 1; | |
159 | |
160 Grp_setFirstLast( Cont_grp(), first, last ); | |
161 } | |
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 | 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 | 217 } |
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 | 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 | 239 UNUSED( arg ); |
240 UNUSED( cmd ); | |
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 | 292 static Bool |
293 needsPseudoGenInfo( const char *grp ) | |
294 { | |
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 | 297 || Online_true() ); |
298 } | |
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 | 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 | 308 /* This adds the pseudo message to the overview contents |
309 but NOT to the group info. If an article gets added, | |
310 the group info will get updated then from the | |
311 contents, so the article number will be preserved. | |
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 |
269
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
317 loadGrpInfo( const char *grp ) |
43
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 ); |
269
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
322 |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
323 /* |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
324 * This routine is used to change back to a group after releasing |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
325 * the lock. We need to preserve the group cursor if at all possible. |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
326 * So, if the article pointer points to an article before or after |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
327 * the current range, adjust it to the first/last article. Otherwise |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
328 * leave it well alone. |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
329 */ |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
330 if ( server.artPtr < Cont_first() ) |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
331 server.artPtr = Cont_first(); |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
332 else if ( server.artPtr > Cont_last() ) |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
333 server.artPtr = Cont_last(); |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
334 |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
335 server.groupReady = TRUE; |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
336 } |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
337 |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
338 static void |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
339 changeToGrp( const char *grp ) |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
340 { |
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
341 loadGrpInfo( grp ); |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
342 server.artPtr = Cont_first(); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
343 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
344 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
345 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
346 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
|
347 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
348 int first, last, numb; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
349 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
350 if ( arg[ 0 ] == '\0' ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
351 putSyntax( cmd ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
352 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
|
353 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
|
354 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
355 { |
155
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
356 Utl_cpyStr( server.grp, arg ); |
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
357 server.groupReady = FALSE; |
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
358 server.artPtr = Grp_first( arg ); |
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
359 first = server.artPtr; |
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
360 last = Grp_last( arg ); |
160
23a53c92d4d7
[svn] apply bug-fix for lazy group loading by Matija Nalis
enz
parents:
155
diff
changeset
|
361 |
23a53c92d4d7
[svn] apply bug-fix for lazy group loading by Matija Nalis
enz
parents:
155
diff
changeset
|
362 if ( ( first == 0 && last == 0 ) |
23a53c92d4d7
[svn] apply bug-fix for lazy group loading by Matija Nalis
enz
parents:
155
diff
changeset
|
363 || first > last ) { |
23a53c92d4d7
[svn] apply bug-fix for lazy group loading by Matija Nalis
enz
parents:
155
diff
changeset
|
364 changeToGrp( arg ); |
23a53c92d4d7
[svn] apply bug-fix for lazy group loading by Matija Nalis
enz
parents:
155
diff
changeset
|
365 first = Cont_first(); |
23a53c92d4d7
[svn] apply bug-fix for lazy group loading by Matija Nalis
enz
parents:
155
diff
changeset
|
366 last = Cont_last(); |
23a53c92d4d7
[svn] apply bug-fix for lazy group loading by Matija Nalis
enz
parents:
155
diff
changeset
|
367 } |
23a53c92d4d7
[svn] apply bug-fix for lazy group loading by Matija Nalis
enz
parents:
155
diff
changeset
|
368 |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
369 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
|
370 || first > last ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
371 first = last = numb = 0; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
372 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
373 numb = last - first + 1; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
374 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
|
375 numb, first, last, arg ); |
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 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
378 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
379 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
380 static Bool |
155
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
381 loadGrpIfSelected( void ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
382 { |
155
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
383 Str group; |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
384 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
|
385 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
386 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
|
387 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
388 } |
155
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
389 if ( ! server.groupReady ) |
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
390 { |
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
391 Utl_cpyStr( group, server.grp ); |
269
b3a2f710fe2c
[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the
bears
parents:
264
diff
changeset
|
392 loadGrpInfo( group ); |
155
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
393 } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
394 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
395 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
396 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
397 static void |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
398 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
|
399 { |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
400 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
|
401 Str s, grp; |
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 Utl_cpyStr( result, "(unknown)" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
404 if ( Db_contains( msgId ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
405 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
406 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
|
407 p = strtok( s, " \t" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
408 if ( p ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
409 do |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
410 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
411 pColon = strstr( p, ":" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
412 if ( pColon ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
413 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
414 Utl_cpyStrN( grp, p, pColon - p ); |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
415 srv = Grp_server( grp ); |
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
416 if ( Cfg_servIsPreferential( srv, result ) ) |
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
417 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
|
418 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
419 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
420 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
|
421 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
422 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
423 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
424 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
425 retrieveArt( const char *msgId ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
426 { |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
427 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
|
428 int stat; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
429 |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
430 findServer( msgId, s ); |
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
431 if ( strcmp( s, "(unknown)" ) == 0 |
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
432 || 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
|
433 return FALSE; |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
434 if ( ! Client_connect( s ) ) |
119
f50cc311e29a
[svn] Leave online mode, if the connection to a remote server
enz
parents:
115
diff
changeset
|
435 { |
f50cc311e29a
[svn] Leave online mode, if the connection to a remote server
enz
parents:
115
diff
changeset
|
436 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
|
437 Online_set( FALSE ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
438 return FALSE; |
119
f50cc311e29a
[svn] Leave online mode, if the connection to a remote server
enz
parents:
115
diff
changeset
|
439 } |
188
f1bacee93ca6
[svn] * src/client.c,src/client.h,src/fetch.c,src/noffle.c,src/server.c:
bears
parents:
185
diff
changeset
|
440 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
|
441 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
|
442 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
|
443 { |
f1bacee93ca6
[svn] * src/client.c,src/client.h,src/fetch.c,src/noffle.c,src/server.c:
bears
parents:
185
diff
changeset
|
444 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
|
445 "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
|
446 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
|
447 return FALSE; |
f1bacee93ca6
[svn] * src/client.c,src/client.h,src/fetch.c,src/noffle.c,src/server.c:
bears
parents:
185
diff
changeset
|
448 } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
449 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
450 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
451 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
452 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
453 checkNumb( int numb ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
454 { |
155
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
455 if ( ! loadGrpIfSelected() ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
456 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
457 if ( ! Cont_validNumb( numb ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
458 { |
181
e196de757ecd
[svn] * src/server.c: Correct error code given when article requested by
bears
parents:
173
diff
changeset
|
459 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
|
460 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
461 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
462 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
463 } |
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 /* |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
466 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
|
467 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
|
468 */ |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
469 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
470 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
|
471 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
472 const Over *ov; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
473 int n; |
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 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
|
476 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
477 if ( ! checkNumb( n ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
478 return FALSE; |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
479 server.artPtr = n; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
480 ov = Cont_get( n ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
481 *msgId = Ov_msgId( ov ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
482 *numb = n; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
483 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
484 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
|
485 { |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
486 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
|
487 return FALSE; |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
488 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
|
489 *msgId = Ov_msgId( ov ); |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
490 *numb = server.artPtr; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
491 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
492 else |
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 *msgId = arg; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
495 *numb = 0; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
496 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
497 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
|
498 { |
181
e196de757ecd
[svn] * src/server.c: Correct error code given when article requested by
bears
parents:
173
diff
changeset
|
499 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
|
500 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
501 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
502 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
503 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
504 |
45
32ba1198c6fa
[svn] * Makefile.in, configure, configure.in, docs/Makefile.in, src/Makefile.in:
uh1763
parents:
43
diff
changeset
|
505 static void |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
506 touchArticle( const char *msgId ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
507 { |
271
3477050e8d10
[svn] * src/client.c,src/fetch.c,src/lock.c.src/protocol.c,src/util.h,src/util.c:
bears
parents:
269
diff
changeset
|
508 unsigned status = Db_status( msgId ); |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
509 status |= DB_INTERESTING; |
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
510 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
|
511 Db_updateLastAccess( msgId ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
512 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
513 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
514 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
515 touchReferences( const char *msgId ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
516 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
517 Str s; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
518 int len; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
519 char *p; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
520 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
|
521 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
522 while ( TRUE ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
523 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
524 p = s; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
525 while ( *ref != '<' ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
526 if ( *(ref++) == '\0' ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
527 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
528 len = 0; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
529 while ( *ref != '>' ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
530 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
531 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
|
532 return; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
533 *(p++) = *(ref++); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
534 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
535 *(p++) = '>'; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
536 *p = '\0'; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
537 if ( Db_contains( s ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
538 touchArticle( s ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
539 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
540 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
541 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
542 static void |
241 | 543 updateArt( const char *msgId ) |
544 /* 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
|
545 { |
271
3477050e8d10
[svn] * src/client.c,src/fetch.c,src/lock.c.src/protocol.c,src/util.h,src/util.c:
bears
parents:
269
diff
changeset
|
546 unsigned status; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
547 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
548 touchArticle( msgId ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
549 touchReferences( msgId ); |
271
3477050e8d10
[svn] * src/client.c,src/fetch.c,src/lock.c.src/protocol.c,src/util.h,src/util.c:
bears
parents:
269
diff
changeset
|
550 status = Db_status( msgId ); |
3477050e8d10
[svn] * src/client.c,src/fetch.c,src/lock.c.src/protocol.c,src/util.h,src/util.c:
bears
parents:
269
diff
changeset
|
551 if ( Online_true() && ( status & DB_NOT_DOWNLOADED ) ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
552 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
553 retrieveArt( msgId ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
554 } |
241 | 555 } |
556 | |
557 static void | |
558 doBodyInDb( const char *msgId ) | |
559 { | |
271
3477050e8d10
[svn] * src/client.c,src/fetch.c,src/lock.c.src/protocol.c,src/util.h,src/util.c:
bears
parents:
269
diff
changeset
|
560 unsigned status; |
241 | 561 Str srv; |
562 | |
271
3477050e8d10
[svn] * src/client.c,src/fetch.c,src/lock.c.src/protocol.c,src/util.h,src/util.c:
bears
parents:
269
diff
changeset
|
563 status = Db_status( msgId ); |
3477050e8d10
[svn] * src/client.c,src/fetch.c,src/lock.c.src/protocol.c,src/util.h,src/util.c:
bears
parents:
269
diff
changeset
|
564 if ( status & DB_RETRIEVING_FAILED ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
565 { |
271
3477050e8d10
[svn] * src/client.c,src/fetch.c,src/lock.c.src/protocol.c,src/util.h,src/util.c:
bears
parents:
269
diff
changeset
|
566 Db_setStatus( msgId, status & ~DB_RETRIEVING_FAILED ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
567 putTxtBuf( Db_body( msgId ) ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
568 } |
271
3477050e8d10
[svn] * src/client.c,src/fetch.c,src/lock.c.src/protocol.c,src/util.h,src/util.c:
bears
parents:
269
diff
changeset
|
569 else if ( status & DB_NOT_DOWNLOADED ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
570 { |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
571 findServer( msgId, srv ); |
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
572 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
|
573 putTxtBuf( Pseudo_alreadyMarkedBody() ); |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
574 else if ( strcmp( srv, "(unknown)" ) != 0 && |
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
575 strcmp( srv, GRP_LOCAL_SERVER_NAME ) != 0 && |
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
576 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
|
577 putTxtBuf( Pseudo_markedBody() ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
578 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
579 putTxtBuf( Pseudo_markingFailedBody() ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
580 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
581 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
582 putTxtBuf( Db_body( msgId ) ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
583 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
584 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
585 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
586 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
|
587 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
588 const char *msgId; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
589 int numb; |
74 | 590 |
591 UNUSED( cmd ); | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
592 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
593 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
|
594 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
595 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
|
596 if ( Pseudo_isGeneralInfo( msgId ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
597 putTxtBuf( Pseudo_generalInfoBody() ); |
241 | 598 else |
599 { | |
600 updateArt( msgId ); | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
601 doBodyInDb( msgId ); |
241 | 602 } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
603 putEndOfTxt(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
604 noteInterest(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
605 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
606 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
607 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
608 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
609 doHeadInDb( const char *msgId ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
610 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
611 putTxtBuf( Db_header( msgId ) ); |
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 Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
615 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
|
616 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
617 const char *msgId; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
618 int numb; |
74 | 619 |
620 UNUSED( cmd ); | |
43
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 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
|
623 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
624 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
|
625 if ( Pseudo_isGeneralInfo( msgId ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
626 putTxtBuf( Pseudo_generalInfoHead() ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
627 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
628 doHeadInDb( msgId ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
629 putEndOfTxt(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
630 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
631 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
632 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
633 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
634 doArtInDb( const char *msgId ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
635 { |
241 | 636 updateArt( msgId ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
637 doHeadInDb( msgId ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
638 putTxtLn( "" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
639 doBodyInDb( msgId ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
640 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
641 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
642 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
643 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
|
644 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
645 const char *msgId; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
646 int numb; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
647 |
74 | 648 UNUSED( cmd ); |
649 | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
650 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
|
651 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
652 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
|
653 if ( Pseudo_isGeneralInfo( msgId ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
654 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
655 putTxtBuf( Pseudo_generalInfoHead() ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
656 putTxtLn( "" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
657 putTxtBuf( Pseudo_generalInfoBody() ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
658 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
659 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
660 doArtInDb( msgId ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
661 putEndOfTxt(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
662 noteInterest(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
663 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
664 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
665 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
666 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
667 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
|
668 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
669 unsigned int i; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
670 |
74 | 671 UNUSED( arg ); |
672 UNUSED( cmd ); | |
673 | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
674 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
|
675 putTxtBuf( "\nCommands:\n\n" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
676 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
|
677 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
|
678 putEndOfTxt(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
679 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
680 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
681 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
682 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
683 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
|
684 { |
74 | 685 UNUSED( arg ); |
686 UNUSED( cmd ); | |
687 | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
688 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
|
689 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
690 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
691 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
692 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
693 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
|
694 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
695 int n; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
696 |
74 | 697 UNUSED( arg ); |
698 UNUSED( cmd ); | |
699 | |
155
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
700 if ( loadGrpIfSelected() ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
701 { |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
702 n = server.artPtr; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
703 if ( ! Cont_validNumb( n ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
704 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
|
705 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
706 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
707 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
|
708 if ( ! Cont_validNumb( n ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
709 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
|
710 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
711 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
712 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
|
713 n, Ov_msgId( Cont_get( n ) ) ); |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
714 server.artPtr = n; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
715 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
716 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
717 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
718 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
719 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
720 |
173 | 721 static Bool |
722 containsWildcards( const char *pattern ) | |
723 { | |
724 return ( strpbrk( pattern, "?*[\\" ) == NULL ? FALSE : TRUE ); | |
725 } | |
726 | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
727 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
728 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
|
729 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
730 Str line; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
731 const char *g; |
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 putStat( STAT_GRPS_FOLLOW, "Groups" ); |
173 | 734 if ( containsWildcards( pat ) ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
735 { |
127 | 736 if ( Grp_firstGrp( &g ) ) |
737 do | |
738 if ( Wld_match( g, pat ) ) | |
739 { | |
740 (*printProc)( line, g ); | |
149
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
741 putTxtLn( line ); |
127 | 742 } |
743 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
|
744 } |
173 | 745 else if ( Grp_exists( pat ) ) |
746 { | |
747 (*printProc)( line, pat ); | |
748 putTxtLn( line ); | |
749 } | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
750 putEndOfTxt(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
751 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
752 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
753 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
754 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
|
755 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
756 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
|
757 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
758 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
759 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
760 doListActiveTimes( const char *pat ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
761 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
762 printGroups( pat, &printActiveTimes ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
763 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
764 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
765 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
766 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
|
767 { |
49 | 768 int last; |
769 | |
770 /* If there will be a pseudo gen info message waiting when we join | |
771 this group, fiddle the group numbers to show it. */ | |
772 last = Grp_last( grp ); | |
773 if ( needsPseudoGenInfo( grp ) ) | |
774 last++; | |
775 | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
776 snprintf( result, MAXCHAR, "%s %d %d %c", |
49 | 777 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
|
778 } |
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 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
781 doListActive( const char *pat ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
782 { |
49 | 783 /* We need to read the fetchlist so we know whether a pseudo |
784 gen info article needs to be faked when printing the group | |
785 last. */ | |
786 Fetchlist_read(); | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
787 printGroups( pat, &printActive ); |
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 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
790 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
791 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
|
792 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
793 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
|
794 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
795 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
796 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
797 doListNewsgrps( const char *pat ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
798 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
799 printGroups( pat, &printNewsgrp ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
800 } |
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 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
803 putGrp( const char *name ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
804 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
805 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
|
806 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
807 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
808 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
809 doListOverFmt( void ) |
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 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
|
812 putTxtBuf( "Subject:\n" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
813 "From:\n" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
814 "Date:\n" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
815 "Message-ID:\n" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
816 "References:\n" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
817 "Bytes:\n" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
818 "Lines:\n" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
819 putEndOfTxt(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
820 } |
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 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
823 doListExtensions( void ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
824 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
825 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
|
826 putTxtBuf( " LISTGROUP\n" |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
827 " XOVER\n" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
828 putEndOfTxt(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
829 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
830 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
831 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
832 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
|
833 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
834 Str s, arg; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
835 const char *pat; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
836 |
259
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
837 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
|
838 doListActive( "*" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
839 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
840 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
841 Utl_toLower( s ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
842 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
|
843 pat = Utl_stripWhiteSpace( arg ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
844 if ( pat[ 0 ] == '\0' ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
845 pat = "*"; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
846 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
|
847 doListActive( pat ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
848 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
|
849 doListOverFmt(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
850 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
|
851 doListNewsgrps( pat ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
852 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
|
853 doListActiveTimes( pat ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
854 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
|
855 doListExtensions(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
856 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
857 putSyntax( cmd ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
858 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
859 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
860 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
861 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
862 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
863 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
|
864 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
865 int first, last, i; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
866 |
74 | 867 UNUSED( cmd ); |
868 | |
264
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
869 if ( *arg != '\0' ) |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
870 { |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
871 if ( ! Grp_exists( arg ) ) |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
872 { |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
873 putStat( STAT_NO_SUCH_GRP, "No such group" ); |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
874 return TRUE; |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
875 } |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
876 changeToGrp( arg ); |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
877 } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
878 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
879 { |
264
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
880 if ( ! loadGrpIfSelected() ) |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
881 return TRUE; |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
882 |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
883 } |
264
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
884 |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
885 first = Cont_first(); |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
886 last = Cont_last(); |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
887 putStat( STAT_GRP_SELECTED, "Article list" ); |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
888 for ( i = first; i <= last; ++i ) |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
889 if ( Cont_get( i ) != NULL ) |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
890 putTxtLn( "%d", i ); |
94b7962a0fbe
[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one.
bears
parents:
259
diff
changeset
|
891 putEndOfTxt(); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
892 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
893 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
894 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
895 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
896 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
|
897 { |
74 | 898 UNUSED( arg ); |
899 UNUSED( cmd ); | |
900 | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
901 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
|
902 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
903 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
904 |
259
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
905 /* |
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
906 * 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
|
907 */ |
69
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
908 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
|
909 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
|
910 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
|
911 Bool timeIsGMT ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
912 { |
64
7250be163ec4
[svn] Avoid compiler warnings about incomplete initializer blocks
enz
parents:
61
diff
changeset
|
913 struct tm t; |
69
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
914 time_t result; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
915 |
69
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
916 ASSERT( year >= 1900 ); |
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
917 ASSERT( mon >= 1 ); |
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
918 ASSERT( mon <= 12 ); |
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
919 ASSERT( day >= 1 ); |
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
920 ASSERT( day <= 31 ); |
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
921 ASSERT( hour >= 0 ); |
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
922 ASSERT( hour <= 23 ); |
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
923 ASSERT( min >= 0 ); |
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
924 ASSERT( min <= 59 ); |
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
925 ASSERT( sec >= 0 ); |
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
926 ASSERT( sec <= 59 ); |
64
7250be163ec4
[svn] Avoid compiler warnings about incomplete initializer blocks
enz
parents:
61
diff
changeset
|
927 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
|
928 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
|
929 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
|
930 t.tm_mday = day; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
931 t.tm_hour = hour; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
932 t.tm_min = min; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
933 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
|
934 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
|
935 result = timeIsGMT ? Utl_mktimeGMT( &t ) : mktime( &t ); |
69
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
936 return result; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
937 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
938 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
939 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
940 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
941 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
|
942 { |
259
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
943 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
|
944 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
|
945 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
|
946 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
|
947 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
|
948 struct tm *tm; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
949 |
259
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
950 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
|
951 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
|
952 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
|
953 { |
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
954 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
|
955 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
|
956 { |
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
957 putSyntax( cmd ); |
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
958 return TRUE; |
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
959 } |
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
960 timeIsGMT = TRUE; |
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
961 } |
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
962 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
|
963 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
964 putSyntax( cmd ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
965 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
966 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
967 len = strlen( date ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
968 switch ( len ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
969 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
970 case 6: |
69
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
971 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
|
972 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
973 putSyntax( cmd ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
974 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
975 } |
259
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
976 /* |
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
977 * 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
|
978 * 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
|
979 */ |
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
980 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
|
981 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
|
982 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
|
983 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
|
984 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
|
985 year -= 100; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
986 break; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
987 case 8: |
69
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
988 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
|
989 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
990 putSyntax( cmd ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
991 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
992 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
993 break; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
994 default: |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
995 putSyntax( cmd ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
996 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
997 } |
69
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
998 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
|
999 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1000 putSyntax( cmd ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1001 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1002 } |
69
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
1003 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
|
1004 || hour < 0 || hour > 23 || min < 0 || min > 59 |
21e778b6c3e9
[svn] Rewrote getTimesInSeconds(): arguments ar now int and
enz
parents:
64
diff
changeset
|
1005 || 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
|
1006 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1007 putSyntax( cmd ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1008 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1009 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1010 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
|
1011 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
|
1012 |
ffb1848a39db
[svn] * src/util.c: Improve (correct) error detection when updating
bears
parents:
197
diff
changeset
|
1013 if ( ! Utl_getStamp( &lastUpdate, file ) ) |
ffb1848a39db
[svn] * src/util.c: Improve (correct) error detection when updating
bears
parents:
197
diff
changeset
|
1014 { |
ffb1848a39db
[svn] * src/util.c: Improve (correct) error detection when updating
bears
parents:
197
diff
changeset
|
1015 /* Can't get stamp. Put out error message. */ |
ffb1848a39db
[svn] * src/util.c: Improve (correct) error detection when updating
bears
parents:
197
diff
changeset
|
1016 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
|
1017 return TRUE; |
ffb1848a39db
[svn] * src/util.c: Improve (correct) error detection when updating
bears
parents:
197
diff
changeset
|
1018 } |
259
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
1019 |
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
1020 /* 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
|
1021 Utl_newsDate( t, timeofday ); |
223
ffb1848a39db
[svn] * src/util.c: Improve (correct) error detection when updating
bears
parents:
197
diff
changeset
|
1022 |
259
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
1023 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
|
1024 |
223
ffb1848a39db
[svn] * src/util.c: Improve (correct) error detection when updating
bears
parents:
197
diff
changeset
|
1025 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
|
1026 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1027 if ( Grp_firstGrp( &g ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1028 do |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1029 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
|
1030 putGrp( g ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1031 while ( Grp_nextGrp( &g ) ); |
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 putEndOfTxt(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1034 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1035 } |
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 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1038 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
|
1039 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1040 int n; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1041 |
74 | 1042 UNUSED(arg); |
1043 UNUSED(cmd); | |
1044 | |
155
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
1045 if ( loadGrpIfSelected() ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1046 { |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
1047 n = server.artPtr; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1048 if ( ! Cont_validNumb( n ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1049 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
|
1050 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1051 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1052 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
|
1053 if ( ! Cont_validNumb( n ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1054 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
|
1055 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1056 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1057 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
|
1058 n, Ov_msgId( Cont_get( n ) ) ); |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
1059 server.artPtr = n; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1060 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1061 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1062 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1063 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1064 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1065 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1066 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1067 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
|
1068 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1069 DynStr *s; |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
85
diff
changeset
|
1070 Str line; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
85
diff
changeset
|
1071 Bool err; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1072 |
74 | 1073 UNUSED(arg); |
1074 UNUSED(cmd); | |
1075 | |
127 | 1076 /* |
1077 * The article may take some time coming in, so release the | |
1078 * lock while collecting it. | |
1079 */ | |
149
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1080 putStat( STAT_SEND_ART, "Continue (end with period)" ); |
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1081 sendOutput(); |
127 | 1082 closeServer(); |
1083 | |
149
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1084 s = new_DynStr( 10000 ); |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
85
diff
changeset
|
1085 err = FALSE; |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
85
diff
changeset
|
1086 while ( ! err && getTxtLn( line, &err ) ) |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
85
diff
changeset
|
1087 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
|
1088 |
149
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1089 initOutput(); |
127 | 1090 if ( ! initServer() ) |
1091 { | |
1092 del_DynStr( s ); | |
1093 return FALSE; | |
1094 } | |
1095 | |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
85
diff
changeset
|
1096 if ( ! err |
149
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1097 && Post_open( DynStr_str( s ), 0 ) |
115
3b4db42990e0
[svn] Approved: header, group check before post, all external servers.
bears
parents:
106
diff
changeset
|
1098 && Post_post() ) |
43
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 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
|
1101 if ( Online_true() ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1102 postArts(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1103 } |
88
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
85
diff
changeset
|
1104 else |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
85
diff
changeset
|
1105 putStat( STAT_POST_FAILED, "Posting failed" ); |
1fcdced0246e
[svn] Move posting code to post.c, add command line posting
bears
parents:
85
diff
changeset
|
1106 Post_close(); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1107 del_DynStr( s ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1108 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1109 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1110 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1111 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1112 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
|
1113 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1114 int r, i; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1115 char* p; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1116 Str t; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1117 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1118 Utl_cpyStr( t, s ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1119 p = Utl_stripWhiteSpace( t ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1120 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
|
1121 if ( r < 1 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1122 { |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
1123 *first = server.artPtr; |
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
1124 *last = server.artPtr; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1125 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1126 else if ( r == 1 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1127 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1128 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
|
1129 *last = Cont_last(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1130 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1131 *last = *first; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1132 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1133 if ( *first < Cont_first() ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1134 *first = Cont_first(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1135 if ( *last > Cont_last() ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1136 *last = Cont_last(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1137 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
|
1138 *last = *first - 1; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1139 *numb = 0; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1140 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
|
1141 if ( Cont_validNumb( i ) ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1142 ++(*numb); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1143 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1144 |
127 | 1145 enum XhdrType { SUBJ, FROM, DATE, MSG_ID, REF, BYTES, LINES, XREF, UNKNOWN }; |
1146 | |
1147 static enum XhdrType | |
1148 whatXhdrField( const char * fieldname ) | |
1149 { | |
1150 Str name; | |
1151 | |
1152 Utl_cpyStr( name, fieldname ); | |
1153 Utl_toLower( name ); | |
1154 if ( strcmp( name, "subject" ) == 0 ) | |
1155 return SUBJ; | |
1156 else if ( strcmp( name, "from" ) == 0 ) | |
1157 return FROM; | |
1158 else if ( strcmp( name, "date" ) == 0 ) | |
1159 return DATE; | |
1160 else if ( strcmp( name, "message-id" ) == 0 ) | |
1161 return MSG_ID; | |
1162 else if ( strcmp( name, "references" ) == 0 ) | |
1163 return REF; | |
1164 else if ( strcmp( name, "bytes" ) == 0 ) | |
1165 return BYTES; | |
1166 else if ( strcmp( name, "lines" ) == 0 ) | |
1167 return LINES; | |
1168 else if ( strcmp( name, "xref" ) == 0 ) | |
1169 return XREF; | |
1170 else | |
1171 return UNKNOWN; | |
1172 } | |
1173 | |
1174 static void | |
1175 getXhdrField( enum XhdrType what, const Over * ov, Str res ) | |
1176 { | |
1177 const char * msgId; | |
1178 Str host; | |
1179 | |
1180 switch ( what ) | |
1181 { | |
1182 case SUBJ: | |
1183 Utl_cpyStr( res, Ov_subj( ov ) ); | |
1184 break; | |
1185 case FROM: | |
1186 Utl_cpyStr( res, Ov_from( ov ) ); | |
1187 break; | |
1188 case DATE: | |
1189 Utl_cpyStr( res, Ov_date( ov ) ); | |
1190 break; | |
1191 case MSG_ID: | |
1192 Utl_cpyStr( res, Ov_msgId( ov ) ); | |
1193 break; | |
1194 case REF: | |
1195 Utl_cpyStr( res, Ov_ref( ov ) ); | |
1196 break; | |
1197 case BYTES: | |
271
3477050e8d10
[svn] * src/client.c,src/fetch.c,src/lock.c.src/protocol.c,src/util.h,src/util.c:
bears
parents:
269
diff
changeset
|
1198 snprintf( res, MAXCHAR, "%ld", Ov_bytes( ov ) ); |
127 | 1199 break; |
1200 case LINES: | |
271
3477050e8d10
[svn] * src/client.c,src/fetch.c,src/lock.c.src/protocol.c,src/util.h,src/util.c:
bears
parents:
269
diff
changeset
|
1201 snprintf( res, MAXCHAR, "%ld", Ov_lines( ov ) ); |
127 | 1202 break; |
1203 case XREF: | |
1204 msgId = Ov_msgId( ov ); | |
1205 /* | |
1206 * Gen info messages don't have an Xref header. When INN is asked | |
1207 * for a header that doesn't exist in a message, it reports the | |
1208 * header value as '(none)', so do the same. | |
1209 */ | |
1210 if ( Pseudo_isGeneralInfo( msgId ) ) | |
1211 Utl_cpyStr( res, "none" ); | |
1212 else | |
1213 { | |
1214 gethostname( host, MAXCHAR ); | |
1215 snprintf( res, MAXCHAR, "%s %s", host, Db_xref( msgId ) ); | |
1216 } | |
1217 break; | |
1218 default: | |
1219 ASSERT( FALSE ); | |
1220 } | |
1221 } | |
1222 | |
49 | 1223 /* |
1224 Note this only handles a subset of headers. But they are all | |
1225 the headers any newsreader should need to work properly. | |
127 | 1226 |
49 | 1227 That last sentence will at some stage be proved wrong. |
1228 */ | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1229 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1230 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
|
1231 { |
127 | 1232 enum XhdrType what; |
1233 const char *p; | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1234 Str whatStr; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1235 |
259
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
1236 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
|
1237 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1238 putSyntax( cmd ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1239 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1240 } |
127 | 1241 what = whatXhdrField( whatStr ); |
1242 if ( what == UNKNOWN ) | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1243 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1244 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
|
1245 putEndOfTxt(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1246 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1247 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1248 p = Utl_restOfLn( arg, 1 ); |
49 | 1249 if ( p[ 0 ] == '<' ) |
1250 { | |
127 | 1251 Over * ov; |
1252 Str field; | |
1253 | |
1254 /* Argument is message ID */ | |
1255 ov = Db_over( p ); | |
1256 if ( ov == NULL ) | |
1257 { | |
1258 putStat( STAT_NO_SUCH_ID, "No such article" ); | |
1259 return TRUE; | |
1260 } | |
1261 putStat( STAT_HEAD_FOLLOWS, "%s header %s", whatStr, p ) ; | |
1262 getXhdrField( what, ov, field ); | |
1263 putTxtLn( "%s %s", p, field ); | |
1264 del_Over( ov ); | |
49 | 1265 } |
1266 else | |
127 | 1267 { |
1268 const Over * ov; | |
1269 int first, last, i, n, numb; | |
1270 Str field; | |
1271 | |
1272 /* Argument is article no. or range */ | |
155
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
1273 if ( ! loadGrpIfSelected() ) |
127 | 1274 return TRUE; |
49 | 1275 parseRange( p, &first, &last, &numb ); |
127 | 1276 if ( numb == 0 ) |
1277 { | |
1278 putStat( STAT_NO_ART_SELECTED, "No articles selected" ); | |
1279 return TRUE; | |
1280 } | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1281 putStat( STAT_HEAD_FOLLOWS, "%s header %lu-%lu", |
127 | 1282 whatStr, first, last ) ; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1283 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
|
1284 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
|
1285 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1286 n = Ov_numb( ov ); |
127 | 1287 getXhdrField( what, ov, field ); |
1288 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
|
1289 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1290 } |
127 | 1291 putEndOfTxt(); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1292 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1293 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1294 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1295 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1296 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
|
1297 { |
127 | 1298 enum XhdrType what; |
1299 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
|
1300 |
259
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
1301 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
|
1302 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
|
1303 { |
127 | 1304 putSyntax( cmd ); |
1305 return TRUE; | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1306 } |
127 | 1307 what = whatXhdrField( whatStr ); |
1308 if ( what == UNKNOWN ) | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1309 { |
127 | 1310 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
|
1311 putEndOfTxt(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1312 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1313 } |
127 | 1314 if ( articles[ 0 ] == '<' ) |
1315 { | |
1316 Over * ov; | |
1317 Str field; | |
1318 | |
1319 /* Argument is message ID */ | |
1320 ov = Db_over( articles ); | |
1321 if ( ov == NULL ) | |
1322 { | |
1323 putStat( STAT_NO_SUCH_ID, "No such article" ); | |
1324 return TRUE; | |
1325 } | |
1326 putStat( STAT_HEAD_FOLLOWS, "%s header %s", whatStr, articles ) ; | |
1327 getXhdrField( what, ov, field ); | |
1328 if ( Wld_match( field, pat ) ) | |
1329 putTxtLn( "%s %s", articles, field ); | |
1330 del_Over( ov ); | |
1331 } | |
1332 else | |
1333 { | |
1334 const Over * ov; | |
1335 Str field; | |
1336 int first, last, i, n, numb; | |
1337 | |
1338 /* Argument is article no. or range */ | |
155
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
1339 if ( ! loadGrpIfSelected() ) |
127 | 1340 return TRUE; |
1341 parseRange( articles, &first, &last, &numb ); | |
1342 if ( numb == 0 ) | |
1343 { | |
1344 putStat( STAT_NO_ART_SELECTED, "No articles selected" ); | |
1345 return TRUE; | |
1346 } | |
1347 putStat( STAT_HEAD_FOLLOWS, "%s header %lu-%lu", | |
1348 whatStr, first, last ) ; | |
1349 for ( i = first; i <= last; ++i ) | |
1350 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
|
1351 { |
127 | 1352 n = Ov_numb( ov ); |
1353 getXhdrField( what, ov, field ); | |
1354 if ( Wld_match( field, pat ) ) | |
1355 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
|
1356 } |
127 | 1357 } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1358 putEndOfTxt(); |
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 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
|
1364 { |
74 | 1365 UNUSED( arg ); |
1366 UNUSED( cmd ); | |
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_CMD_OK, "Ok" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1369 return TRUE; |
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 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
|
1374 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1375 const char *msgId; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1376 int numb; |
74 | 1377 |
1378 UNUSED( cmd ); | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1379 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1380 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
|
1381 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1382 if ( numb > 0 ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1383 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
|
1384 numb, msgId ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1385 else |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1386 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
|
1387 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1388 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1389 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1390 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1391 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
|
1392 { |
74 | 1393 UNUSED( arg ); |
1394 UNUSED( cmd ); | |
1395 | |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1396 putStat( STAT_GOODBYE, "Goodbye" ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1397 return FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1398 } |
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 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1401 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
|
1402 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1403 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
|
1404 const Over *ov; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1405 |
74 | 1406 UNUSED( cmd ); |
1407 | |
155
22b81617d427
[svn] applied patch from Matija Nalis: better handling of inconsistent counters
enz
parents:
149
diff
changeset
|
1408 if ( ! loadGrpIfSelected() ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1409 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1410 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
|
1411 if ( n == 0 ) |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
1412 first = last = server.artPtr; |
49 | 1413 putStat( STAT_OVERS_FOLLOW, "Overview %ld-%ld", first, last ); |
1414 for ( i = first; i <= last; ++i ) | |
1415 if ( ( ov = Cont_get( i ) ) ) | |
1416 putTxtLn( "%lu\t%s\t%s\t%s\t%s\t%s\t%d\t%d\t", | |
1417 Ov_numb( ov ), Ov_subj( ov ), Ov_from( ov ), | |
1418 Ov_date( ov ), Ov_msgId( ov ), Ov_ref( ov ), | |
1419 Ov_bytes( ov ), Ov_lines( ov ) ); | |
1420 putEndOfTxt(); | |
191
28488e0e3630
[svn] * src/group.h,src/group.c,src/noffle.c,src/server.c: Grp_setLastAccess is
bears
parents:
188
diff
changeset
|
1421 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
|
1422 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1423 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1424 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1425 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1426 putFatal( const char *fmt, ... ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1427 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1428 va_list ap; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1429 Str s; |
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 va_start( ap, fmt ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1432 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
|
1433 va_end( ap ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1434 Log_err( s ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1435 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
|
1436 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1437 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1438 /* 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
|
1439 static Bool |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1440 parseAndExecute( Str line ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1441 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1442 unsigned int i, n; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1443 Cmd *c; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1444 Str s, arg; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1445 Bool ret; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1446 |
259
b660fadc1814
[svn] * src/server.c,src/util.c,src/util.h: Recognise GMT/UTC on NNTP NEWGROUPS.
bears
parents:
241
diff
changeset
|
1447 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
|
1448 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1449 Utl_toLower( s ); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1450 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
|
1451 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
|
1452 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
|
1453 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
|
1454 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1455 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
|
1456 return ret; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1457 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1458 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1459 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
|
1460 return TRUE; |
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 static void |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1464 putWelcome( void ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1465 { |
149
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1466 initOutput(); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1467 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
|
1468 Cfg_version() ); |
149
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1469 sendOutput(); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1470 } |
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 static Bool |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
1473 initServer( void ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1474 { |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
1475 ASSERT( ! server.running ); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1476 if ( ! Lock_openDatabases() ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1477 return FALSE; |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
1478 server.running = TRUE; |
127 | 1479 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
|
1480 return TRUE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1481 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1482 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1483 static void |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
1484 closeServer( void ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1485 { |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
1486 ASSERT( server.running ); |
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
1487 server.running = FALSE; |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1488 Lock_closeDatabases(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1489 } |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1490 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1491 void |
167
7ba337dafb2c
[svn] * TODO,content.c,lock.c,server.c,server.h: Remove bug notice re:
bears
parents:
160
diff
changeset
|
1492 Server_flushCache( void ) |
7ba337dafb2c
[svn] * TODO,content.c,lock.c,server.c,server.h: Remove bug notice re:
bears
parents:
160
diff
changeset
|
1493 { |
7ba337dafb2c
[svn] * TODO,content.c,lock.c,server.c,server.h: Remove bug notice re:
bears
parents:
160
diff
changeset
|
1494 server.groupReady = FALSE; |
7ba337dafb2c
[svn] * TODO,content.c,lock.c,server.c,server.h: Remove bug notice re:
bears
parents:
160
diff
changeset
|
1495 } |
7ba337dafb2c
[svn] * TODO,content.c,lock.c,server.c,server.h: Remove bug notice re:
bears
parents:
160
diff
changeset
|
1496 |
7ba337dafb2c
[svn] * TODO,content.c,lock.c,server.c,server.h: Remove bug notice re:
bears
parents:
160
diff
changeset
|
1497 void |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
1498 Server_run( void ) |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1499 { |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1500 Bool done; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1501 Str line; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1502 |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1503 putWelcome(); |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1504 done = FALSE; |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1505 while ( ! done ) |
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1506 { |
149
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1507 if ( Prt_getLn( line, stdin, -1 ) ) |
127 | 1508 { |
149
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1509 initOutput(); |
127 | 1510 |
149
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1511 if ( ! initServer() ) |
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1512 { |
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1513 putFatal( "Cannot init server" ); |
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1514 done = TRUE; |
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1515 } |
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1516 else |
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1517 { |
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1518 if ( ! parseAndExecute( line ) ) |
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1519 done = TRUE; |
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1520 } |
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1521 |
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1522 if ( server.running ) |
127 | 1523 closeServer(); |
149
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1524 |
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1525 sendOutput(); |
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1526 } |
bfeea2bc09b6
[svn] Output to buffer, release lock and then send output.
bears
parents:
144
diff
changeset
|
1527 else |
127 | 1528 { |
1529 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
|
1530 done = TRUE; |
127 | 1531 } |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1532 } |
61
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
1533 if ( server.running ) |
adf0af5152f7
[svn] Renamed some variables and function names, because they caused compiler
enz
parents:
54
diff
changeset
|
1534 closeServer(); |
43
2842f50feb55
[svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff
changeset
|
1535 } |