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

0001 /*
0002  * rosterexchangeitem.h
0003  * Copyright (C) 2003  Remko Troncon
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_ROSTERX_H
0023 #define XMPP_ROSTERX_H
0024 
0025 #include <QString>
0026 #include <QStringList>
0027 
0028 #include "xmpp/jid/jid.h"
0029 
0030 class QDomElement;
0031 
0032 namespace XMPP
0033 {
0034     class Stanza;
0035 
0036     class RosterExchangeItem
0037     {
0038     public:
0039         enum Action { Add, Delete, Modify };
0040 
0041         RosterExchangeItem(const Jid& jid, const QString& name = "", const QStringList& groups = QStringList(), Action = Add);
0042         RosterExchangeItem(const QDomElement&);
0043         
0044         const Jid& jid() const;
0045         Action action() const;
0046         const QString& name() const;
0047         const QStringList& groups() const;
0048         bool isNull() const;
0049 
0050         void setJid(const Jid&);
0051         void setAction(Action);
0052         void setName(const QString&);
0053         void setGroups(const QStringList&);
0054 
0055         QDomElement toXml(Stanza&) const;
0056         void fromXml(const QDomElement&);
0057         
0058     private:
0059         Jid jid_;
0060         QString name_;
0061         QStringList groups_;
0062         Action action_;
0063     };
0064     typedef QList<RosterExchangeItem> RosterExchangeItems;
0065 }
0066 
0067 #endif