X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=ctdlphp%2Fctdlprotocol.php;h=32d0030450e1504604ed78e55d5a955c94ae3927;hb=1eab928d963935425463b16424ee64442324d9a0;hp=2fd38d4f3a16dae766565b65b1bfd3af10d1f0d8;hpb=34e2a395aacf95e7cd8b0427704eb7c7eb2fb5ac;p=citadel.git diff --git a/ctdlphp/ctdlprotocol.php b/ctdlphp/ctdlprotocol.php index 2fd38d4f3..32d003045 100644 --- a/ctdlphp/ctdlprotocol.php +++ b/ctdlphp/ctdlprotocol.php @@ -145,12 +145,9 @@ function ctdl_mesg($msgname) { if (substr($response, 0, 1) == "1") { echo "
\n"; - do { - $buf = serv_gets(); - if (strcasecmp($buf, "000")) { - echo "", $buf, "
\n" ; - } - } while (strcasecmp($buf, "000")); + while (strcmp($buf = serv_gets(), "000")) { + echo "", $buf, "
\n" ; + } echo "
\n"; } else { @@ -159,4 +156,50 @@ function ctdl_mesg($msgname) { } +// +// Fetch the list of users currently logged in. +// +function ctdl_rwho() { + global $clientsocket; + + serv_puts("RWHO"); + $response = serv_gets(); + + if (substr($response, 0, 1) != "1") { + return array(0, NULL); + } + + $all_lines = array(); + $num_lines = 0; + + while (strcmp($buf = serv_gets(), "000")) { + + $thisline = array(); + + $tok = strtok($buf, "|"); + if ($tok) $thisline["session"] = $tok; + + $tok = strtok("|"); + if ($tok) $thisline["user"] = $tok; + + $tok = strtok("|"); + if ($tok) $thisline["room"] = $tok; + + $tok = strtok("|"); + if ($tok) $thisline["host"] = $tok; + + $tok = strtok("|"); + if ($tok) $thisline["client"] = $tok; + + // IGnore the rest of the fields for now. + + $num_lines = array_push($all_lines, $thisline); + } + + return array($num_lines, $all_lines); + +} + + + ?>