<commit_before>from twisted.words.protocols import irc
from txircd.modbase import Command
import string

class UserCommand(Command):
    def onUse(self, user, data):
        if not user.username:
            user.registered -= 1
        user.setUsername(data["ident"])
        user.realname = data["gecos"]
        if user.registered == 0:
            user.register()
    
    def processParams(self, user, params):
        if user.registered == 0:
            user.sendMessage(irc.ERR_ALREADYREGISTRED, ":You may not reregister")
            return {}
        if params and len(params) < 4:
            user.sendMessage(irc.ERR_NEEDMOREPARAMS, "USER", ":Not enough parameters")
            return {}
        ident = filter(lambda x: x in string.ascii_letters + string.digits + "-_", params[0][:12])
        if not ident:
            user.sendMessage(irc.ERR_NEEDMOREPARAMS, "USER", ":Your username is not valid")
            return {}<commit_msg>Send the gecos input from USER through the sanitization as well<commit_after>from twisted.words.protocols import irc
from txircd.modbase import Command
import string

class UserCommand(Command):
    def onUse(self, user, data):
        if not user.username:
            user.registered -= 1
        user.setUsername(data["ident"])
        user.setRealname(data["gecos"])
        if user.registered == 0:
            user.register()
    
    def processParams(self, user, params):
        if user.registered == 0:
            user.sendMessage(irc.ERR_ALREADYREGISTRED, ":You may not reregister")
            return {}
        if params and len(params) < 4:
            user.sendMessage(irc.ERR_NEEDMOREPARAMS, "USER", ":Not enough parameters")
            return {}
        ident = filter(lambda x: x in string.ascii_letters + string.digits + "-_", params[0][:12])
        if not ident:
            user.sendMessage(irc.ERR_NEEDMOREPARAMS, "USER", ":Your username is not valid")
            return {}
{'fraction_non_alphanumeric': 0.10945529290853032, 'fraction_numerical': 0.007194244604316547, 'mean_word_length': 2.4705882352941178, 'pattern_counts': {'":': 6, '<': 5, '<?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': '211654', 'n_tokens_mistral': 581, 'n_tokens_neox': 547, 'n_words': 151}