summaryrefslogtreecommitdiff
path: root/irc.py
diff options
context:
space:
mode:
authorBrian Sherson <caretaker82@euclid.shersonb.net>2014-03-23 12:14:56 -0700
committerBrian Sherson <caretaker82@euclid.shersonb.net>2014-03-23 12:14:56 -0700
commitc53c4c03a44e6a30f6b7c127791f9570af232080 (patch)
tree45cf38e29c6c49f042c23e02b07b4ace659e1af3 /irc.py
parent5c66d93f0ca04c06f3ed122772b9751b3dcc3f6e (diff)
Fixing typo in parse324 and throttling for MODE and WHO
Diffstat (limited to 'irc.py')
-rw-r--r--irc.py16
1 files changed, 15 insertions, 1 deletions
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()