def sendMessage(self, command, *args, **kw): """ Sends the given message to this user. Accepts the following keyword arguments: - prefix: The message prefix or None to suppress the default prefix If not given, defaults to the server name. - to: The destination of the message or None if the message has no destination. The implicit destination is this user if this argument isn't specified. - tags: Dict of message tags to send. - alwaysPrefixLastParam: For compatibility with some broken clients, you might want some messages to always have the last parameter prefixed with a colon. To do that, pass this as True. """ if "prefix" not in kw: kw["prefix"] = self.ircd.name if kw["prefix"] is None: del kw["prefix"] to = self.nick if self.nick else "*" if "to" in kw: to = kw["to"] del kw["to"] if to: args = [to] + list(args) self.ircd.runActionStandard("modifyoutgoingmessage", self, command, args, kw) IRCBase.sendMessage(self, command, *args, **kw)
def dataReceived(self, data): self.ircd.runActionStandard("userrecvdata", self, data, users=[self]) try: IRCBase.dataReceived(self, data) except Exception: self.ircd.log.failure("An error occurred while processing incoming data.") if self.uuid in self.ircd.users: self.disconnect("Error occurred")
def dataReceived(self, data): self.ircd.runActionStandard("userrecvdata", self, data, users=[self]) try: IRCBase.dataReceived(self, data) except Exception: self.ircd.log.failure( "An error occurred while processing incoming data.") if self.uuid in self.ircd.users: self.disconnect("Error occurred")
def startBatch(self, user, batchName, batchType, *batchParameters): if "capabilities" not in user.cache or "batch" not in user.cache[ "capabilities"]: return uniqueReferenceTagParts = [random.choice(string.ascii_letters)] for i in range(2, 10): uniqueReferenceTagParts.append( random.choice(string.ascii_letters + string.digits)) uniqueReferenceTag = "".join(uniqueReferenceTagParts) IRCBase.sendMessage(user, "BATCH", "+{}".format(uniqueReferenceTag), batchType, *batchParameters) user.cache["currentBatch"] = uniqueReferenceTag
def sendLine(self, line): self.ircd.runActionStandard("usersenddata", self, line, users=[self]) IRCBase.sendLine(self, line)
def endBatch(self, user, batchName, batchType, *batchParameters): if "currentBatch" not in user.cache: return uniqueReferenceTag = user.cache["currentBatch"] del user.cache["currentBatch"] IRCBase.sendMessage(user, "BATCH", "-{}".format(uniqueReferenceTag))