diff options
author | Brian Sherson <caretaker82@euclid.shersonb.net> | 2014-03-23 12:14:56 -0700 |
---|---|---|
committer | Brian Sherson <caretaker82@euclid.shersonb.net> | 2014-03-23 12:14:56 -0700 |
commit | c53c4c03a44e6a30f6b7c127791f9570af232080 (patch) | |
tree | 45cf38e29c6c49f042c23e02b07b4ace659e1af3 | |
parent | 5c66d93f0ca04c06f3ed122772b9751b3dcc3f6e (diff) |
Fixing typo in parse324 and throttling for MODE and WHO
-rw-r--r-- | irc.py | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -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() |