Rearchitect for different types of response
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
// Placeholder Globals
|
||||
$userid = 0;
|
||||
$room_lang = "th";
|
||||
$is_admin = false;
|
||||
//$userid = 0;
|
||||
//$room_lang = "th";
|
||||
//$is_admin = false;
|
||||
define("BLUE_ROOM", 12345);
|
||||
define("RED_ROOM", 67890);
|
||||
define("INTER_ROOM", 111213);
|
||||
@@ -14,21 +14,16 @@ require_once 'MessageHandler.php';
|
||||
require_once 'Handlers.php';
|
||||
|
||||
$handlers = array(
|
||||
new TestHandler(),
|
||||
new TestHandler()
|
||||
);
|
||||
|
||||
function reply_user($room_id, $msgid, $message)
|
||||
function reply_user($room_id, $msgid, $message, $room_lang)
|
||||
{
|
||||
// Placeholder Globals
|
||||
global $userid;
|
||||
global $room_lang;
|
||||
global $is_admin;
|
||||
|
||||
global $handlers;
|
||||
foreach ($handlers as $handler) {
|
||||
if($handler->CanHandle($room_id, $msgid, $message)) {
|
||||
return $handler->Handle($room_id, $msgid, $message);
|
||||
if($handler->TryHandle($room_id, $msgid, $message, $room_lang)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ;
|
||||
}
|
||||
Reference in New Issue
Block a user