dedimania investigate (no fix for the setchallengetimes) problem foudn yet

This commit is contained in:
kremsy 2017-06-28 14:27:56 +02:00
parent 1da8b61805
commit c7a50ff8cd
3 changed files with 16 additions and 9 deletions

View File

@ -89,9 +89,10 @@ class AsyncHttpRequest implements UsageInformationAble {
array_push($this->headers, 'Keep-Alive: timeout=600, max=2000'); array_push($this->headers, 'Keep-Alive: timeout=600, max=2000');
array_push($this->headers, 'Connection: Keep-Alive'); array_push($this->headers, 'Connection: Keep-Alive');
$content = str_replace(array("\r", "\n"), '', $this->content); //$content = str_replace(array("\r", "\n"), '', $this->content);
$content = $this->content;
if ($this->compression) { if ($this->compression) {
$content = zlib_encode($content, 31); $content = zlib_encode($this->content, ZLIB_ENCODING_GZIP);
array_push($this->headers, 'Content-Encoding: gzip'); array_push($this->headers, 'Content-Encoding: gzip');
} }

View File

@ -36,7 +36,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
* Constants * Constants
*/ */
const ID = 8; const ID = 8;
const VERSION = 0.3; const VERSION = 0.4;
const AUTHOR = 'MCTeam'; const AUTHOR = 'MCTeam';
const NAME = 'Dedimania Plugin'; const NAME = 'Dedimania Plugin';
const MLID_DEDIMANIA = 'Dedimania.ManialinkId'; const MLID_DEDIMANIA = 'Dedimania.ManialinkId';

View File

@ -262,18 +262,23 @@ class DedimaniaWebHandler implements TimerListener {
$this->addRequest(self::DEDIMANIA_WARNINGSANDTTR2, array()); $this->addRequest(self::DEDIMANIA_WARNINGSANDTTR2, array());
$content = xmlrpc_encode_request(self::XMLRPC_MULTICALL, array($this->requests), array('encoding' => 'UTF-8', 'escaping' => 'markup')); $content = xmlrpc_encode_request(self::XMLRPC_MULTICALL, array($this->requests), array('encoding' => 'UTF-8', 'escaping' => 'markup', 'verbosity' => 'no_white_space'));
$asyncHttpRequest = new AsyncHttpRequest($this->maniaControl, self::DEDIMANIA_URL); $asyncHttpRequest = new AsyncHttpRequest($this->maniaControl, self::DEDIMANIA_URL);
$asyncHttpRequest->setCallable(function ($data, $error) { $asyncHttpRequest->setCallable(function ($answerData, $error) {
if ($error) { if ($error) {
Logger::logError("Dedimania Error while update playerlist: " . $error); Logger::logError("Dedimania Error while Request: " . $error);
$this->checkDedimaniaSession(); $this->checkDedimaniaSession();
return; return;
} }
$data = $this->decode($data); $data = $this->decode($answerData);
if(!$data){
//TODO just Temporary
var_dump("Dedimania Debug:");
var_dump($answerData);
}
if (!is_array($data) || empty($data) || !isset($data[0]) || !isset($data[0][0]) || $data[0][0] == false) { if (!is_array($data) || empty($data) || !isset($data[0]) || !isset($data[0][0]) || $data[0][0] == false) {
return; return;
} }
@ -357,7 +362,8 @@ class DedimaniaWebHandler implements TimerListener {
}); });
$asyncHttpRequest->setContent($content); $asyncHttpRequest->setContent($content);
$asyncHttpRequest->setCompression(true); //$asyncHttpRequest->setCompression(true);
//FIXME setChallengeTime Compressed gives Dedimania Error 400
$asyncHttpRequest->setTimeout(500); $asyncHttpRequest->setTimeout(500);
$asyncHttpRequest->postData(); $asyncHttpRequest->postData();