def instantMessageReceived(self, switchboard,message,contact): receivedText = message.getContent() #set the switchboard, so that we can send messages self.switchboard = switchboard if Config.get('System', 'auto_idle_events') == "yes": setIdleTimer.stop() ext_handler = Config.get('System','event_handler') + " " contact_id = str(contact.getEmail()) + " " contact_name = str(contact.getFriendlyName()) + " " if Config.get('System','send_typing') == "yes": # Send typing notify typingMessage = MsnControlMessage() typingMessage.setTypingUser(switchboard.getMessenger().getOwner().getDisplayName()); self.sendMessage(typingMessage) time.sleep(2) cmdline = ext_handler + contact_id + "'" + receivedText + "'" output = os.popen(cmdline).read() #send the msg to the buddy msnMessage = MsnInstantMessage() msnMessage.setContent(output) self.sendMessage(msnMessage) if Config.get('System', 'auto_idle_events') == "yes": setIdleTimer.start()
def instantMessageReceived(self, switchboard, message, contact): receivedText = message.getContent() #set the switchboard, so that we can send messages self.switchboard = switchboard #defines how we should handle the commands received from the other end input_handler = InputHandler() output = input_handler.handleInput(receivedText) #send the msg to the buddy msnMessage = MsnInstantMessage() msnMessage.setContent(output) self.sendMessage(msnMessage)
def instantMessageReceived(self, switchboard,message,contact): receivedText = message.getContent() #set the switchboard, so that we can send messages self.switchboard = switchboard #defines how we should handle the commands received from the other end input_handler = InputHandler() output = input_handler.handleInput(receivedText) #send the msg to the buddy msnMessage = MsnInstantMessage() msnMessage.setContent(output) self.sendMessage(msnMessage)