예제 #1
0
    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)
예제 #2
0
파일: user.py 프로젝트: Heufneutje/txircd
	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)
예제 #3
0
파일: user.py 프로젝트: Heufneutje/txircd
	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")
예제 #4
0
 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")
예제 #5
0
파일: batch.py 프로젝트: guyguy2001/txircd
 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
예제 #6
0
 def sendLine(self, line):
     self.ircd.runActionStandard("usersenddata", self, line, users=[self])
     IRCBase.sendLine(self, line)
예제 #7
0
파일: batch.py 프로젝트: guyguy2001/txircd
 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))
예제 #8
0
파일: user.py 프로젝트: Heufneutje/txircd
	def sendLine(self, line):
		self.ircd.runActionStandard("usersenddata", self, line, users=[self])
		IRCBase.sendLine(self, line)