Ejemplo n.º 1
0
 def processParams(self, user, params):
     if user.registered > 0:
         user.sendMessage(irc.ERR_NOTREGISTERED, "SANICK", ":You have not registered")
         return {}
     if "o" not in user.mode:
         user.sendMessage(irc.ERR_NOPRIVILEGES, ":Permission denied - You do not have the correct operator privileges")
         return {}
     if not params or len(params) < 2:
         user.sendMessage(irc.ERR_NEEDMOREPARAMS, "SANICK", ":Not enough parameters")
         return {}
     if params[0] not in self.ircd.users:
         user.sendMessage(irc.ERR_NOSUCHNICK, params[0], ":No such nick/channel")
         return {}
     target = self.ircd.users[params[0]]
     if "o" in target.mode:
         user.sendMessage(irc.ERR_NOPRIVILEGES, ":Permission denied - You cannot SANICK another oper")
         return {}
     if not VALID_NICKNAME.match(params[1]):
         user.sendMessage(irc.ERR_ERRONEUSNICKNAME, params[1], ":Erroneous nickname")
         return {}
     if params[0] == params[1]:
         return {}
     return {
         "user": user,
         "targetuser": target,
         "newnick": params[1]
     }
Ejemplo n.º 2
0
 def processParams(self, user, params):
     if user.registered > 0:
         user.sendMessage(irc.ERR_NOTREGISTERED, "SANICK",
                          ":You have not registered")
         return {}
     if "o" not in user.mode:
         user.sendMessage(
             irc.ERR_NOPRIVILEGES,
             ":Permission denied - You do not have the correct operator privileges"
         )
         return {}
     if not params or len(params) < 2:
         user.sendMessage(irc.ERR_NEEDMOREPARAMS, "SANICK",
                          ":Not enough parameters")
         return {}
     if params[0] not in self.ircd.users:
         user.sendMessage(irc.ERR_NOSUCHNICK, params[0],
                          ":No such nick/channel")
         return {}
     target = self.ircd.users[params[0]]
     if "o" in target.mode:
         user.sendMessage(
             irc.ERR_NOPRIVILEGES,
             ":Permission denied - You cannot SANICK another oper")
         return {}
     if not VALID_NICKNAME.match(params[1]):
         user.sendMessage(irc.ERR_ERRONEUSNICKNAME, params[1],
                          ":Erroneous nickname")
         return {}
     if params[0] == params[1]:
         return {}
     return {"user": user, "targetuser": target, "newnick": params[1]}
Ejemplo n.º 3
0
 def processParams(self, user, params):
     if user.registered > 0:
         user.sendMessage(irc.ERR_NOTREGISTERED, "QLINE", ":You have not registered")
         return {}
     if "o" not in user.mode:
         user.sendMessage(irc.ERR_NOPRIVILEGES, ":Permission denied - You do not have the correct operator privileges")
         return {}
     if not params:
         user.sendMessage(irc.ERR_NEEDMOREPARAMS, "QLINE", ":Not enough parameters")
         return {}
     self.expire_qlines()
     banmask = params[0]
     if banmask[0] == "-":
         banmask = banmask[1:]
         if not banmask:
             user.sendMessage(irc.ERR_NEEDMOREPARAMS, "QLINE", ":Not enough parameters")
             return {}
         if banmask not in self.banList:
             user.sendMessage("NOTICE", ":*** There is not a q:line set on {}; check /stats Q for a list of existing q:lines".format(banmask))
             return {}
         return {
             "user": user,
             "mask": banmask
         }
     if len(params) < 3 or not params[2]:
         user.sendMessage(irc.ERR_NEEDMOREPARAMS, "QLINE", ":Not enough parameters")
         return {}
     if banmask[0] == "+":
         banmask = banmask[1:]
         if not banmask:
             user.sendMessage(irc.ERR_NEEDMOREPARAMS, "QLINE", ":Not enough parameters")
             return {}
     if banmask in self.banList:
         user.sendMessage("NOTICE", ":*** Q:line already exists for {}!  Check /stats Q for a list of existing q:lines.".format(params[0]))
         return {}
     bancheck = banmask.replace("*", "")
     if not bancheck or ("*" in banmask and bancheck == "?"):
         user.sendMessage("NOTICE", ":*** That q:line will match all nicks!  Please check your nick mask and try again.")
         return {}
     if not VALID_NICKNAME.match(params[0].replace("*", "").replace("?", "a")):
         user.sendMessage("NOTICE", ":*** That isn't a valid nick mask and won't match any nicks.  Please check your nick mask and try again.")
         return {}
     return {
         "user": user,
         "mask": banmask,
         "duration": parse_duration(params[1]),
         "reason": " ".join(params[2:])
     }
Ejemplo n.º 4
0
 def processParams(self, user, params):
     if not params:
         user.sendMessage(irc.ERR_NONICKNAMEGIVEN, ":No nickname given")
         return {}
     if not params[0]:
         user.sendMessage(irc.ERR_ERRONEUSNICKNAME, "*", ":Erroneous nickname")
         return {}
     if not VALID_NICKNAME.match(params[0]):
         user.sendMessage(irc.ERR_ERRONEUSNICKNAME, params[0], ":Erroneous nickname")
         return {}
     if params[0] == user.nickname:
         return {}
     if params[0] in self.ircd.users and (not user.nickname or irc_lower(params[0]) != irc_lower(user.nickname)):
         user.sendMessage(irc.ERR_NICKNAMEINUSE, self.ircd.users[params[0]].nickname, ":Nickname is already in use")
         return {}
     return {
         "user": user,
         "nick": params[0]
     }
Ejemplo n.º 5
0
 def processParams(self, user, params):
     if not params:
         user.sendMessage(irc.ERR_NONICKNAMEGIVEN, ":No nickname given")
         return {}
     if not params[0]:
         user.sendMessage(irc.ERR_ERRONEUSNICKNAME, "*",
                          ":Erroneous nickname")
         return {}
     if not VALID_NICKNAME.match(params[0]):
         user.sendMessage(irc.ERR_ERRONEUSNICKNAME, params[0],
                          ":Erroneous nickname")
         return {}
     if params[0] == user.nickname:
         return {}
     if params[0] in self.ircd.users and (not user.nickname or irc_lower(
             params[0]) != irc_lower(user.nickname)):
         user.sendMessage(irc.ERR_NICKNAMEINUSE,
                          self.ircd.users[params[0]].nickname,
                          ":Nickname is already in use")
         return {}
     return {"user": user, "nick": params[0]}
Ejemplo n.º 6
0
 def processParams(self, user, params):
     if user.registered > 0:
         user.sendMessage(irc.ERR_NOTREGISTERED, "QLINE",
                          ":You have not registered")
         return {}
     if "o" not in user.mode:
         user.sendMessage(
             irc.ERR_NOPRIVILEGES,
             ":Permission denied - You do not have the correct operator privileges"
         )
         return {}
     if not params:
         user.sendMessage(irc.ERR_NEEDMOREPARAMS, "QLINE",
                          ":Not enough parameters")
         return {}
     self.expire_qlines()
     banmask = params[0]
     if banmask[0] == "-":
         banmask = banmask[1:]
         if not banmask:
             user.sendMessage(irc.ERR_NEEDMOREPARAMS, "QLINE",
                              ":Not enough parameters")
             return {}
         if banmask not in self.banList:
             user.sendMessage(
                 "NOTICE",
                 ":*** There is not a q:line set on {}; check /stats Q for a list of existing q:lines"
                 .format(banmask))
             return {}
         return {"user": user, "mask": banmask}
     if len(params) < 3 or not params[2]:
         user.sendMessage(irc.ERR_NEEDMOREPARAMS, "QLINE",
                          ":Not enough parameters")
         return {}
     if banmask[0] == "+":
         banmask = banmask[1:]
         if not banmask:
             user.sendMessage(irc.ERR_NEEDMOREPARAMS, "QLINE",
                              ":Not enough parameters")
             return {}
     if banmask in self.banList:
         user.sendMessage(
             "NOTICE",
             ":*** Q:line already exists for {}!  Check /stats Q for a list of existing q:lines."
             .format(params[0]))
         return {}
     bancheck = banmask.replace("*", "")
     if not bancheck or ("*" in banmask and bancheck == "?"):
         user.sendMessage(
             "NOTICE",
             ":*** That q:line will match all nicks!  Please check your nick mask and try again."
         )
         return {}
     if not VALID_NICKNAME.match(params[0].replace("*", "").replace(
             "?", "a")):
         user.sendMessage(
             "NOTICE",
             ":*** That isn't a valid nick mask and won't match any nicks.  Please check your nick mask and try again."
         )
         return {}
     return {
         "user": user,
         "mask": banmask,
         "duration": parse_duration(params[1]),
         "reason": " ".join(params[2:])
     }