//
// Copyright (c) 2003 by Art Cancro <ajc@uncensored.citadel.org>
// This program is released under the terms of the GNU General Public License.
-//
//
//
function become_logged_in($server_parms) {
$_SESSION["logged_in"] = 1;
+
+ $tok = strtok($server_parms, "|");
+ if ($tok) $thisline["username"] = $tok;
+
+ $tok = strtok("|");
+ if ($tok) $thisline["axlevel"] = $tok;
+
+ $tok = strtok("|");
+ if ($tok) $thisline["calls"] = $tok;
+
+ $tok = strtok("|");
+ if ($tok) $thisline["posts"] = $tok;
+
+ $tok = strtok("|");
+ if ($tok) $thisline["userflags"] = $tok;
+
+ $tok = strtok("|");
+ if ($tok) $thisline["usernum"] = $tok;
+
+ $tok = strtok("|");
+ if ($tok) $thisline["lastcall"] = $tok;
+
+ ctdl_goto("_BASEROOM_");
}
}
+//
+// Goto a room.
+//
+function ctdl_goto($to_where) {
+
+ serv_puts("GOTO " . $to_where);
+ $response = serv_gets();
+
+ if (substr($response, 0, 1) == "2") {
+ $_SESSION["room"] = strtok(substr($response, 4), "|");
+ return array(TRUE, substr($response, 0, 3));
+ }
+
+ else {
+ return array(FALSE, substr($response, 0, 3));
+ }
+
+}
+
+
+
+//
+// Fetch the list of known rooms.
+//
+function ctdl_knrooms() {
+ global $clientsocket;
+
+ serv_puts("LKRA");
+ $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["name"] = $tok;
+
+ $tok = strtok("|");
+ if ($tok) $thisline["flags"] = $tok;
+
+ $tok = strtok("|");
+ if ($tok) $thisline["floor"] = $tok;
+
+ $tok = strtok("|");
+ if ($tok) $thisline["order"] = $tok;
+
+ $tok = strtok("|");
+ if ($tok) $thisline["flags2"] = $tok;
+
+ $tok = strtok("|");
+ if ($tok) $thisline["access"] = $tok;
+
+ if ($thisline["access"] & 8) {
+ $thisline["hasnewmsgs"] = TRUE;
+ }
+ else {
+ $thisline["hasnewmsgs"] = FALSE;
+ }
+
+ $num_lines = array_push($all_lines, $thisline);
+ }
+
+ return array($num_lines, $all_lines);
+
+}
+
+
+//
+// Fetch the list of messages in this room.
+// Returns: count, response, message array
+//
+function ctdl_msgs($mode, $count) {
+ global $clientsocket;
+
+ serv_puts("MSGS " . $mode . "|" . $count);
+ $response = serv_gets();
+
+ if (substr($response, 0, 1) != "1") {
+ return array(0, substr($response, 4), NULL);
+ }
+
+ $msgs = array();
+ $num_msgs = 0;
+
+ while (strcmp($buf = serv_gets(), "000")) {
+ $num_msgs = array_push($msgs, $buf);
+ }
+
+ return array($num_msgs, substr($response, 4), $msgs);
+}
+
?>