X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=ctdlphp%2Fctdlprotocol.php;h=7341f2d1965804894d4fa2c71ee406d5749d10b2;hb=737366a9ee1d0a66622d51598f7d639c9edeb8b8;hp=8ed50b9f0095e0dfbfa076392c621ed336b82657;hpb=01ac687c952f00692404b51f1abfe413c120176d;p=citadel.git diff --git a/ctdlphp/ctdlprotocol.php b/ctdlphp/ctdlprotocol.php index 8ed50b9f0..7341f2d19 100644 --- a/ctdlphp/ctdlprotocol.php +++ b/ctdlphp/ctdlprotocol.php @@ -305,5 +305,29 @@ function ctdl_knrooms() { } +// +// 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); +} + ?>