Slightly improve bytestreams management
[iris.git] / src / xmpp / xmpp-im / xmpp_tasks.h
blobee0e467d5307cc467278b559af7fd9a16f8c5b13
1 /*
2 * tasks.h - basic tasks
3 * Copyright (C) 2001, 2002 Justin Karneges
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.
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.
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
21 #ifndef JABBER_TASKS_H
22 #define JABBER_TASKS_H
24 #include <qstring.h>
25 #include <qdom.h>
26 //Added by qt3to4:
27 #include <QList>
29 #include "im.h"
30 #include "xmpp_vcard.h"
31 #include "xmpp_discoinfotask.h"
33 namespace XMPP
35 class Roster;
36 class Status;
37 class BoBData;
39 class JT_Register : public Task
41 Q_OBJECT
42 public:
43 JT_Register(Task *parent);
44 ~JT_Register();
46 // OLd style registration
47 void reg(const QString &user, const QString &pass);
49 void changepw(const QString &pass);
50 void unreg(const Jid &j="");
52 const Form & form() const;
53 bool hasXData() const;
54 const XData& xdata() const;
55 void getForm(const Jid &);
56 void setForm(const Form &);
57 void setForm(const Jid&, const XData &);
59 void onGo();
60 bool take(const QDomElement &);
62 private:
63 QDomElement iq;
64 Jid to;
66 class Private;
67 Private *d;
70 class JT_UnRegister : public Task
72 Q_OBJECT
73 public:
74 JT_UnRegister(Task *parent);
75 ~JT_UnRegister();
77 void unreg(const Jid &);
79 void onGo();
81 private slots:
82 void getFormFinished();
83 void unregFinished();
85 private:
86 class Private;
87 Private *d;
90 class JT_Roster : public Task
92 Q_OBJECT
93 public:
94 JT_Roster(Task *parent);
95 ~JT_Roster();
97 void get();
98 void set(const Jid &, const QString &name, const QStringList &groups);
99 void remove(const Jid &);
101 const Roster & roster() const;
103 QString toString() const;
104 bool fromString(const QString &);
106 void onGo();
107 bool take(const QDomElement &x);
109 private:
110 int type;
111 QDomElement iq;
112 Jid to;
114 class Private;
115 Private *d;
118 class JT_PushRoster : public Task
120 Q_OBJECT
121 public:
122 JT_PushRoster(Task *parent);
123 ~JT_PushRoster();
125 bool take(const QDomElement &);
127 signals:
128 void roster(const Roster &);
130 private:
131 class Private;
132 Private *d;
135 class JT_Presence : public Task
137 Q_OBJECT
138 public:
139 JT_Presence(Task *parent);
140 ~JT_Presence();
142 void pres(const Status &);
143 void pres(const Jid &, const Status &);
144 void sub(const Jid &, const QString &subType, const QString& nick = QString());
145 void probe(const Jid &to);
147 void onGo();
149 private:
150 QDomElement tag;
151 int type;
153 class Private;
154 Private *d;
157 class JT_PushPresence : public Task
159 Q_OBJECT
160 public:
161 JT_PushPresence(Task *parent);
162 ~JT_PushPresence();
164 bool take(const QDomElement &);
166 signals:
167 void presence(const Jid &, const Status &);
168 void subscription(const Jid &, const QString &, const QString&);
170 private:
171 class Private;
172 Private *d;
175 class JT_Session : public Task
177 public:
178 JT_Session(Task *parent);
179 void onGo();
180 bool take(const QDomElement&);
183 class JT_Message : public Task
185 Q_OBJECT
186 public:
187 JT_Message(Task *parent, const Message &);
188 ~JT_Message();
190 void onGo();
192 private:
193 Message m;
195 class Private;
196 Private *d;
199 class JT_PushMessage : public Task
201 Q_OBJECT
202 public:
203 JT_PushMessage(Task *parent);
204 ~JT_PushMessage();
206 bool take(const QDomElement &);
208 signals:
209 void message(const Message &);
211 private:
212 class Private;
213 Private *d;
216 class JT_GetServices : public Task
218 Q_OBJECT
219 public:
220 JT_GetServices(Task *);
222 void get(const Jid &);
224 const AgentList & agents() const;
226 void onGo();
227 bool take(const QDomElement &x);
229 private:
230 class Private;
231 Private *d;
233 QDomElement iq;
234 Jid jid;
235 AgentList agentList;
238 class JT_VCard : public Task
240 Q_OBJECT
241 public:
242 JT_VCard(Task *parent);
243 ~JT_VCard();
245 void get(const Jid &);
246 void set(const VCard &);
247 void set(const Jid &, const VCard &);
249 const Jid & jid() const;
250 const VCard & vcard() const;
252 void onGo();
253 bool take(const QDomElement &x);
255 private:
256 int type;
258 class Private;
259 Private *d;
262 class JT_Search : public Task
264 Q_OBJECT
265 public:
266 JT_Search(Task *parent);
267 ~JT_Search();
269 const Form & form() const;
270 const QList<SearchResult> & results() const;
272 bool hasXData() const;
273 const XData & xdata() const;
275 void get(const Jid &);
276 void set(const Form &);
277 void set(const Jid &, const XData &);
279 void onGo();
280 bool take(const QDomElement &x);
282 private:
283 QDomElement iq;
284 int type;
286 class Private;
287 Private *d;
290 class JT_ClientVersion : public Task
292 Q_OBJECT
293 public:
294 JT_ClientVersion(Task *);
296 void get(const Jid &);
297 void onGo();
298 bool take(const QDomElement &);
300 const Jid & jid() const;
301 const QString & name() const;
302 const QString & version() const;
303 const QString & os() const;
305 private:
306 QDomElement iq;
308 Jid j;
309 QString v_name, v_ver, v_os;
312 class JT_ClientTime : public Task
314 Q_OBJECT
315 public:
316 JT_ClientTime(Task *, const Jid &);
318 void go();
319 bool take(const QDomElement &);
321 Jid j;
322 QDateTime utc;
323 QString timezone, display;
325 private:
326 QDomElement iq;
329 class JT_ServInfo : public Task
331 Q_OBJECT
332 public:
333 JT_ServInfo(Task *);
334 ~JT_ServInfo();
336 bool take(const QDomElement &);
339 class JT_Gateway : public Task
341 Q_OBJECT
342 public:
343 JT_Gateway(Task *);
345 void get(const Jid &);
346 void set(const Jid &, const QString &prompt);
347 void onGo();
348 bool take(const QDomElement &);
350 Jid jid() const;
352 QString desc() const;
353 QString prompt() const;
354 Jid translatedJid() const;
356 private:
357 QDomElement iq;
359 int type;
360 Jid v_jid;
361 Jid v_translatedJid;
362 QString v_prompt, v_desc;
365 class JT_Browse : public Task
367 Q_OBJECT
368 public:
369 JT_Browse(Task *);
370 ~JT_Browse();
372 void get(const Jid &);
374 const AgentList & agents() const;
375 const AgentItem & root() const;
377 void onGo();
378 bool take(const QDomElement &);
380 private:
381 class Private;
382 Private *d;
384 AgentItem browseHelper (const QDomElement &i);
387 class JT_DiscoItems : public Task
389 Q_OBJECT
390 public:
391 JT_DiscoItems(Task *);
392 ~JT_DiscoItems();
394 void get(const Jid &, const QString &node = QString::null);
395 void get(const DiscoItem &);
397 const DiscoList &items() const;
399 void onGo();
400 bool take(const QDomElement &);
402 private:
403 class Private;
404 Private *d;
407 class JT_DiscoPublish : public Task
409 Q_OBJECT
410 public:
411 JT_DiscoPublish(Task *);
412 ~JT_DiscoPublish();
414 void set(const Jid &, const DiscoList &);
416 void onGo();
417 bool take(const QDomElement &);
419 private:
420 class Private;
421 Private *d;
424 class JT_BoBServer : public Task
426 Q_OBJECT
428 public:
429 JT_BoBServer(Task *parent);
430 bool take(const QDomElement &);
433 class JT_BitsOfBinary : public Task
435 Q_OBJECT
436 public:
437 JT_BitsOfBinary(Task *);
438 ~JT_BitsOfBinary();
440 void get(const Jid &, const QString &);
442 void onGo();
443 bool take(const QDomElement &);
444 BoBData data();
446 private:
447 class Private;
448 Private *d;
452 #endif