+ checkGameUpdate: function(obj)
+ {
+ // Check all that is possible (required) in obj:
+ if (!!obj.move)
+ {
+ if (!obj.move.played.toString().match(/^[0-9]+$/))
+ return "Wrong move played time";
+ if (!obj.move.idx.toString().match(/^[0-9]+$/))
+ return "Wrong move index";
+ }
+ if (!!obj.fen && !obj.fen.match(/^[a-zA-Z0-9, /-]*$/))
+ return "Wrong FEN string";
+ if (!!obj.score && !obj.score.match(/^[012?*\/-]+$/))
+ return "Wrong characters in score";
+ if (!!obj.scoreMsg && !obj.scoreMsg.match(/^[a-zA-Z ]+$/))
+ return "Wrong characters in score message";
+ if (!!obj.chat)
+ return UserModel.checkNameEmail({name: obj.chat.name});
+ return "";
+ },
+