# Path: txircd/modbase.py
# class Module(object):
#     def hook(self, base):
#         self.ircd = base
#         return self


from txircd.modbase import Module

class UserhostInNames(Module):
    def namesListEntry(self, user, channel, listingUser, representation):
        if "cap" in user.cache and "userhost-in-names" in user.cache["cap"]:
            return "{}!{}@{}".format(representation, listingUser.username, listingUser.hostname)
        return representation
    
    def capRequest(self, user, capability):
        return True
    
    def capAcknowledge(self, user, capability):
        return False
    
    def capRequestRemove(self, user, capability):
        return True
    
    def capAcknowledgeRemove(self, user, capability):
        return False
    
    def capClear(self, user, capability):
        return True

class Spawner(object):
    def __init__(self, ircd):
        self.ircd = ircd
        self.userhost_in_names = None
    
    def spawn(self):
        self.userhost_in_names = UserhostInNames().hook(self.ircd)

# Path: txircd/modbase.py
# class Module(object):
#     def hook(self, base):
#         self.ircd = base
#         return self


# Path: txircd/modules/userhost-in-names.py
from txircd.modbase import Module


class UserhostInNames(Module):
    def namesListEntry(self, user, channel, listingUser, representation):
        if "cap" in user.cache and "userhost-in-names" in user.cache["cap"]:
            return "{}!{}@{}".format(representation, listingUser.username, listingUser.hostname)
        return representation
    
    def capRequest(self, user, capability):
        return True
    
    def capAcknowledge(self, user, capability):
        return False
    
    def capRequestRemove(self, user, capability):
        return True
    
    def capAcknowledgeRemove(self, user, capability):
        return False
    
    def capClear(self, user, capability):
        return True

class Spawner(object):
    def __init__(self, ircd):
        self.ircd = ircd
        self.userhost_in_names = None
    
    def spawn(self):
        self.userhost_in_names = UserhostInNames().hook(self.ircd)

        if "cap" not in self.ircd.module_data_cache: