]> code.citadel.org Git - citadel.git/commitdiff
* Set up the SNET (Send NETwork config) and GNET (Get NETwork config) commands
authorArt Cancro <ajc@citadel.org>
Sun, 30 Jul 2000 04:36:12 +0000 (04:36 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 30 Jul 2000 04:36:12 +0000 (04:36 +0000)
  for the network overhaul.

citadel/ChangeLog
citadel/citadel.c
citadel/serv_network.c

index c4568e689750a48876bd20f355f3920fe8197f6f..8a9823efa607e7a617bc39369de02a3a8d2e5724 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 572.21  2000/07/30 04:36:12  ajc
+ * Set up the SNET (Send NETwork config) and GNET (Get NETwork config) commands
+   for the network overhaul.
+
  Revision 572.20  2000/07/29 05:29:19  ajc
  * Changed the format of RWHO output to provide non-masqueraded user/room/host
    names (to Aides only) as additional fields rather than an extra line of
@@ -1968,4 +1972,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Initial CVS import 
-
index 17ba3cc7c3221ac02e38002c25b50450da42afa0..e638835bdf8e953e6ac4f44fa263a66dc3be12cf 100644 (file)
@@ -728,10 +728,10 @@ void get_serv_info(void)
  */
 void who_is_online(int longlist)
 {
-       char buf[128], username[128], roomname[128], fromhost[128];
-       char flags[128];
-       char actual_user[128], actual_room[128], actual_host[128];
-       char tbuf[128], clientsoft[128];
+       char buf[256], username[256], roomname[256], fromhost[256];
+       char flags[256];
+       char actual_user[256], actual_room[256], actual_host[256];
+       char tbuf[256], clientsoft[256];
        time_t timenow = 0;
        time_t idletime, idlehours, idlemins, idlesecs;
        int last_session = (-1);
index f266d802b044cdeb4bc2fe985e1fc422d85a7b66..8ed03aa6ffdeec14fdb04ff0fbe5cbc9fb2d052f 100644 (file)
 
 
 void cmd_gnet(char *argbuf) {
+       char filename[256];
+       char buf[256];
+       FILE *fp;
+
+       if (CtdlAccessCheck(ac_room_aide)) return;
+       assoc_file_name(filename, &CC->quickroom, "netconfigs");
+       cprintf("%d Network settings for room #%ld <%s>\n",
+               LISTING_FOLLOWS,
+               CC->quickroom.QRnumber, CC->quickroom.QRname);
+
+       fp = fopen(filename, "r");
+       if (fp != NULL) {
+               while (fgets(buf, sizeof buf, fp) != NULL) {
+                       buf[strlen(buf)-1] = 0;
+                       cprintf("%s\n", buf);
+               }
+               fclose(fp);
+       }
+
+       cprintf("000\n");
 }
 
 
 void cmd_snet(char *argbuf) {
+       char tempfilename[256];
+       char filename[256];
+       char buf[256];
+       FILE *fp;
+
+       if (CtdlAccessCheck(ac_room_aide)) return;
+       safestrncpy(tempfilename, tmpnam(NULL), sizeof tempfilename);
+       assoc_file_name(filename, &CC->quickroom, "netconfigs");
+
+       fp = fopen(tempfilename, "w");
+       if (fp == NULL) {
+               cprintf("%d Cannot open %s: %s\n",
+                       ERROR+INTERNAL_ERROR,
+                       tempfilename,
+                       strerror(errno));
+       }
+
+       cprintf("%d %s\n", SEND_LISTING, tempfilename);
+       while (client_gets(buf), strcmp(buf, "000")) {
+               fprintf(fp, "%s\n", buf);
+       }
+       fclose(fp);
+
+       /* Now that we've got the whole file, put it in place */
+       unlink(filename);
+       link(tempfilename, filename);
+       unlink(tempfilename);
 }