define to disable chat ban added
[brisk.git] / web / Obj / sac-a-push.phh
index 1151ea1..c9220a1 100644 (file)
@@ -105,9 +105,13 @@ function gpcs_var($name, $get, $post, $cookie)
 
 function headers_render($header, $len)
 {
-    
     $s = "";
-    $s .= "HTTP/1.1 200 OK\r\n";
+    if (isset($header['Location'])) {
+        return sprintf("HTTP/1.1 302 OK\r\nLocation: %s\r\n\r\n", $header['Location']);
+    }
+    else {
+        $s .= "HTTP/1.1 200 OK\r\n";
+    }
     if (!isset($header['Date']))
         $s .= sprintf("Date: %s\r\n", date(DATE_RFC822));
     if (!isset($header['Connection']))
@@ -399,6 +403,12 @@ class Sac_a_push {
                 }
             }
             
+            /*
+               $response:                        raw stream data not sent
+               $content:                         html consistent data (<script bla bla>)
+               $user->stream_keepalive($w_ping)  ping srv->cli OR srv->cli + cli->srv if $w_ping == TRUE
+            */
+
             /* manage open streaming */
             foreach ($this->socks as $k => $sock) {
                 if (isset($this->s2u[intval($sock)])) {
@@ -411,13 +421,14 @@ class Sac_a_push {
                         $content = "";
                         $user->stream_main($content, $get, $post, $cookie);
                         printf("[%s] [%d] [%d]\n", $user->name, $user->lacc, $this->curtime);
-                        if ($content == "" && $user->ping_req == FALSE 
+                        if (/* $content == "" && */ $user->ping_req == FALSE 
                             && (($this->curtime - $user->lacc) > (EXPIRE_TIME_RD / 2))) {
-                            $content = $user->stream_ping();
+                            // $content = $user->stream_keepalive(TRUE);
+                            $content += $user->stream_keepalive(TRUE);
                             $user->ping_req = TRUE;
                         }
                         if ($content == "" && $user->rd_kalive_is_expired($this->curtime)) {
-                            $content = $user->stream_keepalive();
+                            $content = $user->stream_keepalive(FALSE);
                         }
                         if ($content != "") {
                             $response = chunked_content($content);