annotate parsemeta.c @ 3:5a977ccbc7a9 default tip

Empty changelog
author darius
date Sat, 06 Dec 1997 05:41:29 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1 /* $Id: parsemeta.c,v 1.1.1.1 1997/12/06 05:41:29 darius Exp $ */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
3 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
4 * meta.c - Nick Trown May 1993
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
5 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
6
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
7 #ifdef METASERVER
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
8
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
9 #include "copyright.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
10 #include <fcntl.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
11 #include <stdio.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
12 #include <ctype.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
13 #include <sys/types.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
14 #include <sys/time.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
15 #include <stdlib.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
16 #include <sys/socket.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
17 #include <unistd.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
18
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
19 #ifdef RS6K
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
20 #include <sys/select.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
21 #include <fcntl.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
22 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
23
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
24 #ifndef DNET
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
25 #include <netinet/in.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
26 #include <arpa/inet.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
27 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
28 #include <netdb.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
29 #include <errno.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
30 #include "Wlib.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
31 #include "defs.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
32 #include "struct.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
33 #include "data.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
34 #include "proto.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
35
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
36 #include <string.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
37 #if !defined(SYSV) && !defined(apollo) && !defined(SVR4)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
38 #include <strings.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
39 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
40
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
41 #define BUF 4096
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
42
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
43 static void metarefresh P((int i));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
44 static void metadone P((void));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
45
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
46 int pid = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
47 int num_servers = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
48 int max_servers = 20;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
49 struct servers *serverlist = NULL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
50 char *keystrings[] = {"OPEN:", "Wait queue:", "Nobody"};
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
51
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
52 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
53 I was planning to use this function a lot but it doesn't look like
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
54 I need it more than once. It finds the next number after position
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
55 'start'.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
56 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
57
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
58 int
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
59 getnumber(string, start)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
60 char *string;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
61 int start;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
62 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
63 #if 0 /* this is stupid [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
64 char temp[LINE];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
65 int c;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
66 int tc = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
67
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
68 for (c = start; c <= (int) strlen(string); c++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
69 if ((string[c] >= '0') && (string[c] <= '9')) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
70 temp[tc++] = string[c];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
71 } else if (tc > 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
72 temp[tc] = '\0';
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
73 return (atoi(temp));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
74 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
75 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
76 return 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
77 #endif /*0*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
78
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
79 string += start;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
80 while(!isdigit(*string) && *string) string++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
81 return atoi(string);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
82 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
83
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
84
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
85 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
86 The connection to the metaserver is by Andy McFadden.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
87 This calls the metaserver and parses the output into something
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
88 useful
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
89 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
90
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
91 static int
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
92 open_port(host, port, verbose)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
93 char *host;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
94 int port;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
95 int verbose;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
96 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
97 #ifdef DNET
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
98 return DNetOpenMeta(host, port);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
99 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
100 struct sockaddr_in addr;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
101 struct hostent *hp;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
102 int s;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
103
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
104
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
105 /* Connect to the metaserver */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
106 /* get numeric form */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
107 if ((addr.sin_addr.s_addr = inet_addr(host)) == -1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
108 if ((hp = gethostbyname(host)) == NULL) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
109 if (verbose)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
110 fprintf(stderr, "unknown host '%s'\n", host);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
111 return (-1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
112 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
113 addr.sin_addr.s_addr = *(long *) hp->h_addr;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
114 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
115 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
116 addr.sin_family = AF_INET;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
117 addr.sin_port = htons(port);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
118 if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
119 if (verbose)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
120 perror("socket");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
121 return (-1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
122 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
123 if (connect(s, (struct sockaddr *) & addr, sizeof(addr)) < 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
124 if (verbose)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
125 perror("connect");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
126 close(s);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
127 return (-1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
128 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
129 return (s);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
130 #endif /* DNET */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
131 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
132
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
133 static int
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
134 readmeta(s)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
135 int s;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
136 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
137 int cc, lc = 0, c, tc;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
138
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
139 static char buf[BUF + 1];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
140 static char *numstr;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
141 static char line[LINE + 1];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
142
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
143 #ifndef DEBUG
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
144 while (1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
145 #ifdef DNET /* annoying... */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
146 if ((cc = sock_read(s, buf, BUF)) < 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
147 #else /* } */ /* to balance the {'s for emacs */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
148 if ((cc = sock_read(s, buf, BUF)) <= 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
149 if (cc < 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
150 perror("read");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
151 #endif /* DNET */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
152 sock_close(s);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
153 return (cc);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
154 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
155 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
156 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
157 cat the output of the metaserver port 3521 to a file called "output"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
158 for testing purposes
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
159 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
160 s = open("output", O_RDONLY);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
161
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
162 if ((cc = read(s, buf, BUF)) <= 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
163 if (cc < 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
164 perror("read");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
165 close(s);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
166 return (cc);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
167 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
168 fwrite(buf, cc, 1, stdout);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
169 close(s);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
170 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
171
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
172 for (c = 0; c < cc; c++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
173 if (buf[c] != '\n') /* Break up the buffer into lines */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
174 line[lc++] = buf[c];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
175 else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
176 line[lc] = 0; /* random problems without this. No terminator
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
177 means invalid strlen(). [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
178 if (sscanf(line, "-h %s -p %d %d", /* parse line */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
179 serverlist[num_servers].address,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
180 &serverlist[num_servers].port,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
181 &serverlist[num_servers].time) == 3) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
182 /* get what type of server it is */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
183 serverlist[num_servers].typeflag = line[strlen(line) - 1];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
184 if (serverlist[num_servers].typeflag == 'P') {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
185 serverlist[num_servers].status = 2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
186 serverlist[num_servers].players = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
187 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
188 serverlist[num_servers].status = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
189
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
190 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
191 I don't have it checking the servers with nobody playing
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
192 because the menu window would then be too large to fit on
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
193 a 1024 x 768 window. :( - NBT
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
194 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
195
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
196 for (tc = 0; tc < KEY; tc++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
197 if ((numstr = strstr(line, keystrings[tc]))) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
198 serverlist[num_servers].status = tc;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
199 serverlist[num_servers].players = getnumber(numstr, 0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
200 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
201 if (strrchr(line, 'R'))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
202 serverlist[num_servers].RSA_client = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
203 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
204 serverlist[num_servers].RSA_client = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
205
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
206 if (serverlist[num_servers].status >= 0 &&
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
207 (serverlist[num_servers].status != 2 ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
208 serverlist[num_servers].typeflag == 'P')) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
209
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
210 #ifdef DEBUG
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
211 printf("HOST:%-30s PORT:%-6d %12s %-5d %d\n",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
212 serverlist[num_servers].address,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
213 serverlist[num_servers].port,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
214 keystrings[serverlist[num_servers].status],
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
215 serverlist[num_servers].players,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
216 serverlist[num_servers].RSA_client);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
217 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
218
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
219 serverlist[num_servers].hilited = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
220 num_servers++; /* It's valid */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
221 if(num_servers == max_servers) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
222 /* double the size every time it's exceeded [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
223 serverlist = (struct servers*) realloc(serverlist,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
224 sizeof(struct servers) * (max_servers *= 2));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
225 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
226 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
227 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
228 lc = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
229 /*line[0] = '\0'; silly [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
230 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
231 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
232 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
233 /* close(s); */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
234 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
235
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
236
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
237 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
238 parsemeta()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
239 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
240 int s;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
241
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
242 num_servers = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
243
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
244 /* serverlist is now dynamic and grows. This fixes the random coredump
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
245 and data corruption problems the previous static method caused.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
246 [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
247 if(serverlist) free(serverlist);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
248 serverlist = (struct servers*) malloc(sizeof(struct servers) * max_servers);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
249
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
250 if (serverName) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
251 strcpy(serverlist[num_servers].address, serverName);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
252 serverlist[num_servers].port = xtrekPort;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
253
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
254 #ifdef RSA
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
255 serverlist[num_servers].RSA_client = RSA_Client;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
256 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
257
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
258 serverlist[num_servers].status = KEY + 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
259 serverlist[num_servers].players = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
260 num_servers++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
261 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
262 printf("connecting to metaserver...");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
263 fflush(stdout);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
264
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
265 #ifdef DEBUG
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
266 readmeta(0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
267 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
268 if ((s = open_port(metaserverAddress, METAPORT, 1)) > 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
269 readmeta(s);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
270 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
271 printf("failed (%s , %d)\n", metaserverAddress, METAPORT);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
272 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
273 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
274 printf("\n");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
275 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
276
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
277
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
278 /* Show the meta server menu window */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
279
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
280 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
281 metawindow()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
282 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
283 register int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
284 static int old_num_servers = -1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
285
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
286 if (old_num_servers != num_servers) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
287 if (metaWin)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
288 W_DestroyWindow(metaWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
289 metaWin = W_MakeMenu("MetaServer List", WINSIDE + 10, -BORDER + 10, 69,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
290 num_servers + 2, NULL, 2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
291 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
292 for (i = 0; i < num_servers; i++)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
293 metarefresh(i);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
294
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
295 /* add refresh option [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
296 W_WriteText(metaWin, 0, num_servers, textColor, "Refresh", 7, 0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
297
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
298 /* Add quit option */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
299 W_WriteText(metaWin, 0, num_servers + 1, textColor, "Quit", 4, W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
300
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
301 /* Map window */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
302 if (!W_IsMapped(metaWin))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
303 W_MapWindow(metaWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
304 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
305
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
306 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
307 * Refresh item i
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
308 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
309 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
310 metarefresh(i)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
311 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
312 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
313 char buf[BUFSIZ];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
314
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
315 if (serverlist[i].status < KEY) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
316 sprintf(buf, "%-40s %12s ",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
317 serverlist[i].address,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
318 keystrings[serverlist[i].status]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
319 if (serverlist[i].status != 2)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
320 sprintf(buf + strlen(buf), "%-5d ", serverlist[i].players);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
321 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
322 strcat(buf, " ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
323 switch (serverlist[i].typeflag) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
324 case 'P':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
325 strcat(buf, "Paradise");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
326 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
327 case 'B':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
328 strcat(buf, "Bronco");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
329 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
330 case 'C':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
331 strcat(buf, "Chaos");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
332 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
333 case 'I':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
334 strcat(buf, "INL");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
335 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
336 case 'S':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
337 strcat(buf, "Sturgeon");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
338 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
339 case 'H':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
340 strcat(buf, "Hockey");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
341 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
342 case 'F':
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
343 strcat(buf, "Dogfight");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
344 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
345 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
346 } else if (serverlist[i].status == KEY) { /* For when I have checking
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
347 code */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
348 sprintf(buf, "%-40s CANNOT CONNECT", serverlist[i].address);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
349 } else if (serverlist[i].status == KEY + 1) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
350 sprintf(buf, "%-40s DEFAULT SERVER", serverlist[i].address);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
351 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
352 W_WriteText(metaWin, 0, i,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
353 serverlist[i].hilited ? W_Yellow : textColor,
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
354 buf, (int)strlen(buf),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
355 serverlist[i].hilited ? W_HighlightFont : W_RegularFont);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
356 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
357
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
358
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
359 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
360 Check selection to see if was valid. If it was then we have a winner!
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
361 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
362 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
363 metaaction(data)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
364 W_Event *data;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
365 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
366 int s;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
367 static time_t lastRefresh = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
368 static time_t t;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
369
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
370 if ((data->y >= 0) && (data->y < num_servers)) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
371 xtrekPort = serverlist[data->y].port;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
372 serverName = serverlist[data->y].address;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
373
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
374 #ifdef RSA
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
375 RSA_Client = serverlist[data->y].RSA_client;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
376 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
377 serverlist[data->y].hilited = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
378 metarefresh(data->y);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
379
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
380 if ((s = open_port(serverName, xtrekPort, 0)) <= 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
381 serverlist[data->y].status = KEY;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
382 serverlist[data->y].hilited = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
383 metarefresh(data->y);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
384 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
385 sock_close(s);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
386 #ifndef AMIGA
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
387 /* allow spawning off multiple clients [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
388 if (metaFork) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
389 /* just blink yellow [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
390 serverlist[data->y].hilited = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
391 metarefresh(data->y);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
392 pid = fork();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
393 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
394 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
395 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
396 OUCH. fork() sucks ;-) Using "run" is equivalent to appending
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
397 a & to a command in Unix. (my shell allows &, but it's not
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
398 built in to AmigaDOS.) This is a stupid kludge. I
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
399 should write a silly shell or rexx script to do all the
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
400 metaserver stuff instead, and not compile PARSEMETA at all.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
401 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
402 if (metaFork) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
403 extern char *command_line; /* main.c, argv */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
404 extern int global_argc;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
405 int ac;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
406 char buf2[256];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
407 char buf[80];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
408
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
409 sprintf(buf,"run %s ",command_line[0]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
410 for(ac=1;ac<global_argc;ac++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
411 if(strcmp(command_line[ac], "-m") == 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
412 ac++;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
413 else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
414 strcat(buf,command_line[ac]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
415 strcat(buf," ");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
416 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
417 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
418 printf(buf2,"-h %s -p %d", command_line[0], serverName, xtrekPort);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
419 strcat(buf, buf2);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
420 Execute(buf, Input(), Output());
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
421 } else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
422 #endif /* AMIGA */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
423 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
424 pid = 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
425 metadone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
426 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
427 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
428 } else if (data->y == num_servers) { /* refresh [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
429 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
430 they can bang on refresh all day, but it won't refresh any faster
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
431 than once/minute. [BDyess]
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
432 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
433 if ((t = time(NULL)) < lastRefresh + 60)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
434 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
435 lastRefresh = t;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
436 parsemeta(); /* connect and parse info */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
437 metawindow(); /* refresh */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
438 } else { /* quit */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
439 metadone();
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
440 exit(0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
441 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
442 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
443
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
444
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
445 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
446 Unmap the metaWindow
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
447 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
448
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
449 static void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
450 metadone()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
451 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
452 /* Unmap window */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
453 W_UnmapWindow(metaWin);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
454 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
455
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
456
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
457 /*
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
458 My own little input() function. I needed this so I don't have
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
459 to use all the bull in the main input(). Plus to use it I'd have
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
460 to call mapAll() first and the client would read in the default
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
461 server and then call it up before I can select a server.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
462 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
463
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
464 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
465 metainput()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
466 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
467 W_Event data;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
468
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
469 while (W_IsMapped(metaWin) && pid == 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
470 W_GetEvent(&data);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
471 switch ((int) data.type) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
472 case W_EV_KEY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
473 if (data.Window == metaWin)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
474 metaaction(&data);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
475 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
476 case W_EV_BUTTON:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
477 if (data.Window == metaWin)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
478 metaaction(&data);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
479 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
480 case W_EV_EXPOSE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
481 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
482 default:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
483 break;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
484 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
485 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
486 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
487 #endif /* METASERVER */