diff options
| author | 2018-08-31 13:32:46 +0100 | |
|---|---|---|
| committer | 2018-08-31 13:32:46 +0100 | |
| commit | 85af02ffe5f21711adb5757f74da2d0341023654 (patch) | |
| tree | 6b1a8e31de60aa76645fd644840eedea3f33ea7f /EventManager.py | |
| parent | Some networks don't prefix channel names in INVITE messages (diff) | |
| signature | ||
Move event priority mechanics to get_hooks() to factor in contextual events
Diffstat (limited to 'EventManager.py')
| -rw-r--r-- | EventManager.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/EventManager.py b/EventManager.py index 40dae924..0d4d1dd1 100644 --- a/EventManager.py +++ b/EventManager.py @@ -110,13 +110,10 @@ class EventHook(object): if context == None: self._hooks.append(callback) - hooks = self._hooks else: if not context in self._context_hooks: self._context_hooks[context] = [] self._context_hooks[context].append(callback) - hooks = self._context_hooks[context] - hooks.sort(key=lambda x: x.priority) if replay and not self._stored_events == None: for kwargs in self._stored_events: @@ -223,5 +220,5 @@ class EventHook(object): child.purge_context(context) def get_hooks(self): - return self._hooks + list(itertools.chain.from_iterable( - self._context_hooks.values())) + return sorted(self._hooks + list(itertools.chain.from_iterable( + self._context_hooks.values())), key=lambda e: e.priority) |
