citadel
About: Citadel is an advanced messaging and collaboration system for groupware and BBS applications (preferred OS: Linux).
  Fossies Dox: citadel.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Loading...
Searching...
No Matches
serv_rooms.c
Go to the documentation of this file.
1// Server functions which perform operations on room objects.
2//
3// Copyright (c) 1987-2022 by the citadel.org team
4//
5// This program is open source software; you can redistribute it and/or modify
6// it under the terms of the GNU General Public License, version 3.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12
13#include <stdlib.h>
14#include <unistd.h>
15#include <stdio.h>
16#include <sys/types.h>
17#include <sys/stat.h>
18#include <dirent.h> /* for cmd_rdir to read contents of the directory */
19#include <libcitadel.h>
20
21#include "../../citserver.h"
22#include "../../ctdl_module.h"
23#include "../../room_ops.h"
24#include "../../config.h"
25
26// Back-back-end for all room listing commands
27void list_roomname(struct ctdlroom *qrbuf, int ra, int current_view, int default_view) {
28 char truncated_roomname[ROOMNAMELEN];
29
30 // For my own mailbox rooms, chop off the owner prefix
31 if ( (qrbuf->QRflags & QR_MAILBOX)
32 && (atol(qrbuf->QRname) == CC->user.usernum) ) {
33 safestrncpy(truncated_roomname, qrbuf->QRname, sizeof truncated_roomname);
34 safestrncpy(truncated_roomname, &truncated_roomname[11], sizeof truncated_roomname);
35 cprintf("%s", truncated_roomname);
36 }
37 // For all other rooms, just display the name in its entirety
38 else {
39 cprintf("%s", qrbuf->QRname);
40 }
41
42 /* ...and now the other parameters */
43 cprintf("|%u|%d|%d|%d|%d|%d|%d|%ld|\n",
45 (int) qrbuf->QRfloor,
46 (int) qrbuf->QRorder,
47 (int) qrbuf->QRflags2,
48 ra,
49 current_view,
50 default_view,
52 );
53}
54
55
56// cmd_lrms() - List all accessible rooms, known or forgotten
57void cmd_lrms_backend(struct ctdlroom *qrbuf, void *data) {
58 int FloorBeingSearched = (-1);
59 int ra;
60 int view;
61
62 FloorBeingSearched = *(int *)data;
63 CtdlRoomAccess(qrbuf, &CC->user, &ra, &view);
64
65 if ((( ra & (UA_KNOWN | UA_ZAPPED)))
66 && ((qrbuf->QRfloor == (FloorBeingSearched))
67 || ((FloorBeingSearched) < 0)))
69}
70
71
72void cmd_lrms(char *argbuf) {
73 int FloorBeingSearched = (-1);
74 if (!IsEmptyStr(argbuf))
75 FloorBeingSearched = extract_int(argbuf, 0);
76
78
79 CtdlGetUser(&CC->user, CC->curr_user);
80 cprintf("%d Accessible rooms:\n", LISTING_FOLLOWS);
81
82 CtdlForEachRoom(cmd_lrms_backend, &FloorBeingSearched);
83 cprintf("000\n");
84}
85
86
87// cmd_lkra() - List all known rooms
88void cmd_lkra_backend(struct ctdlroom *qrbuf, void *data) {
89 int FloorBeingSearched = (-1);
90 int ra;
91 int view;
92
93 FloorBeingSearched = *(int *)data;
94 CtdlRoomAccess(qrbuf, &CC->user, &ra, &view);
95
96 if ((( ra & (UA_KNOWN))) && ((qrbuf->QRfloor == (FloorBeingSearched)) || ((FloorBeingSearched) < 0))) {
98 }
99}
100
101
102void cmd_lkra(char *argbuf) {
103 int FloorBeingSearched = (-1);
104 if (!IsEmptyStr(argbuf)) {
105 FloorBeingSearched = extract_int(argbuf, 0);
106 }
107
109
110 CtdlGetUser(&CC->user, CC->curr_user);
111 cprintf("%d Known rooms:\n", LISTING_FOLLOWS);
112
113 CtdlForEachRoom(cmd_lkra_backend, &FloorBeingSearched);
114 cprintf("000\n");
115}
116
117
118void cmd_lprm_backend(struct ctdlroom *qrbuf, void *data) {
119 int FloorBeingSearched = (-1);
120 int ra;
121 int view;
122
123 FloorBeingSearched = *(int *)data;
124 CtdlRoomAccess(qrbuf, &CC->user, &ra, &view);
125
126 if (((qrbuf->QRflags & QR_PRIVATE) == 0) && ((qrbuf->QRflags & QR_MAILBOX) == 0) && ((qrbuf->QRfloor == (FloorBeingSearched)) || ((FloorBeingSearched) < 0))) {
128 }
129}
130
131
132void cmd_lprm(char *argbuf) {
133 int FloorBeingSearched = (-1);
134 if (!IsEmptyStr(argbuf)) {
135 FloorBeingSearched = extract_int(argbuf, 0);
136 }
137
138 cprintf("%d Public rooms:\n", LISTING_FOLLOWS);
139
140 CtdlForEachRoom(cmd_lprm_backend, &FloorBeingSearched);
141 cprintf("000\n");
142}
143
144
145// cmd_lkrn() - List all known rooms with new messages
146void cmd_lkrn_backend(struct ctdlroom *qrbuf, void *data) {
147 int FloorBeingSearched = (-1);
148 int ra;
149 int view;
150
151 FloorBeingSearched = *(int *)data;
152 CtdlRoomAccess(qrbuf, &CC->user, &ra, &view);
153
154 if ((ra & UA_KNOWN) && (ra & UA_HASNEWMSGS) && ((qrbuf->QRfloor == (FloorBeingSearched)) || ((FloorBeingSearched) < 0))) {
156 }
157}
158
159
160void cmd_lkrn(char *argbuf) {
161 int FloorBeingSearched = (-1);
162 if (!IsEmptyStr(argbuf)) {
163 FloorBeingSearched = extract_int(argbuf, 0);
164 }
165
167
168 CtdlGetUser(&CC->user, CC->curr_user);
169 cprintf("%d Rooms w/ new msgs:\n", LISTING_FOLLOWS);
170
171 CtdlForEachRoom(cmd_lkrn_backend, &FloorBeingSearched);
172 cprintf("000\n");
173}
174
175
176// cmd_lkro() - List all known rooms
177void cmd_lkro_backend(struct ctdlroom *qrbuf, void *data) {
178 int FloorBeingSearched = (-1);
179 int ra;
180 int view;
181
182 FloorBeingSearched = *(int *)data;
183 CtdlRoomAccess(qrbuf, &CC->user, &ra, &view);
184
185 if ((ra & UA_KNOWN) && ((ra & UA_HASNEWMSGS) == 0) && ((qrbuf->QRfloor == (FloorBeingSearched)) || ((FloorBeingSearched) < 0))) {
187 }
188}
189
190
191void cmd_lkro(char *argbuf) {
192 int FloorBeingSearched = (-1);
193 if (!IsEmptyStr(argbuf)) {
194 FloorBeingSearched = extract_int(argbuf, 0);
195 }
196
198
199 CtdlGetUser(&CC->user, CC->curr_user);
200 cprintf("%d Rooms w/o new msgs:\n", LISTING_FOLLOWS);
201
202 CtdlForEachRoom(cmd_lkro_backend, &FloorBeingSearched);
203 cprintf("000\n");
204}
205
206
207// cmd_lzrm() - List all forgotten rooms
208void cmd_lzrm_backend(struct ctdlroom *qrbuf, void *data) {
209 int FloorBeingSearched = (-1);
210 int ra;
211 int view;
212
213 FloorBeingSearched = *(int *)data;
214 CtdlRoomAccess(qrbuf, &CC->user, &ra, &view);
215
216 if ((ra & UA_GOTOALLOWED) && (ra & UA_ZAPPED) && ((qrbuf->QRfloor == (FloorBeingSearched)) || ((FloorBeingSearched) < 0))) {
218 }
219}
220
221
222void cmd_lzrm(char *argbuf) {
223 int FloorBeingSearched = (-1);
224 if (!IsEmptyStr(argbuf))
225 FloorBeingSearched = extract_int(argbuf, 0);
226
228
229 CtdlGetUser(&CC->user, CC->curr_user);
230 cprintf("%d Zapped rooms:\n", LISTING_FOLLOWS);
231
232 CtdlForEachRoom(cmd_lzrm_backend, &FloorBeingSearched);
233 cprintf("000\n");
234}
235
236
237// cmd_goto() - goto a new room
238void cmd_goto(char *gargs) {
239 struct CitContext *CCC = CC;
240 struct ctdlroom QRscratch;
241 int c;
242 int ok = 0;
243 int ra;
244 char augmented_roomname[ROOMNAMELEN];
245 char towhere[ROOMNAMELEN];
246 char password[32];
247 int transiently = 0;
248
250
251 extract_token(towhere, gargs, 0, '|', sizeof towhere);
252 extract_token(password, gargs, 1, '|', sizeof password);
253 transiently = extract_int(gargs, 2);
254
255 CtdlGetUser(&CCC->user, CCC->curr_user);
256
257 // Handle some of the macro named rooms
258 convert_room_name_macros(towhere, sizeof towhere);
259
260 // First try a regular match
261 c = CtdlGetRoom(&QRscratch, towhere);
262
263 // Then try a mailbox name match
264 if (c != 0) {
265 CtdlMailboxName(augmented_roomname, sizeof augmented_roomname, &CCC->user, towhere);
266 c = CtdlGetRoom(&QRscratch, augmented_roomname);
267 if (c == 0) {
268 safestrncpy(towhere, augmented_roomname, sizeof towhere);
269 }
270 }
271
272 // And if the room was found...
273 if (c == 0) {
274 // Let internal programs go directly to any room.
275 if (CCC->internal_pgm) {
276 memcpy(&CCC->room, &QRscratch, sizeof(struct ctdlroom));
277 CtdlUserGoto(NULL, 1, transiently, NULL, NULL, NULL, NULL);
278 return;
279 }
280
281 // See if there is an existing user/room relationship
282 CtdlRoomAccess(&QRscratch, &CCC->user, &ra, NULL);
283
284 // normal clients have to pass through security
285 if (ra & UA_GOTOALLOWED) {
286 ok = 1;
287 }
288
289 if (ok == 1) {
290 if ((QRscratch.QRflags & QR_MAILBOX) &&
291 ((ra & UA_GOTOALLOWED))) {
292 memcpy(&CCC->room, &QRscratch, sizeof(struct ctdlroom));
293 CtdlUserGoto(NULL, 1, transiently, NULL, NULL, NULL, NULL);
294 return;
295 }
296 else if ((QRscratch.QRflags & QR_PASSWORDED) &&
297 ((ra & UA_KNOWN) == 0) &&
298 (strcasecmp(QRscratch.QRpasswd, password)) &&
299 (CCC->user.axlevel < AxAideU)
300 ) {
301 cprintf("%d wrong or missing passwd\n", ERROR + PASSWORD_REQUIRED);
302 return;
303 }
304 else if ((QRscratch.QRflags & QR_PRIVATE) &&
305 ((QRscratch.QRflags & QR_PASSWORDED) == 0) &&
306 ((QRscratch.QRflags & QR_GUESSNAME) == 0) &&
307 ((ra & UA_KNOWN) == 0) &&
308 (CCC->user.axlevel < AxAideU)
309 ) {
310 syslog(LOG_DEBUG, "rooms: failed to acquire private room");
311 }
312 else {
313 memcpy(&CCC->room, &QRscratch, sizeof(struct ctdlroom));
314 CtdlUserGoto(NULL, 1, transiently, NULL, NULL, NULL, NULL);
315 return;
316 }
317 }
318 }
319
320 cprintf("%d room '%s' not found\n", ERROR + ROOM_NOT_FOUND, towhere);
321}
322
323
324void cmd_whok(char *cmdbuf) {
325 struct ctdluser temp;
326 struct cdbdata *cdbus;
327 int ra;
328
329 cprintf("%d Who knows room:\n", LISTING_FOLLOWS);
331 while (cdbus = cdb_next_item(CDB_USERS), cdbus != NULL) {
332 memset(&temp, 0, sizeof temp);
333 memcpy(&temp, cdbus->ptr, sizeof temp);
334 cdb_free(cdbus);
335
336 CtdlRoomAccess(&CC->room, &temp, &ra, NULL);
337 if ((!IsEmptyStr(temp.fullname)) &&
338 (CC->room.QRflags & QR_INUSE) &&
339 (ra & UA_KNOWN)
340 )
341 cprintf("%s\n", temp.fullname);
342 }
343 cprintf("000\n");
344}
345
346
347// RDIR command for room directory
348void cmd_rdir(char *cmdbuf) {
349 char buf[256];
350 char comment[256];
351 FILE *fd;
352 struct stat statbuf;
353 DIR *filedir = NULL;
354 struct dirent *filedir_entry;
355 int d_namelen;
356 char buf2[SIZ];
357 char mimebuf[64];
358 long len;
359
360 if (CtdlAccessCheck(ac_logged_in)) return;
361
362 CtdlGetRoom(&CC->room, CC->room.QRname);
363 CtdlGetUser(&CC->user, CC->curr_user);
364
365 if ((CC->room.QRflags & QR_DIRECTORY) == 0) {
366 cprintf("%d not here.\n", ERROR + NOT_HERE);
367 return;
368 }
369 if (((CC->room.QRflags & QR_VISDIR) == 0)
370 && (CC->user.axlevel < AxAideU)
371 && (CC->user.usernum != CC->room.QRroomaide))
372 {
373 cprintf("%d not here.\n", ERROR + HIGHER_ACCESS_REQUIRED);
374 return;
375 }
376
377 snprintf(buf, sizeof buf, "%s/%s", ctdl_file_dir, CC->room.QRdirname);
378 filedir = opendir (buf);
379
380 if (filedir == NULL) {
381 cprintf("%d not here.\n", ERROR + HIGHER_ACCESS_REQUIRED);
382 return;
383 }
384 cprintf("%d %s|%s/%s\n", LISTING_FOLLOWS, CtdlGetConfigStr("c_fqdn"), ctdl_file_dir, CC->room.QRdirname);
385
386 snprintf(buf, sizeof buf, "%s/%s/filedir", ctdl_file_dir, CC->room.QRdirname);
387 fd = fopen(buf, "r");
388 if (fd == NULL) {
389 fd = fopen("/dev/null", "r");
390 }
391 while ((filedir_entry = readdir(filedir))) {
392 if (strcasecmp(filedir_entry->d_name, "filedir") && filedir_entry->d_name[0] != '.') {
393#ifdef _DIRENT_HAVE_D_NAMELEN
394 d_namelen = filedir_entry->d_namlen;
395#else
396 d_namelen = strlen(filedir_entry->d_name);
397#endif
398 snprintf(buf, sizeof buf, "%s/%s/%s", ctdl_file_dir, CC->room.QRdirname, filedir_entry->d_name);
399 stat(buf, &statbuf); /* stat the file */
400 if (!(statbuf.st_mode & S_IFREG)) {
401 snprintf(buf2, sizeof buf2,
402 "\"%s\" appears in the file directory for room \"%s\" but is not a regular file. Directories, named pipes, sockets, etc. are not usable in Citadel room directories.\n",
403 buf, CC->room.QRname
404 );
405 CtdlAideMessage(buf2, "Unusable data found in room directory");
406 continue; /* not a useable file type so don't show it */
407 }
408 safestrncpy(comment, "", sizeof comment);
409 fseek(fd, 0L, 0); /* rewind descriptions file */
410 /* Get the description from the descriptions file */
411 while ((fgets(buf, sizeof buf, fd) != NULL) && (IsEmptyStr(comment))) {
412 buf[strlen(buf) - 1] = 0;
413 if ((!strncasecmp(buf, filedir_entry->d_name, d_namelen)) && (buf[d_namelen] == ' '))
414 safestrncpy(comment, &buf[d_namelen + 1], sizeof comment);
415 }
416 len = extract_token (mimebuf, comment, 0,' ', 64);
417 if ((len <0) || strchr(mimebuf, '/') == NULL) {
418 snprintf (mimebuf, 64, "application/octetstream");
419 len = 0;
420 }
421 cprintf("%s|%ld|%s|%s\n",
422 filedir_entry->d_name,
423 (long)statbuf.st_size,
424 mimebuf,
425 &comment[len]);
426 }
427 }
428 fclose(fd);
429 closedir(filedir);
430
431 cprintf("000\n");
432}
433
434
435// get room parameters (admin or room admin command)
436void cmd_getr(char *cmdbuf) {
437 if (CtdlAccessCheck(ac_room_aide)) return;
438
439 CtdlGetRoom(&CC->room, CC->room.QRname);
440 cprintf("%d%c%s|%s|%s|%d|%d|%d|%d|%d|\n",
441 CIT_OK,
443 ((CC->room.QRflags & QR_MAILBOX) ? &CC->room.QRname[11] : CC->room.QRname),
444 ((CC->room.QRflags & QR_PASSWORDED) ? CC->room.QRpasswd : ""),
445 ((CC->room.QRflags & QR_DIRECTORY) ? CC->room.QRdirname : ""),
446 CC->room.QRflags,
447 (int) CC->room.QRfloor,
448 (int) CC->room.QRorder,
449 CC->room.QRdefaultview,
450 CC->room.QRflags2
451 );
452}
453
454
455// set room parameters (admin or room admin command)
456void cmd_setr(char *args) {
457 char buf[256];
458 int new_order = 0;
459 int r;
460 int new_floor;
461 char new_name[ROOMNAMELEN];
462
463 if (CtdlAccessCheck(ac_logged_in)) return;
464
465 if (num_parms(args) >= 6) {
466 new_floor = extract_int(args, 5);
467 }
468 else {
469 new_floor = (-1); /* don't change the floor */
470 }
471
472 /* When is a new name more than just a new name? When the old name
473 * has a namespace prefix.
474 */
475 if (CC->room.QRflags & QR_MAILBOX) {
476 sprintf(new_name, "%010ld.", atol(CC->room.QRname) );
477 }
478 else {
479 safestrncpy(new_name, "", sizeof new_name);
480 }
481 extract_token(&new_name[strlen(new_name)], args, 0, '|', (sizeof new_name - strlen(new_name)));
482
483 r = CtdlRenameRoom(CC->room.QRname, new_name, new_floor);
484
485 if (r == crr_room_not_found) {
486 cprintf("%d Internal error - room not found?\n", ERROR + INTERNAL_ERROR);
487 }
488 else if (r == crr_already_exists) {
489 cprintf("%d '%s' already exists.\n",
490 ERROR + ALREADY_EXISTS, new_name);
491 }
492 else if (r == crr_noneditable) {
493 cprintf("%d Cannot edit this room.\n", ERROR + NOT_HERE);
494 }
495 else if (r == crr_invalid_floor) {
496 cprintf("%d Target floor does not exist.\n",
498 }
499 else if (r == crr_access_denied) {
500 cprintf("%d You do not have permission to edit '%s'\n",
502 CC->room.QRname);
503 }
504 else if (r != crr_ok) {
505 cprintf("%d Error: CtdlRenameRoom() returned %d\n",
506 ERROR + INTERNAL_ERROR, r);
507 }
508
509 if (r != crr_ok) {
510 return;
511 }
512
513 CtdlGetRoom(&CC->room, new_name);
514
515 /* Now we have to do a bunch of other stuff */
516
517 if (num_parms(args) >= 7) {
518 new_order = extract_int(args, 6);
519 if (new_order < 1)
520 new_order = 1;
521 if (new_order > 127)
522 new_order = 127;
523 }
524
525 CtdlGetRoomLock(&CC->room, CC->room.QRname);
526
527 /* Directory room */
528 extract_token(buf, args, 2, '|', sizeof buf);
529 buf[15] = 0;
530 safestrncpy(CC->room.QRdirname, buf,
531 sizeof CC->room.QRdirname);
532
533 /* Default view */
534 if (num_parms(args) >= 8) {
535 CC->room.QRdefaultview = extract_int(args, 7);
536 }
537
538 /* Second set of flags */
539 if (num_parms(args) >= 9) {
540 CC->room.QRflags2 = extract_int(args, 8);
541 }
542
543 /* Misc. flags */
544 CC->room.QRflags = (extract_int(args, 3) | QR_INUSE);
545 /* Clean up a client boo-boo: if the client set the room to
546 * guess-name or passworded, ensure that the private flag is
547 * also set.
548 */
549 if ((CC->room.QRflags & QR_GUESSNAME)
550 || (CC->room.QRflags & QR_PASSWORDED))
551 CC->room.QRflags |= QR_PRIVATE;
552
553 /* Some changes can't apply to BASEROOM */
554 if (!strncasecmp(CC->room.QRname, CtdlGetConfigStr("c_baseroom"), ROOMNAMELEN)) {
555 CC->room.QRorder = 0;
556 CC->room.QRpasswd[0] = '\0';
557 CC->room.QRflags &= ~(QR_PRIVATE & QR_PASSWORDED &
559 CC->room.QRflags |= QR_PERMANENT;
560 }
561 else {
562 /* March order (doesn't apply to AIDEROOM) */
563 if (num_parms(args) >= 7)
564 CC->room.QRorder = (char) new_order;
565 /* Room password */
566 extract_token(buf, args, 1, '|', sizeof buf);
567 buf[10] = 0;
568 safestrncpy(CC->room.QRpasswd, buf, sizeof CC->room.QRpasswd);
569 /* Kick everyone out if the client requested it
570 * (by changing the room's generation number)
571 */
572 if (extract_int(args, 4)) {
573 time(&CC->room.QRgen);
574 }
575 }
576 /* Some changes can't apply to AIDEROOM */
577 if (!strncasecmp(CC->room.QRname, CtdlGetConfigStr("c_baseroom"), ROOMNAMELEN)) {
578 CC->room.QRorder = 0;
579 CC->room.QRflags &= ~QR_MAILBOX;
580 CC->room.QRflags |= QR_PERMANENT;
581 }
582
583 /* Write the room record back to disk */
584 CtdlPutRoomLock(&CC->room);
585
586 /* Create a room directory if necessary */
587 if (CC->room.QRflags & QR_DIRECTORY) {
588 snprintf(buf, sizeof buf,"%s/%s", ctdl_file_dir, CC->room.QRdirname);
589 mkdir(buf, 0755);
590 }
591 snprintf(buf, sizeof buf, "The room \"%s\" has been edited by %s.\n",
592 CC->room.QRname,
593 (CC->logged_in ? CC->curr_user : "an administrator")
594 );
595 CtdlAideMessage(buf, "Room modification Message");
596 cprintf("%d Ok\n", CIT_OK);
597}
598
599
600// get the name of the room admin for this room
601void cmd_geta(char *cmdbuf) {
602 struct ctdluser usbuf;
603
604 if (CtdlAccessCheck(ac_logged_in)) return;
605
606 if (CtdlGetUserByNumber(&usbuf, CC->room.QRroomaide) == 0) {
607 cprintf("%d %s\n", CIT_OK, usbuf.fullname);
608 }
609 else {
610 cprintf("%d \n", CIT_OK);
611 }
612}
613
614
615// set the room admin for this room
616void cmd_seta(char *new_ra) {
617 struct ctdluser usbuf;
618 long newu;
619 char buf[SIZ];
620 int post_notice;
621
622 if (CtdlAccessCheck(ac_room_aide)) return;
623
624 if (CtdlGetUser(&usbuf, new_ra) != 0) {
625 newu = (-1L);
626 }
627 else {
628 newu = usbuf.usernum;
629 }
630
631 CtdlGetRoomLock(&CC->room, CC->room.QRname);
632 post_notice = 0;
633 if (CC->room.QRroomaide != newu) {
634 post_notice = 1;
635 }
636 CC->room.QRroomaide = newu;
637 CtdlPutRoomLock(&CC->room);
638
639 // We have to post the change notice _after_ writing changes to
640 // the room table, otherwise it would deadlock!
641 if (post_notice == 1) {
642 if (!IsEmptyStr(usbuf.fullname))
643 snprintf(buf, sizeof buf,
644 "%s is now the room admin for \"%s\".\n",
645 usbuf.fullname, CC->room.QRname);
646 else
647 snprintf(buf, sizeof buf,
648 "There is now no room admin for \"%s\".\n",
649 CC->room.QRname);
650 CtdlAideMessage(buf, "Admin Room Modification");
651 }
652 cprintf("%d Ok\n", CIT_OK);
653}
654
655
656// Retrieve info file for this room (this ought to be upgraded to handle non-plain-text)
657void cmd_rinf(char *argbuf) {
658 struct CtdlMessage *msg = CtdlFetchMessage(CC->room.msgnum_info, 1);
659 if (msg != NULL) {
660 cprintf("%d Info:\n", LISTING_FOLLOWS);
662 CM_Free(msg);
663 cprintf("000\n");
664 }
665 else {
666 cprintf("%d No info file.\n", ERROR + FILE_NOT_FOUND);
667 }
668}
669
670
671// admin command: kill the current room
672void cmd_kill(char *argbuf) {
673 char deleted_room_name[ROOMNAMELEN];
674 char msg[SIZ];
675 int kill_ok;
676
677 kill_ok = extract_int(argbuf, 0);
678
679 if (CtdlDoIHavePermissionToDeleteThisRoom(&CC->room) == 0) {
680 cprintf("%d Can't delete this room.\n", ERROR + NOT_HERE);
681 return;
682 }
683 if (kill_ok) {
684 if (CC->room.QRflags & QR_MAILBOX) {
685 safestrncpy(deleted_room_name, &CC->room.QRname[11], sizeof deleted_room_name);
686 }
687 else {
688 safestrncpy(deleted_room_name, CC->room.QRname, sizeof deleted_room_name);
689 }
690
691 /* Do the dirty work */
693
694 /* Return to the Lobby */
695 CtdlUserGoto(CtdlGetConfigStr("c_baseroom"), 0, 0, NULL, NULL, NULL, NULL);
696
697 /* tell the world what we did */
698 snprintf(msg, sizeof msg, "The room \"%s\" has been deleted by %s.\n",
699 deleted_room_name,
700 (CC->logged_in ? CC->curr_user : "an administrator")
701 );
702 CtdlAideMessage(msg, "Room Purger Message");
703 cprintf("%d '%s' deleted.\n", CIT_OK, deleted_room_name);
704 }
705 else {
706 cprintf("%d ok to delete.\n", CIT_OK);
707 }
708}
709
710
711// create a new room
712void cmd_cre8(char *args) {
713 int cre8_ok;
714 char new_room_name[ROOMNAMELEN];
715 int new_room_type;
716 char new_room_pass[32];
717 int new_room_floor;
718 int new_room_view;
719 char *notification_message = NULL;
720 unsigned newflags;
721 struct floor *fl;
722 int avoid_access = 0;
723
724 cre8_ok = extract_int(args, 0);
725 extract_token(new_room_name, args, 1, '|', sizeof new_room_name);
726 new_room_name[ROOMNAMELEN - 1] = 0;
727 new_room_type = extract_int(args, 2);
728 extract_token(new_room_pass, args, 3, '|', sizeof new_room_pass);
729 avoid_access = extract_int(args, 5);
730 new_room_view = extract_int(args, 6);
731 new_room_pass[9] = 0;
732 new_room_floor = 0;
733
734 if ((IsEmptyStr(new_room_name)) && (cre8_ok == 1)) {
735 cprintf("%d Invalid room name.\n", ERROR + ILLEGAL_VALUE);
736 return;
737 }
738
739 if (!strcasecmp(new_room_name, MAILROOM)) {
740 cprintf("%d '%s' already exists.\n",
741 ERROR + ALREADY_EXISTS, new_room_name);
742 return;
743 }
744
745 if (num_parms(args) >= 5) {
746 fl = CtdlGetCachedFloor(extract_int(args, 4));
747 if (fl == NULL) {
748 cprintf("%d Invalid floor number.\n",
750 return;
751 }
752 else if ((fl->f_flags & F_INUSE) == 0) {
753 cprintf("%d Invalid floor number.\n",
755 return;
756 } else {
757 new_room_floor = extract_int(args, 4);
758 }
759 }
760
761 if (CtdlAccessCheck(ac_logged_in)) return;
762
763 if (CC->user.axlevel < CtdlGetConfigInt("c_createax") && !CC->internal_pgm) {
764 cprintf("%d You need higher access to create rooms.\n",
766 return;
767 }
768
769 if ((IsEmptyStr(new_room_name)) && (cre8_ok == 0)) {
770 cprintf("%d Ok to create rooms.\n", CIT_OK);
771 return;
772 }
773
774 if ((new_room_type < 0) || (new_room_type > 5)) {
775 cprintf("%d Invalid room type.\n", ERROR + ILLEGAL_VALUE);
776 return;
777 }
778
779 if (new_room_type == 5) {
780 if (CC->user.axlevel < AxAideU) {
781 cprintf("%d Higher access required\n",
783 return;
784 }
785 }
786
787 /* Check to make sure the requested room name doesn't already exist */
788 newflags = CtdlCreateRoom(new_room_name,
789 new_room_type, new_room_pass, new_room_floor,
790 0, avoid_access, new_room_view);
791 if (newflags == 0) {
792 cprintf("%d '%s' already exists.\n",
793 ERROR + ALREADY_EXISTS, new_room_name);
794 return;
795 }
796
797 if (cre8_ok == 0) {
798 cprintf("%d OK to create '%s'\n", CIT_OK, new_room_name);
799 return;
800 }
801
802 /* If we reach this point, the room needs to be created. */
803
804 newflags = CtdlCreateRoom(new_room_name,
805 new_room_type, new_room_pass, new_room_floor, 1, 0,
806 new_room_view);
807
808 /* post a message in Aide> describing the new room */
809 notification_message = malloc(1024);
810 snprintf(notification_message, 1024,
811 "A new room called \"%s\" has been created by %s%s%s%s%s%s\n",
812 new_room_name,
813 (CC->logged_in ? CC->curr_user : "an administrator"),
814 ((newflags & QR_MAILBOX) ? " [personal]" : ""),
815 ((newflags & QR_PRIVATE) ? " [private]" : ""),
816 ((newflags & QR_GUESSNAME) ? " [hidden]" : ""),
817 ((newflags & QR_PASSWORDED) ? " Password: " : ""),
818 ((newflags & QR_PASSWORDED) ? new_room_pass : "")
819 );
820 CtdlAideMessage(notification_message, "Room Creation Message");
821 free(notification_message);
822
823 cprintf("%d '%s' has been created.\n", CIT_OK, new_room_name);
824}
825
826
827// Upload the room banner text for this room.
828// This should be amended to handle content types other than plain text.
829void cmd_einf(char *ok) { /* enter info file for current room */
830 char buf[SIZ];
832
833 if (CtdlAccessCheck(ac_room_aide)) return;
834
835 if (atoi(ok) == 0) {
836 cprintf("%d Ok.\n", CIT_OK);
837 return;
838 }
839
840 StrBuf *NewBanner = NewStrBufPlain("Content-type: text/plain; charset=UTF-8\nContent-transfer-encoding: 8bit\n\n", -1);
841
842 cprintf("%d Transmit new banner in plain text now.\n", SEND_LISTING);
843 while(client_getln(buf, sizeof buf) >= 0 && strcmp(buf,"000")) {
844 StrBufAppendBufPlain(NewBanner, buf, -1, 0);
845 StrBufAppendBufPlain(NewBanner, HKEY("\n"), 0);
846 }
847
848 // We have read the new banner from the user , now save it
849 long new_msgnum = quickie_message("Citadel", NULL, NULL, SYSCONFIGROOM, ChrPtr(NewBanner), FMT_RFC822, "Banner submitted with EINF command");
850 FreeStrBuf(&NewBanner);
851
852 // Update the room record with a pointer to our new banner
853 CtdlGetRoomLock(&CC->room, CC->room.QRname);
854 long old_msgnum = CC->room.msgnum_info;
855 CC->room.msgnum_info = new_msgnum;
856 CtdlPutRoomLock(&CC->room);
857
858 // Delete the old one
859 CtdlDeleteMessages(SYSCONFIGROOM, &old_msgnum, 1, "");
860}
861
862
863// cmd_lflr() - List all known floors
864void cmd_lflr(char *gargs) {
865 int a;
866 struct floor flbuf;
867
869
870 cprintf("%d Known floors:\n", LISTING_FOLLOWS);
871
872 for (a = 0; a < MAXFLOORS; ++a) {
873 CtdlGetFloor(&flbuf, a);
874 if (flbuf.f_flags & F_INUSE) {
875 cprintf("%d|%s|%d\n", a, flbuf.f_name, flbuf.f_ref_count);
876 }
877 }
878 cprintf("000\n");
879}
880
881
882// create a new floor
883void cmd_cflr(char *argbuf) {
884 char new_floor_name[256];
885 struct floor flbuf;
886 int cflr_ok;
887 int free_slot = (-1);
888 int a;
889
890 extract_token(new_floor_name, argbuf, 0, '|', sizeof new_floor_name);
891 cflr_ok = extract_int(argbuf, 1);
892
893 if (CtdlAccessCheck(ac_aide)) return;
894
895 if (IsEmptyStr(new_floor_name)) {
896 cprintf("%d Blank floor name not allowed.\n",
898 return;
899 }
900
901 for (a = 0; a < MAXFLOORS; ++a) {
902 CtdlGetFloor(&flbuf, a);
903
904 /* note any free slots while we're scanning... */
905 if (((flbuf.f_flags & F_INUSE) == 0)
906 && (free_slot < 0))
907 free_slot = a;
908
909 /* check to see if it already exists */
910 if ((!strcasecmp(flbuf.f_name, new_floor_name))
911 && (flbuf.f_flags & F_INUSE)) {
912 cprintf("%d Floor '%s' already exists.\n",
914 flbuf.f_name);
915 return;
916 }
917 }
918
919 if (free_slot < 0) {
920 cprintf("%d There is no space available for a new floor.\n",
922 return;
923 }
924 if (cflr_ok == 0) {
925 cprintf("%d ok to create...\n", CIT_OK);
926 return;
927 }
928 lgetfloor(&flbuf, free_slot);
930 flbuf.f_ref_count = 0;
931 safestrncpy(flbuf.f_name, new_floor_name, sizeof flbuf.f_name);
932 lputfloor(&flbuf, free_slot);
933 cprintf("%d %d\n", CIT_OK, free_slot);
934}
935
936
937// delete a floor
938void cmd_kflr(char *argbuf) {
939 struct floor flbuf;
940 int floor_to_delete;
941 int kflr_ok;
942 int delete_ok;
943
944 floor_to_delete = extract_int(argbuf, 0);
945 kflr_ok = extract_int(argbuf, 1);
946
947 if (CtdlAccessCheck(ac_aide)) return;
948
949 lgetfloor(&flbuf, floor_to_delete);
950
951 delete_ok = 1;
952 if ((flbuf.f_flags & F_INUSE) == 0) {
953 cprintf("%d Floor %d not in use.\n", ERROR + INVALID_FLOOR_OPERATION, floor_to_delete);
954 delete_ok = 0;
955 } else {
956 if (flbuf.f_ref_count != 0) {
957 cprintf("%d Cannot delete; floor contains %d rooms.\n",
960 delete_ok = 0;
961 }
962 else {
963 if (kflr_ok == 1) {
964 cprintf("%d Ok\n", CIT_OK);
965 }
966 else {
967 cprintf("%d Ok to delete...\n", CIT_OK);
968 }
969
970 }
971
972 }
973
974 if ((delete_ok == 1) && (kflr_ok == 1)) {
975 flbuf.f_flags = 0;
976 }
977 lputfloor(&flbuf, floor_to_delete);
978}
979
980
981// edit a floor
982void cmd_eflr(char *argbuf) {
983 struct floor flbuf;
984 int floor_num;
985 int np;
986
987 np = num_parms(argbuf);
988 if (np < 1) {
989 cprintf("%d Usage error.\n", ERROR + ILLEGAL_VALUE);
990 return;
991 }
992
993 if (CtdlAccessCheck(ac_aide)) return;
994
995 floor_num = extract_int(argbuf, 0);
996 lgetfloor(&flbuf, floor_num);
997 if ((flbuf.f_flags & F_INUSE) == 0) {
998 lputfloor(&flbuf, floor_num);
999 cprintf("%d Floor %d is not in use.\n", ERROR + INVALID_FLOOR_OPERATION, floor_num);
1000 return;
1001 }
1002 if (np >= 2) {
1003 extract_token(flbuf.f_name, argbuf, 1, '|', sizeof flbuf.f_name);
1004 }
1005 lputfloor(&flbuf, floor_num);
1006
1007 cprintf("%d Ok\n", CIT_OK);
1008}
1009
1010
1011// cmd_stat() - return the modification time of the current room (maybe other things in the future)
1012void cmd_stat(char *gargs) {
1014 CtdlGetRoom(&CC->room, CC->room.QRname);
1015 cprintf("%d %s|%ld|\n", CIT_OK, CC->room.QRname, CC->room.QRmtime);
1016}
1017
1018
1019// Initialization function, called from modules_init.c
1021 if (!threading) {
1022 CtdlRegisterProtoHook(cmd_lrms, "LRMS", "List rooms");
1023 CtdlRegisterProtoHook(cmd_lkra, "LKRA", "List all known rooms");
1024 CtdlRegisterProtoHook(cmd_lkrn, "LKRN", "List known rooms with new messages");
1025 CtdlRegisterProtoHook(cmd_lkro, "LKRO", "List known rooms without new messages");
1026 CtdlRegisterProtoHook(cmd_lzrm, "LZRM", "List zapped rooms");
1027 CtdlRegisterProtoHook(cmd_lprm, "LPRM", "List public rooms");
1028 CtdlRegisterProtoHook(cmd_goto, "GOTO", "Goto a named room");
1029 CtdlRegisterProtoHook(cmd_stat, "STAT", "Get mtime of the current room");
1030 CtdlRegisterProtoHook(cmd_whok, "WHOK", "List users who know this room");
1031 CtdlRegisterProtoHook(cmd_rdir, "RDIR", "List files in room directory");
1032 CtdlRegisterProtoHook(cmd_getr, "GETR", "Get room parameters");
1033 CtdlRegisterProtoHook(cmd_setr, "SETR", "Set room parameters");
1034 CtdlRegisterProtoHook(cmd_geta, "GETA", "Get the room admin name");
1035 CtdlRegisterProtoHook(cmd_seta, "SETA", "Set the room admin for this room");
1036 CtdlRegisterProtoHook(cmd_rinf, "RINF", "Fetch room info file");
1037 CtdlRegisterProtoHook(cmd_kill, "KILL", "Kill (delete) the current room");
1038 CtdlRegisterProtoHook(cmd_cre8, "CRE8", "Create a new room");
1039 CtdlRegisterProtoHook(cmd_einf, "EINF", "Enter info file for the current room");
1040 CtdlRegisterProtoHook(cmd_lflr, "LFLR", "List all known floors");
1041 CtdlRegisterProtoHook(cmd_cflr, "CFLR", "Create a new floor");
1042 CtdlRegisterProtoHook(cmd_kflr, "KFLR", "Kill a floor");
1043 CtdlRegisterProtoHook(cmd_eflr, "EFLR", "Edit a floor");
1044 }
1045 /* return our id for the log */
1046 return "rooms";
1047}
#define ROOMNAMELEN
Definition: citadel.h:51
#define F_INUSE
Definition: citadel.h:131
#define ctdl_file_dir
Definition: citadel_dirs.h:15
char CtdlCheckExpress(void)
Definition: citserver.c:170
char * CtdlGetConfigStr(char *key)
Definition: config.c:363
int CtdlGetConfigInt(char *key)
Definition: config.c:390
#define CC
Definition: context.h:140
int CtdlAccessCheck(int)
Definition: user_ops.c:334
@ crr_invalid_floor
Definition: ctdl_module.h:232
@ crr_noneditable
Definition: ctdl_module.h:231
@ crr_room_not_found
Definition: ctdl_module.h:229
@ crr_ok
Definition: ctdl_module.h:228
@ crr_already_exists
Definition: ctdl_module.h:230
@ crr_access_denied
Definition: ctdl_module.h:233
void CtdlMailboxName(char *buf, size_t n, const struct ctdluser *who, const char *prefix)
Definition: user_ops.c:305
void CtdlGetFloor(struct floor *flbuf, int floor_num)
Definition: room_ops.c:450
int CtdlGetRoom(struct ctdlroom *qrbuf, const char *room_name)
Definition: room_ops.c:309
int CtdlGetUserByNumber(struct ctdluser *usbuf, long number)
Definition: user_ops.c:398
void CtdlScheduleRoomForDeletion(struct ctdlroom *qrbuf)
Definition: room_ops.c:942
#define CtdlAideMessage(TEXT, SUBJECT)
Definition: ctdl_module.h:61
int threading
Definition: modules_init.c:24
void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf, int *result, int *view)
Definition: room_ops.c:103
struct floor * CtdlGetCachedFloor(int floor_num)
Definition: room_ops.c:478
int CtdlGetRoomLock(struct ctdlroom *qrbuf, const char *room_name)
Definition: room_ops.c:352
int CtdlDoIHavePermissionToDeleteThisRoom(struct ctdlroom *qr)
Definition: room_ops.c:1000
void CtdlForEachRoom(ForEachRoomCallBack CB, void *in_data)
Definition: room_ops.c:542
int CtdlRenameRoom(char *old_name, char *new_name, int new_floor)
Definition: room_ops.c:829
@ ac_room_aide
Definition: ctdl_module.h:248
@ ac_logged_in_or_guest
Definition: ctdl_module.h:246
@ ac_aide
Definition: ctdl_module.h:249
@ ac_logged_in
Definition: ctdl_module.h:247
unsigned CtdlCreateRoom(char *new_room_name, int new_room_type, char *new_room_pass, int new_room_floor, int really_create, int avoid_access, int new_room_view)
Definition: room_ops.c:1035
void CtdlUserGoto(char *where, int display_result, int transiently, int *msgs, int *new, long *oldest, long *newest)
Definition: room_ops.c:623
int CtdlGetUser(struct ctdluser *usbuf, char *name)
Definition: user_ops.c:64
void CtdlPutRoomLock(struct ctdlroom *qrbuf)
Definition: room_ops.c:400
void CtdlRegisterProtoHook(void(*handler)(char *), char *cmd, char *desc)
void cdb_free(struct cdbdata *cdb)
Definition: database.c:604
struct cdbdata * cdb_next_item(int cdb)
Definition: database.c:650
void cdb_rewind(int cdb)
Definition: database.c:626
#define QR_GUESSNAME
Definition: ipcdef.h:43
#define QR_PASSWORDED
Definition: ipcdef.h:42
#define CIT_OK
Definition: ipcdef.h:6
#define ILLEGAL_VALUE
Definition: ipcdef.h:16
#define UA_ZAPPED
Definition: ipcdef.h:82
#define INTERNAL_ERROR
Definition: ipcdef.h:14
#define LISTING_FOLLOWS
Definition: ipcdef.h:5
#define HIGHER_ACCESS_REQUIRED
Definition: ipcdef.h:23
#define ROOM_NOT_FOUND
Definition: ipcdef.h:31
#define QR_PREFONLY
Definition: ipcdef.h:51
#define INVALID_FLOOR_OPERATION
Definition: ipcdef.h:28
#define QR_PRIVATE
Definition: ipcdef.h:41
#define QR_VISDIR
Definition: ipcdef.h:47
#define FILE_NOT_FOUND
Definition: ipcdef.h:30
#define QR_DIRECTORY
Definition: ipcdef.h:44
#define UA_HASNEWMSGS
Definition: ipcdef.h:81
#define QR_MAILBOX
Definition: ipcdef.h:53
#define ERROR
Definition: ipcdef.h:9
#define QR_PERMANENT
Definition: ipcdef.h:39
#define UA_GOTOALLOWED
Definition: ipcdef.h:80
#define SEND_LISTING
Definition: ipcdef.h:8
#define ALREADY_EXISTS
Definition: ipcdef.h:33
#define UA_KNOWN
Definition: ipcdef.h:79
#define PASSWORD_REQUIRED
Definition: ipcdef.h:20
#define NOT_HERE
Definition: ipcdef.h:27
#define QR_INUSE
Definition: ipcdef.h:40
void CM_Free(struct CtdlMessage *msg)
Definition: msgbase.c:305
int CtdlOutputPreLoadedMsg(struct CtdlMessage *TheMessage, int mode, int headers_only, int do_proto, int crlf, int flags)
Definition: msgbase.c:1958
struct CtdlMessage * CtdlFetchMessage(long msgnum, int with_body)
Definition: msgbase.c:1128
int CtdlDeleteMessages(const char *room_name, long *dmsgnums, int num_dmsgnums, char *content_type)
Definition: msgbase.c:3229
long quickie_message(char *from, char *fromaddr, char *to, char *room, char *text, int format_type, char *subject)
Definition: msgbase.c:2906
#define HEADERS_NONE
Definition: msgbase.h:41
void * malloc(unsigned)
void free(void *)
void lgetfloor(struct floor *flbuf, int floor_num)
Definition: room_ops.c:470
void lputfloor(struct floor *flbuf, int floor_num)
Definition: room_ops.c:536
void convert_room_name_macros(char *towhere, size_t maxlen)
Definition: room_ops.c:792
struct floor flbuf
Definition: serv_migrate.c:501
struct ctdlroom qrbuf
Definition: serv_migrate.c:497
struct ctdluser usbuf
Definition: serv_migrate.c:496
void cmd_kill(char *argbuf)
Definition: serv_rooms.c:672
void cmd_getr(char *cmdbuf)
Definition: serv_rooms.c:436
void cmd_lkro_backend(struct ctdlroom *qrbuf, void *data)
Definition: serv_rooms.c:177
void cmd_geta(char *cmdbuf)
Definition: serv_rooms.c:601
char * ctdl_module_init_rooms(void)
Definition: serv_rooms.c:1020
void cmd_cre8(char *args)
Definition: serv_rooms.c:712
void cmd_kflr(char *argbuf)
Definition: serv_rooms.c:938
void cmd_cflr(char *argbuf)
Definition: serv_rooms.c:883
void cmd_lprm(char *argbuf)
Definition: serv_rooms.c:132
void cmd_lkro(char *argbuf)
Definition: serv_rooms.c:191
void cmd_lkra(char *argbuf)
Definition: serv_rooms.c:102
void cmd_lrms(char *argbuf)
Definition: serv_rooms.c:72
void cmd_lzrm(char *argbuf)
Definition: serv_rooms.c:222
void cmd_goto(char *gargs)
Definition: serv_rooms.c:238
void cmd_rdir(char *cmdbuf)
Definition: serv_rooms.c:348
void cmd_eflr(char *argbuf)
Definition: serv_rooms.c:982
void cmd_lflr(char *gargs)
Definition: serv_rooms.c:864
void cmd_lkra_backend(struct ctdlroom *qrbuf, void *data)
Definition: serv_rooms.c:88
void cmd_lkrn_backend(struct ctdlroom *qrbuf, void *data)
Definition: serv_rooms.c:146
void cmd_seta(char *new_ra)
Definition: serv_rooms.c:616
void cmd_lkrn(char *argbuf)
Definition: serv_rooms.c:160
void cmd_setr(char *args)
Definition: serv_rooms.c:456
void cmd_lrms_backend(struct ctdlroom *qrbuf, void *data)
Definition: serv_rooms.c:57
void cmd_einf(char *ok)
Definition: serv_rooms.c:829
void cmd_lzrm_backend(struct ctdlroom *qrbuf, void *data)
Definition: serv_rooms.c:208
void cmd_lprm_backend(struct ctdlroom *qrbuf, void *data)
Definition: serv_rooms.c:118
void list_roomname(struct ctdlroom *qrbuf, int ra, int current_view, int default_view)
Definition: serv_rooms.c:27
void cmd_stat(char *gargs)
Definition: serv_rooms.c:1012
void cmd_whok(char *cmdbuf)
Definition: serv_rooms.c:324
void cmd_rinf(char *argbuf)
Definition: serv_rooms.c:657
#define FMT_RFC822
Definition: server.h:178
@ CDB_USERS
Definition: server.h:186
@ MT_CITADEL
Definition: server.h:166
struct ctdluser user
Definition: context.h:109
char curr_user[64]
Definition: context.h:69
int internal_pgm
Definition: context.h:71
struct ctdlroom room
Definition: context.h:110
char * ptr
Definition: server.h:204
char QRfloor
Definition: citadel.h:102
unsigned QRflags2
Definition: citadel.h:107
time_t QRmtime
Definition: citadel.h:103
char QRname[128]
Definition: citadel.h:94
char QRpasswd[10]
Definition: citadel.h:95
unsigned QRflags
Definition: citadel.h:99
int QRdefaultview
Definition: citadel.h:108
char QRorder
Definition: citadel.h:106
cit_uint8_t axlevel
Definition: citadel.h:76
char fullname[64]
Definition: citadel.h:80
long usernum
Definition: citadel.h:77
Definition: citadel.h:124
int f_ref_count
Definition: citadel.h:127
char f_name[256]
Definition: citadel.h:126
unsigned short f_flags
Definition: citadel.h:125
#define MAILROOM
Definition: sysconfig.h:61
#define SIZ
Definition: sysconfig.h:33
#define MAXFLOORS
Definition: sysconfig.h:25
#define SYSCONFIGROOM
Definition: sysconfig.h:72
void cprintf(const char *format,...)
Definition: sysdep.c:369
int client_getln(char *buf, int bufsize)
Definition: sysdep.c:528
void unbuffer_output(void)
Definition: sysdep.c:268