sketch - sync-ops action in otpoll.php

This commit is contained in:
Tobias Hintze 2013-08-06 11:37:37 +02:00
parent 15bcfb137f
commit eff5bc7bb3

View File

@ -50,14 +50,10 @@ function bogusSession($i){
return $bs; return $bs;
} }
$command = isset($_POST['command']) ? $_POST['command'] : '';
// sorry - but currently the whole body is the message...
$postbody = file_get_contents('php://input'); $postbody = file_get_contents('php://input');
if (preg_match('/(^[^:]*):/', $postbody, $matches)) { $postobject = json_decode($postbody, true);
$command = $matches[1];
} else { $command = $postobject['command'];
$command = '';
}
$response = array(); $response = array();
switch ($command){ switch ($command){
@ -69,6 +65,16 @@ switch ($command){
break; break;
case 'sync-ops': case 'sync-ops':
// completely bogus // completely bogus
if $postobject['args']['seq_head'] is the most recent op in the ops-table:
// append all ops in $postobject['args']['client_ops'] to the ops-table
else:
// reply with:
// {
// result: 'conflict',
// ops: a list of all ops since $postobject['args']['seq_head']
// headSeq: the most recent op-seq
// }
/* /*
* try { * try {
* OCA\Office\Op::add( * OCA\Office\Op::add(