1 | /*
|
---|
2 | * tasks.h - basic tasks
|
---|
3 | * Copyright (C) 2001, 2002 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 JABBER_TASKS_H
|
---|
22 | #define JABBER_TASKS_H
|
---|
23 |
|
---|
24 | #include<qstring.h>
|
---|
25 | #include<qdom.h>
|
---|
26 |
|
---|
27 | #include"im.h"
|
---|
28 | #include"xmpp_vcard.h"
|
---|
29 |
|
---|
30 | namespace XMPP
|
---|
31 | {
|
---|
32 | class Roster;
|
---|
33 | class Status;
|
---|
34 |
|
---|
35 | class JT_Register : public Task
|
---|
36 | {
|
---|
37 | Q_OBJECT
|
---|
38 | public:
|
---|
39 | JT_Register(Task *parent);
|
---|
40 | ~JT_Register();
|
---|
41 |
|
---|
42 | void reg(const QString &user, const QString &pass);
|
---|
43 | void changepw(const QString &pass);
|
---|
44 | void unreg(const Jid &j="");
|
---|
45 |
|
---|
46 | const Form & form() const;
|
---|
47 | void getForm(const Jid &);
|
---|
48 | void setForm(const Form &);
|
---|
49 |
|
---|
50 | void onGo();
|
---|
51 | bool take(const QDomElement &);
|
---|
52 |
|
---|
53 | private:
|
---|
54 | QDomElement iq;
|
---|
55 | Jid to;
|
---|
56 |
|
---|
57 | class Private;
|
---|
58 | Private *d;
|
---|
59 | };
|
---|
60 |
|
---|
61 | class JT_UnRegister : public Task
|
---|
62 | {
|
---|
63 | Q_OBJECT
|
---|
64 | public:
|
---|
65 | JT_UnRegister(Task *parent);
|
---|
66 | ~JT_UnRegister();
|
---|
67 |
|
---|
68 | void unreg(const Jid &);
|
---|
69 |
|
---|
70 | void onGo();
|
---|
71 |
|
---|
72 | private slots:
|
---|
73 | void getFormFinished();
|
---|
74 | void unregFinished();
|
---|
75 |
|
---|
76 | private:
|
---|
77 | class Private;
|
---|
78 | Private *d;
|
---|
79 | };
|
---|
80 |
|
---|
81 | class JT_Roster : public Task
|
---|
82 | {
|
---|
83 | Q_OBJECT
|
---|
84 | public:
|
---|
85 | JT_Roster(Task *parent);
|
---|
86 | ~JT_Roster();
|
---|
87 |
|
---|
88 | void get();
|
---|
89 | void set(const Jid &, const QString &name, const QStringList &groups);
|
---|
90 | void remove(const Jid &);
|
---|
91 |
|
---|
92 | const Roster & roster() const;
|
---|
93 |
|
---|
94 | QString toString() const;
|
---|
95 | bool fromString(const QString &);
|
---|
96 |
|
---|
97 | void onGo();
|
---|
98 | bool take(const QDomElement &x);
|
---|
99 |
|
---|
100 | private:
|
---|
101 | int type;
|
---|
102 | QDomElement iq;
|
---|
103 | Jid to;
|
---|
104 |
|
---|
105 | class Private;
|
---|
106 | Private *d;
|
---|
107 | };
|
---|
108 |
|
---|
109 | class JT_PushRoster : public Task
|
---|
110 | {
|
---|
111 | Q_OBJECT
|
---|
112 | public:
|
---|
113 | JT_PushRoster(Task *parent);
|
---|
114 | ~JT_PushRoster();
|
---|
115 |
|
---|
116 | bool take(const QDomElement &);
|
---|
117 |
|
---|
118 | signals:
|
---|
119 | void roster(const Roster &);
|
---|
120 |
|
---|
121 | private:
|
---|
122 | class Private;
|
---|
123 | Private *d;
|
---|
124 | };
|
---|
125 |
|
---|
126 | class JT_Presence : public Task
|
---|
127 | {
|
---|
128 | Q_OBJECT
|
---|
129 | public:
|
---|
130 | JT_Presence(Task *parent);
|
---|
131 | ~JT_Presence();
|
---|
132 |
|
---|
133 | void pres(const Status &);
|
---|
134 | void pres(const Jid &, const Status &);
|
---|
135 | void sub(const Jid &, const QString &subType);
|
---|
136 |
|
---|
137 | void onGo();
|
---|
138 |
|
---|
139 | private:
|
---|
140 | QDomElement tag;
|
---|
141 | int type;
|
---|
142 |
|
---|
143 | class Private;
|
---|
144 | Private *d;
|
---|
145 | };
|
---|
146 |
|
---|
147 | class JT_PushPresence : public Task
|
---|
148 | {
|
---|
149 | Q_OBJECT
|
---|
150 | public:
|
---|
151 | JT_PushPresence(Task *parent);
|
---|
152 | ~JT_PushPresence();
|
---|
153 |
|
---|
154 | bool take(const QDomElement &);
|
---|
155 |
|
---|
156 | signals:
|
---|
157 | void presence(const Jid &, const Status &);
|
---|
158 | void subscription(const Jid &, const QString &);
|
---|
159 |
|
---|
160 | private:
|
---|
161 | class Private;
|
---|
162 | Private *d;
|
---|
163 | };
|
---|
164 |
|
---|
165 | class JT_Message : public Task
|
---|
166 | {
|
---|
167 | Q_OBJECT
|
---|
168 | public:
|
---|
169 | JT_Message(Task *parent, const Message &);
|
---|
170 | ~JT_Message();
|
---|
171 |
|
---|
172 | void onGo();
|
---|
173 |
|
---|
174 | private:
|
---|
175 | Message m;
|
---|
176 |
|
---|
177 | class Private;
|
---|
178 | Private *d;
|
---|
179 | };
|
---|
180 |
|
---|
181 | class JT_PushMessage : public Task
|
---|
182 | {
|
---|
183 | Q_OBJECT
|
---|
184 | public:
|
---|
185 | JT_PushMessage(Task *parent);
|
---|
186 | ~JT_PushMessage();
|
---|
187 |
|
---|
188 | bool take(const QDomElement &);
|
---|
189 |
|
---|
190 | signals:
|
---|
191 | void message(const Message &);
|
---|
192 |
|
---|
193 | private:
|
---|
194 | class Private;
|
---|
195 | Private *d;
|
---|
196 | };
|
---|
197 |
|
---|
198 | class JT_GetServices : public Task
|
---|
199 | {
|
---|
200 | Q_OBJECT
|
---|
201 | public:
|
---|
202 | JT_GetServices(Task *);
|
---|
203 |
|
---|
204 | void get(const Jid &);
|
---|
205 |
|
---|
206 | const AgentList & agents() const;
|
---|
207 |
|
---|
208 | void onGo();
|
---|
209 | bool take(const QDomElement &x);
|
---|
210 |
|
---|
211 | private:
|
---|
212 | class Private;
|
---|
213 | Private *d;
|
---|
214 |
|
---|
215 | QDomElement iq;
|
---|
216 | Jid jid;
|
---|
217 | AgentList agentList;
|
---|
218 | };
|
---|
219 |
|
---|
220 | class JT_VCard : public Task
|
---|
221 | {
|
---|
222 | Q_OBJECT
|
---|
223 | public:
|
---|
224 | JT_VCard(Task *parent);
|
---|
225 | ~JT_VCard();
|
---|
226 |
|
---|
227 | void get(const Jid &);
|
---|
228 | void set(const VCard &);
|
---|
229 |
|
---|
230 | const Jid & jid() const;
|
---|
231 | const VCard & vcard() const;
|
---|
232 |
|
---|
233 | void onGo();
|
---|
234 | bool take(const QDomElement &x);
|
---|
235 |
|
---|
236 | private:
|
---|
237 | int type;
|
---|
238 |
|
---|
239 | class Private;
|
---|
240 | Private *d;
|
---|
241 | };
|
---|
242 |
|
---|
243 | class JT_Search : public Task
|
---|
244 | {
|
---|
245 | Q_OBJECT
|
---|
246 | public:
|
---|
247 | JT_Search(Task *parent);
|
---|
248 | ~JT_Search();
|
---|
249 |
|
---|
250 | const Form & form() const;
|
---|
251 | const QValueList<SearchResult> & results() const;
|
---|
252 |
|
---|
253 | void get(const Jid &);
|
---|
254 | void set(const Form &);
|
---|
255 |
|
---|
256 | void onGo();
|
---|
257 | bool take(const QDomElement &x);
|
---|
258 |
|
---|
259 | private:
|
---|
260 | QDomElement iq;
|
---|
261 | int type;
|
---|
262 |
|
---|
263 | class Private;
|
---|
264 | Private *d;
|
---|
265 | };
|
---|
266 |
|
---|
267 | class JT_ClientVersion : public Task
|
---|
268 | {
|
---|
269 | Q_OBJECT
|
---|
270 | public:
|
---|
271 | JT_ClientVersion(Task *);
|
---|
272 |
|
---|
273 | void get(const Jid &);
|
---|
274 | void onGo();
|
---|
275 | bool take(const QDomElement &);
|
---|
276 |
|
---|
277 | const Jid & jid() const;
|
---|
278 | const QString & name() const;
|
---|
279 | const QString & version() const;
|
---|
280 | const QString & os() const;
|
---|
281 |
|
---|
282 | private:
|
---|
283 | QDomElement iq;
|
---|
284 |
|
---|
285 | Jid j;
|
---|
286 | QString v_name, v_ver, v_os;
|
---|
287 | };
|
---|
288 | /*
|
---|
289 | class JT_ClientTime : public Task
|
---|
290 | {
|
---|
291 | Q_OBJECT
|
---|
292 | public:
|
---|
293 | JT_ClientTime(Task *, const Jid &);
|
---|
294 |
|
---|
295 | void go();
|
---|
296 | bool take(const QDomElement &);
|
---|
297 |
|
---|
298 | Jid j;
|
---|
299 | QDateTime utc;
|
---|
300 | QString timezone, display;
|
---|
301 |
|
---|
302 | private:
|
---|
303 | QDomElement iq;
|
---|
304 | };
|
---|
305 | */
|
---|
306 | class JT_ServInfo : public Task
|
---|
307 | {
|
---|
308 | Q_OBJECT
|
---|
309 | public:
|
---|
310 | JT_ServInfo(Task *);
|
---|
311 | ~JT_ServInfo();
|
---|
312 |
|
---|
313 | bool take(const QDomElement &);
|
---|
314 | };
|
---|
315 |
|
---|
316 | class JT_Gateway : public Task
|
---|
317 | {
|
---|
318 | Q_OBJECT
|
---|
319 | public:
|
---|
320 | JT_Gateway(Task *);
|
---|
321 |
|
---|
322 | void get(const Jid &);
|
---|
323 | void set(const Jid &, const QString &prompt);
|
---|
324 | void onGo();
|
---|
325 | bool take(const QDomElement &);
|
---|
326 |
|
---|
327 | Jid jid() const;
|
---|
328 | QString desc() const;
|
---|
329 | QString prompt() const;
|
---|
330 |
|
---|
331 | private:
|
---|
332 | QDomElement iq;
|
---|
333 |
|
---|
334 | int type;
|
---|
335 | Jid v_jid;
|
---|
336 | QString v_prompt, v_desc;
|
---|
337 | };
|
---|
338 |
|
---|
339 | class JT_Browse : public Task
|
---|
340 | {
|
---|
341 | Q_OBJECT
|
---|
342 | public:
|
---|
343 | JT_Browse(Task *);
|
---|
344 | ~JT_Browse();
|
---|
345 |
|
---|
346 | void get(const Jid &);
|
---|
347 |
|
---|
348 | const AgentList & agents() const;
|
---|
349 | const AgentItem & root() const;
|
---|
350 |
|
---|
351 | void onGo();
|
---|
352 | bool take(const QDomElement &);
|
---|
353 |
|
---|
354 | private:
|
---|
355 | class Private;
|
---|
356 | Private *d;
|
---|
357 |
|
---|
358 | AgentItem browseHelper (const QDomElement &i);
|
---|
359 | };
|
---|
360 |
|
---|
361 | class JT_DiscoItems : public Task
|
---|
362 | {
|
---|
363 | Q_OBJECT
|
---|
364 | public:
|
---|
365 | JT_DiscoItems(Task *);
|
---|
366 | ~JT_DiscoItems();
|
---|
367 |
|
---|
368 | void get(const Jid &, const QString &node = QString::null);
|
---|
369 | void get(const DiscoItem &);
|
---|
370 |
|
---|
371 | const DiscoList &items() const;
|
---|
372 |
|
---|
373 | void onGo();
|
---|
374 | bool take(const QDomElement &);
|
---|
375 |
|
---|
376 | private:
|
---|
377 | class Private;
|
---|
378 | Private *d;
|
---|
379 | };
|
---|
380 |
|
---|
381 | class JT_DiscoInfo : public Task
|
---|
382 | {
|
---|
383 | Q_OBJECT
|
---|
384 | public:
|
---|
385 | JT_DiscoInfo(Task *);
|
---|
386 | ~JT_DiscoInfo();
|
---|
387 |
|
---|
388 | void get(const Jid &, const QString &node = QString::null, const DiscoItem::Identity = DiscoItem::Identity());
|
---|
389 | void get(const DiscoItem &);
|
---|
390 |
|
---|
391 | const DiscoItem &item() const;
|
---|
392 |
|
---|
393 | void onGo();
|
---|
394 | bool take(const QDomElement &);
|
---|
395 |
|
---|
396 | private:
|
---|
397 | class Private;
|
---|
398 | Private *d;
|
---|
399 | };
|
---|
400 |
|
---|
401 | class JT_DiscoPublish : public Task
|
---|
402 | {
|
---|
403 | Q_OBJECT
|
---|
404 | public:
|
---|
405 | JT_DiscoPublish(Task *);
|
---|
406 | ~JT_DiscoPublish();
|
---|
407 |
|
---|
408 | void set(const Jid &, const DiscoList &);
|
---|
409 |
|
---|
410 | void onGo();
|
---|
411 | bool take(const QDomElement &);
|
---|
412 |
|
---|
413 | private:
|
---|
414 | class Private;
|
---|
415 | Private *d;
|
---|
416 | };
|
---|
417 | }
|
---|
418 |
|
---|
419 | #endif
|
---|