def handle(self, msgType, di): """ Send data from the net on the local netMessenger. """ assert self.notify.debugCall() if msgType not in self.__type2message: self.notify.warning('Received unknown message: %d' % msgType) return message = self.__type2message[msgType] sentArgs = loads(di.getString()) if type(sentArgs) != list: self.notify.warning('Received non-list item in %s message: %r' % (message, sentArgs)) return Messenger.send(self, message, sentArgs=sentArgs)
def send(self, message, sentArgs=[]): """ Send message to anything that's listening for it. """ assert self.notify.debugCall() datagram = self.prepare(message, sentArgs) self.air.send(datagram) Messenger.send(self, message, sentArgs=sentArgs)
def handle(self, msgType, di): if msgType not in self.__type2message: self.notify.warning('Received unknown message: %d' % msgType) return message = self.__type2message[msgType] sentArgs = loads(di.getString()) if type(sentArgs) != list: self.notify.warning('Received non-list item in %s message: %r' % (message, sentArgs)) return Messenger.send(self, message, sentArgs=sentArgs)
def handle(self, pickleData): """ Send pickleData from the net on the local netMessenger. The internal data in pickleData should have a tuple of (messageString, sendArgsList). """ assert self.notify.debugCall() messageType=self.air.getMsgType() if messageType: message=MESSAGE_TYPES[messageType-1] sentArgs=loads(pickleData) else: (message, sentArgs) = loads(pickleData) Messenger.send(self, message, sentArgs=sentArgs)
def handle(self, pickleData): """ Send pickleData from the net on the local netMessenger. The internal data in pickleData should have a tuple of (messageString, sendArgsList). """ assert self.notify.debugCall() messageType = self.air.getMsgType() if messageType: message = MESSAGE_TYPES[messageType - 1] sentArgs = loads(pickleData) else: (message, sentArgs) = loads(pickleData) Messenger.send(self, message, sentArgs=sentArgs)
def handle(self, msgType, di): """ Send data from the net on the local netMessenger. """ assert self.notify.debugCall() if msgType not in self.__type2message: self.notify.warning('Received unknown message: %d' % msgType) return message = self.__type2message[msgType] sentArgs=loads(di.getString()) if type(sentArgs) != list: self.notify.warning('Received non-list item in %s message: %r' % (message, sentArgs)) return Messenger.send(self, message, sentArgs=sentArgs)
self.air.send(datagram) def handle(self, pickleData): """ Send pickleData from the net on the local netMessenger. The internal data in pickleData should have a tuple of (messageString, sendArgsList). """ assert self.notify.debugCall() messageType=self.air.getMsgType() if messageType: message=MESSAGE_TYPES[messageType-1] sentArgs=loads(pickleData) else: (message, sentArgs) = loads(pickleData) Messenger.send(self, message, sentArgs=sentArgs) def register(self, code, message): assert self.notify.debugCall() channel = self.baseChannel + code msgType = self.baseMsgType + code if message in self.__message2type: self.notify.error('Tried to register message %s twice!' % message) return self.__message2type[message] = msgType self.__type2message[msgType] = message self.__message2channel[message] = channel
def send(self, message, sentArgs=[]): datagram = self.prepare(message, sentArgs) self.air.send(datagram) Messenger.send(self, message, sentArgs=sentArgs)