|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.Cooperation.CooperationClient</title> |
|
4 <meta charset="UTF-8"> |
|
5 <style> |
|
6 body { |
|
7 background: #EDECE6; |
|
8 margin: 0em 1em 10em 1em; |
|
9 color: black; |
|
10 } |
|
11 |
|
12 h1 { color: white; background: #85774A; } |
|
13 h2 { color: white; background: #85774A; } |
|
14 h3 { color: white; background: #9D936E; } |
|
15 h4 { color: white; background: #9D936E; } |
|
16 |
|
17 a { color: #BA6D36; } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body><a NAME="top" ID="top"></a> |
|
22 <h1>eric6.Cooperation.CooperationClient</h1> |
|
23 <p> |
|
24 Module implementing the client of the cooperation package. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>None</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr> |
|
33 <td><a href="#CooperationClient">CooperationClient</a></td> |
|
34 <td>Class implementing the client of the cooperation package.</td> |
|
35 </tr> |
|
36 </table> |
|
37 <h3>Functions</h3> |
|
38 <table> |
|
39 <tr><td>None</td></tr> |
|
40 </table> |
|
41 <hr /><hr /> |
|
42 <a NAME="CooperationClient" ID="CooperationClient"></a> |
|
43 <h2>CooperationClient</h2> |
|
44 <p> |
|
45 Class implementing the client of the cooperation package. |
|
46 </p><h3>Signals</h3> |
|
47 <dl> |
|
48 <dt>cannotConnect()</dt> |
|
49 <dd> |
|
50 emitted, if the initial connection fails |
|
51 </dd><dt>connectionError(message)</dt> |
|
52 <dd> |
|
53 emitted when a connection error occurs |
|
54 (string) |
|
55 </dd><dt>editorCommand(hash, filename, message)</dt> |
|
56 <dd> |
|
57 emitted when an editor |
|
58 command has been received (string, string, string) |
|
59 </dd><dt>newMessage(user, message)</dt> |
|
60 <dd> |
|
61 emitted after a new message has |
|
62 arrived (string, string) |
|
63 </dd><dt>newParticipant(nickname)</dt> |
|
64 <dd> |
|
65 emitted after a new participant joined |
|
66 (string) |
|
67 </dd><dt>participantLeft(nickname)</dt> |
|
68 <dd> |
|
69 emitted after a participant left (string) |
|
70 </dd> |
|
71 </dl> |
|
72 <h3>Derived from</h3> |
|
73 QObject |
|
74 <h3>Class Attributes</h3> |
|
75 <table> |
|
76 <tr><td>None</td></tr> |
|
77 </table> |
|
78 <h3>Class Methods</h3> |
|
79 <table> |
|
80 <tr><td>None</td></tr> |
|
81 </table> |
|
82 <h3>Methods</h3> |
|
83 <table> |
|
84 <tr> |
|
85 <td><a href="#CooperationClient.__init__">CooperationClient</a></td> |
|
86 <td>Constructor</td> |
|
87 </tr><tr> |
|
88 <td><a href="#CooperationClient.__connectionError">__connectionError</a></td> |
|
89 <td>Private slot to handle a connection error.</td> |
|
90 </tr><tr> |
|
91 <td><a href="#CooperationClient.__connectionRejected">__connectionRejected</a></td> |
|
92 <td>Private slot to handle the rejection of a connection.</td> |
|
93 </tr><tr> |
|
94 <td><a href="#CooperationClient.__disconnected">__disconnected</a></td> |
|
95 <td>Private slot to handle the disconnection of a chat client.</td> |
|
96 </tr><tr> |
|
97 <td><a href="#CooperationClient.__findConnections">__findConnections</a></td> |
|
98 <td>Private method to get a list of connection given a nick name.</td> |
|
99 </tr><tr> |
|
100 <td><a href="#CooperationClient.__getParticipants">__getParticipants</a></td> |
|
101 <td>Private slot to handle the request for a list of participants.</td> |
|
102 </tr><tr> |
|
103 <td><a href="#CooperationClient.__newConnection">__newConnection</a></td> |
|
104 <td>Private slot to handle a new connection.</td> |
|
105 </tr><tr> |
|
106 <td><a href="#CooperationClient.__processParticipants">__processParticipants</a></td> |
|
107 <td>Private slot to handle the receipt of a list of participants.</td> |
|
108 </tr><tr> |
|
109 <td><a href="#CooperationClient.__readyForUse">__readyForUse</a></td> |
|
110 <td>Private slot to handle a connection getting ready for use.</td> |
|
111 </tr><tr> |
|
112 <td><a href="#CooperationClient.banKickUser">banKickUser</a></td> |
|
113 <td>Public method to ban and kick a user by its nick name.</td> |
|
114 </tr><tr> |
|
115 <td><a href="#CooperationClient.banUser">banUser</a></td> |
|
116 <td>Public method to ban a user by its nick name.</td> |
|
117 </tr><tr> |
|
118 <td><a href="#CooperationClient.chatWidget">chatWidget</a></td> |
|
119 <td>Public method to get a reference to the chat widget.</td> |
|
120 </tr><tr> |
|
121 <td><a href="#CooperationClient.close">close</a></td> |
|
122 <td>Public method to close all connections and stop listening.</td> |
|
123 </tr><tr> |
|
124 <td><a href="#CooperationClient.connectToHost">connectToHost</a></td> |
|
125 <td>Public method to connect to a host.</td> |
|
126 </tr><tr> |
|
127 <td><a href="#CooperationClient.disconnectConnections">disconnectConnections</a></td> |
|
128 <td>Public slot to disconnect from the chat network.</td> |
|
129 </tr><tr> |
|
130 <td><a href="#CooperationClient.errorString">errorString</a></td> |
|
131 <td>Public method to get a human readable error message about the last server error.</td> |
|
132 </tr><tr> |
|
133 <td><a href="#CooperationClient.hasConnection">hasConnection</a></td> |
|
134 <td>Public method to check for an existing connection.</td> |
|
135 </tr><tr> |
|
136 <td><a href="#CooperationClient.hasConnections">hasConnections</a></td> |
|
137 <td>Public method to check, if there are any connections established.</td> |
|
138 </tr><tr> |
|
139 <td><a href="#CooperationClient.isListening">isListening</a></td> |
|
140 <td>Public method to check, if the client is listening for connections.</td> |
|
141 </tr><tr> |
|
142 <td><a href="#CooperationClient.kickUser">kickUser</a></td> |
|
143 <td>Public method to kick a user by its nick name.</td> |
|
144 </tr><tr> |
|
145 <td><a href="#CooperationClient.nickName">nickName</a></td> |
|
146 <td>Public method to get the nick name.</td> |
|
147 </tr><tr> |
|
148 <td><a href="#CooperationClient.removeConnection">removeConnection</a></td> |
|
149 <td>Public method to remove a connection.</td> |
|
150 </tr><tr> |
|
151 <td><a href="#CooperationClient.sendEditorCommand">sendEditorCommand</a></td> |
|
152 <td>Public method to send an editor command.</td> |
|
153 </tr><tr> |
|
154 <td><a href="#CooperationClient.sendMessage">sendMessage</a></td> |
|
155 <td>Public method to send a message.</td> |
|
156 </tr><tr> |
|
157 <td><a href="#CooperationClient.startListening">startListening</a></td> |
|
158 <td>Public method to start listening for new connections.</td> |
|
159 </tr> |
|
160 </table> |
|
161 <h3>Static Methods</h3> |
|
162 <table> |
|
163 <tr><td>None</td></tr> |
|
164 </table> |
|
165 <a NAME="CooperationClient.__init__" ID="CooperationClient.__init__"></a> |
|
166 <h4>CooperationClient (Constructor)</h4> |
|
167 <b>CooperationClient</b>(<i>parent=None</i>) |
|
168 <p> |
|
169 Constructor |
|
170 </p><dl> |
|
171 <dt><i>parent</i></dt> |
|
172 <dd> |
|
173 reference to the parent object (QObject) |
|
174 </dd> |
|
175 </dl><a NAME="CooperationClient.__connectionError" ID="CooperationClient.__connectionError"></a> |
|
176 <h4>CooperationClient.__connectionError</h4> |
|
177 <b>__connectionError</b>(<i>socketError, connection</i>) |
|
178 <p> |
|
179 Private slot to handle a connection error. |
|
180 </p><dl> |
|
181 <dt><i>socketError</i> (QAbstractSocket.SocketError)</dt> |
|
182 <dd> |
|
183 reference to the error object |
|
184 </dd><dt><i>connection</i> (Connection)</dt> |
|
185 <dd> |
|
186 connection that caused the error |
|
187 </dd> |
|
188 </dl><a NAME="CooperationClient.__connectionRejected" ID="CooperationClient.__connectionRejected"></a> |
|
189 <h4>CooperationClient.__connectionRejected</h4> |
|
190 <b>__connectionRejected</b>(<i>msg</i>) |
|
191 <p> |
|
192 Private slot to handle the rejection of a connection. |
|
193 </p><dl> |
|
194 <dt><i>msg</i></dt> |
|
195 <dd> |
|
196 error message (string) |
|
197 </dd> |
|
198 </dl><a NAME="CooperationClient.__disconnected" ID="CooperationClient.__disconnected"></a> |
|
199 <h4>CooperationClient.__disconnected</h4> |
|
200 <b>__disconnected</b>(<i>connection</i>) |
|
201 <p> |
|
202 Private slot to handle the disconnection of a chat client. |
|
203 </p><dl> |
|
204 <dt><i>connection</i> (Connection)</dt> |
|
205 <dd> |
|
206 connection that was disconnected |
|
207 </dd> |
|
208 </dl><a NAME="CooperationClient.__findConnections" ID="CooperationClient.__findConnections"></a> |
|
209 <h4>CooperationClient.__findConnections</h4> |
|
210 <b>__findConnections</b>(<i>nick</i>) |
|
211 <p> |
|
212 Private method to get a list of connection given a nick name. |
|
213 </p><dl> |
|
214 <dt><i>nick</i></dt> |
|
215 <dd> |
|
216 nick name in the format of self.nickName() (string) |
|
217 </dd> |
|
218 </dl><dl> |
|
219 <dt>Returns:</dt> |
|
220 <dd> |
|
221 list of references to the connection objects (list of |
|
222 Connection) |
|
223 </dd> |
|
224 </dl><a NAME="CooperationClient.__getParticipants" ID="CooperationClient.__getParticipants"></a> |
|
225 <h4>CooperationClient.__getParticipants</h4> |
|
226 <b>__getParticipants</b>(<i>reqConnection</i>) |
|
227 <p> |
|
228 Private slot to handle the request for a list of participants. |
|
229 </p><dl> |
|
230 <dt><i>reqConnection</i> (Connection)</dt> |
|
231 <dd> |
|
232 reference to the connection to get |
|
233 participants for |
|
234 </dd> |
|
235 </dl><a NAME="CooperationClient.__newConnection" ID="CooperationClient.__newConnection"></a> |
|
236 <h4>CooperationClient.__newConnection</h4> |
|
237 <b>__newConnection</b>(<i>connection</i>) |
|
238 <p> |
|
239 Private slot to handle a new connection. |
|
240 </p><dl> |
|
241 <dt><i>connection</i></dt> |
|
242 <dd> |
|
243 reference to the new connection (Connection) |
|
244 </dd> |
|
245 </dl><a NAME="CooperationClient.__processParticipants" ID="CooperationClient.__processParticipants"></a> |
|
246 <h4>CooperationClient.__processParticipants</h4> |
|
247 <b>__processParticipants</b>(<i>participants</i>) |
|
248 <p> |
|
249 Private slot to handle the receipt of a list of participants. |
|
250 </p><dl> |
|
251 <dt><i>participants</i></dt> |
|
252 <dd> |
|
253 list of participants (list of strings of |
|
254 "host:port") |
|
255 </dd> |
|
256 </dl><a NAME="CooperationClient.__readyForUse" ID="CooperationClient.__readyForUse"></a> |
|
257 <h4>CooperationClient.__readyForUse</h4> |
|
258 <b>__readyForUse</b>(<i>connection</i>) |
|
259 <p> |
|
260 Private slot to handle a connection getting ready for use. |
|
261 </p><dl> |
|
262 <dt><i>connection</i> (Connection)</dt> |
|
263 <dd> |
|
264 connection that got ready for use |
|
265 </dd> |
|
266 </dl><a NAME="CooperationClient.banKickUser" ID="CooperationClient.banKickUser"></a> |
|
267 <h4>CooperationClient.banKickUser</h4> |
|
268 <b>banKickUser</b>(<i>nick</i>) |
|
269 <p> |
|
270 Public method to ban and kick a user by its nick name. |
|
271 </p><dl> |
|
272 <dt><i>nick</i></dt> |
|
273 <dd> |
|
274 nick name in the format of self.nickName() (string) |
|
275 </dd> |
|
276 </dl><a NAME="CooperationClient.banUser" ID="CooperationClient.banUser"></a> |
|
277 <h4>CooperationClient.banUser</h4> |
|
278 <b>banUser</b>(<i>nick</i>) |
|
279 <p> |
|
280 Public method to ban a user by its nick name. |
|
281 </p><dl> |
|
282 <dt><i>nick</i></dt> |
|
283 <dd> |
|
284 nick name in the format of self.nickName() (string) |
|
285 </dd> |
|
286 </dl><a NAME="CooperationClient.chatWidget" ID="CooperationClient.chatWidget"></a> |
|
287 <h4>CooperationClient.chatWidget</h4> |
|
288 <b>chatWidget</b>(<i></i>) |
|
289 <p> |
|
290 Public method to get a reference to the chat widget. |
|
291 </p><dl> |
|
292 <dt>Returns:</dt> |
|
293 <dd> |
|
294 reference to the chat widget (ChatWidget) |
|
295 </dd> |
|
296 </dl><a NAME="CooperationClient.close" ID="CooperationClient.close"></a> |
|
297 <h4>CooperationClient.close</h4> |
|
298 <b>close</b>(<i></i>) |
|
299 <p> |
|
300 Public method to close all connections and stop listening. |
|
301 </p><a NAME="CooperationClient.connectToHost" ID="CooperationClient.connectToHost"></a> |
|
302 <h4>CooperationClient.connectToHost</h4> |
|
303 <b>connectToHost</b>(<i>host, port</i>) |
|
304 <p> |
|
305 Public method to connect to a host. |
|
306 </p><dl> |
|
307 <dt><i>host</i></dt> |
|
308 <dd> |
|
309 host to connect to (string) |
|
310 </dd><dt><i>port</i></dt> |
|
311 <dd> |
|
312 port to connect to (integer) |
|
313 </dd> |
|
314 </dl><a NAME="CooperationClient.disconnectConnections" ID="CooperationClient.disconnectConnections"></a> |
|
315 <h4>CooperationClient.disconnectConnections</h4> |
|
316 <b>disconnectConnections</b>(<i></i>) |
|
317 <p> |
|
318 Public slot to disconnect from the chat network. |
|
319 </p><a NAME="CooperationClient.errorString" ID="CooperationClient.errorString"></a> |
|
320 <h4>CooperationClient.errorString</h4> |
|
321 <b>errorString</b>(<i></i>) |
|
322 <p> |
|
323 Public method to get a human readable error message about the last |
|
324 server error. |
|
325 </p><dl> |
|
326 <dt>Returns:</dt> |
|
327 <dd> |
|
328 human readable error message about the last server error |
|
329 (string) |
|
330 </dd> |
|
331 </dl><a NAME="CooperationClient.hasConnection" ID="CooperationClient.hasConnection"></a> |
|
332 <h4>CooperationClient.hasConnection</h4> |
|
333 <b>hasConnection</b>(<i>senderIp, senderPort=-1</i>) |
|
334 <p> |
|
335 Public method to check for an existing connection. |
|
336 </p><dl> |
|
337 <dt><i>senderIp</i></dt> |
|
338 <dd> |
|
339 address of the sender (QHostAddress) |
|
340 </dd><dt><i>senderPort</i></dt> |
|
341 <dd> |
|
342 port of the sender (integer) |
|
343 </dd> |
|
344 </dl><dl> |
|
345 <dt>Returns:</dt> |
|
346 <dd> |
|
347 flag indicating an existing connection (boolean) |
|
348 </dd> |
|
349 </dl><a NAME="CooperationClient.hasConnections" ID="CooperationClient.hasConnections"></a> |
|
350 <h4>CooperationClient.hasConnections</h4> |
|
351 <b>hasConnections</b>(<i></i>) |
|
352 <p> |
|
353 Public method to check, if there are any connections established. |
|
354 </p><dl> |
|
355 <dt>Returns:</dt> |
|
356 <dd> |
|
357 flag indicating the presence of connections (boolean) |
|
358 </dd> |
|
359 </dl><a NAME="CooperationClient.isListening" ID="CooperationClient.isListening"></a> |
|
360 <h4>CooperationClient.isListening</h4> |
|
361 <b>isListening</b>(<i></i>) |
|
362 <p> |
|
363 Public method to check, if the client is listening for connections. |
|
364 </p><dl> |
|
365 <dt>Returns:</dt> |
|
366 <dd> |
|
367 flag indicating the listening state (boolean) |
|
368 </dd> |
|
369 </dl><a NAME="CooperationClient.kickUser" ID="CooperationClient.kickUser"></a> |
|
370 <h4>CooperationClient.kickUser</h4> |
|
371 <b>kickUser</b>(<i>nick</i>) |
|
372 <p> |
|
373 Public method to kick a user by its nick name. |
|
374 </p><dl> |
|
375 <dt><i>nick</i></dt> |
|
376 <dd> |
|
377 nick name in the format of self.nickName() (string) |
|
378 </dd> |
|
379 </dl><a NAME="CooperationClient.nickName" ID="CooperationClient.nickName"></a> |
|
380 <h4>CooperationClient.nickName</h4> |
|
381 <b>nickName</b>(<i></i>) |
|
382 <p> |
|
383 Public method to get the nick name. |
|
384 </p><dl> |
|
385 <dt>Returns:</dt> |
|
386 <dd> |
|
387 nick name (string) |
|
388 </dd> |
|
389 </dl><a NAME="CooperationClient.removeConnection" ID="CooperationClient.removeConnection"></a> |
|
390 <h4>CooperationClient.removeConnection</h4> |
|
391 <b>removeConnection</b>(<i>connection</i>) |
|
392 <p> |
|
393 Public method to remove a connection. |
|
394 </p><dl> |
|
395 <dt><i>connection</i></dt> |
|
396 <dd> |
|
397 reference to the connection to be removed |
|
398 (Connection) |
|
399 </dd> |
|
400 </dl><a NAME="CooperationClient.sendEditorCommand" ID="CooperationClient.sendEditorCommand"></a> |
|
401 <h4>CooperationClient.sendEditorCommand</h4> |
|
402 <b>sendEditorCommand</b>(<i>projectHash, filename, message</i>) |
|
403 <p> |
|
404 Public method to send an editor command. |
|
405 </p><dl> |
|
406 <dt><i>projectHash</i></dt> |
|
407 <dd> |
|
408 hash of the project (string) |
|
409 </dd><dt><i>filename</i></dt> |
|
410 <dd> |
|
411 project relative universal file name of |
|
412 the sending editor (string) |
|
413 </dd><dt><i>message</i></dt> |
|
414 <dd> |
|
415 editor command to be sent (string) |
|
416 </dd> |
|
417 </dl><a NAME="CooperationClient.sendMessage" ID="CooperationClient.sendMessage"></a> |
|
418 <h4>CooperationClient.sendMessage</h4> |
|
419 <b>sendMessage</b>(<i>message</i>) |
|
420 <p> |
|
421 Public method to send a message. |
|
422 </p><dl> |
|
423 <dt><i>message</i></dt> |
|
424 <dd> |
|
425 message to be sent (string) |
|
426 </dd> |
|
427 </dl><a NAME="CooperationClient.startListening" ID="CooperationClient.startListening"></a> |
|
428 <h4>CooperationClient.startListening</h4> |
|
429 <b>startListening</b>(<i>port=-1</i>) |
|
430 <p> |
|
431 Public method to start listening for new connections. |
|
432 </p><dl> |
|
433 <dt><i>port</i></dt> |
|
434 <dd> |
|
435 port to listen on (integer) |
|
436 </dd> |
|
437 </dl><dl> |
|
438 <dt>Returns:</dt> |
|
439 <dd> |
|
440 tuple giving a flag indicating success (boolean) and |
|
441 the port the server listens on |
|
442 </dd> |
|
443 </dl> |
|
444 <div align="right"><a href="#top">Up</a></div> |
|
445 <hr /> |
|
446 </body></html> |