Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

presence.hh

00001 // presence.hh
00002 // Jabber client library
00003 //
00004 // Original Code Copyright (C) 1999-2001 Dave Smith (dave@jabber.org)
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License, or (at your option) any later version.
00010 // 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 // 
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 //
00020 // Contributor(s): Julian Missig
00021 //
00022 // This Original Code has been modified by IBM Corporation. Modifications 
00023 // made by IBM described herein are Copyright (c) International Business 
00024 // Machines Corporation, 2002.
00025 //
00026 // Date             Modified by     Description of modification
00027 // 01/20/2002       IBM Corp.       Updated to libjudo 1.1.1
00028 // 2002-03-05       IBM Corp.       Updated to libjudo 1.1.5
00029 // 2002-07-09       IBM Corp.       Added Roster::getSession()
00030 //
00031 // =====================================================================================
00032 
00033 #ifndef PRESENCE_HH
00034 #define PRESENCE_HH
00035 
00036 #include <packet.hh>
00037 
00038 namespace jabberoo
00039 {
00045      class Presence
00046           : public Packet
00047           {
00048           public:
00052                enum Type {
00053                     ptSubRequest,   
00054                     ptUnsubRequest, 
00055                     ptSubscribed,   
00056                     ptUnsubscribed, 
00057                     ptAvailable,    
00058                     ptUnavailable,  
00059                     ptError,        
00060                     ptInvisible     
00061                };
00062 
00068                enum Show {
00069                     stInvalid, 
00070                     stOffline, 
00071                     stOnline,  
00072                     stChat,    
00073                     stAway,    
00074                     stXA,      
00075                     stDND      
00076                };
00077 
00084                Presence(const judo::Element& t);
00085 
00095                Presence(const std::string& jid, Type ptype, Show stype = stInvalid, const std::string& status = "", const std::string& priority = "0");
00096 
00097                // Modifiers
00103                void setType(Presence::Type ptype);
00108                void setStatus(const std::string& status);
00114                void setShow(Presence::Show stype);
00119                void setPriority(const std::string& priority);
00120 
00121                // Accessors
00127                Type          getType()     const;
00133                Show          getShow()     const;
00139                const std::string  getStatus()   const;
00145                const std::string  getShow_str() const;
00153                int           getPriority() const;
00154 
00155           protected:
00156                static std::string translateType(Type ptype);
00157                static Type   translateType(const std::string& ptype);
00158                static std::string translateShow(Show stype);
00159                static Show   translateShow(Type ptype, const std::string& stype);
00160 
00161           private:
00162                Show   _show;
00163                Type   _type;
00164                int    _priority;
00165           };
00166 } // namespace jabberoo
00167 
00168 #endif // PRESENCE_HH

Generated on Thu Jul 24 13:31:51 2003 for jabberoo by doxygen1.3-rc3