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 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 #3
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 #4
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 #5
0
 def rehash(self):
     if self.connector.running:
         self.connector.stop()
     self.connector.start(durationToSeconds(self.ircd.config.get("autoconnect_period", 60)), False)
Example #6
0
 def load(self):
     self.connector = LoopingCall(self.runConnections)
     self.connector.start(durationToSeconds(self.ircd.config.get("autoconnect_period", 60)), False)