File indexing completed on 2024-06-23 04:03:42

0001 /*
0002  * tasks.h - basic tasks
0003  * Copyright (C) 2001, 2002  Justin Karneges
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Lesser General Public
0007  * License as published by the Free Software Foundation; either
0008  * either version 2
0009    of the License, or (at your option) any later version.1 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Lesser General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Lesser General Public
0017  * License along with this library; if not, write to the Free Software
0018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
0019  *
0020  */
0021 
0022 #ifndef JABBER_TASKS_H
0023 #define JABBER_TASKS_H
0024 
0025 #include <QString>
0026 #include <qdom.h>
0027 //Added by qt3to4:
0028 #include <QList>
0029 
0030 #include "iris_export.h"
0031 #include "im.h"
0032 #include "xmpp_vcard.h"
0033 #include "xmpp_discoinfotask.h"
0034 
0035 namespace XMPP
0036 {
0037     class Roster;
0038     class Status;
0039 
0040     class IRIS_EXPORT JT_Register : public Task
0041     {
0042         Q_OBJECT
0043     public:
0044         JT_Register(Task *parent);
0045         ~JT_Register() override;
0046 
0047         // OLd style registration
0048         void reg(const QString &user, const QString &pass);
0049 
0050         void changepw(const QString &pass);
0051         void unreg(const Jid &j="");
0052 
0053         const Form & form() const;
0054         bool hasXData() const;
0055         const XData& xdata() const;
0056         void getForm(const Jid &);
0057         void setForm(const Form &);
0058         void setForm(const Jid&, const XData &);
0059 
0060         void onGo() override;
0061         bool take(const QDomElement &) override;
0062 
0063     private:
0064         QDomElement iq;
0065         Jid to;
0066 
0067         class Private;
0068         Private *d;
0069     };
0070 
0071     class IRIS_EXPORT JT_UnRegister : public Task
0072     {
0073         Q_OBJECT
0074     public:
0075         JT_UnRegister(Task *parent);
0076         ~JT_UnRegister() override;
0077 
0078         void unreg(const Jid &);
0079 
0080         void onGo() override;
0081 
0082     private slots:
0083         void getFormFinished();
0084         void unregFinished();
0085 
0086     private:
0087         class Private;
0088         Private *d;
0089     };
0090 
0091     class IRIS_EXPORT JT_Roster : public Task
0092     {
0093         Q_OBJECT
0094     public:
0095         JT_Roster(Task *parent);
0096         ~JT_Roster() override;
0097 
0098         void get();
0099         void set(const Jid &, const QString &name, const QStringList &groups);
0100         void remove(const Jid &);
0101 
0102         const Roster & roster() const;
0103 
0104         QString toString() const;
0105         bool fromString(const QString &);
0106 
0107         void onGo() override;
0108         bool take(const QDomElement &x) override;
0109 
0110     private:
0111         int type;
0112         QDomElement iq;
0113         Jid to;
0114 
0115         class Private;
0116         Private *d;
0117     };
0118 
0119     class IRIS_EXPORT JT_PushRoster : public Task
0120     {
0121         Q_OBJECT
0122     public:
0123         JT_PushRoster(Task *parent);
0124         ~JT_PushRoster() override;
0125 
0126         bool take(const QDomElement &) override;
0127 
0128     signals:
0129         void roster(const Roster &);
0130 
0131     private:
0132         class Private;
0133         Private *d;
0134     };
0135 
0136     class IRIS_EXPORT JT_Presence : public Task
0137     {
0138         Q_OBJECT
0139     public:
0140         JT_Presence(Task *parent);
0141         ~JT_Presence() override;
0142 
0143         void pres(const Status &);
0144         void pres(const Jid &, const Status &);
0145         void sub(const Jid &, const QString &subType, const QString& nick = QString());
0146         void probe(const Jid &to);
0147 
0148         void onGo() override;
0149 
0150     private:
0151         QDomElement tag;
0152         int type;
0153 
0154         class Private;
0155         Private *d;
0156     };
0157 
0158     class IRIS_EXPORT JT_PushPresence : public Task
0159     {
0160         Q_OBJECT
0161     public:
0162         JT_PushPresence(Task *parent);
0163         ~JT_PushPresence() override;
0164 
0165         bool take(const QDomElement &) override;
0166 
0167     signals:
0168         void presence(const Jid &, const Status &);
0169         void subscription(const Jid &, const QString &, const QString&);
0170 
0171     private:
0172         class Private;
0173         Private *d;
0174     };
0175     
0176     class IRIS_EXPORT JT_Session : public Task
0177     {
0178     public:
0179         JT_Session(Task *parent);
0180         void onGo() override;
0181         bool take(const QDomElement&) override;
0182     };
0183 
0184     class IRIS_EXPORT JT_Message : public Task
0185     {
0186         Q_OBJECT
0187     public:
0188         JT_Message(Task *parent, const Message &);
0189         ~JT_Message() override;
0190 
0191         void onGo() override;
0192 
0193     private:
0194         Message m;
0195 
0196         class Private;
0197         Private *d;
0198     };
0199 
0200     class IRIS_EXPORT JT_PushMessage : public Task
0201     {
0202         Q_OBJECT
0203     public:
0204         JT_PushMessage(Task *parent);
0205         ~JT_PushMessage() override;
0206 
0207         bool take(const QDomElement &) override;
0208 
0209     signals:
0210         void message(const Message &);
0211 
0212     private:
0213         class Private;
0214         Private *d;
0215     };
0216 
0217     class IRIS_EXPORT JT_GetServices : public Task
0218     {
0219         Q_OBJECT
0220     public:
0221         JT_GetServices(Task *);
0222 
0223         void get(const Jid &);
0224 
0225         const AgentList & agents() const;
0226 
0227         void onGo() override;
0228         bool take(const QDomElement &x) override;
0229 
0230     private:
0231         class Private;
0232         Private *d;
0233 
0234         QDomElement iq;
0235         Jid jid;
0236         AgentList agentList;
0237     };
0238 
0239     class IRIS_EXPORT JT_VCard : public Task
0240     {
0241         Q_OBJECT
0242     public:
0243         JT_VCard(Task *parent);
0244         ~JT_VCard() override;
0245 
0246         void get(const Jid &);
0247         void set(const VCard &);
0248         void set(const Jid &, const VCard &);
0249 
0250         const Jid & jid() const;
0251         const VCard  & vcard() const;
0252         
0253         void onGo() override;
0254         bool take(const QDomElement &x) override;
0255 
0256     private:
0257         int type;
0258 
0259         class Private;
0260         Private *d;
0261     };
0262 
0263     class IRIS_EXPORT JT_Search : public Task
0264     {
0265         Q_OBJECT
0266     public:
0267         JT_Search(Task *parent);
0268         ~JT_Search() override;
0269 
0270         const Form & form() const;
0271         const QList<SearchResult> & results() const;
0272 
0273         bool hasXData() const;
0274         const XData & xdata() const;
0275 
0276         void get(const Jid &);
0277         void set(const Form &);
0278         void set(const Jid &, const XData &);
0279 
0280         void onGo() override;
0281         bool take(const QDomElement &x) override;
0282 
0283     private:
0284         QDomElement iq;
0285         int type;
0286 
0287         class Private;
0288         Private *d;
0289     };
0290 
0291     class IRIS_EXPORT JT_ClientVersion : public Task
0292     {
0293         Q_OBJECT
0294     public:
0295         JT_ClientVersion(Task *);
0296 
0297         void get(const Jid &);
0298         void onGo() override;
0299         bool take(const QDomElement &) override;
0300 
0301         const Jid & jid() const;
0302         const QString & name() const;
0303         const QString & version() const;
0304         const QString & os() const;
0305 
0306     private:
0307         QDomElement iq;
0308 
0309         Jid j;
0310         QString v_name, v_ver, v_os;
0311     };
0312 /*
0313     class JT_ClientTime : public Task
0314     {
0315         Q_OBJECT
0316     public:
0317         JT_ClientTime(Task *, const Jid &);
0318 
0319         void go();
0320         bool take(const QDomElement &);
0321 
0322         Jid j;
0323         QDateTime utc;
0324         QString timezone, display;
0325 
0326     private:
0327         QDomElement iq;
0328     };
0329 */
0330     class IRIS_EXPORT JT_ServInfo : public Task
0331     {
0332         Q_OBJECT
0333     public:
0334         JT_ServInfo(Task *);
0335         ~JT_ServInfo() override;
0336 
0337         bool take(const QDomElement &) override;
0338     };
0339 
0340     class IRIS_EXPORT JT_Gateway : public Task
0341     {
0342         Q_OBJECT
0343     public:
0344         JT_Gateway(Task *);
0345 
0346         void get(const Jid &);
0347         void set(const Jid &, const QString &prompt);
0348         void onGo() override;
0349         bool take(const QDomElement &) override;
0350 
0351         Jid jid() const;
0352         QString desc() const;
0353         QString prompt() const;
0354 
0355     private:
0356         QDomElement iq;
0357 
0358         int type;
0359         Jid v_jid;
0360         QString v_prompt, v_desc;
0361     };
0362 
0363     class IRIS_EXPORT JT_Browse : public Task
0364     {
0365         Q_OBJECT
0366     public:
0367         JT_Browse(Task *);
0368         ~JT_Browse() override;
0369 
0370         void get(const Jid &);
0371 
0372         const AgentList & agents() const;
0373         const AgentItem & root() const;
0374 
0375         void onGo() override;
0376         bool take(const QDomElement &) override;
0377 
0378     private:
0379         class Private;
0380         Private *d;
0381 
0382         AgentItem browseHelper (const QDomElement &i);
0383     };
0384 
0385     class IRIS_EXPORT JT_DiscoItems : public Task
0386     {
0387         Q_OBJECT
0388     public:
0389         JT_DiscoItems(Task *);
0390         ~JT_DiscoItems() override;
0391     
0392         void get(const Jid &, const QString &node = QString());
0393         void get(const DiscoItem &);
0394     
0395         const DiscoList &items() const;
0396     
0397         void onGo() override;
0398         bool take(const QDomElement &) override;
0399     
0400     private:
0401         class Private;
0402         Private *d;
0403     };
0404 
0405     class IRIS_EXPORT JT_DiscoPublish : public Task
0406     {
0407         Q_OBJECT
0408     public:
0409         JT_DiscoPublish(Task *);
0410         ~JT_DiscoPublish() override;
0411     
0412         void set(const Jid &, const DiscoList &);
0413     
0414         void onGo() override;
0415         bool take(const QDomElement &) override;
0416     
0417     private:
0418         class Private;
0419         Private *d;
0420     };
0421 }
0422 
0423 #endif