self.send('NICK ' + quote(tokens[1]))
else:
self.log_msg('? need login name')
- #elif self.input_.startswith('/msg'):
- # tokens = self.input_.split(maxsplit=2)
- # if len(tokens) == 3:
- # self.send('QUERY %s %s' % (quote(tokens[1]),
- # quote(tokens[2])))
- # else:
- # self.log_msg('? need message target and message')
else:
self.log_msg('? unknown command')
else:
let parser = {
tokenize: function(str) {
- let token_ends = [];
let tokens = [];
let token = ''
let quoted = false;
quoted = true
} else if (c === ' ') {
if (token.length > 0) {
- token_ends.push(i);
tokens.push(token);
token = '';
}
if (token.length > 0) {
tokens.push(token);
}
- let token_starts = [];
- for (let i = 0; i < token_ends.length; i++) {
- token_starts.push(token_ends[i] - tokens[i].length);
- };
- return [tokens, token_starts];
+ return tokens;
},
parse_yx: function(position_string) {
let coordinate_strings = position_string.split(',')
this.websocket.send(unparser.untokenize(tokens));
},
handle_event: function(event) {
- let tokens = parser.tokenize(event.data)[0];
+ let tokens = parser.tokenize(event.data);
if (tokens[0] === 'TURN') {
game.turn_complete = false;
game.things = {};
content += '[' + this.keys.switch_to_play + '] – play mode\n';
} else if (this.mode == mode_chat) {
content += '/nick NAME – re-name yourself to NAME\n';
- //content += '/msg USER TEXT – send TEXT to USER\n';
content += '/' + this.keys.switch_to_play + ' or /play – switch to play mode\n';
content += '/' + this.keys.switch_to_study + ' or /study – switch to study mode\n';
}
} else {
tui.log_msg('? need new name');
}
- //} else if (tokens[0].slice(1) == 'msg') {
- // if (tokens.length > 2) {
- // let msg = tui.inputEl.value.slice(token_starts[2]);
- // server.send(['QUERY', tokens[1], msg]);
- // } else {
- // tui.log_msg('? need message target and message');
- // }
} else {
tui.log_msg('? unknown command');
}