~ubuntu-branches/ubuntu/edgy/psi/edgy

« back to all changes in this revision

Viewing changes to src/jabtasks.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2004-06-15 00:10:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040615001041-enywb6pcpe4sjsw6
Tags: 0.9.2-1
* New upstream release
* Set KDEDIR for ./configure so kde specific files get installed
* Don't install libpsiwidgets.so. It got installed in /usr/share
  where it doesn't belong. May be included (at a better location)
  later.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/****************************************************************************
2
 
** jabtasks.h - basic tasks for use with the JabIO task system
3
 
** Copyright (C) 2001, 2002  Justin Karneges
4
 
**
5
 
** This program is free software; you can redistribute it and/or
6
 
** modify it under the terms of the GNU General Public License
7
 
** as published by the Free Software Foundation; either version 2
8
 
** of the License, or (at your option) any later version.
9
 
**
10
 
** This program 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
13
 
** GNU General Public License for more details.
14
 
**
15
 
** You should have received a copy of the GNU General Public License
16
 
** along with this program; 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 JABTASKS_H
22
 
#define JABTASKS_H
23
 
 
24
 
#include<qstring.h>
25
 
#include<qptrlist.h>
26
 
#include"jabio.h"
27
 
 
28
 
 
29
 
// subscription types
30
 
#define JABSUB_SUBSCRIBE        0
31
 
#define JABSUB_SUBSCRIBED       1
32
 
#define JABSUB_UNSUBSCRIBE      2
33
 
#define JABSUB_UNSUBSCRIBED     3
34
 
 
35
 
 
36
 
class JT_Auth : public JabTask
37
 
{
38
 
        Q_OBJECT
39
 
public:
40
 
        JT_Auth(JabTask *parent, const QString &user, const QString &pass, const QString &sid, const QString &resource, bool plain=FALSE);
41
 
 
42
 
        void go();
43
 
 
44
 
        bool take(const QDomElement &x);
45
 
 
46
 
private:
47
 
        QDomElement iq;
48
 
};
49
 
 
50
 
class JT_Register : public JabTask
51
 
{
52
 
        Q_OBJECT
53
 
public:
54
 
        JT_Register(JabTask *parent);
55
 
 
56
 
        void reg(const QString &user, const QString &pass);
57
 
        //void unreg(const QString &user, const QString &pass);
58
 
 
59
 
        void go();
60
 
 
61
 
        bool take(const QDomElement &x);
62
 
 
63
 
private:
64
 
        QDomElement iq;
65
 
};
66
 
 
67
 
class JT_Roster : public JabTask
68
 
{
69
 
        Q_OBJECT
70
 
public:
71
 
        JT_Roster(JabTask *parent);
72
 
 
73
 
        void get();
74
 
        void set(const QString &jid, const QString &nick, const QStringList &groups);
75
 
        void remove(const QString &jid);
76
 
 
77
 
        void go();
78
 
        QString toString();
79
 
        bool fromString(const QString &);
80
 
 
81
 
        bool take(const QDomElement &x);
82
 
        JabRoster roster;
83
 
 
84
 
        QString jid, nick;
85
 
        QStringList groups;
86
 
 
87
 
private:
88
 
        int type;
89
 
        QDomElement iq;
90
 
};
91
 
 
92
 
class JT_Presence : public JabTask
93
 
{
94
 
        Q_OBJECT
95
 
public:
96
 
        JT_Presence(JabTask *parent);
97
 
 
98
 
        void pres(int status, const QString &statusString, int priority);
99
 
        void sub(const Jid &to, int subType);
100
 
 
101
 
        void go();
102
 
 
103
 
        int status, priority;
104
 
        QString statusString;
105
 
 
106
 
signals:
107
 
        void receivePresence(int, const QString &);
108
 
 
109
 
private:
110
 
        QDomElement tag;
111
 
        int type;
112
 
};
113
 
 
114
 
class JT_Login : public JabTask
115
 
{
116
 
        Q_OBJECT
117
 
public:
118
 
        JT_Login(JabTask *);
119
 
 
120
 
        void login(const QString &user, const QString &pass, const QString &sid, const QString &resource, int, const QString &, int, bool plain=FALSE);
121
 
        void create(const QString &user, const QString &pass, const QString &sid, const QString &resource, int, const QString &, int, bool plain=FALSE);
122
 
 
123
 
        void go();
124
 
        void done(JabTask *);
125
 
 
126
 
        JT_Register *reg;
127
 
        JT_Auth *auth;
128
 
        JT_Roster *rost;
129
 
        JT_Presence *pres;
130
 
        int status, priority;
131
 
        QString statusString;
132
 
        QString user, pass, sid, resource;
133
 
        bool usePlain;
134
 
 
135
 
        int type;
136
 
 
137
 
signals:
138
 
        void stepChanged();
139
 
        void receiveAuth();
140
 
        void receiveRoster(JabRoster &);
141
 
        void receivePresence(int, const QString &);
142
 
};
143
 
 
144
 
class JT_PushPresence : public JabTask
145
 
{
146
 
        Q_OBJECT
147
 
public:
148
 
        JT_PushPresence(JabTask *parent);
149
 
 
150
 
        bool isDaemon() { return TRUE; }
151
 
        bool take(const QDomElement &);
152
 
 
153
 
        struct Info
154
 
        {
155
 
                Jid jid;
156
 
                int status, priority;
157
 
                QString statusString;
158
 
                QString songTitle;
159
 
                QDateTime timeStamp;
160
 
        };
161
 
 
162
 
signals:
163
 
        void presence(const JT_PushPresence::Info &);
164
 
        void subscription(const Jid &, int);
165
 
};
166
 
 
167
 
class JT_PushRoster : public JabTask
168
 
{
169
 
        Q_OBJECT
170
 
public:
171
 
        JT_PushRoster(JabTask *parent);
172
 
 
173
 
        bool isDaemon() { return TRUE; }
174
 
        bool take(const QDomElement &);
175
 
 
176
 
signals:
177
 
        void roster(JabRoster &);
178
 
};
179
 
 
180
 
class JT_Message : public JabTask
181
 
{
182
 
        Q_OBJECT
183
 
public:
184
 
        JT_Message(JabTask *parent, const JabMessage &);
185
 
 
186
 
        JabMessage jmsg;
187
 
 
188
 
        void go();
189
 
};
190
 
 
191
 
class JT_PushMessage : public JabTask
192
 
{
193
 
        Q_OBJECT
194
 
public:
195
 
        JT_PushMessage(JabTask *parent);
196
 
 
197
 
        bool isDaemon() { return TRUE; }
198
 
        bool take(const QDomElement &);
199
 
 
200
 
signals:
201
 
        void message(const JabMessage &);
202
 
};
203
 
 
204
 
// this will issue a bunch of JabTasks one by one in sequence
205
 
class JT_Queue : public JabTask
206
 
{
207
 
        Q_OBJECT
208
 
public:
209
 
        JT_Queue(JabTask *parent);
210
 
 
211
 
        void addTask(JabTask *);
212
 
        int count();
213
 
 
214
 
        void done(JabTask *);
215
 
        bool isClearable() { return FALSE; }
216
 
 
217
 
        void go();
218
 
        void stop();
219
 
        QString toString();
220
 
        bool fromString(const QString &);
221
 
 
222
 
signals:
223
 
        void countChanged();
224
 
        void itemDone(JabTask *);
225
 
 
226
 
private slots:
227
 
        void afterDone();
228
 
 
229
 
private:
230
 
        void doNext();
231
 
        JabTask *active;
232
 
        QPtrList<JabTask> list;
233
 
        bool going;
234
 
};
235
 
 
236
 
class JT_GetServices : public JabTask
237
 
{
238
 
        Q_OBJECT
239
 
public:
240
 
        JT_GetServices(JabTask *parent, const QString &host);
241
 
 
242
 
        void go();
243
 
 
244
 
        bool take(const QDomElement &x);
245
 
 
246
 
        JabRoster services;
247
 
 
248
 
private:
249
 
        QDomElement iq;
250
 
};
251
 
 
252
 
class JT_VCard : public JabTask
253
 
{
254
 
        Q_OBJECT
255
 
public:
256
 
        JT_VCard(JabTask *parent);
257
 
 
258
 
        void get(const QString &);
259
 
        void set(VCard &);
260
 
 
261
 
        void go();
262
 
 
263
 
        bool take(const QDomElement &x);
264
 
 
265
 
        QString jid;
266
 
        VCard vcard;
267
 
        int type;
268
 
 
269
 
private:
270
 
        QDomElement iq;
271
 
};
272
 
 
273
 
class JT_RegForm : public JabTask
274
 
{
275
 
        Q_OBJECT
276
 
public:
277
 
        JT_RegForm(JabTask *parent);
278
 
 
279
 
        void get(const QString &);
280
 
        void set(const JabForm &);
281
 
 
282
 
        void go();
283
 
 
284
 
        bool take(const QDomElement &x);
285
 
 
286
 
        QString jid;
287
 
        JabForm form;
288
 
        int type;
289
 
 
290
 
private:
291
 
        QDomElement iq;
292
 
};
293
 
 
294
 
class JT_Search : public JabTask
295
 
{
296
 
        Q_OBJECT
297
 
public:
298
 
        JT_Search(JabTask *parent);
299
 
 
300
 
        void get(const QString &);
301
 
        void set(const JabForm &);
302
 
 
303
 
        void go();
304
 
 
305
 
        bool take(const QDomElement &x);
306
 
 
307
 
        QString jid;
308
 
        JabForm form;
309
 
        JabRoster roster;
310
 
        int type;
311
 
 
312
 
private:
313
 
        QDomElement iq;
314
 
};
315
 
 
316
 
class JT_ClientVersion : public JabTask
317
 
{
318
 
        Q_OBJECT
319
 
public:
320
 
        JT_ClientVersion(JabTask *, const Jid &);
321
 
 
322
 
        void go();
323
 
        bool take(const QDomElement &);
324
 
 
325
 
        Jid j;
326
 
        QString name, version, os;
327
 
 
328
 
private:
329
 
        QDomElement iq;
330
 
};
331
 
 
332
 
class JT_ClientTime : public JabTask
333
 
{
334
 
        Q_OBJECT
335
 
public:
336
 
        JT_ClientTime(JabTask *, const Jid &);
337
 
 
338
 
        void go();
339
 
        bool take(const QDomElement &);
340
 
 
341
 
        Jid j;
342
 
        QDateTime utc;
343
 
        QString timezone, display;
344
 
 
345
 
private:
346
 
        QDomElement iq;
347
 
};
348
 
 
349
 
class JT_ServInfo : public JabTask
350
 
{
351
 
        Q_OBJECT
352
 
public:
353
 
        JT_ServInfo(JabTask *parent);
354
 
 
355
 
        bool isDaemon() { return TRUE; }
356
 
        bool take(const QDomElement &);
357
 
};
358
 
 
359
 
class JT_Gateway : public JabTask
360
 
{
361
 
        Q_OBJECT
362
 
public:
363
 
        JT_Gateway(JabTask *parent);
364
 
 
365
 
        void get(const QString &service);
366
 
        void set(const QString &service, const QString &prompt);
367
 
 
368
 
        void go();
369
 
 
370
 
        bool take(const QDomElement &x);
371
 
 
372
 
        QString jid, prompt, desc;
373
 
        int type;
374
 
 
375
 
private:
376
 
        QDomElement iq;
377
 
};
378
 
 
379
 
#endif