# Path: txircd/modbase.py
# class Mode(object):
#     def hook(self, base):
#         self.ircd = base
#         return self
#     def checkSet(self, user, target, param):
#         return [True, param]
#     def checkUnset(self, user, target, param):
#         return [True, param]
#     def showParam(self, user, target, param):
#         return param
#     def checkPermission(self, user, cmd, data):
#         return data


from twisted.words.protocols import irc
from txircd.modbase import Mode
            return data
        
        targetChannels = data["targetchan"]
        chanModList = data["chanmod"]
        removeTargets = []
        
        for channel in targetChannels:
            if "n" in channel.mode and user not in channel.users:
                removeTargets.append(channel)
                user.sendMessage(irc.ERR_CANNOTSENDTOCHAN, channel.name, ":Cannot send to channel (no external messages)")
        
        for channel in removeTargets:
            index = targetChannels.index(channel)
            targetChannels.pop(index)
            chanModList.pop(index)
        
        data["targetchan"] = targetChannels
        data["chanmod"] = chanModList
        return data

class Spawner(object):
    def __init__(self, ircd):
        self.ircd = ircd
    
    def spawn(self):
        return {
            "modes": {
                "cnn": NoExternalMessagesMode()
            },
            "common": True

# Path: txircd/modbase.py
# class Mode(object):
#     def hook(self, base):
#         self.ircd = base
#         return self
#     def checkSet(self, user, target, param):
#         return [True, param]
#     def checkUnset(self, user, target, param):
#         return [True, param]
#     def showParam(self, user, target, param):
#         return param
#     def checkPermission(self, user, cmd, data):
#         return data


# Path: txircd/modules/cmode_n.py
from twisted.words.protocols import irc
from txircd.modbase import Mode

            return data
        
        targetChannels = data["targetchan"]
        chanModList = data["chanmod"]
        removeTargets = []
        
        for channel in targetChannels:
            if "n" in channel.mode and user not in channel.users:
                removeTargets.append(channel)
                user.sendMessage(irc.ERR_CANNOTSENDTOCHAN, channel.name, ":Cannot send to channel (no external messages)")
        
        for channel in removeTargets:
            index = targetChannels.index(channel)
            targetChannels.pop(index)
            chanModList.pop(index)
        
        data["targetchan"] = targetChannels
        data["chanmod"] = chanModList
        return data

class Spawner(object):
    def __init__(self, ircd):
        self.ircd = ircd
    
    def spawn(self):
        return {
            "modes": {
                "cnn": NoExternalMessagesMode()
            },
            "common": True

        }