root/trunk/Phergie/Client/Driver.php @ 12

Revision 12, 4.4 KB (checked in by tobias382, 5 years ago)

Fixes #7
* Modified Quit plugin to use doQuit instead of disconnect
* Added a note in the base Driver class for plugins not to use disconnect

Line 
1<?php
2
3/**
4* @see Phergie_Connection
5*/
6require_once 'Phergie/Connection.php';
7
8/**
9* @see Phergie_Exception
10*/
11require_once 'Phergie/Exception.php';
12
13/**
14* @see Phergie_Event_Handler
15*/
16require_once 'Phergie/Event/Handler.php';
17
18/**
19* Handles reception, transmission, and processing of data sent to and
20* from IRC server.
21*/
22interface Phergie_Client_Driver
23{
24    /**
25    * Adds a set of callbacks for events received from the server.
26    *
27    * @param Phergie_Event_Handler $handler
28    */
29    public function addEventHandler(Phergie_Event_Handler $handler);
30
31    /**
32    * Establishes a connection to the server.
33    *
34    * @param Phergie_Connection $connection Connection information
35    * @throws Phergie_Exception A connectivity issue occurred
36    */
37    public function connect(Phergie_Connection $connection);
38
39    /**
40    * Terminates any existing connection to the server. Note that this
41    * should never be used by an event handler; doQuit should be called
42    * instead.
43    */
44    public function disconnect();
45
46    /**
47    * Returns whether or not the client is currently connected to the server.
48    *
49    * @return TRUE if the client is connected, FALSE otherwise
50    */
51    public function isConnected();
52
53    /**
54    * Executes a continuous loop in which the client listens for events from
55    * the server and processes them until the connection is terminated.
56    *
57    * @throws Phergie_Exception A runtime issue occurred
58    */
59    public function run();
60
61    /**
62    * Controls debugging output.
63    *
64    * @param string $message Debugging message
65    */
66    public function debug($message);
67
68    /**
69    * Terminates the connection with the server.
70    *
71    * @param string $reason Reason for connection termination (optional)
72    */
73    public function doQuit($reason = null);
74
75    /**
76    * Joins a channel.
77    *
78    * @param string $channel Name of the channel to join
79    * @param string $keys Channel key if needed (optional)
80    */
81    public function doJoin($channel, $key = null);
82
83    /**
84    * Leaves a channel.
85    *
86    * @param string $channel Name of the channel to leave
87    */
88    public function doPart($channel);
89
90    /**
91    * Invites a user to an invite-only channel.
92    *
93    * @param string $nick Nick of the user to invite
94    * @param string $channel Name of the channel
95    */
96    public function doInvite($nick, $channel);
97
98    /**
99    * Obtains a list of nicks of usrs in currently joined channels.
100    *
101    * @param string $channels Comma-delimited list of one or more channels
102    */
103    public function doNames($channels);
104
105    /**
106    * Obtains a list of channel names and topics.
107    *
108    * @param string $channels Comma-delimited list of one or more channels
109    *                         to which the response should be restricted
110    *                         (optional)
111    */
112    public function doList($channels = null);
113
114    /**
115    * Retrieves or changes a channel topic.
116    *
117    * @param string $channel Name of the channel
118    * @param string $topic New topic to assign (optional)
119    */
120    public function doTopic($channel, $topic = null);
121
122    /**
123    * Retrieves or changes a channel or user mode.
124    *
125    * @param string $target Channel name or user nick
126    * @param string $mode New mode to assign (optional)
127    */
128    public function doMode($target, $mode = null);
129
130    /**
131    * Changes the client nick.
132    *
133    * @param string $nick New nick to assign
134    */
135    public function doNick($nick);
136
137    /**
138    * Retrieves information about a nick.
139    *
140    * @param string $nick
141    */
142    public function doWhois($nick);
143
144    /**
145    * Sends a message to a nick or channel.
146    *
147    * @param string $target Channel name or user nick
148    * @param string $text Text of the message to send
149    */
150    public function doPrivmsg($target, $text);
151
152    /**
153    * Sends a notice to a nick or channel.
154    *
155    * @param string $target Channel name or user nick
156    * @param string $text Text of the notice to send
157    */
158    public function doNotice($target, $text);
159
160    /**
161    * Kicks a user from a channel.
162    *
163    * @param string $nick Nick of the user
164    * @param string $channel Channel name
165    * @param string $reason Reason for the kick (optional)
166    */
167    public function doKick($nick, $channel, $reason = null);
168
169    /**
170    * Responds to a server test of client responsiveness.
171    *
172    * @param string $daemon Daemon from which the original request originates
173    */
174    public function doPong($daemon);
175}
Note: See TracBrowser for help on using the browser.