diff --git a/index.php b/index.php index 9e272b7..c3d80b0 100644 --- a/index.php +++ b/index.php @@ -377,19 +377,17 @@ if ($loggedin && isset($_POST['postwaituntil']) && preg_match('#^\d+$#',$_POST[' if ($res['ok']) { $lspostid=$res['data']['id']; $debug.="lspostid: {$lspostid}
\n"; - $rls=ckratelimit($res['headers'],'necho',true,false); - //if ($i==2) $rls=['remaining'=>0,'secstoreset'=>3895];// test err - //$rls=['remaining'=>0,'secstoreset'=>5];// test err - if (!is_null($rls)) { - if ($rls['remaining']<=REQSTOPRESV && $i<$postscount-1) { - $postingok=false; - $postwait=$rls['secstoreset']; - $postwaituntil=time()+$postwait; - $postsoffset=$i+1; - $postmsgs.='
Sending split post '.($i+1)."/{$postscount}, {$sname} reached your {$host}’s account posting rate limit, so it stopped sending; you’ll find the rest of your split posts (those which have not been sent, ".($i+2)."-{$postscount}) below; before posting them, you’ll have to wait ".ght($postwait)." for rate limit reset.
\n"; - $pbtext='Please wait '.ght($postwait).' before posting'; - break; - } + $rls=ckratelimit($res['headers']); + //if ($i==2) $rls=['remaining'=>0,'sleep'=>3895];// test err + //$rls=['remaining'=>0,'sleep'=>5];// test err + if ($rls['ok'] && $rls['remaining']<=REQSTOPRESV && $i<$postscount-1) { + $postingok=false; + $postwait=$rls['secstoreset']; + $postwaituntil=time()+$postwait; + $postsoffset=$i+1; + $postmsgs.='
Sending split post '.($i+1)."/{$postscount}, {$sname} reached your {$host}’s account posting rate limit, so it stopped sending; you’ll find the rest of your split posts (those which have not been sent, ".($i+2)."-{$postscount}) below; before posting them, you’ll have to wait ".ght($postwait)." for rate limit reset.
\n"; + $pbtext='Please wait '.ght($postwait).' before posting'; + break; } if ($i<$postscount-1) usleep(POSTPAUSE*1000); @@ -820,14 +818,11 @@ echo "
".SNAME." ".SVERS."
\n"; + function preprint($var) { return '
'.print_r($var,true)."
\n"; } -function necho($var) { - // do nothing :-) -} - function dieyoung($msg) { echo $msg; exit(1); diff --git a/post.php b/post.php index 546bf09..5068e59 100644 --- a/post.php +++ b/post.php @@ -33,11 +33,11 @@ if (isset($_COOKIE['verbose_host']) && isset($_COOKIE['verbose_token']) && isset if ($res['ok']) { $resp['ok']=true; $resp['id']=$res['data']['id']; - $rls=ckratelimit($res['headers'],'necho',true,false); - //$rls=['remaining'=>20,'secstoreset'=>5];// test - if (!is_null($rls)) { + $rls=ckratelimit($res['headers']); + //$rls=['remaining'=>20,'sleep'=>5];// test + if ($rls['ok']) { $resp['remaining']=$rls['remaining']; - $resp['secstoreset']=$rls['secstoreset']; + $resp['secstoreset']=$rls['sleep']; } } else { $resp['error']=htmlentities($res['error']); @@ -53,8 +53,4 @@ echo $resp; //echo '
'.print_r($_POST,true).'
'; -function necho($msg) { - // do nothing :-) -} - ?>