# 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 irc_lower(str):
#     return str.lower().replace("[","{").replace("]","}").replace("/","|").replace("~","^")
# 
# def epoch(utc_datetime):
#     delta = utc_datetime - UNIX_EPOCH
#     return int(delta.total_seconds())


from twisted.words.protocols import irc
from txircd.modbase import Command
from txircd.utils import irc_lower, epoch
            if len(params) > 1 and params[1]:
                return {
                    "user": user,
                    "targetuser": self.ircd.users[params[0]],
                    "modes": params[1],
                    "params": params[2:]
                }
            return {
                "user": user,
                "targetuser": self.ircd.users[params[0]]
            }
        if params[0] in self.ircd.channels:
            cdata = self.ircd.channels[params[0]]
            if not user.hasAccess(cdata, self.ircd.servconfig["channel_minimum_level"]["MODE"]):
                if len(params) > 2:
                    user.sendMessage(irc.ERR_CHANOPRIVSNEEDED, cdata.name, ":You must have channel operator access to set channel modes")
                    return {}
                if len(params) > 1:
                    for mode in params[1]:
                        if mode == "+" or mode == "-":
                            continue
                        if mode in self.ircd.channel_mode_type and self.ircd.channel_mode_type[mode] != 0:
                            user.sendMessage(irc.ERR_CHANOPRIVSNEEDED, cdata.name, ":You must have channel operator access to set channel modes")
                            return {}
            if len(params) > 1 and params[1]:
                return {
                    "user": user,
                    "targetchan": cdata,
                    "modes": params[1],
                    "params": params[2:]

# 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 irc_lower(str):
#     return str.lower().replace("[","{").replace("]","}").replace("/","|").replace("~","^")
# 
# def epoch(utc_datetime):
#     delta = utc_datetime - UNIX_EPOCH
#     return int(delta.total_seconds())


# Path: txircd/modules/cmd_mode.py
from twisted.words.protocols import irc
from txircd.modbase import Command
from txircd.utils import irc_lower, epoch

            if len(params) > 1 and params[1]:
                return {
                    "user": user,
                    "targetuser": self.ircd.users[params[0]],
                    "modes": params[1],
                    "params": params[2:]
                }
            return {
                "user": user,
                "targetuser": self.ircd.users[params[0]]
            }
        if params[0] in self.ircd.channels:
            cdata = self.ircd.channels[params[0]]
            if not user.hasAccess(cdata, self.ircd.servconfig["channel_minimum_level"]["MODE"]):
                if len(params) > 2:
                    user.sendMessage(irc.ERR_CHANOPRIVSNEEDED, cdata.name, ":You must have channel operator access to set channel modes")
                    return {}
                if len(params) > 1:
                    for mode in params[1]:
                        if mode == "+" or mode == "-":
                            continue
                        if mode in self.ircd.channel_mode_type and self.ircd.channel_mode_type[mode] != 0:
                            user.sendMessage(irc.ERR_CHANOPRIVSNEEDED, cdata.name, ":You must have channel operator access to set channel modes")
                            return {}
            if len(params) > 1 and params[1]:
                return {
                    "user": user,
                    "targetchan": cdata,
                    "modes": params[1],
                    "params": params[2:]

                }