From: Art Cancro Date: Sun, 23 Nov 2003 04:39:30 +0000 (+0000) Subject: * Implemented SEND_LISTING mode in the session proxy X-Git-Tag: v7.86~5693 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=6565c6b027cb55e57abda3281fe0c56466e8b4b9 * Implemented SEND_LISTING mode in the session proxy * Put together a simple 'enter message' loop (doesn't work properly yet) * Threw in a temporary menu --- diff --git a/ctdlphp/ctdlheader.php b/ctdlphp/ctdlheader.php index 94f14417d..3eaa8a855 100644 --- a/ctdlphp/ctdlheader.php +++ b/ctdlphp/ctdlheader.php @@ -62,7 +62,24 @@ LITERAL; echo '' . $_SESSION["username"] . '' ; echo '' . $_SESSION["room"] . '' ; echo 'Log out' ; - echo '
'; + echo '
'; + + // Temporary menu + if ($_SESSION["logged_in"]) { + echo '' . + 'room list ' . + '' . + 'Read all messages ' . + '' . + 'Read new messages ' . + '' . + 'Enter a message ' . + '' . + 'Who is online? ' . + '' . + 'Log out
' ; + } + } diff --git a/ctdlphp/ctdlprotocol.php b/ctdlphp/ctdlprotocol.php index 777036411..ff23a05b6 100644 --- a/ctdlphp/ctdlprotocol.php +++ b/ctdlphp/ctdlprotocol.php @@ -27,6 +27,7 @@ function serv_puts($buf) { global $clientsocket; fwrite($clientsocket, $buf . "\n", (strlen($buf)+1) ); + fflush($clientsocket); } diff --git a/ctdlphp/display_enter.php b/ctdlphp/display_enter.php new file mode 100644 index 000000000..56a98742f --- /dev/null +++ b/ctdlphp/display_enter.php @@ -0,0 +1,27 @@ +' ; + } + else { + echo '
' . + '
' . + ''. + '' . + '
' . + '
'. + '
' . + '
' + ; + } + + bbs_page_footer(); +?> diff --git a/ctdlphp/postmsg.php b/ctdlphp/postmsg.php new file mode 100644 index 000000000..70111a754 --- /dev/null +++ b/ctdlphp/postmsg.php @@ -0,0 +1,24 @@ +' ; + } + else { + echo 'Sending: ' . $_REQUEST["msgtext"] . '
' ; + flush(); + serv_puts($_REQUEST["msgtext"]); + echo 'Sending: 000
' ; + flush(); + serv_puts("000"); + } + + echo "Message has been posted.
\n" ; + + bbs_page_footer(); +?> diff --git a/ctdlphp/sessionproxy.php b/ctdlphp/sessionproxy.php index ba4a502bc..0ace0b57e 100755 --- a/ctdlphp/sessionproxy.php +++ b/ctdlphp/sessionproxy.php @@ -143,6 +143,7 @@ do { } socket_write($msgsock, $talkback, strlen($talkback)); + // LISTING_FOLLOWS mode if (substr($talkback, 0, 1) == "1") do { $buf = fgets($ctdlsock, 4096); if (!$buf) { @@ -154,6 +155,20 @@ do { } } while ($buf != "000\n"); + // SEND_LISTING mode + if (substr($talkback, 0, 1) == "4") do { + $buf = sock_gets($msgsock); + if (!$buf) { + $buf = "000" ; + } + if (!fwrite($ctdlsock, $buf . "\n")) { + fclose($ctdlsock); + socket_close($sock); + system("/bin/rm -f " . $sockname); + exit(11); + } + } while ($buf != "000"); + } } while($buf !== false); diff --git a/ctdlphp/who.php b/ctdlphp/who.php index 92d7ccb8d..8f0bf9f3d 100644 --- a/ctdlphp/who.php +++ b/ctdlphp/who.php @@ -3,15 +3,15 @@ include "ctdlheader.php"; bbs_page_header(); - echo "This is an example of the use of ctdl_rwho() to display the " ; - echo "list of users currently logged in.

\n" ; - - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo "This is an example of the use of ctdl_rwho() to display " . + "the list of users currently logged in.

\n" ; + + echo "
UserRoomHost
" . + "" . + "" . + "" . + "" . + "" ; list($num_users, $wholist) = ctdl_rwho();
UserRoomHost