Skip to content

Commit

Permalink
moved preDispatch() to processEventQueue so it gets called before eve…
Browse files Browse the repository at this point in the history
…ry event queue processing
  • Loading branch information
dotEvan committed Mar 8, 2010
1 parent 0561bf0 commit d604485
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Phergie/Bot.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ protected function handleEvents()
->setConnection($connection)
->setEvent($event)
->preEvent()
->{'on' . ucfirst($event->getType())}()
->preDispatch();
->{'on' . ucfirst($event->getType())}();


$this->processEventQueue($connection);
}
Expand All @@ -354,8 +354,11 @@ protected function handleEvents()
protected function processEventQueue(Phergie_Connection $connection) {
$driver = $this->getDriver();
$events = $this->getEventHandler();
$plugins = $this->getPluginHandler();
$ui = $this->getUi();

$plugins->preDispatch();

foreach ($events as $event) {
$ui->onCommand($event, $connection);
$method = 'do' . ucfirst(strtolower($event->getType()));
Expand All @@ -364,7 +367,7 @@ protected function processEventQueue(Phergie_Connection $connection) {
$event->getArguments()
);
}
$this->getPluginHandler()->postDispatch();
$plugins->postDispatch();

if ($events->hasEventOfType(Phergie_Event_Request::TYPE_QUIT)) {
$ui->onQuit($connection);
Expand Down

0 comments on commit d604485

Please sign in to comment.