rosteritem.h

00001 /*
00002   Copyright (c) 2004-2008 by Jakob Schroeter <js@camaya.net>
00003   This file is part of the gloox library. http://camaya.net/gloox
00004 
00005   This software is distributed under a license. The full license
00006   agreement can be found in the file LICENSE in this distribution.
00007   This software may not be copied, modified, sold or distributed
00008   other than expressed in the named license agreement.
00009 
00010   This software is distributed without any warranty.
00011 */
00012 
00013 
00014 #ifndef ROSTERITEM_H__
00015 #define ROSTERITEM_H__
00016 
00017 #include "gloox.h"
00018 #include "jid.h"
00019 #include "resource.h"
00020 
00021 #include <string>
00022 #include <list>
00023 
00024 
00025 namespace gloox
00026 {
00027 
00037   class GLOOX_API RosterItem
00038   {
00039     friend class RosterManager;
00040 
00041     public:
00045       typedef std::map<std::string, Resource*> ResourceMap;
00046 
00050       enum SubscriptionEnum
00051       {
00052         S10nNone,            
00054         S10nNoneOut,         
00057         S10nNoneIn,          
00062         S10nNoneOutIn,       
00066         S10nTo,              
00067         S10nToIn,            
00069         S10nFrom,            
00070         S10nFromOut,         
00072         S10nBoth              
00073       };
00074 
00080       RosterItem( const JID& jid, const std::string& name = "" );
00081 
00085       virtual ~RosterItem();
00086 
00091       virtual void setName( const std::string& name );
00092 
00097       virtual const std::string& name() const { return m_name; }
00098 
00103       virtual const std::string& jid() const { return m_jid; }
00104 
00109       virtual SubscriptionEnum subscription() const { return m_subscription; }
00110 
00115       virtual void setGroups( const StringList& groups );
00116 
00121       virtual const StringList& groups() const { return m_groups; }
00122 
00127       virtual bool changed() const { return m_changed; }
00128 
00133       virtual bool online() const;
00134 
00139       virtual const ResourceMap& resources() const { return m_resources; }
00140 
00146       virtual const Resource* resource( const std::string& res ) const;
00147 
00148     protected:
00154       virtual void setPresence( const std::string& resource, Presence presence );
00155 
00161       virtual void setStatus( const std::string& resource, const std::string& msg );
00162 
00168       virtual void setPriority( const std::string& resource, int priority );
00169 
00175       virtual void setSubscription( const std::string& subscription, bool ask );
00176 
00180       virtual void setSynchronized() { m_changed = false; }
00181 
00186       virtual void removeResource( const std::string& resource );
00187 
00188     private:
00189       StringList m_groups;
00190       ResourceMap m_resources;
00191       SubscriptionEnum m_subscription;
00192       std::string m_name;
00193       std::string m_jid;
00194       bool m_changed;
00195   };
00196 
00197 }
00198 
00199 #endif // ROSTERITEM_H__

Generated on Fri Oct 10 15:26:11 2008 for gloox by  doxygen 1.5.6