]> git.mjollnir.org Git - moodle.git/commitdiff
Preliminary support for browser quirks, for now just targeting Safari
authordefacer <defacer>
Mon, 23 Aug 2004 15:25:18 +0000 (15:25 +0000)
committerdefacer <defacer>
Mon, 23 Aug 2004 15:25:18 +0000 (15:25 +0000)
mod/chat/chatd.php

index 8a315a2596c18188e592b54dd0350bea041b9f3f..3ac0cbb0fbaab3267a871b9d4be39b9d3fb6ee66 100755 (executable)
@@ -1,6 +1,8 @@
 #!/usr/bin/php -q
 <?php
 
+define('QUIRK_CHUNK_UPDATE', 0x0001);
+
 echo "Moodle chat daemon v1.0  (\$Id$)\n\n";
 
 /// Set up all the variables we need   /////////////////////////////////////
@@ -376,9 +378,12 @@ class ChatDaemon {
             'user'      => $user,
             'userid'    => $chatuser->userid,
             'groupid'   => $groupid,
-            'lang'      => $lang
+            'lang'      => $lang,
+            'quirks'    => $this->conn_sets[$sessionid]['customdata']['quirks']
         );
 
+        trace('QUIRKS value for this connection is '.$this->conn_sets[$sessionid]['customdata']['quirks']);
+
         $this->dismiss_half($sessionid, false);
         chat_socket_write($this->conn_sets[$sessionid][CHAT_CONNECTION_CHANNEL], $CHAT_HTMLHEAD_JS);
         trace('Connection accepted: '.$this->conn_sets[$sessionid][CHAT_CONNECTION_CHANNEL].', SID: '.$sessionid.' UID: '.$chatuser->userid.' GID: '.intval($groupid));
@@ -554,7 +559,11 @@ class ChatDaemon {
                 }
 
                 // Testing for Safari
-                $output->html .= $GLOBALS['CHAT_DUMMY_DATA'];
+                if($info['quirks'] & QUIRK_CHUNK_UPDATE) {
+                    $output->html .= $GLOBALS['CHAT_DUMMY_DATA'];
+                    $output->html .= $GLOBALS['CHAT_DUMMY_DATA'];
+                    $output->html .= $GLOBALS['CHAT_DUMMY_DATA'];
+                }
 
                 if(!chat_socket_write($this->conn_sets[$sessionid][CHAT_CONNECTION_CHANNEL], $output->html)) {
 
@@ -774,6 +783,13 @@ while(true) {
                 switch($type) {
                     case 'chat':
                        $type = CHAT_CONNECTION_CHANNEL;
+                        if(!ereg('Safari', $data)) {
+                            trace('Safari identified...', E_USER_WARNING);
+                            $customdata['quirks'] = QUIRK_CHUNK_UPDATE;
+                        }
+                        else {
+                            $customdata['quirks'] = 0;
+                        }
                     break;
                     case 'users':
                         $type = CHAT_SIDEKICK_USERS;