/** * Copyright 2009 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS-IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import("comet"); import("ejs"); import("etherpad.collab.ace.easysync2.{AttribPool,Changeset}"); import("etherpad.log"); import("etherpad.pad.activepads"); import("etherpad.pad.model"); import("etherpad.pad.padutils"); import("etherpad.pad.padevents"); import("etherpad.pro.pro_padmeta"); import("fastJSON"); import("fileutils.readFile"); import("jsutils.eachProperty"); jimport("java.util.Random"); jimport("java.lang.System"); import("etherpad.collab.collab_server"); // importClass(java.util.Random); // importClass(java.lang.System); var _serverDebug = function() {}; var _dmesg = function() { System.out.println(arguments[0]+""); }; /// Begin readonly/padId conversion code /// TODO: refactor into new file? var _baseRandomNumber = 0x123123; // keep this number seekrit function _map(array, func) { for(var i=0; i 1) { for(var i=0; i= start && charcode <= end; } /* a short little testing function, converts back and forth */ // function _testEncrypt(str) { // var encrypted = padIdToReadonly(str); // var decrypted = readonlyToPadId(encrypted); // _dmesg(str + " " + encrypted + " " + decrypted); // if(decrypted != str) { // _dmesg("ERROR: " + str + " and " + decrypted + " do not match"); // } // } // _testEncrypt("testing$");