<commit_before>from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements

class AccountTag(ModuleData):
	implements(IPlugin, IModuleData)
	
	name = "AccountTag"
	
	def actions(self):
		return [ ("modifyoutgoingmessage", 1, self.addAccountTag),
		         ("capabilitylist", 10, self.addCapability) ]
	
	def load(self):
		if "unloading-account-tag" in self.ircd.dataCache:
			del self.ircd.dataCache["unloading-account-tag"]
			return
		if "cap-add" in self.ircd.functionCache:
			self.ircd.functionCache["cap-add"]("account-tag")
	
	def unload(self):
		self.ircd.dataCache["unloading-account-tag"]
	
	def fullUnload(self):
		del self.ircd.dataCache["unloading-account-tag"]
		if "cap-del" in self.ircd.functionCache:
			self.ircd.functionCache["cap-del"]("account-tag")
	
	def addCapability(self, user, capList):
		capList.append("account-tag")
	
	def addAccountTag(self, user, command, args, kw):
		if "prefix" not in kw:
			return
		if "capabilities" not in user.cache or "account-tag" not in user.cache["capabilities"]:
			return
		prefix = kw["prefix"]
		if "!" not in prefix or "@" not in prefix:
			return
		nick = prefix.split("!", 1)[0]
		if nick not in self.ircd.userNicks:
			return<commit_msg>Implement the account-tag extension<commit_after>from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements

class AccountTag(ModuleData):
	implements(IPlugin, IModuleData)
	
	name = "AccountTag"
	
	def actions(self):
		return [ ("modifyoutgoingmessage", 1, self.addAccountTag),
		         ("capabilitylist", 10, self.addCapability) ]
	
	def load(self):
		if "unloading-account-tag" in self.ircd.dataCache:
			del self.ircd.dataCache["unloading-account-tag"]
			return
		if "cap-add" in self.ircd.functionCache:
			self.ircd.functionCache["cap-add"]("account-tag")
	
	def unload(self):
		self.ircd.dataCache["unloading-account-tag"] = True
	
	def fullUnload(self):
		del self.ircd.dataCache["unloading-account-tag"]
		if "cap-del" in self.ircd.functionCache:
			self.ircd.functionCache["cap-del"]("account-tag")
	
	def addCapability(self, user, capList):
		capList.append("account-tag")
	
	def addAccountTag(self, user, command, args, kw):
		if "prefix" not in kw:
			return
		if "capabilities" not in user.cache or "account-tag" not in user.cache["capabilities"]:
			return
		prefix = kw["prefix"]
		if "!" not in prefix or "@" not in prefix:
			return
		nick = prefix.split("!", 1)[0]
		if nick not in self.ircd.userNicks:
			return
{'fraction_non_alphanumeric': 0.13219945883262466, 'fraction_numerical': 0.003865481252415926, 'mean_word_length': 4.4255765199161425, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3204457', 'n_tokens_mistral': 958, 'n_tokens_neox': 864, 'n_words': 207}