presence.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef PRESENCE_H__
00014 #define PRESENCE_H__
00015
00016 #include "stanza.h"
00017
00018 #include <string>
00019
00020 namespace gloox
00021 {
00022
00023 class Capabilities;
00024 class JID;
00025
00032 class GLOOX_API Presence : public Stanza
00033 {
00034
00035 friend class ClientBase;
00036
00037 public:
00038
00042 enum PresenceType
00043 {
00044 Available,
00045 Chat,
00046 Away,
00047 DND,
00048 XA,
00049 Unavailable,
00050 Probe,
00051 Error,
00052 Invalid
00053 };
00054
00064 Presence( PresenceType type, const JID& to, const std::string& status = EmptyString,
00065 int priority = 0, const std::string& xmllang = EmptyString );
00066
00070 virtual ~Presence();
00071
00076 PresenceType subtype() const { return m_subtype; }
00077
00082 const Capabilities* capabilities() const;
00083
00088
00089 PresenceType presence() const { return m_subtype; }
00090
00095 void setPresence( PresenceType type ) { m_subtype = type; }
00096
00106 const std::string status( const std::string& lang = "default" ) const
00107 {
00108 return findLang( m_stati, m_status, lang );
00109 }
00110
00117 void addStatus( const std::string& status, const std::string& lang = EmptyString )
00118 {
00119 setLang( &m_stati, m_status, status, lang );
00120 }
00121
00125 void resetStatus();
00126
00131 int priority() const { return m_priority; }
00132
00137 void setPriority( int priority );
00138
00139
00140 virtual Tag* tag() const;
00141
00142 private:
00143 #ifdef PRESENCE_TEST
00144 public:
00145 #endif
00146
00150 Presence( Tag* tag );
00151
00152 PresenceType m_subtype;
00153 StringMap* m_stati;
00154 std::string m_status;
00155 int m_priority;
00156
00157 };
00158
00159 }
00160
00161 #endif // PRESENCE_H__