(self, userIp, username, room, clientVersion)
| 102 | return features |
| 103 | |
| 104 | def getMotd(self, userIp, username, room, clientVersion): |
| 105 | oldClient = False |
| 106 | if constants.WARN_OLD_CLIENTS: |
| 107 | if not meetsMinVersion(clientVersion, constants.RECENT_CLIENT_THRESHOLD): |
| 108 | oldClient = True |
| 109 | if self._motdFilePath and os.path.isfile(self._motdFilePath): |
| 110 | tmpl = codecs.open(self._motdFilePath, "r", "utf-8-sig").read() |
| 111 | args = dict(version=syncplay.version, userIp=userIp, username=username, room=room) |
| 112 | try: |
| 113 | motd = Template(tmpl).substitute(args) |
| 114 | if oldClient: |
| 115 | motdwarning = getMessage("new-syncplay-available-motd-message").format(clientVersion) |
| 116 | motd = "{}\n{}".format(motdwarning, motd) |
| 117 | return motd if len(motd) < constants.SERVER_MAX_TEMPLATE_LENGTH else getMessage("server-messed-up-motd-too-long").format(constants.SERVER_MAX_TEMPLATE_LENGTH, len(motd)) |
| 118 | except ValueError: |
| 119 | return getMessage("server-messed-up-motd-unescaped-placeholders") |
| 120 | elif oldClient: |
| 121 | return getMessage("new-syncplay-available-motd-message").format(clientVersion) |
| 122 | else: |
| 123 | return "" |
| 124 | |
| 125 | def addWatcher(self, watcherProtocol, username, roomName): |
| 126 | roomName = truncateText(roomName, constants.MAX_ROOM_NAME_LENGTH) |
no test coverage detected