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

0001 /*
0002  * xmpp_features.h
0003  * Copyright (C) 2003  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 XMPP_FEATURES_H
0023 #define XMPP_FEATURES_H
0024 
0025 #include <QStringList>
0026 
0027 class QString;
0028 
0029 namespace XMPP
0030 {
0031     class Features
0032     {
0033     public:
0034         Features();
0035         Features(const QStringList &);
0036         Features(const QString &);
0037         ~Features();
0038 
0039         QStringList list() const; // actual featurelist
0040         void setList(const QStringList &);
0041         void addFeature(const QString&);
0042 
0043         // features
0044         bool canRegister() const;
0045         bool canSearch() const;
0046         bool canMulticast() const;
0047         bool canGroupchat() const;
0048         bool canVoice() const;
0049         bool canDisco() const;
0050         bool canXHTML() const;
0051         bool canChatState() const;
0052         bool canCommand() const;
0053         bool isGateway() const;
0054         bool haveVCard() const;
0055 
0056         enum FeatureID {
0057             FID_Invalid = -1,
0058             FID_None,
0059             FID_Register,
0060             FID_Search,
0061             FID_Groupchat,
0062             FID_Disco,
0063             FID_Gateway,
0064             FID_VCard,
0065             FIX_Xhtml,
0066             FID_AHCommand,
0067 
0068             // private Psi actions
0069             FID_Add
0070         };
0071 
0072         // useful functions
0073         bool test(const QStringList &) const;
0074 
0075         QString name() const;
0076         static QString name(long id);
0077         static QString name(const QString &feature);
0078 
0079         long id() const;
0080         static long id(const QString &feature);
0081         static QString feature(long id);
0082 
0083         class FeatureName;
0084     private:
0085         QStringList _list;
0086     };
0087 }
0088 
0089 #endif