1 | /*
|
---|
2 | * im.h - XMPP "IM" library API
|
---|
3 | * Copyright (C) 2003 Justin Karneges
|
---|
4 | *
|
---|
5 | * This library is free software; you can redistribute it and/or
|
---|
6 | * modify it under the terms of the GNU Lesser General Public
|
---|
7 | * License as published by the Free Software Foundation; either
|
---|
8 | * version 2.1 of the License, or (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This library is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
13 | * Lesser General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU Lesser General Public
|
---|
16 | * License along with this library; if not, write to the Free Software
|
---|
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
18 | *
|
---|
19 | */
|
---|
20 |
|
---|
21 | #ifndef XMPP_IM_H
|
---|
22 | #define XMPP_IM_H
|
---|
23 |
|
---|
24 | #include<qdatetime.h>
|
---|
25 | #include"xmpp.h"
|
---|
26 |
|
---|
27 | namespace XMPP
|
---|
28 | {
|
---|
29 | class Url
|
---|
30 | {
|
---|
31 | public:
|
---|
32 | Url(const QString &url="", const QString &desc="");
|
---|
33 | Url(const Url &);
|
---|
34 | Url & operator=(const Url &);
|
---|
35 | ~Url();
|
---|
36 |
|
---|
37 | QString url() const;
|
---|
38 | QString desc() const;
|
---|
39 |
|
---|
40 | void setUrl(const QString &);
|
---|
41 | void setDesc(const QString &);
|
---|
42 |
|
---|
43 | private:
|
---|
44 | class Private;
|
---|
45 | Private *d;
|
---|
46 | };
|
---|
47 |
|
---|
48 | typedef QValueList<Url> UrlList;
|
---|
49 | typedef QMap<QString, QString> StringMap;
|
---|
50 | typedef enum { OfflineEvent, DeliveredEvent, DisplayedEvent,
|
---|
51 | ComposingEvent, CancelEvent } MsgEvent;
|
---|
52 |
|
---|
53 | class Message
|
---|
54 | {
|
---|
55 | public:
|
---|
56 | Message(const Jid &to="");
|
---|
57 | Message(const Message &from);
|
---|
58 | Message & operator=(const Message &from);
|
---|
59 | ~Message();
|
---|
60 |
|
---|
61 | Jid to() const;
|
---|
62 | Jid from() const;
|
---|
63 | QString id() const;
|
---|
64 | QString type() const;
|
---|
65 | QString lang() const;
|
---|
66 | QString subject(const QString &lang="") const;
|
---|
67 | QString body(const QString &lang="") const;
|
---|
68 | QString thread() const;
|
---|
69 | Stanza::Error error() const;
|
---|
70 |
|
---|
71 | void setTo(const Jid &j);
|
---|
72 | void setFrom(const Jid &j);
|
---|
73 | void setId(const QString &s);
|
---|
74 | void setType(const QString &s);
|
---|
75 | void setLang(const QString &s);
|
---|
76 | void setSubject(const QString &s, const QString &lang="");
|
---|
77 | void setBody(const QString &s, const QString &lang="");
|
---|
78 | void setThread(const QString &s);
|
---|
79 | void setError(const Stanza::Error &err);
|
---|
80 |
|
---|
81 | // JEP-0091
|
---|
82 | QDateTime timeStamp() const;
|
---|
83 | void setTimeStamp(const QDateTime &ts);
|
---|
84 |
|
---|
85 | // JEP-0066
|
---|
86 | UrlList urlList() const;
|
---|
87 | void urlAdd(const Url &u);
|
---|
88 | void urlsClear();
|
---|
89 | void setUrlList(const UrlList &list);
|
---|
90 |
|
---|
91 | // JEP-0022
|
---|
92 | QString eventId() const;
|
---|
93 | void setEventId(const QString& id);
|
---|
94 | bool containsEvents() const;
|
---|
95 | bool containsEvent(MsgEvent e) const;
|
---|
96 | void addEvent(MsgEvent e);
|
---|
97 |
|
---|
98 | // JEP-0027
|
---|
99 | QString xencrypted() const;
|
---|
100 | void setXEncrypted(const QString &s);
|
---|
101 |
|
---|
102 | // Obsolete invitation
|
---|
103 | QString invite() const;
|
---|
104 | void setInvite(const QString &s);
|
---|
105 |
|
---|
106 | // for compatibility. delete me later
|
---|
107 | bool spooled() const;
|
---|
108 | void setSpooled(bool);
|
---|
109 | bool wasEncrypted() const;
|
---|
110 | void setWasEncrypted(bool);
|
---|
111 |
|
---|
112 | Stanza toStanza(Stream *stream) const;
|
---|
113 | bool fromStanza(const Stanza &s, int tzoffset);
|
---|
114 |
|
---|
115 | private:
|
---|
116 | class Private;
|
---|
117 | Private *d;
|
---|
118 | };
|
---|
119 |
|
---|
120 | class Subscription
|
---|
121 | {
|
---|
122 | public:
|
---|
123 | enum SubType { None, To, From, Both, Remove };
|
---|
124 |
|
---|
125 | Subscription(SubType type=None);
|
---|
126 |
|
---|
127 | int type() const;
|
---|
128 |
|
---|
129 | QString toString() const;
|
---|
130 | bool fromString(const QString &);
|
---|
131 |
|
---|
132 | private:
|
---|
133 | SubType value;
|
---|
134 | };
|
---|
135 |
|
---|
136 | class Status
|
---|
137 | {
|
---|
138 | public:
|
---|
139 | Status(const QString &show="", const QString &status="", int priority=0, bool available=true);
|
---|
140 | ~Status();
|
---|
141 |
|
---|
142 | int priority() const;
|
---|
143 | const QString & show() const;
|
---|
144 | const QString & status() const;
|
---|
145 | QDateTime timeStamp() const;
|
---|
146 | const QString & keyID() const;
|
---|
147 | bool isAvailable() const;
|
---|
148 | bool isAway() const;
|
---|
149 | bool isInvisible() const;
|
---|
150 | bool hasError() const;
|
---|
151 | int errorCode() const;
|
---|
152 | const QString & errorString() const;
|
---|
153 |
|
---|
154 | const QString & xsigned() const;
|
---|
155 | const QString & songTitle() const;
|
---|
156 |
|
---|
157 | void setPriority(int);
|
---|
158 | void setShow(const QString &);
|
---|
159 | void setStatus(const QString &);
|
---|
160 | void setTimeStamp(const QDateTime &);
|
---|
161 | void setKeyID(const QString &);
|
---|
162 | void setIsAvailable(bool);
|
---|
163 | void setIsInvisible(bool);
|
---|
164 | void setError(int, const QString &);
|
---|
165 |
|
---|
166 | void setXSigned(const QString &);
|
---|
167 | void setSongTitle(const QString &);
|
---|
168 |
|
---|
169 | private:
|
---|
170 | int v_priority;
|
---|
171 | QString v_show, v_status, v_key;
|
---|
172 | QDateTime v_timeStamp;
|
---|
173 | bool v_isAvailable;
|
---|
174 | bool v_isInvisible;
|
---|
175 |
|
---|
176 | QString v_xsigned;
|
---|
177 | // gabber song extension
|
---|
178 | QString v_songTitle;
|
---|
179 |
|
---|
180 | int ecode;
|
---|
181 | QString estr;
|
---|
182 |
|
---|
183 | class Private;
|
---|
184 | Private *d;
|
---|
185 | };
|
---|
186 |
|
---|
187 | class Resource
|
---|
188 | {
|
---|
189 | public:
|
---|
190 | Resource(const QString &name="", const Status &s=Status());
|
---|
191 | ~Resource();
|
---|
192 |
|
---|
193 | const QString & name() const;
|
---|
194 | int priority() const;
|
---|
195 | const Status & status() const;
|
---|
196 |
|
---|
197 | void setName(const QString &);
|
---|
198 | void setStatus(const Status &);
|
---|
199 |
|
---|
200 | private:
|
---|
201 | QString v_name;
|
---|
202 | Status v_status;
|
---|
203 |
|
---|
204 | class ResourcePrivate *d;
|
---|
205 | };
|
---|
206 |
|
---|
207 | class ResourceList : public QValueList<Resource>
|
---|
208 | {
|
---|
209 | public:
|
---|
210 | ResourceList();
|
---|
211 | ~ResourceList();
|
---|
212 |
|
---|
213 | ResourceList::Iterator find(const QString &);
|
---|
214 | ResourceList::Iterator priority();
|
---|
215 |
|
---|
216 | ResourceList::ConstIterator find(const QString &) const;
|
---|
217 | ResourceList::ConstIterator priority() const;
|
---|
218 |
|
---|
219 | private:
|
---|
220 | class ResourceListPrivate *d;
|
---|
221 | };
|
---|
222 |
|
---|
223 | class RosterItem
|
---|
224 | {
|
---|
225 | public:
|
---|
226 | RosterItem(const Jid &jid="");
|
---|
227 | virtual ~RosterItem();
|
---|
228 |
|
---|
229 | const Jid & jid() const;
|
---|
230 | const QString & name() const;
|
---|
231 | const QStringList & groups() const;
|
---|
232 | const Subscription & subscription() const;
|
---|
233 | const QString & ask() const;
|
---|
234 | bool isPush() const;
|
---|
235 | bool inGroup(const QString &) const;
|
---|
236 |
|
---|
237 | virtual void setJid(const Jid &);
|
---|
238 | void setName(const QString &);
|
---|
239 | void setGroups(const QStringList &);
|
---|
240 | void setSubscription(const Subscription &);
|
---|
241 | void setAsk(const QString &);
|
---|
242 | void setIsPush(bool);
|
---|
243 | bool addGroup(const QString &);
|
---|
244 | bool removeGroup(const QString &);
|
---|
245 |
|
---|
246 | QDomElement toXml(QDomDocument *) const;
|
---|
247 | bool fromXml(const QDomElement &);
|
---|
248 |
|
---|
249 | private:
|
---|
250 | Jid v_jid;
|
---|
251 | QString v_name;
|
---|
252 | QStringList v_groups;
|
---|
253 | Subscription v_subscription;
|
---|
254 | QString v_ask;
|
---|
255 | bool v_push;
|
---|
256 |
|
---|
257 | class RosterItemPrivate *d;
|
---|
258 | };
|
---|
259 |
|
---|
260 | class Roster : public QValueList<RosterItem>
|
---|
261 | {
|
---|
262 | public:
|
---|
263 | Roster();
|
---|
264 | ~Roster();
|
---|
265 |
|
---|
266 | Roster::Iterator find(const Jid &);
|
---|
267 | Roster::ConstIterator find(const Jid &) const;
|
---|
268 |
|
---|
269 | private:
|
---|
270 | class RosterPrivate *d;
|
---|
271 | };
|
---|
272 |
|
---|
273 | class Features
|
---|
274 | {
|
---|
275 | public:
|
---|
276 | Features();
|
---|
277 | Features(const QStringList &);
|
---|
278 | Features(const QString &);
|
---|
279 | ~Features();
|
---|
280 |
|
---|
281 | QStringList list() const; // actual featurelist
|
---|
282 | void setList(const QStringList &);
|
---|
283 |
|
---|
284 | // features
|
---|
285 | bool canRegister() const;
|
---|
286 | bool canSearch() const;
|
---|
287 | bool canGroupchat() const;
|
---|
288 | bool canDisco() const;
|
---|
289 | bool isGateway() const;
|
---|
290 | bool haveVCard() const;
|
---|
291 |
|
---|
292 | enum FeatureID {
|
---|
293 | FID_Invalid = -1,
|
---|
294 | FID_None,
|
---|
295 | FID_Register,
|
---|
296 | FID_Search,
|
---|
297 | FID_Groupchat,
|
---|
298 | FID_Disco,
|
---|
299 | FID_Gateway,
|
---|
300 | FID_VCard,
|
---|
301 |
|
---|
302 | // private Psi actions
|
---|
303 | FID_Add
|
---|
304 | };
|
---|
305 |
|
---|
306 | // useful functions
|
---|
307 | bool test(const QStringList &) const;
|
---|
308 |
|
---|
309 | QString name() const;
|
---|
310 | static QString name(long id);
|
---|
311 | static QString name(const QString &feature);
|
---|
312 |
|
---|
313 | long id() const;
|
---|
314 | static long id(const QString &feature);
|
---|
315 | static QString feature(long id);
|
---|
316 |
|
---|
317 | class FeatureName;
|
---|
318 | private:
|
---|
319 | QStringList _list;
|
---|
320 | };
|
---|
321 |
|
---|
322 | class AgentItem
|
---|
323 | {
|
---|
324 | public:
|
---|
325 | AgentItem() { }
|
---|
326 |
|
---|
327 | const Jid & jid() const { return v_jid; }
|
---|
328 | const QString & name() const { return v_name; }
|
---|
329 | const QString & category() const { return v_category; }
|
---|
330 | const QString & type() const { return v_type; }
|
---|
331 | const Features & features() const { return v_features; }
|
---|
332 |
|
---|
333 | void setJid(const Jid &j) { v_jid = j; }
|
---|
334 | void setName(const QString &n) { v_name = n; }
|
---|
335 | void setCategory(const QString &c) { v_category = c; }
|
---|
336 | void setType(const QString &t) { v_type = t; }
|
---|
337 | void setFeatures(const Features &f) { v_features = f; }
|
---|
338 |
|
---|
339 | private:
|
---|
340 | Jid v_jid;
|
---|
341 | QString v_name, v_category, v_type;
|
---|
342 | Features v_features;
|
---|
343 | };
|
---|
344 |
|
---|
345 | typedef QValueList<AgentItem> AgentList;
|
---|
346 |
|
---|
347 | class DiscoItem
|
---|
348 | {
|
---|
349 | public:
|
---|
350 | DiscoItem();
|
---|
351 | ~DiscoItem();
|
---|
352 |
|
---|
353 | const Jid &jid() const;
|
---|
354 | const QString &node() const;
|
---|
355 | const QString &name() const;
|
---|
356 |
|
---|
357 | void setJid(const Jid &);
|
---|
358 | void setName(const QString &);
|
---|
359 | void setNode(const QString &);
|
---|
360 |
|
---|
361 | enum Action {
|
---|
362 | None = 0,
|
---|
363 | Remove,
|
---|
364 | Update
|
---|
365 | };
|
---|
366 |
|
---|
367 | Action action() const;
|
---|
368 | void setAction(Action);
|
---|
369 |
|
---|
370 | const Features &features() const;
|
---|
371 | void setFeatures(const Features &);
|
---|
372 |
|
---|
373 | struct Identity
|
---|
374 | {
|
---|
375 | QString category;
|
---|
376 | QString name;
|
---|
377 | QString type;
|
---|
378 | };
|
---|
379 |
|
---|
380 | typedef QValueList<Identity> Identities;
|
---|
381 |
|
---|
382 | const Identities &identities() const;
|
---|
383 | void setIdentities(const Identities &);
|
---|
384 |
|
---|
385 | // some useful helper functions
|
---|
386 | static Action string2action(QString s);
|
---|
387 | static QString action2string(Action a);
|
---|
388 |
|
---|
389 | DiscoItem & operator= (const DiscoItem &);
|
---|
390 | DiscoItem(const DiscoItem &);
|
---|
391 |
|
---|
392 | operator AgentItem() const { return toAgentItem(); }
|
---|
393 | AgentItem toAgentItem() const;
|
---|
394 | void fromAgentItem(const AgentItem &);
|
---|
395 |
|
---|
396 | private:
|
---|
397 | class Private;
|
---|
398 | Private *d;
|
---|
399 | };
|
---|
400 |
|
---|
401 | typedef QValueList<DiscoItem> DiscoList;
|
---|
402 |
|
---|
403 | class FormField
|
---|
404 | {
|
---|
405 | public:
|
---|
406 | enum { username, nick, password, name, first, last, email, address, city, state, zip, phone, url, date, misc };
|
---|
407 | FormField(const QString &type="", const QString &value="");
|
---|
408 | ~FormField();
|
---|
409 |
|
---|
410 | int type() const;
|
---|
411 | QString fieldName() const;
|
---|
412 | QString realName() const;
|
---|
413 | bool isSecret() const;
|
---|
414 | const QString & value() const;
|
---|
415 | void setType(int);
|
---|
416 | bool setType(const QString &);
|
---|
417 | void setValue(const QString &);
|
---|
418 |
|
---|
419 | private:
|
---|
420 | int tagNameToType(const QString &) const;
|
---|
421 | QString typeToTagName(int) const;
|
---|
422 |
|
---|
423 | int v_type;
|
---|
424 | QString v_value;
|
---|
425 |
|
---|
426 | class Private;
|
---|
427 | Private *d;
|
---|
428 | };
|
---|
429 |
|
---|
430 | class Form : public QValueList<FormField>
|
---|
431 | {
|
---|
432 | public:
|
---|
433 | Form(const Jid &j="");
|
---|
434 | ~Form();
|
---|
435 |
|
---|
436 | Jid jid() const;
|
---|
437 | QString instructions() const;
|
---|
438 | QString key() const;
|
---|
439 | void setJid(const Jid &);
|
---|
440 | void setInstructions(const QString &);
|
---|
441 | void setKey(const QString &);
|
---|
442 |
|
---|
443 | private:
|
---|
444 | Jid v_jid;
|
---|
445 | QString v_instructions, v_key;
|
---|
446 |
|
---|
447 | class Private;
|
---|
448 | Private *d;
|
---|
449 | };
|
---|
450 |
|
---|
451 | class SearchResult
|
---|
452 | {
|
---|
453 | public:
|
---|
454 | SearchResult(const Jid &jid="");
|
---|
455 | ~SearchResult();
|
---|
456 |
|
---|
457 | const Jid & jid() const;
|
---|
458 | const QString & nick() const;
|
---|
459 | const QString & first() const;
|
---|
460 | const QString & last() const;
|
---|
461 | const QString & email() const;
|
---|
462 |
|
---|
463 | void setJid(const Jid &);
|
---|
464 | void setNick(const QString &);
|
---|
465 | void setFirst(const QString &);
|
---|
466 | void setLast(const QString &);
|
---|
467 | void setEmail(const QString &);
|
---|
468 |
|
---|
469 | private:
|
---|
470 | Jid v_jid;
|
---|
471 | QString v_nick, v_first, v_last, v_email;
|
---|
472 | };
|
---|
473 |
|
---|
474 | class Client;
|
---|
475 | class LiveRosterItem;
|
---|
476 | class LiveRoster;
|
---|
477 | class S5BManager;
|
---|
478 | class IBBManager;
|
---|
479 | class JidLinkManager;
|
---|
480 | class FileTransferManager;
|
---|
481 |
|
---|
482 | class Task : public QObject
|
---|
483 | {
|
---|
484 | Q_OBJECT
|
---|
485 | public:
|
---|
486 | enum { ErrDisc };
|
---|
487 | Task(Task *parent);
|
---|
488 | Task(Client *, bool isRoot);
|
---|
489 | virtual ~Task();
|
---|
490 |
|
---|
491 | Task *parent() const;
|
---|
492 | Client *client() const;
|
---|
493 | QDomDocument *doc() const;
|
---|
494 | QString id() const;
|
---|
495 |
|
---|
496 | bool success() const;
|
---|
497 | int statusCode() const;
|
---|
498 | const QString & statusString() const;
|
---|
499 |
|
---|
500 | void go(bool autoDelete=false);
|
---|
501 | virtual bool take(const QDomElement &);
|
---|
502 | void safeDelete();
|
---|
503 |
|
---|
504 | signals:
|
---|
505 | void finished();
|
---|
506 |
|
---|
507 | protected:
|
---|
508 | virtual void onGo();
|
---|
509 | virtual void onDisconnect();
|
---|
510 | void send(const QDomElement &);
|
---|
511 | void setSuccess(int code=0, const QString &str="");
|
---|
512 | void setError(const QDomElement &);
|
---|
513 | void setError(int code=0, const QString &str="");
|
---|
514 | void debug(const char *, ...);
|
---|
515 | void debug(const QString &);
|
---|
516 | bool iqVerify(const QDomElement &x, const Jid &to, const QString &id, const QString &xmlns="");
|
---|
517 |
|
---|
518 | private slots:
|
---|
519 | void clientDisconnected();
|
---|
520 | void done();
|
---|
521 |
|
---|
522 | private:
|
---|
523 | void init();
|
---|
524 |
|
---|
525 | class TaskPrivate;
|
---|
526 | TaskPrivate *d;
|
---|
527 | };
|
---|
528 |
|
---|
529 | class Client : public QObject
|
---|
530 | {
|
---|
531 | Q_OBJECT
|
---|
532 |
|
---|
533 | public:
|
---|
534 | Client(QObject *parent=0);
|
---|
535 | ~Client();
|
---|
536 |
|
---|
537 | bool isActive() const;
|
---|
538 | void connectToServer(ClientStream *s, const Jid &j, bool auth=true);
|
---|
539 | void start(const QString &host, const QString &user, const QString &pass, const QString &resource);
|
---|
540 | void close(bool fast=false);
|
---|
541 |
|
---|
542 | Stream & stream();
|
---|
543 | const LiveRoster & roster() const;
|
---|
544 | const ResourceList & resourceList() const;
|
---|
545 |
|
---|
546 | void send(const QDomElement &);
|
---|
547 | void send(const QString &);
|
---|
548 |
|
---|
549 | QString host() const;
|
---|
550 | QString user() const;
|
---|
551 | QString pass() const;
|
---|
552 | QString resource() const;
|
---|
553 | Jid jid() const;
|
---|
554 |
|
---|
555 | void rosterRequest();
|
---|
556 | void sendMessage(const Message &);
|
---|
557 | void sendSubscription(const Jid &, const QString &);
|
---|
558 | void setPresence(const Status &);
|
---|
559 |
|
---|
560 | void debug(const QString &);
|
---|
561 | QString genUniqueId();
|
---|
562 | Task *rootTask();
|
---|
563 | QDomDocument *doc() const;
|
---|
564 |
|
---|
565 | QString OSName() const;
|
---|
566 | QString timeZone() const;
|
---|
567 | int timeZoneOffset() const;
|
---|
568 | QString clientName() const;
|
---|
569 | QString clientVersion() const;
|
---|
570 |
|
---|
571 | void setOSName(const QString &);
|
---|
572 | void setTimeZone(const QString &, int);
|
---|
573 | void setClientName(const QString &);
|
---|
574 | void setClientVersion(const QString &);
|
---|
575 |
|
---|
576 | S5BManager *s5bManager() const;
|
---|
577 | IBBManager *ibbManager() const;
|
---|
578 | JidLinkManager *jidLinkManager() const;
|
---|
579 |
|
---|
580 | void setFileTransferEnabled(bool b);
|
---|
581 | FileTransferManager *fileTransferManager() const;
|
---|
582 |
|
---|
583 | bool groupChatJoin(const QString &host, const QString &room, const QString &nick);
|
---|
584 | void groupChatSetStatus(const QString &host, const QString &room, const Status &);
|
---|
585 | void groupChatChangeNick(const QString &host, const QString &room, const QString &nick, const Status &);
|
---|
586 | void groupChatLeave(const QString &host, const QString &room);
|
---|
587 |
|
---|
588 | signals:
|
---|
589 | void activated();
|
---|
590 | void disconnected();
|
---|
591 | //void authFinished(bool, int, const QString &);
|
---|
592 | void rosterRequestFinished(bool, int, const QString &);
|
---|
593 | void rosterItemAdded(const RosterItem &);
|
---|
594 | void rosterItemUpdated(const RosterItem &);
|
---|
595 | void rosterItemRemoved(const RosterItem &);
|
---|
596 | void resourceAvailable(const Jid &, const Resource &);
|
---|
597 | void resourceUnavailable(const Jid &, const Resource &);
|
---|
598 | void presenceError(const Jid &, int, const QString &);
|
---|
599 | void subscription(const Jid &, const QString &);
|
---|
600 | void messageReceived(const Message &);
|
---|
601 | void debugText(const QString &);
|
---|
602 | void xmlIncoming(const QString &);
|
---|
603 | void xmlOutgoing(const QString &);
|
---|
604 | void groupChatJoined(const Jid &);
|
---|
605 | void groupChatLeft(const Jid &);
|
---|
606 | void groupChatPresence(const Jid &, const Status &);
|
---|
607 | void groupChatError(const Jid &, int, const QString &);
|
---|
608 |
|
---|
609 | void incomingJidLink();
|
---|
610 |
|
---|
611 | private slots:
|
---|
612 | //void streamConnected();
|
---|
613 | //void streamHandshaken();
|
---|
614 | //void streamError(const StreamError &);
|
---|
615 | //void streamSSLCertificateReady(const QSSLCert &);
|
---|
616 | //void streamCloseFinished();
|
---|
617 | void streamError(int);
|
---|
618 | void streamReadyRead();
|
---|
619 | void streamIncomingXml(const QString &);
|
---|
620 | void streamOutgoingXml(const QString &);
|
---|
621 |
|
---|
622 | void slotRosterRequestFinished();
|
---|
623 |
|
---|
624 | // basic daemons
|
---|
625 | void ppSubscription(const Jid &, const QString &);
|
---|
626 | void ppPresence(const Jid &, const Status &);
|
---|
627 | void pmMessage(const Message &);
|
---|
628 | void prRoster(const Roster &);
|
---|
629 |
|
---|
630 | void s5b_incomingReady();
|
---|
631 | void ibb_incomingReady();
|
---|
632 |
|
---|
633 | public:
|
---|
634 | class GroupChat;
|
---|
635 | private:
|
---|
636 | void cleanup();
|
---|
637 | void distribute(const QDomElement &);
|
---|
638 | void importRoster(const Roster &);
|
---|
639 | void importRosterItem(const RosterItem &);
|
---|
640 | void updateSelfPresence(const Jid &, const Status &);
|
---|
641 | void updatePresence(LiveRosterItem *, const Jid &, const Status &);
|
---|
642 |
|
---|
643 | class ClientPrivate;
|
---|
644 | ClientPrivate *d;
|
---|
645 | };
|
---|
646 |
|
---|
647 | class LiveRosterItem : public RosterItem
|
---|
648 | {
|
---|
649 | public:
|
---|
650 | LiveRosterItem(const Jid &j="");
|
---|
651 | LiveRosterItem(const RosterItem &);
|
---|
652 | ~LiveRosterItem();
|
---|
653 |
|
---|
654 | void setRosterItem(const RosterItem &);
|
---|
655 |
|
---|
656 | ResourceList & resourceList();
|
---|
657 | ResourceList::Iterator priority();
|
---|
658 |
|
---|
659 | const ResourceList & resourceList() const;
|
---|
660 | ResourceList::ConstIterator priority() const;
|
---|
661 |
|
---|
662 | bool isAvailable() const;
|
---|
663 | const Status & lastUnavailableStatus() const;
|
---|
664 | bool flagForDelete() const;
|
---|
665 |
|
---|
666 | void setLastUnavailableStatus(const Status &);
|
---|
667 | void setFlagForDelete(bool);
|
---|
668 |
|
---|
669 | private:
|
---|
670 | ResourceList v_resourceList;
|
---|
671 | Status v_lastUnavailableStatus;
|
---|
672 | bool v_flagForDelete;
|
---|
673 |
|
---|
674 | class LiveRosterItemPrivate;
|
---|
675 | LiveRosterItemPrivate *d;
|
---|
676 | };
|
---|
677 |
|
---|
678 | class LiveRoster : public QValueList<LiveRosterItem>
|
---|
679 | {
|
---|
680 | public:
|
---|
681 | LiveRoster();
|
---|
682 | ~LiveRoster();
|
---|
683 |
|
---|
684 | void flagAllForDelete();
|
---|
685 | LiveRoster::Iterator find(const Jid &, bool compareRes=true);
|
---|
686 | LiveRoster::ConstIterator find(const Jid &, bool compareRes=true) const;
|
---|
687 |
|
---|
688 | private:
|
---|
689 | class LiveRosterPrivate;
|
---|
690 | LiveRosterPrivate *d;
|
---|
691 | };
|
---|
692 | }
|
---|
693 |
|
---|
694 | #endif
|
---|