1
/****************************************************************************
2
** jabtasks.h - basic tasks for use with the JabIO task system
3
** Copyright (C) 2001, 2002 Justin Karneges
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.
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.
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.
19
****************************************************************************/
30
#define JABSUB_SUBSCRIBE 0
31
#define JABSUB_SUBSCRIBED 1
32
#define JABSUB_UNSUBSCRIBE 2
33
#define JABSUB_UNSUBSCRIBED 3
36
class JT_Auth : public JabTask
40
JT_Auth(JabTask *parent, const QString &user, const QString &pass, const QString &sid, const QString &resource, bool plain=FALSE);
44
bool take(const QDomElement &x);
50
class JT_Register : public JabTask
54
JT_Register(JabTask *parent);
56
void reg(const QString &user, const QString &pass);
57
//void unreg(const QString &user, const QString &pass);
61
bool take(const QDomElement &x);
67
class JT_Roster : public JabTask
71
JT_Roster(JabTask *parent);
74
void set(const QString &jid, const QString &nick, const QStringList &groups);
75
void remove(const QString &jid);
79
bool fromString(const QString &);
81
bool take(const QDomElement &x);
92
class JT_Presence : public JabTask
96
JT_Presence(JabTask *parent);
98
void pres(int status, const QString &statusString, int priority);
99
void sub(const Jid &to, int subType);
103
int status, priority;
104
QString statusString;
107
void receivePresence(int, const QString &);
114
class JT_Login : public JabTask
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);
124
void done(JabTask *);
130
int status, priority;
131
QString statusString;
132
QString user, pass, sid, resource;
140
void receiveRoster(JabRoster &);
141
void receivePresence(int, const QString &);
144
class JT_PushPresence : public JabTask
148
JT_PushPresence(JabTask *parent);
150
bool isDaemon() { return TRUE; }
151
bool take(const QDomElement &);
156
int status, priority;
157
QString statusString;
163
void presence(const JT_PushPresence::Info &);
164
void subscription(const Jid &, int);
167
class JT_PushRoster : public JabTask
171
JT_PushRoster(JabTask *parent);
173
bool isDaemon() { return TRUE; }
174
bool take(const QDomElement &);
177
void roster(JabRoster &);
180
class JT_Message : public JabTask
184
JT_Message(JabTask *parent, const JabMessage &);
191
class JT_PushMessage : public JabTask
195
JT_PushMessage(JabTask *parent);
197
bool isDaemon() { return TRUE; }
198
bool take(const QDomElement &);
201
void message(const JabMessage &);
204
// this will issue a bunch of JabTasks one by one in sequence
205
class JT_Queue : public JabTask
209
JT_Queue(JabTask *parent);
211
void addTask(JabTask *);
214
void done(JabTask *);
215
bool isClearable() { return FALSE; }
220
bool fromString(const QString &);
224
void itemDone(JabTask *);
232
QPtrList<JabTask> list;
236
class JT_GetServices : public JabTask
240
JT_GetServices(JabTask *parent, const QString &host);
244
bool take(const QDomElement &x);
252
class JT_VCard : public JabTask
256
JT_VCard(JabTask *parent);
258
void get(const QString &);
263
bool take(const QDomElement &x);
273
class JT_RegForm : public JabTask
277
JT_RegForm(JabTask *parent);
279
void get(const QString &);
280
void set(const JabForm &);
284
bool take(const QDomElement &x);
294
class JT_Search : public JabTask
298
JT_Search(JabTask *parent);
300
void get(const QString &);
301
void set(const JabForm &);
305
bool take(const QDomElement &x);
316
class JT_ClientVersion : public JabTask
320
JT_ClientVersion(JabTask *, const Jid &);
323
bool take(const QDomElement &);
326
QString name, version, os;
332
class JT_ClientTime : public JabTask
336
JT_ClientTime(JabTask *, const Jid &);
339
bool take(const QDomElement &);
343
QString timezone, display;
349
class JT_ServInfo : public JabTask
353
JT_ServInfo(JabTask *parent);
355
bool isDaemon() { return TRUE; }
356
bool take(const QDomElement &);
359
class JT_Gateway : public JabTask
363
JT_Gateway(JabTask *parent);
365
void get(const QString &service);
366
void set(const QString &service, const QString &prompt);
370
bool take(const QDomElement &x);
372
QString jid, prompt, desc;