def handleMsg(self, connection, cmd, msg): if(cmd == 30 and connection.authLevel > 0): # send chat log(self, "relaying chat from from %s to skype: %s" % (connection, msg[2:]), 2) self.chat.SendMessage(msg[2:]) return # break here so that we don't get echo # messages that we don't handle get passed to the usual handler CC_Server.handleMsg(self, connection, cmd, msg)
def handleMsg(self, connection, cmd, msg): CC_Server.handleMsg(self, connection, cmd, msg) if(cmd == 40): # on new join we send everyone's images to the new conn self.connections.sendUserData(connection) elif(cmd == 201): # font update cmd self.connections.updateUserFont(connection, msg) elif(cmd == 202): # avatar update cmd self.connections.updateUserAvatar(connection, msg)
def handleMsg(self, connection, cmd, msg): CC_Server.handleMsg(self, connection, cmd, msg) if(cmd == 30): msg = msg[2:] if(connection.level() > 0): # save the results if it's a grid changing message if(msg.startswith("setGrid")): self.tileGrid = msg.split('|') self.updateGridFile() elif(msg.startswith("setTile")): args = msg.split('|') index = int(args[1]) + int(args[2]) * int(self.tileGrid[2]) + int(args[3]) * int(self.tileGrid[2]) * int(self.tileGrid[3]) self.tileGrid[index + 11] = args[4] self.updateGridFile() if(msg.startswith("playerMove")): # name, <pos>, light args = msg.split('|') player = self.connections.findByName(args[1]) # permissions: you can only edit your own pos unless you're admin or guested if(player and (player == connection or connection.level() > 0)): self.connections.updatePlayer(player, '|'.join(args[2:5]), args[5]) else: self.connections.sendPlayerPosList()