File indexing completed on 2024-06-02 04:07:10
0001 /* 0002 * Copyright (C) 2003 Justin Karneges 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; either 0007 * either version 2 0008 of the License, or (at your option) any later version.1 of the License, or (at your option) any later version. 0009 * 0010 * This library is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 * Lesser General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Lesser General Public 0016 * License along with this library; if not, write to the Free Software 0017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 0018 * 0019 */ 0020 0021 #ifndef XMPP_ROSTERITEM_H 0022 #define XMPP_ROSTERITEM_H 0023 0024 #include <QString> 0025 #include <QStringList> 0026 0027 #include "xmpp/jid/jid.h" 0028 0029 namespace XMPP 0030 { 0031 class Subscription 0032 { 0033 public: 0034 enum SubType { None, To, From, Both, Remove }; 0035 0036 Subscription(SubType type=None); 0037 0038 int type() const; 0039 0040 QString toString() const; 0041 bool fromString(const QString &); 0042 0043 private: 0044 SubType value; 0045 }; 0046 0047 class RosterItem 0048 { 0049 public: 0050 RosterItem(const Jid &jid=""); 0051 virtual ~RosterItem(); 0052 0053 const Jid & jid() const; 0054 const QString & name() const; 0055 const QStringList & groups() const; 0056 const Subscription & subscription() const; 0057 const QString & ask() const; 0058 bool isPush() const; 0059 bool inGroup(const QString &) const; 0060 0061 virtual void setJid(const Jid &); 0062 void setName(const QString &); 0063 void setGroups(const QStringList &); 0064 void setSubscription(const Subscription &); 0065 void setAsk(const QString &); 0066 void setIsPush(bool); 0067 bool addGroup(const QString &); 0068 bool removeGroup(const QString &); 0069 0070 QDomElement toXml(QDomDocument *) const; 0071 bool fromXml(const QDomElement &); 0072 0073 private: 0074 Jid v_jid; 0075 QString v_name; 0076 QStringList v_groups; 0077 Subscription v_subscription; 0078 QString v_ask; 0079 bool v_push; 0080 }; 0081 } 0082 0083 #endif