# 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

class QuitCommand(Command):
    def onUse(self, user, data):
        reason = "Quit: {}".format(data["reason"]) if "reason" in data and data["reason"] else "Client Quit"
        user.disconnect(reason)
    
    def processParams(self, user, params):
        reason = params[0] if params and params[0] else "Client exited"

# 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_quit.py
from twisted.words.protocols import irc
from txircd.modbase import Command


class QuitCommand(Command):
    def onUse(self, user, data):
        reason = "Quit: {}".format(data["reason"]) if "reason" in data and data["reason"] else "Client Quit"
        user.disconnect(reason)
    
    def processParams(self, user, params):
        reason = params[0] if params and params[0] else "Client exited"

        return {