Fixed bugs in room changing

This commit is contained in:
Uriziel 2012-10-15 17:13:05 +02:00
parent 24c517bf2e
commit fcde772529

View File

@ -1,13 +1,10 @@
from __future__ import print_function from __future__ import print_function
import threading import threading
import re
import time import time
import syncplay import syncplay
import os import os
class ConsoleUI(threading.Thread): class ConsoleUI(threading.Thread):
RE_ROOM = re.compile("^room( (.+))?")
def __init__(self): def __init__(self):
self.promptMode = threading.Event() self.promptMode = threading.Event()
self.PromptResult = "" self.PromptResult = ""
@ -51,10 +48,9 @@ class ConsoleUI(threading.Thread):
print("ERROR:\t" + message) print("ERROR:\t" + message)
def _executeCommand(self, data): def _executeCommand(self, data):
matched_room = self.RE_ROOM.match(data) if data[0:4] == "room":
if matched_room: room = data[5:]
room = matched_room.group(2) if room == "":
if room == None:
if self._syncplayClient.userlist.currentUser.file: if self._syncplayClient.userlist.currentUser.file:
room = self._syncplayClient.userlist.currentUser.file["name"] room = self._syncplayClient.userlist.currentUser.file["name"]
else: else: