Browse Source

Merge remote-tracking branch 'etenil/master'

pull/5/head
Jaussoin Timothée 15 years ago
parent
commit
9c265c43bb
  1. 2
      js/movimrpc.js
  2. 2
      lib/MovimRPC.php
  3. 16
      lib/widgets/Poller/poller.js

2
js/movimrpc.js

@ -221,7 +221,7 @@ function MovimRPC_commit()
movim_xmlhttp.onreadystatechange = function()
{
if(movim_xmlhttp.readyState == 4 && movim_xmlhttp.status == 200) {
log("Received data " + movim_xmlhttp.responseText);
// log("Received data " + movim_xmlhttp.responseText);
MovimRPC_handle_rpc(movim_xmlhttp.responseXML);
}
};

2
lib/MovimRPC.php

@ -123,8 +123,6 @@ class MovimRPC
}
}
var_dump($params);
$widgets = WidgetWrapper::getInstance(false);
$widgets->run_widget($widget_name, (string)$request['name'], $params);
}

16
lib/widgets/Poller/poller.js

@ -1,3 +1,7 @@
var last_poll;
var poll_flood_detect = 3;
var failed_poll_count = 0;
/**
* Attach a callback function to an event.
*/
@ -14,6 +18,8 @@ function movimRegisterPollHandler(type, func)
*/
function movim_poll()
{
last_poll = new Date().getTime();
poller = MovimRPC_make_xmlhttp();
poller.open('GET', 'jajax.php?do=poll', true);
@ -27,6 +33,16 @@ function movim_poll()
}
if(poller.status > 0) {
var time = new Date().getTime();
if(time - last_poll < 1000) {
failed_poll_count++;
if(failed_poll_count > poll_flood_detect) {
window.location = "index.php?q=disconnect";
return;
}
} else {
failed_poll_count = 0;
}
// Restarting polling.
movim_poll();
}

Loading…
Cancel
Save