]> code.citadel.org Git - citadel.git/blobdiff - ctdlphp/ctdlprotocol.php
*** empty log message ***
[citadel.git] / ctdlphp / ctdlprotocol.php
index 84ab12541616d1011cdd819908101b64bb52ab7c..2a6545187f5e6ff8bd0895d1460fc2120e161b07 100644 (file)
@@ -1,5 +1,17 @@
 <?PHP
 
+// $Id$
+// 
+// Implements various Citadel server commands.
+//
+// Copyright (c) 2003 by Art Cancro <ajc@uncensored.citadel.org>
+// This program is released under the terms of the GNU General Public License.
+//
+
+
+//
+// serv_gets() -- generic function to read one line of text from the server
+//
 function serv_gets() {
        global $clientsocket;
 
@@ -8,6 +20,10 @@ function serv_gets() {
        return $buf;
 }
 
+
+//
+// serv_puts() -- generic function to write one line of text to the server
+//
 function serv_puts($buf) {
        global $clientsocket;
        
@@ -15,6 +31,29 @@ function serv_puts($buf) {
 }
 
 
+//
+// Learn all sorts of interesting things about the Citadel server to
+// which we are connected.
+//
+function ctdl_get_serv_info() {
+       global $serv_humannode;
+       global $serv_software;
+
+       serv_puts("INFO");
+       serv_gets($buf);
+       if (substr($buf, 0, 1) == "1") {
+               $i = 0;
+               do {
+                       $buf = serv_gets();
+                       if ($i == 2) $serv_humannode = $buf;
+                       if ($i == 4) $serv_software = $buf;
+                       $i = $i + 1;
+               } while ($buf != "000");
+       }
+
+}
+
+
 
 function test_for_echo() {