1
/****************************************************************************
2
** jabio.h - handles JabTasks
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
****************************************************************************/
25
#include<qobjectlist.h>
27
#include<qstringlist.h>
36
class JabTask : public QObject
40
JabTask(JabTask *parent);
41
JabTask(JabIO *parent);
42
virtual ~JabTask() { }
44
bool isRoot() { return v_isRoot; }
45
bool isDone() { return v_isDone; }
46
JabIO *io() { return v_io; }
49
JabTask *find(const char *);
50
JabTask *findById(const QString &);
52
const QString & id() { return v_id; }
53
bool success() { return v_success; }
54
const QString & errorString() { return v_errorString; }
57
virtual void stop() { }
58
virtual bool take(const QDomElement &);
59
virtual void done(JabTask *);
60
virtual QString toString();
61
virtual bool fromString(const QString &);
62
virtual bool isClearable() { return TRUE; }
63
virtual bool isDaemon() { return FALSE; }
66
bool stamp2TS(const QString &ts, QDateTime *d);
67
QString TS2stamp(const QDateTime &);
68
QDomElement textTag(const QString &name, const QString &content);
69
QString tagContent(const QDomElement &e);
70
QDomElement findSubTag(const QDomElement &e, const QString &name, bool *found);
71
QDomElement createIQ(const QString &type, const QString &to, const QString &id);
72
QDomElement queryTag(const QDomElement &e);
73
QString queryNS(const QDomElement &e);
74
JabRoster xmlReadRoster(const QDomElement &, bool push=FALSE);
75
QString getErrorString(const QDomElement &e);
78
void finished(JabTask *);
79
void childFinished(JabTask *);
80
void childAdded(JabTask *);
81
void childRemoved(JabTask *);
84
QString v_id, v_errorString;
85
bool v_success, v_isDone;
91
void send(const QDomElement &);
92
void setSuccess(bool);
93
void setError(const QString &);
96
void childEvent(QChildEvent *);
100
class JabIO : public QObject
111
void send(const QDomElement &);
113
JabTask *find(const char *);
114
JabTask *findById(const QString &);
116
void doneJT(JabTask *);
121
void outgoingPacket(const QDomElement &);
122
void done(JabTask *);
123
void anyDone(JabTask *);
126
void incomingPacket(const QDomElement &);
132
void distribute(const QDomElement &);