else if msg accept var newRev msg rev if newRev rev dmesg bad message

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
else if (msg.t == "accept") {
var newRev = msg.rev;
if (newRev != (rev + 1)) {
dmesg("bad message revision on ACCEPT_COMMIT: " + newRev + " not " + (rev + 1));
setChannelState("DISCONNECTED", "badmessage_acceptcommit");
return;
}
sendingDisabled = false;
rev = newRev;
editor.applyPreparedChangesetToBase();
setStateIdle();
callCatchingErrors("onInternalAction", function()
{
callbacks.onInternalAction("commitAcceptedByServer");
});
callCatchingErrors("onConnectionTrouble", function()
{
callbacks.onConnectionTrouble("OK");
});
handleUserChanges();
_pad.fireEvent('accept.changes', newRev, msg);
}