src/eric7/Documentation/Source/eric7.Cooperation.CooperationClient.html

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8596
d64760b2da50
child 10423
299802979277
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.Cooperation.CooperationClient</title>
4 <meta charset="UTF-8">
5 <link rel="stylesheet" href="styles.css">
6 </head>
7 <body>
8 <a NAME="top" ID="top"></a>
9 <h1>eric7.Cooperation.CooperationClient</h1>
10
11 <p>
12 Module implementing the client of the cooperation package.
13 </p>
14 <h3>Global Attributes</h3>
15
16 <table>
17 <tr><td>None</td></tr>
18 </table>
19 <h3>Classes</h3>
20
21 <table>
22
23 <tr>
24 <td><a href="#CooperationClient">CooperationClient</a></td>
25 <td>Class implementing the client of the cooperation package.</td>
26 </tr>
27 </table>
28 <h3>Functions</h3>
29
30 <table>
31 <tr><td>None</td></tr>
32 </table>
33 <hr />
34 <hr />
35 <a NAME="CooperationClient" ID="CooperationClient"></a>
36 <h2>CooperationClient</h2>
37
38 <p>
39 Class implementing the client of the cooperation package.
40 </p>
41 <h3>Signals</h3>
42 <dl>
43
44 <dt>cannotConnect()</dt>
45 <dd>
46 emitted, if the initial connection fails
47 </dd>
48 <dt>connectionError(message)</dt>
49 <dd>
50 emitted when a connection error occurs
51 (string)
52 </dd>
53 <dt>editorCommand(hash, filename, message)</dt>
54 <dd>
55 emitted when an editor
56 command has been received (string, string, string)
57 </dd>
58 <dt>newMessage(user, message)</dt>
59 <dd>
60 emitted after a new message has
61 arrived (string, string)
62 </dd>
63 <dt>newParticipant(nickname)</dt>
64 <dd>
65 emitted after a new participant joined
66 (string)
67 </dd>
68 <dt>participantLeft(nickname)</dt>
69 <dd>
70 emitted after a participant left (string)
71 </dd>
72 </dl>
73 <h3>Derived from</h3>
74 QObject
75 <h3>Class Attributes</h3>
76
77 <table>
78 <tr><td>None</td></tr>
79 </table>
80 <h3>Class Methods</h3>
81
82 <table>
83 <tr><td>None</td></tr>
84 </table>
85 <h3>Methods</h3>
86
87 <table>
88
89 <tr>
90 <td><a href="#CooperationClient.__init__">CooperationClient</a></td>
91 <td>Constructor</td>
92 </tr>
93 <tr>
94 <td><a href="#CooperationClient.__connectionError">__connectionError</a></td>
95 <td>Private slot to handle a connection error.</td>
96 </tr>
97 <tr>
98 <td><a href="#CooperationClient.__connectionRejected">__connectionRejected</a></td>
99 <td>Private slot to handle the rejection of a connection.</td>
100 </tr>
101 <tr>
102 <td><a href="#CooperationClient.__disconnected">__disconnected</a></td>
103 <td>Private slot to handle the disconnection of a chat client.</td>
104 </tr>
105 <tr>
106 <td><a href="#CooperationClient.__findConnections">__findConnections</a></td>
107 <td>Private method to get a list of connection given a nick name.</td>
108 </tr>
109 <tr>
110 <td><a href="#CooperationClient.__getParticipants">__getParticipants</a></td>
111 <td>Private slot to handle the request for a list of participants.</td>
112 </tr>
113 <tr>
114 <td><a href="#CooperationClient.__newConnection">__newConnection</a></td>
115 <td>Private slot to handle a new connection.</td>
116 </tr>
117 <tr>
118 <td><a href="#CooperationClient.__processParticipants">__processParticipants</a></td>
119 <td>Private slot to handle the receipt of a list of participants.</td>
120 </tr>
121 <tr>
122 <td><a href="#CooperationClient.__readyForUse">__readyForUse</a></td>
123 <td>Private slot to handle a connection getting ready for use.</td>
124 </tr>
125 <tr>
126 <td><a href="#CooperationClient.banKickUser">banKickUser</a></td>
127 <td>Public method to ban and kick a user by its nick name.</td>
128 </tr>
129 <tr>
130 <td><a href="#CooperationClient.banUser">banUser</a></td>
131 <td>Public method to ban a user by its nick name.</td>
132 </tr>
133 <tr>
134 <td><a href="#CooperationClient.chatWidget">chatWidget</a></td>
135 <td>Public method to get a reference to the chat widget.</td>
136 </tr>
137 <tr>
138 <td><a href="#CooperationClient.close">close</a></td>
139 <td>Public method to close all connections and stop listening.</td>
140 </tr>
141 <tr>
142 <td><a href="#CooperationClient.connectToHost">connectToHost</a></td>
143 <td>Public method to connect to a host.</td>
144 </tr>
145 <tr>
146 <td><a href="#CooperationClient.disconnectConnections">disconnectConnections</a></td>
147 <td>Public slot to disconnect from the chat network.</td>
148 </tr>
149 <tr>
150 <td><a href="#CooperationClient.errorString">errorString</a></td>
151 <td>Public method to get a human readable error message about the last server error.</td>
152 </tr>
153 <tr>
154 <td><a href="#CooperationClient.hasConnection">hasConnection</a></td>
155 <td>Public method to check for an existing connection.</td>
156 </tr>
157 <tr>
158 <td><a href="#CooperationClient.hasConnections">hasConnections</a></td>
159 <td>Public method to check, if there are any connections established.</td>
160 </tr>
161 <tr>
162 <td><a href="#CooperationClient.isListening">isListening</a></td>
163 <td>Public method to check, if the client is listening for connections.</td>
164 </tr>
165 <tr>
166 <td><a href="#CooperationClient.kickUser">kickUser</a></td>
167 <td>Public method to kick a user by its nick name.</td>
168 </tr>
169 <tr>
170 <td><a href="#CooperationClient.nickName">nickName</a></td>
171 <td>Public method to get the nick name.</td>
172 </tr>
173 <tr>
174 <td><a href="#CooperationClient.removeConnection">removeConnection</a></td>
175 <td>Public method to remove a connection.</td>
176 </tr>
177 <tr>
178 <td><a href="#CooperationClient.sendEditorCommand">sendEditorCommand</a></td>
179 <td>Public method to send an editor command.</td>
180 </tr>
181 <tr>
182 <td><a href="#CooperationClient.sendMessage">sendMessage</a></td>
183 <td>Public method to send a message.</td>
184 </tr>
185 <tr>
186 <td><a href="#CooperationClient.startListening">startListening</a></td>
187 <td>Public method to start listening for new connections.</td>
188 </tr>
189 </table>
190 <h3>Static Methods</h3>
191
192 <table>
193 <tr><td>None</td></tr>
194 </table>
195
196 <a NAME="CooperationClient.__init__" ID="CooperationClient.__init__"></a>
197 <h4>CooperationClient (Constructor)</h4>
198 <b>CooperationClient</b>(<i>parent=None</i>)
199
200 <p>
201 Constructor
202 </p>
203 <dl>
204
205 <dt><i>parent</i></dt>
206 <dd>
207 reference to the parent object (QObject)
208 </dd>
209 </dl>
210 <a NAME="CooperationClient.__connectionError" ID="CooperationClient.__connectionError"></a>
211 <h4>CooperationClient.__connectionError</h4>
212 <b>__connectionError</b>(<i>socketError, connection</i>)
213
214 <p>
215 Private slot to handle a connection error.
216 </p>
217 <dl>
218
219 <dt><i>socketError</i> (QAbstractSocket.SocketError)</dt>
220 <dd>
221 reference to the error object
222 </dd>
223 <dt><i>connection</i> (Connection)</dt>
224 <dd>
225 connection that caused the error
226 </dd>
227 </dl>
228 <a NAME="CooperationClient.__connectionRejected" ID="CooperationClient.__connectionRejected"></a>
229 <h4>CooperationClient.__connectionRejected</h4>
230 <b>__connectionRejected</b>(<i>msg</i>)
231
232 <p>
233 Private slot to handle the rejection of a connection.
234 </p>
235 <dl>
236
237 <dt><i>msg</i></dt>
238 <dd>
239 error message (string)
240 </dd>
241 </dl>
242 <a NAME="CooperationClient.__disconnected" ID="CooperationClient.__disconnected"></a>
243 <h4>CooperationClient.__disconnected</h4>
244 <b>__disconnected</b>(<i>connection</i>)
245
246 <p>
247 Private slot to handle the disconnection of a chat client.
248 </p>
249 <dl>
250
251 <dt><i>connection</i> (Connection)</dt>
252 <dd>
253 connection that was disconnected
254 </dd>
255 </dl>
256 <a NAME="CooperationClient.__findConnections" ID="CooperationClient.__findConnections"></a>
257 <h4>CooperationClient.__findConnections</h4>
258 <b>__findConnections</b>(<i>nick</i>)
259
260 <p>
261 Private method to get a list of connection given a nick name.
262 </p>
263 <dl>
264
265 <dt><i>nick</i></dt>
266 <dd>
267 nick name in the format of self.nickName() (string)
268 </dd>
269 </dl>
270 <dl>
271 <dt>Return:</dt>
272 <dd>
273 list of references to the connection objects (list of
274 Connection)
275 </dd>
276 </dl>
277 <a NAME="CooperationClient.__getParticipants" ID="CooperationClient.__getParticipants"></a>
278 <h4>CooperationClient.__getParticipants</h4>
279 <b>__getParticipants</b>(<i>reqConnection</i>)
280
281 <p>
282 Private slot to handle the request for a list of participants.
283 </p>
284 <dl>
285
286 <dt><i>reqConnection</i> (Connection)</dt>
287 <dd>
288 reference to the connection to get
289 participants for
290 </dd>
291 </dl>
292 <a NAME="CooperationClient.__newConnection" ID="CooperationClient.__newConnection"></a>
293 <h4>CooperationClient.__newConnection</h4>
294 <b>__newConnection</b>(<i>connection</i>)
295
296 <p>
297 Private slot to handle a new connection.
298 </p>
299 <dl>
300
301 <dt><i>connection</i></dt>
302 <dd>
303 reference to the new connection (Connection)
304 </dd>
305 </dl>
306 <a NAME="CooperationClient.__processParticipants" ID="CooperationClient.__processParticipants"></a>
307 <h4>CooperationClient.__processParticipants</h4>
308 <b>__processParticipants</b>(<i>participants</i>)
309
310 <p>
311 Private slot to handle the receipt of a list of participants.
312 </p>
313 <dl>
314
315 <dt><i>participants</i></dt>
316 <dd>
317 list of participants (list of strings of
318 "host:port")
319 </dd>
320 </dl>
321 <a NAME="CooperationClient.__readyForUse" ID="CooperationClient.__readyForUse"></a>
322 <h4>CooperationClient.__readyForUse</h4>
323 <b>__readyForUse</b>(<i>connection</i>)
324
325 <p>
326 Private slot to handle a connection getting ready for use.
327 </p>
328 <dl>
329
330 <dt><i>connection</i> (Connection)</dt>
331 <dd>
332 connection that got ready for use
333 </dd>
334 </dl>
335 <a NAME="CooperationClient.banKickUser" ID="CooperationClient.banKickUser"></a>
336 <h4>CooperationClient.banKickUser</h4>
337 <b>banKickUser</b>(<i>nick</i>)
338
339 <p>
340 Public method to ban and kick a user by its nick name.
341 </p>
342 <dl>
343
344 <dt><i>nick</i></dt>
345 <dd>
346 nick name in the format of self.nickName() (string)
347 </dd>
348 </dl>
349 <a NAME="CooperationClient.banUser" ID="CooperationClient.banUser"></a>
350 <h4>CooperationClient.banUser</h4>
351 <b>banUser</b>(<i>nick</i>)
352
353 <p>
354 Public method to ban a user by its nick name.
355 </p>
356 <dl>
357
358 <dt><i>nick</i></dt>
359 <dd>
360 nick name in the format of self.nickName() (string)
361 </dd>
362 </dl>
363 <a NAME="CooperationClient.chatWidget" ID="CooperationClient.chatWidget"></a>
364 <h4>CooperationClient.chatWidget</h4>
365 <b>chatWidget</b>(<i></i>)
366
367 <p>
368 Public method to get a reference to the chat widget.
369 </p>
370 <dl>
371 <dt>Return:</dt>
372 <dd>
373 reference to the chat widget (ChatWidget)
374 </dd>
375 </dl>
376 <a NAME="CooperationClient.close" ID="CooperationClient.close"></a>
377 <h4>CooperationClient.close</h4>
378 <b>close</b>(<i></i>)
379
380 <p>
381 Public method to close all connections and stop listening.
382 </p>
383 <a NAME="CooperationClient.connectToHost" ID="CooperationClient.connectToHost"></a>
384 <h4>CooperationClient.connectToHost</h4>
385 <b>connectToHost</b>(<i>host, port</i>)
386
387 <p>
388 Public method to connect to a host.
389 </p>
390 <dl>
391
392 <dt><i>host</i></dt>
393 <dd>
394 host to connect to (string)
395 </dd>
396 <dt><i>port</i></dt>
397 <dd>
398 port to connect to (integer)
399 </dd>
400 </dl>
401 <a NAME="CooperationClient.disconnectConnections" ID="CooperationClient.disconnectConnections"></a>
402 <h4>CooperationClient.disconnectConnections</h4>
403 <b>disconnectConnections</b>(<i></i>)
404
405 <p>
406 Public slot to disconnect from the chat network.
407 </p>
408 <a NAME="CooperationClient.errorString" ID="CooperationClient.errorString"></a>
409 <h4>CooperationClient.errorString</h4>
410 <b>errorString</b>(<i></i>)
411
412 <p>
413 Public method to get a human readable error message about the last
414 server error.
415 </p>
416 <dl>
417 <dt>Return:</dt>
418 <dd>
419 human readable error message about the last server error
420 (string)
421 </dd>
422 </dl>
423 <a NAME="CooperationClient.hasConnection" ID="CooperationClient.hasConnection"></a>
424 <h4>CooperationClient.hasConnection</h4>
425 <b>hasConnection</b>(<i>senderIp, senderPort=-1</i>)
426
427 <p>
428 Public method to check for an existing connection.
429 </p>
430 <dl>
431
432 <dt><i>senderIp</i></dt>
433 <dd>
434 address of the sender (QHostAddress)
435 </dd>
436 <dt><i>senderPort</i></dt>
437 <dd>
438 port of the sender (integer)
439 </dd>
440 </dl>
441 <dl>
442 <dt>Return:</dt>
443 <dd>
444 flag indicating an existing connection (boolean)
445 </dd>
446 </dl>
447 <a NAME="CooperationClient.hasConnections" ID="CooperationClient.hasConnections"></a>
448 <h4>CooperationClient.hasConnections</h4>
449 <b>hasConnections</b>(<i></i>)
450
451 <p>
452 Public method to check, if there are any connections established.
453 </p>
454 <dl>
455 <dt>Return:</dt>
456 <dd>
457 flag indicating the presence of connections (boolean)
458 </dd>
459 </dl>
460 <a NAME="CooperationClient.isListening" ID="CooperationClient.isListening"></a>
461 <h4>CooperationClient.isListening</h4>
462 <b>isListening</b>(<i></i>)
463
464 <p>
465 Public method to check, if the client is listening for connections.
466 </p>
467 <dl>
468 <dt>Return:</dt>
469 <dd>
470 flag indicating the listening state (boolean)
471 </dd>
472 </dl>
473 <a NAME="CooperationClient.kickUser" ID="CooperationClient.kickUser"></a>
474 <h4>CooperationClient.kickUser</h4>
475 <b>kickUser</b>(<i>nick</i>)
476
477 <p>
478 Public method to kick a user by its nick name.
479 </p>
480 <dl>
481
482 <dt><i>nick</i></dt>
483 <dd>
484 nick name in the format of self.nickName() (string)
485 </dd>
486 </dl>
487 <a NAME="CooperationClient.nickName" ID="CooperationClient.nickName"></a>
488 <h4>CooperationClient.nickName</h4>
489 <b>nickName</b>(<i></i>)
490
491 <p>
492 Public method to get the nick name.
493 </p>
494 <dl>
495 <dt>Return:</dt>
496 <dd>
497 nick name (string)
498 </dd>
499 </dl>
500 <a NAME="CooperationClient.removeConnection" ID="CooperationClient.removeConnection"></a>
501 <h4>CooperationClient.removeConnection</h4>
502 <b>removeConnection</b>(<i>connection</i>)
503
504 <p>
505 Public method to remove a connection.
506 </p>
507 <dl>
508
509 <dt><i>connection</i></dt>
510 <dd>
511 reference to the connection to be removed
512 (Connection)
513 </dd>
514 </dl>
515 <a NAME="CooperationClient.sendEditorCommand" ID="CooperationClient.sendEditorCommand"></a>
516 <h4>CooperationClient.sendEditorCommand</h4>
517 <b>sendEditorCommand</b>(<i>projectHash, filename, message</i>)
518
519 <p>
520 Public method to send an editor command.
521 </p>
522 <dl>
523
524 <dt><i>projectHash</i></dt>
525 <dd>
526 hash of the project (string)
527 </dd>
528 <dt><i>filename</i></dt>
529 <dd>
530 project relative universal file name of
531 the sending editor (string)
532 </dd>
533 <dt><i>message</i></dt>
534 <dd>
535 editor command to be sent (string)
536 </dd>
537 </dl>
538 <a NAME="CooperationClient.sendMessage" ID="CooperationClient.sendMessage"></a>
539 <h4>CooperationClient.sendMessage</h4>
540 <b>sendMessage</b>(<i>message</i>)
541
542 <p>
543 Public method to send a message.
544 </p>
545 <dl>
546
547 <dt><i>message</i></dt>
548 <dd>
549 message to be sent (string)
550 </dd>
551 </dl>
552 <a NAME="CooperationClient.startListening" ID="CooperationClient.startListening"></a>
553 <h4>CooperationClient.startListening</h4>
554 <b>startListening</b>(<i>port=-1</i>)
555
556 <p>
557 Public method to start listening for new connections.
558 </p>
559 <dl>
560
561 <dt><i>port</i></dt>
562 <dd>
563 port to listen on (integer)
564 </dd>
565 </dl>
566 <dl>
567 <dt>Return:</dt>
568 <dd>
569 tuple giving a flag indicating success (boolean) and
570 the port the server listens on
571 </dd>
572 </dl>
573 <div align="right"><a href="#top">Up</a></div>
574 <hr />
575 </body></html>

eric ide

mercurial