]> git.mjollnir.org Git - moodle.git/commitdiff
New stuff to support socket mode
authormoodler <moodler>
Fri, 30 Jul 2004 15:36:39 +0000 (15:36 +0000)
committermoodler <moodler>
Fri, 30 Jul 2004 15:36:39 +0000 (15:36 +0000)
mod/chat/insert.php
mod/chat/lib.php
mod/chat/view.php

index 60a6b41d972164a759b39ab07c09b7ff213f88cd..1192a76845890ea966ca60c7dc8da7e0564c5df6 100644 (file)
         echo "Not logged in!";
         die;
     }
-    
+
     if (!$chat = get_record("chat", "id", $chatuser->chatid)) {
         error("No chat found");
     }
-    
+
     require_login($chat->course);
 
     if ($groupid) {
@@ -24,7 +24,7 @@
             error("You can't chat here!");
         }
     }
-    
+
 /// Clean up the message
 
     $chat_message = clean_text($chat_message, FORMAT_MOODLE);  // Strip bad tags
 /// Add the message to the database
 
     if (!empty($chat_message)) {
-    
+
         $message->chatid = $chatuser->chatid;
         $message->userid = $chatuser->userid;
         $message->groupid = $groupid;
         $message->message = $chat_message;
         $message->timestamp = time();
-     
+
         if (!insert_record("chat_messages", $message)) {
             error("Could not insert a chat message!");
         }
 
-        $chatuser->lastmessageping = time();
+        $chatuser->lastmessageping = time() - 2;
         update_record("chat_users", $chatuser);
 
         if ($cm = get_coursemodule_from_instance("chat", $chat->id, $chat->course)) {
             add_to_log($chat->course, "chat", "talk", "view.php?id=$cm->id", $chat->id, $cm->id);
         }
     }
-    
+
 /// Go back to the other page
 
     if ($chat_version == "header" OR $chat_version == "box") {
         redirect("../gui_$chat_version/chatinput.php?chat_sid=$chat_sid&groupid=$groupid");
-    
+
+    } else if ($chat_version == 'sockets') {
+        //redirect('./gui_sockets/chatinput.php?chat_sid='.$chat_sid.'&groupid='.$groupid);
+
     } else if ($chat_version == "text") {
         redirect("../gui_$chat_version/index.php?chat_sid=$chat_sid&chat_lastid=$chat_lastid&groupid=$groupid");
-    
+
     } else {
         redirect("empty.php");
     }
index 066f476c5efa00d30aa99212d8bde173b6611085..067512476049bbc0679ffbb2c4c39df5957ee2e5 100644 (file)
@@ -11,7 +11,21 @@ if (!isset($CFG->chat_refresh_userlist)) {
 if (!isset($CFG->chat_old_ping)) {
     set_config("chat_old_ping", 30);
 } 
-
+if (!isset($CFG->chat_method)) {
+    set_config("chat_method", "header_js");
+} 
+if (!isset($CFG->chat_serverhost)) {
+    set_config("chat_serverhost", $_SERVER['HTTP_HOST']);
+} 
+if (!isset($CFG->chat_serverip)) {
+    set_config("chat_serverip", $_SERVER['SERVER_ADDR']);
+} 
+if (!isset($CFG->chat_serverport)) {
+    set_config("chat_serverport", 9111);
+} 
+if (!isset($CFG->chat_servermax)) {
+    set_config("chat_servermax", 100);
+} 
 
 define("CHAT_DRAWBOARD", false);  // Look into this later
 
index e137d915b888ad0ebf4b7823bee7d1a1a3cdd366..a53f6306bebd463d7db538926f01350ead794430 100644 (file)
@@ -84,7 +84,7 @@
 /// Print the main part of the page
 
    // Do the browser-detection etc later on.
-    $chatversion = "header_js";
+   // $chatversion = "header_js";
 
    // $browser = chat_browser_detect($HTTP_USER_AGENT);
 
 
     if (!isguest()) {
         print_simple_box_start("center");
-        link_to_popup_window ("/mod/chat/gui_$chatversion/index.php?id=$chat->id$groupparam", 
+        link_to_popup_window ("/mod/chat/gui_$CFG->chat_method/index.php?id=$chat->id$groupparam", 
                               "chat$course->id$chat->id$groupparam", "$strenterchat", 500, 700, $strchat);
         print_simple_box_end();
     }