# 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/server.py
# class ModuleMessage(Command):
#     arguments = [
#         ("destserver", String()),
#         ("type", String()),
#         ("args", ListOf(String()))
#     ]
#     errors = {
#         HandshakeNotYetComplete: "HANDSHAKE_NOT_COMPLETE"
#     }


from twisted.words.protocols import irc
from txircd.modbase import Command
from txircd.server import ModuleMessage
        if user.registered > 0:
            user.sendMessage(irc.ERR_NOTREGISTERED, "SQUIT", ":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:
            user.sendMessage(irc.ERR_NEEDMOREPARAMS, "SQUIT", ":Not enough parameters")
            return {}
        if params[0] not in self.ircd.servers:
            user.sendMessage(irc.ERR_NOSUCHSERVER, params[0], ":No such server")
            return {}
        server = self.ircd.servers[params[0]]
        return {
            "user": user,
            "server": server
        }
    
    def remoteQuit(self, command, args):
        if args[0] not in self.ircd.servers:
            return
        server = self.ircd.servers[args[0]]
        if server.nearHop == self.ircd.name:
            server.transport.loseConnection()

class Spawner(object):
    def __init__(self, ircd):
        self.ircd = ircd
        self.squit_cmd = None
    

# 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/server.py
# class ModuleMessage(Command):
#     arguments = [
#         ("destserver", String()),
#         ("type", String()),
#         ("args", ListOf(String()))
#     ]
#     errors = {
#         HandshakeNotYetComplete: "HANDSHAKE_NOT_COMPLETE"
#     }


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

        if user.registered > 0:
            user.sendMessage(irc.ERR_NOTREGISTERED, "SQUIT", ":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:
            user.sendMessage(irc.ERR_NEEDMOREPARAMS, "SQUIT", ":Not enough parameters")
            return {}
        if params[0] not in self.ircd.servers:
            user.sendMessage(irc.ERR_NOSUCHSERVER, params[0], ":No such server")
            return {}
        server = self.ircd.servers[params[0]]
        return {
            "user": user,
            "server": server
        }
    
    def remoteQuit(self, command, args):
        if args[0] not in self.ircd.servers:
            return
        server = self.ircd.servers[args[0]]
        if server.nearHop == self.ircd.name:
            server.transport.loseConnection()

class Spawner(object):
    def __init__(self, ircd):
        self.ircd = ircd
        self.squit_cmd = None
    

    def spawn(self):