# 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()
# 
# class Module(object):
#     def hook(self, base):
#         self.ircd = base
#         return self


from twisted.words.protocols import irc
from txircd.modbase import Command, Module

class PassCommand(Command, Module):
    def onUse(self, user, data):
        if "server_password" in self.ircd.servconfig and self.ircd.servconfig["server_password"] and not user.password:
            user.registered -= 1

# 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()
# 
# class Module(object):
#     def hook(self, base):
#         self.ircd = base
#         return self


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


class PassCommand(Command, Module):
    def onUse(self, user, data):
        if "server_password" in self.ircd.servconfig and self.ircd.servconfig["server_password"] and not user.password:
            user.registered -= 1

        user.password = data["password"]