def processCommand(self, line, callbacks=[]): """ This function processes a command :-) """ if callbacks == []: callbacks = self.callbacks command=line.split()[0] args=line.split()[1:] #Hooks should only return something in special #cases (IE, login plugin returning error because #user has still not logged in) result, message = self.__runHooks("processCommand", command, args) #Only process the command if no hook has returned error if not result: if self.commands.has_key(command): #return self.commands[command](args) newJob = self.commands[command]() newJob.command = command newJob.args = args newJob.sessionManager = self newJob.jobID = self.createJobID() for callback in callbacks: newJob.addCallback(callback) self.proto.sendLine("0 Command queued as: " + str(newJob.jobID)) self.jobManager.add_job(newJob) else: return (-1, "Command not found") else: print "hook returned something:", result, message return (result, message)