From c53c4c03a44e6a30f6b7c127791f9570af232080 Mon Sep 17 00:00:00 2001 From: Brian Sherson Date: Sun, 23 Mar 2014 12:14:56 -0700 Subject: Fixing typo in parse324 and throttling for MODE and WHO --- irc.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/irc.py b/irc.py index a69c7f9..2510a53 100644 --- a/irc.py +++ b/irc.py @@ -1260,7 +1260,7 @@ class Connection(object): for mode in setmodes: if mode == "+": continue - elif mode in [2]: + elif mode in chanmodes[2]: param = modeparams.pop(0) modedelta.append(("+%s" % mode, param)) elif mode in chanmodes[3]: @@ -2446,6 +2446,20 @@ class Connection(object): else: T = max(T, self.throttledata[-1] + 1) self.throttledata.append(T) + elif cmd in ("WHO", "MODE"): + # Might as well throttle WHOs and MODEs too. + while len(self.throttledata) and self.throttledata[0] < T - 4: + del self.throttledata[0] + if not self.throttled: + if len(self.throttledata) >= 5: + self.throttled = True + T = self.throttledata[-1] + 0.125 + else: + if len(self.throttledata) == 0 or self.throttledata[-1] < T - 2: + self.throttled = False + else: + T = max(T, self.throttledata[-1] + 1) + self.throttledata.append(T) with self._sendline: self._outgoing.append((T, line, origin)) self._sendline.notify() -- cgit v1.2.3