phergie / phergie-irc-client-react

IRC client library built on React
BSD 3-Clause "New" or "Revised" License
56 stars 26 forks source link

Add a method to get a list of all active connections #41

Closed Renegade334 closed 9 years ago

Renegade334 commented 9 years ago
class Plugin extends AbstractPlugin
{
  /* ... */

  public function myRegularCallback()
  {
    /* get some data */

    foreach ($this->getClient()->getActiveConnections() as $connection) {
      $queue = $this->getEventQueueFactory()->getEventQueue($connection);
      $queue->ircPrivmsg('#mychan', "OHAI I HAZ SUM DATA 4 U: $data");
    }
  }
}

There is the question of whether such a function would need to be added to the client interface.

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.05%) to 98.87% when pulling 68ed1d1d7303e83aba392382a77be1f79f9d2fd4 on Renegade334:devel-active-connections-list into 63d736cbfadaf0dc2948f05cc808cd12dcdbf42a on phergie:master.

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.03%) to 98.86% when pulling 22c50a5f2125964c2de6a18d5f7d7958d93b41d7 on Renegade334:devel-active-connections-list into 63d736cbfadaf0dc2948f05cc808cd12dcdbf42a on phergie:master.

elazar commented 9 years ago

Do we really need the "active" portion of the method / property names? Seems implied that the connections being managed are active.

Renegade334 commented 9 years ago

Needs to be distinguished from the addConnection() family of methods, which create IRC sessions from connection objects. These ones just mark connection objects as active or not active by adding and removing them from the store.

elazar commented 9 years ago

Thanks!