Implement Chat: send messages between clients in a room
This commit is contained in:
parent
6444ef441f
commit
8a4c356747
@ -82,6 +82,7 @@ en = {
|
||||
"commandlist-notification/toggle" : u"\tt - toggles whether you are ready to watch or not",
|
||||
"commandlist-notification/create" : "\tc [name] - create managed room using name of current room",
|
||||
"commandlist-notification/auth" : "\ta [password] - authenticate as room operator with operator password",
|
||||
"commandlist-notification/chat" : "\tch [message] - send a chat message in a room",
|
||||
"syncplay-version-notification" : "Syncplay version: {}", # syncplay.version
|
||||
"more-info-notification" : "More info available at: {}", # projectURL
|
||||
|
||||
|
||||
@ -241,6 +241,9 @@ class SyncClientProtocol(JSONCommandProtocol):
|
||||
"password": password
|
||||
}
|
||||
})
|
||||
def handleChat(self,message):
|
||||
self._client.ui.showMessage(message)
|
||||
#TODO
|
||||
|
||||
def setReady(self, isReady, manuallyInitiated=True):
|
||||
self.sendSet({
|
||||
@ -330,7 +333,9 @@ class SyncServerProtocol(JSONCommandProtocol):
|
||||
self._logged = True
|
||||
self.sendHello(version)
|
||||
def handleChat(self,chatMessage):
|
||||
#TODO
|
||||
if self._factory.chat:
|
||||
self._factory.sendChat(self._watcher,chatMessage)
|
||||
|
||||
def setWatcher(self, watcher):
|
||||
self._watcher = watcher
|
||||
|
||||
|
||||
@ -129,6 +129,9 @@ class SyncFactory(Factory):
|
||||
except ValueError:
|
||||
self._roomManager.broadcastRoom(watcher, lambda w: w.sendControlledRoomAuthStatus(False, watcher.getName(), room._name))
|
||||
|
||||
def sendChat(self,watcher,message):
|
||||
self._roomManager.broadcastRoom(watcher, lambda w: w.sendChatMessage(message))
|
||||
|
||||
def setReady(self, watcher, isReady, manuallyInitiated=True):
|
||||
watcher.setReady(isReady)
|
||||
self._roomManager.broadcastRoom(watcher, lambda w: w.sendSetReady(watcher.getName(), watcher.isReady(), manuallyInitiated))
|
||||
@ -368,6 +371,9 @@ class Watcher(object):
|
||||
def sendControlledRoomAuthStatus(self, success, username, room):
|
||||
self._connector.sendControlledRoomAuthStatus(success, username, room)
|
||||
|
||||
def sendChatMessage(self,message):
|
||||
self._connector.sendMessage({"Chat" : message})
|
||||
|
||||
def sendSetReady(self, username, isReady, manuallyInitiated=True):
|
||||
self._connector.sendSetReady(username, isReady, manuallyInitiated)
|
||||
|
||||
|
||||
@ -175,6 +175,7 @@ class ConsoleUI(threading.Thread):
|
||||
self.showMessage(getMessage("commandlist-notification/toggle"), True)
|
||||
self.showMessage(getMessage("commandlist-notification/create"), True)
|
||||
self.showMessage(getMessage("commandlist-notification/auth"), True)
|
||||
self.showMessage(getMessage("commandlist-notification/chat"), True)
|
||||
self.showMessage(getMessage("syncplay-version-notification").format(syncplay.version), True)
|
||||
self.showMessage(getMessage("more-info-notification").format(syncplay.projectURL), True)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user