def on_message(message, status): msg = mappers.remap_message_object(message) transport = TTransport.TMemoryBuffer() protocol = TBinaryProtocol.TBinaryProtocol(transport) msg.write(protocol) serialized = transport.getvalue() server.sendall(struct.pack('!i', len(serialized))) server.sendall(serialized)
def send_message(self, auth, chat_name, message_body): self._check_auth(auth) chat = self.skype.Chat(chat_name) return mappers.remap_message_object(chat.SendMessage(message_body))