From 1de9808551fd581902b0c3a8bb5a892c5d3272e2 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 4 Nov 2003 19:17:16 +0000 Subject: [PATCH] * Added an initial version of the goto command --- ctdlphp/ChangeLog | 4 +++- ctdlphp/ctdlprotocol.php | 21 +++++++++++++++++++++ ctdlphp/ctdlsession.php | 9 ++++++++- ctdlphp/welcome.php | 1 + 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/ctdlphp/ChangeLog b/ctdlphp/ChangeLog index 017052299..4b918281e 100644 --- a/ctdlphp/ChangeLog +++ b/ctdlphp/ChangeLog @@ -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 - diff --git a/ctdlphp/ctdlprotocol.php b/ctdlphp/ctdlprotocol.php index 45c136e3d..cebf9f452 100644 --- a/ctdlphp/ctdlprotocol.php +++ b/ctdlphp/ctdlprotocol.php @@ -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)); + } + +} + + ?> diff --git a/ctdlphp/ctdlsession.php b/ctdlphp/ctdlsession.php index a890e8421..b8f2dbcd1 100644 --- a/ctdlphp/ctdlsession.php +++ b/ctdlphp/ctdlsession.php @@ -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_"); + } } } diff --git a/ctdlphp/welcome.php b/ctdlphp/welcome.php index e1a49cafd..19dc73428 100644 --- a/ctdlphp/welcome.php +++ b/ctdlphp/welcome.php @@ -5,6 +5,7 @@

You're online!

+

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; -- 2.30.2