* Added an initial version of the goto command
authorArt Cancro <ajc@citadel.org>
Tue, 4 Nov 2003 19:17:16 +0000 (19:17 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 4 Nov 2003 19:17:16 +0000 (19:17 +0000)
ctdlphp/ChangeLog
ctdlphp/ctdlprotocol.php
ctdlphp/ctdlsession.php
ctdlphp/welcome.php

index 017052299fe48c7fe2ff32fc351ee4ff46a2efc6..4b918281e31f3e3a015d9007e83527bace29f4b3 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 1.12  2003/11/04 19:17:16  ajc
+ * Added an initial version of the goto command
+
  Revision 1.11  2003/11/03 05:32:57  ajc
  * Minor code cleanups
  * ctdl_mesg() now returns ready-to-output HTML to the caller, instead of
@@ -50,4 +53,3 @@
 
  Revision 1.1  2003/10/31 03:47:13  ajc
  * Initial CVS import
-
index 45c136e3de8ff1934efbd138c3938ed03a9575a6..cebf9f45210a99795eeca50fb6bebb40dae5cb12 100644 (file)
@@ -108,6 +108,7 @@ function create_new_user($user, $pass) {
 //
 function become_logged_in($server_parms) {
        $_SESSION["logged_in"] = 1;
+       ctdl_goto("_BASEROOM_");
 }
 
 
@@ -209,5 +210,25 @@ function ctdl_rwho() {
 }
 
 
+//
+// 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));
+       }
+
+}
+
+
 
 ?>
index a890e842149692bebc7d170fa755cdd9bdb9ee88..b8f2dbcd14215fce35960876abf60fd69044670c 100644 (file)
@@ -42,7 +42,7 @@ function establish_citadel_session() {
                // Ok, now try again.
                $clientsocket = fsockopen($sockname, 0, $errno, $errstr, 5);
 
-               // Try to log the user back in.
+               // Try to log the user back in and go back to the correct room.
                if ($clientsocket) {
 
                        ctdl_iden();    // Identify client
@@ -53,6 +53,13 @@ function establish_citadel_session() {
                                        $_SESSION["password"]
                                );
                        }
+
+                       if ($_SESSION["room"]) {
+                               ctdl_goto($_SESSION["room"]);
+                       }
+                       else {
+                               ctdl_goto("_BASEROOM_");
+                       }
                }
        }
 
index e1a49cafd554bc14b990ff73f1f53fa8a5fb9973..19dc7342830e62d1d2cd263a1a8799ef71cc2bd8 100644 (file)
@@ -5,6 +5,7 @@
 
 <h1>You're online!</h1>
 <h2><?PHP echo "Welcome to ", $_SESSION["serv_humannode"]; ?></h2>
+<h3><?PHP echo "You're in: ", $_SESSION["room"]; ?></h3>
 
 <P>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum
 ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;