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

0001 /*
0002  * xmpp_status.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_STATUS_H
0023 #define XMPP_STATUS_H
0024 
0025 #include <QList>
0026 #include <QString>
0027 #include <QDateTime>
0028 
0029 #include "iris_export.h"
0030 #include "xmpp_muc.h"
0031 
0032 namespace XMPP 
0033 {
0034   class IRIS_EXPORT Status
0035     {
0036     public:
0037         enum Type { Offline, Online, Away, XA, DND, Invisible, FFC };
0038 
0039         Status(const QString &show="", const QString &status="", int priority=0, bool available=true);
0040         Status(Type type, const QString& status="", int priority=0);
0041         ~Status();
0042 
0043         int priority() const;
0044         Type type() const;
0045         QString typeString() const;
0046         const QString & show() const;
0047         const QString & status() const;
0048         QDateTime timeStamp() const;
0049         const QString & keyID() const;
0050         bool isAvailable() const;
0051         bool isAway() const;
0052         bool isInvisible() const;
0053         bool hasError() const;
0054         int errorCode() const;
0055         const QString & errorString() const;
0056 
0057         const QString & xsigned() const;
0058         const QString & songTitle() const;
0059         const QString & capsNode() const;
0060         const QString & capsVersion() const;
0061         const QString & capsExt() const;
0062         
0063         bool isMUC() const;
0064         bool hasMUCItem() const;
0065         const MUCItem & mucItem() const;
0066         bool hasMUCDestroy() const;
0067         const MUCDestroy & mucDestroy() const;
0068         const QList<int>& getMUCStatuses() const;
0069         const QString& mucPassword() const;
0070         bool hasMUCHistory() const;
0071         int mucHistoryMaxChars() const;
0072         int mucHistoryMaxStanzas() const;
0073         int mucHistorySeconds() const;
0074 
0075         void setPriority(int);
0076         void setType(Type);
0077         void setType(QString);
0078         void setShow(const QString &);
0079         void setStatus(const QString &);
0080         void setTimeStamp(const QDateTime &);
0081         void setKeyID(const QString &);
0082         void setIsAvailable(bool);
0083         void setIsInvisible(bool);
0084         void setError(int, const QString &);
0085         void setCapsNode(const QString&);
0086         void setCapsVersion(const QString&);
0087         void setCapsExt(const QString&);
0088         
0089         void setMUC();
0090         void setMUCItem(const MUCItem&);
0091         void setMUCDestroy(const MUCDestroy&);
0092         void addMUCStatus(int);
0093         void setMUCPassword(const QString&);
0094         void setMUCHistory(int maxchars, int maxstanzas, int seconds);
0095 
0096         void setXSigned(const QString &);
0097         void setSongTitle(const QString &);
0098 
0099         // JEP-153: VCard-based Avatars
0100         const QString& photoHash() const;
0101         void setPhotoHash(const QString&);
0102         bool hasPhotoHash() const;
0103 
0104     private:
0105         int v_priority;
0106         QString v_show, v_status, v_key;
0107         QDateTime v_timeStamp;
0108         bool v_isAvailable;
0109         bool v_isInvisible;
0110         QString v_photoHash;
0111         bool v_hasPhotoHash;
0112 
0113         QString v_xsigned;
0114         // gabber song extension
0115         QString v_songTitle;
0116         QString v_capsNode, v_capsVersion, v_capsExt;
0117 
0118         // MUC
0119         bool v_isMUC, v_hasMUCItem, v_hasMUCDestroy;
0120         MUCItem v_mucItem;
0121         MUCDestroy v_mucDestroy;
0122         QList<int> v_mucStatuses;
0123         QString v_mucPassword;
0124         int v_mucHistoryMaxChars, v_mucHistoryMaxStanzas, v_mucHistorySeconds;
0125 
0126         int ecode;
0127         QString estr;
0128     };
0129 
0130 }
0131 
0132 #endif