# 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/utils.py
# def chunk_message(msg, chunk_size):
#     chunks = []
#     msg += "\n"
#     while msg:
#         index = msg.find("\n",0,chunk_size+1)
#         if index < 0:
#             index = msg.rfind(" ",0,chunk_size+1)
#         if index < 0:
#             index = chunk_size
#         chunks.append(msg[:index])
#         msg = msg[index+1:] if msg[index] in " \n" else msg[index:]
#     return chunks


from twisted.words.protocols import irc
from txircd.modbase import Command
from txircd.utils import chunk_message

class MOTDCommand(Command):
    def onUse(self, user, data):
        user.send_motd()
    
    def processParams(self, user, params):
        if user.registered > 0:
            user.sendMessage(irc.ERR_NOTREGISTERED, "MOTD", ":You have not registered")
            return {}
        return {
            "user": user
        }

class Spawner(object):
    def __init__(self, ircd):
        self.ircd = 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/utils.py
# def chunk_message(msg, chunk_size):
#     chunks = []
#     msg += "\n"
#     while msg:
#         index = msg.find("\n",0,chunk_size+1)
#         if index < 0:
#             index = msg.rfind(" ",0,chunk_size+1)
#         if index < 0:
#             index = chunk_size
#         chunks.append(msg[:index])
#         msg = msg[index+1:] if msg[index] in " \n" else msg[index:]
#     return chunks


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


class MOTDCommand(Command):
    def onUse(self, user, data):
        user.send_motd()
    
    def processParams(self, user, params):
        if user.registered > 0:
            user.sendMessage(irc.ERR_NOTREGISTERED, "MOTD", ":You have not registered")
            return {}
        return {
            "user": user
        }

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

    def spawn(self):