# Path: txircd/modbase.py
# class Command(object):
#     def hook(self, base):
#         self.ircd = base
#         return self
#     def onUse(self, user, data):
#         pass
#     def processParams(self, user, params):
#         return {
#             "user": user,
#             "params": params
#         }
#     def updateActivity(self, user):
#         user.lastactivity = now()


from twisted.words.protocols import irc
from txircd.modbase import Command
        target = data["targetuser"]
        reason = "Killed by {}: {}".format(user.nickname, data["reason"])
        target.sendMessage("KILL", ":{} {}".format(user.nickname, data["reason"]), prefix=user.prefix())
        target.disconnect(reason)
    
    def processParams(self, user, params):
        if user.registered > 0:
            user.sendMessage(irc.ERR_NOTREGISTERED, "KILL", ":You have not registered")
            return {}
        if "o" not in user.mode:
            user.sendMessage(irc.ERR_NOPRIVILEGES, ":Permission denied - You do not have the correct operator privileges")
            return {}
        if not params or len(params) < 2:
            user.sendMessage(irc.ERR_NEEDMOREPARAMS, "KILL", ":Not enough parameters")
            return {}
        if params[0] not in self.ircd.users:
            user.sendMessage(irc.ERR_NOSUCHNICK, params[0], ":No such nick/channel")
            return {}
        target = self.ircd.users[params[0]]
        if "o" in target.mode:
            user.sendMessage(irc.ERR_NOPRIVILEGES, ":Permission denied - You cannot KILL another oper")
            return {}
        return {
            "user": user,
            "targetuser": target,
            "reason": " ".join(params[1:])
        }

class Spawner(object):
    def __init__(self, ircd):

# Path: txircd/modbase.py
# class Command(object):
#     def hook(self, base):
#         self.ircd = base
#         return self
#     def onUse(self, user, data):
#         pass
#     def processParams(self, user, params):
#         return {
#             "user": user,
#             "params": params
#         }
#     def updateActivity(self, user):
#         user.lastactivity = now()


# Path: txircd/modules/cmd_kill.py
from twisted.words.protocols import irc
from txircd.modbase import Command

        target = data["targetuser"]
        reason = "Killed by {}: {}".format(user.nickname, data["reason"])
        target.sendMessage("KILL", ":{} {}".format(user.nickname, data["reason"]), prefix=user.prefix())
        target.disconnect(reason)
    
    def processParams(self, user, params):
        if user.registered > 0:
            user.sendMessage(irc.ERR_NOTREGISTERED, "KILL", ":You have not registered")
            return {}
        if "o" not in user.mode:
            user.sendMessage(irc.ERR_NOPRIVILEGES, ":Permission denied - You do not have the correct operator privileges")
            return {}
        if not params or len(params) < 2:
            user.sendMessage(irc.ERR_NEEDMOREPARAMS, "KILL", ":Not enough parameters")
            return {}
        if params[0] not in self.ircd.users:
            user.sendMessage(irc.ERR_NOSUCHNICK, params[0], ":No such nick/channel")
            return {}
        target = self.ircd.users[params[0]]
        if "o" in target.mode:
            user.sendMessage(irc.ERR_NOPRIVILEGES, ":Permission denied - You cannot KILL another oper")
            return {}
        return {
            "user": user,
            "targetuser": target,
            "reason": " ".join(params[1:])
        }

class Spawner(object):
    def __init__(self, ircd):

        self.ircd = ircd