+ checkChallenge: function(c)
+ {
+ if (!c.vid.match(/^[0-9]+$/))
+ return "Wrong variant ID";
+
+ if (!c.timeControl.match(/^[0-9dhms +]+$/))
+ return "Wrong characters in time control";
+
+ if (!c.fen.match(/^[a-zA-Z0-9, /-]+$/))
+ return "Bad FEN string";
+ },
+
+ initializeWillPlay: function(uids, cid, cb)
+ {
+ let query = "INSERT INTO WillPlay VALUES ";
+ for (let i=0; i<uids.length; i++)
+ {
+ query += "(false," + cid + "," + uids[i] + ")";
+ if (i < uids.length-1)
+ query += ",";
+ }
+ db.run(query, cb);
+ },
+
+ // fen cannot be undefined