Changes between Version 4 and Version 5 of DevelopersGuide
- Timestamp:
- 02/28/08 00:25:07 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DevelopersGuide
v4 v5 39 39 * The `shutdown` method is called before the client terminates its connection to the server. It should be used in the same manner as a destructor. 40 40 41 All plugins are implicitly passed an event instance before event handler methods are called. This can be accessed within event handler methods via {{{$this->event}}}. Most events include arguments of some sort, such as the nick of the user that sent them or some sort of message content. These can be accessed either by called {{{$this->event->getArguments()}}}, which returns an array, or {{{$this->event->getArgument(#)}}} where # is the position of the argument beginning from 0. 41 All plugins are implicitly passed an event instance before event handler methods are called. This can be accessed within event handler methods via {{{$this->event}}}. Most events include arguments of some sort, such as the nick of the user that sent them or some sort of message content. These can be accessed either by calling {{{$this->event->getArguments()}}} which returns an array, {{{$this->event->getArgument(#)}}} where # is the position of the argument beginning from 0 or an argument name from the list below (depends on the event type), or {{{$this->event->getArgname()}}} where Argname is an argument name from the list below (depends on the event type). 42 43 ||'''Event Type'''||'''Position'''||'''Name'''|| 44 ||QUIT||0||message|| 45 ||JOIN||0||channel|| 46 ||KICK||0||channel|| 47 ||||1||user|| 48 ||||2||comment|| 49 ||PART||0||channel|| 50 ||MODE||0||target|| 51 ||||1||mode|| 52 ||||2||limit|| 53 ||||3||user|| 54 ||||4||banmask|| 55 ||TOPIC||0||channel|| 56 ||||1||topic|| 57 ||PRIVMSG||0||receiver|| 58 ||||1||text|| 59 ||NOTICE||0||nickname|| 60 ||||1||text|| 61 ||ACTION||0||target|| 62 ||||1||action|| 42 63 43 64 More information on the arguments passed for each type of event can be found in [http://irchelp.org/irchelp/rfc/chapter4.html Chapter 4] of the [http://irchelp.org/irchelp/rfc/rfc.html RFC for the IRC protocol]. For more information on the capabilities of the event instance, check out the [http://trac2.assembla.com/phergie/browser/trunk/Phergie/Event/Request.php request] (passed to most event handler methods) and [http://trac2.assembla.com/phergie/browser/trunk/Phergie/Event/Response.php response] (passed to the `onResponse` method) classes. … … 95 116 96 117 At the moment, plugins are essentially having to roll their own garbage collection functionality for cases where data may not be needed after a certain point or may need to be purged from memory on a regular basis. This will likely be implemented using a driver-based approach where the initial concrete implementation will use PHP arrays and a later planned implementation will use [http://www.danga.com/memcached/ memcached]. 97 98 === [http://trac2.assembla.com/phergie/ticket/17 Named Event Arguments] ===99 100 Event arguments can currently only be referred to by position. This addition will modify the request class so that the `getArgument` method can process requests for string-based indices based on the event type. For example, $this->event->getArgument('message') could be used in place of $this->event->getArgument(1) for the message content of a PRIVMSG event. This change will not break backward-compatibility, merely make plugin code able to be more intuitive and easier to create.