Example #1
0
	def removeOldEntries(self, whowasEntries):
		expireDuration = durationToSeconds(self.ircd.config.get("whowas_duration", "1d"))
		maxCount = self.ircd.config.get("whowas_max_entries", 10)
		while whowasEntries and len(whowasEntries) > maxCount:
			whowasEntries.pop(0)
		expireTime = timestamp(now()) - expireDuration
		while whowasEntries and whowasEntries[0]["when"] < expireTime:
			whowasEntries.pop(0)
		return whowasEntries
Example #2
0
 def removeOldEntries(self, whowasEntries):
     expireDuration = durationToSeconds(
         self.ircd.config.get("whowas_duration", "1d"))
     maxCount = self.ircd.config.get("whowas_max_entries", 10)
     while whowasEntries and len(whowasEntries) > maxCount:
         whowasEntries.pop(0)
     expireTime = timestamp(now()) - expireDuration
     while whowasEntries and whowasEntries[0]["when"] < expireTime:
         whowasEntries.pop(0)
     return whowasEntries
Example #3
0
 def parseParams(self, user, params, prefix, tags):
     if len(params) < 1 or len(params) == 2:
         user.sendSingleError("QLineParams", irc.ERR_NEEDMOREPARAMS,
                              "QLINE", "Not enough parameters")
         return None
     if len(params) == 1:
         return {"mask": params[0]}
     return {
         "mask": params[0],
         "duration": durationToSeconds(params[1]),
         "reason": " ".join(params[2:])
     }
Example #4
0
	def parseParams(self, user, params, prefix, tags):
		if len(params) < 1 or len(params) == 2:
			user.sendSingleError("QLineParams", irc.ERR_NEEDMOREPARAMS, "QLINE", "Not enough parameters")
			return None
		if len(params) == 1:
			return {
				"mask": params[0]
			}
		return {
			"mask": params[0],
			"duration": durationToSeconds(params[1]),
			"reason": " ".join(params[2:])
		}
Example #5
0
 def parseParams(self, user, params, prefix, tags):
     if len(params) < 1 or len(params) == 2:
         user.sendSingleError("ZLineParams", irc.ERR_NEEDMOREPARAMS,
                              "ZLINE", "Not enough parameters")
         return None
     banmask = params[0]
     if banmask in self.module.ircd.userNicks:
         banmask = self.module.ircd.users[
             self.module.ircd.userNicks[banmask]].ip
     if len(params) == 1:
         return {"mask": banmask}
     return {
         "mask": banmask,
         "duration": durationToSeconds(params[1]),
         "reason": " ".join(params[2:])
     }
Example #6
0
	def parseParams(self, user, params, prefix, tags):
		if len(params) < 1 or len(params) == 2:
			user.sendSingleError("ZLineParams", irc.ERR_NEEDMOREPARAMS, "ZLINE", "Not enough parameters")
			return None
		banmask = params[0]
		if banmask in self.module.ircd.userNicks:
			banmask = self.module.ircd.users[self.module.ircd.userNicks[banmask]].ip
		if len(params) == 1:
			return {
				"mask": banmask
			}
		return {
			"mask": banmask,
			"duration": durationToSeconds(params[1]),
			"reason": " ".join(params[2:])
		}
Example #7
0
    def parseParams(self, user, params, prefix, tags):
        if len(params) < 1 or len(params) == 2:
            user.sendSingleError("ELineParams", irc.ERR_NEEDMOREPARAMS, "ELINE", "Not enough parameters")
            return None

        banmask = params[0]
        if banmask in self.module.ircd.userNicks:
            targetUser = self.module.ircd.users[self.module.ircd.userNicks[banmask]]
            banmask = "{}@{}".format(targetUser.ident, targetUser.realHost)
        else:
            if "@" not in banmask:
                banmask = "*@{}".format(banmask)

        if len(params) == 1:
            return {"mask": banmask}
        return {"mask": banmask, "duration": durationToSeconds(params[1]), "reason": " ".join(params[2:])}
Example #8
0
    def parseParams(self, user, params, prefix, tags):
        if len(params) < 1 or len(params) == 2:
            user.sendSingleError("KLineParams", irc.ERR_NEEDMOREPARAMS,
                                 "KLINE", "Not enough parameters")
            return None

        banmask = params[0]
        if banmask in self.ircd.userNicks:
            targetUser = self.ircd.users[self.ircd.userNicks[banmask]]
            banmask = "{}@{}".format(targetUser.ident, targetUser.realHost)
        else:
            if "@" not in banmask:
                banmask = "*@{}".format(banmask)
        if len(params) == 1:
            return {"mask": banmask}
        return {
            "mask": banmask,
            "duration": durationToSeconds(params[1]),
            "reason": " ".join(params[2:])
        }
Example #9
0
    def parseParams(self, user, params, prefix, tags):
        if len(params) < 1 or len(params) == 2:
            user.sendSingleError("ShunParams", irc.ERR_NEEDMOREPARAMS, "SHUN",
                                 "Not enough parameters")
            return None

        shunmask = params[0]
        if shunmask in self.module.ircd.userNicks:
            targetUser = self.module.ircd.users[
                self.module.ircd.userNicks[shunmask]]
            shunmask = "{}@{}".format(targetUser.ident, targetUser.host())
        else:
            if "@" not in shunmask:
                shunmask = "*@{}".format(shunmask)
        if len(params) == 1:
            return {"mask": shunmask}
        return {
            "mask": shunmask,
            "duration": durationToSeconds(params[1]),
            "reason": " ".join(params[2:])
        }
Example #10
0
 def rehash(self):
     if self.connector.running:
         self.connector.stop()
     self.connector.start(durationToSeconds(self.ircd.config.get("autoconnect_period", 60)), False)
Example #11
0
 def load(self):
     self.connector = LoopingCall(self.runConnections)
     self.connector.start(durationToSeconds(self.ircd.config.get("autoconnect_period", 60)), False)
Example #12
0
 def rehash(self):
     if self.connector.running:
         self.connector.stop()
     self.connector.start(
         durationToSeconds(self.ircd.config.get("autoconnect_period", 60)),
         False)
Example #13
0
 def load(self):
     self.connector = LoopingCall(self.runConnections)
     self.connector.start(
         durationToSeconds(self.ircd.config.get("autoconnect_period", 60)),
         False)