rosteritem.cpp

00001 /*
00002   Copyright (c) 2004-2005 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 
00015 #include "rosteritem.h"
00016 
00017 namespace gloox
00018 {
00019 
00020   RosterItem::RosterItem( const std::string& jid, const std::string& name )
00021     : m_status( PRESENCE_UNKNOWN ), m_name( name ), m_jid( jid ), m_changed( false )
00022   {
00023   }
00024 
00025   RosterItem::~RosterItem()
00026   {
00027   }
00028 
00029   void RosterItem::setName( const std::string& name )
00030   {
00031     m_name = name;
00032     m_changed = true;
00033   }
00034 
00035   void RosterItem::setStatus( PresenceStatus status )
00036   {
00037     m_status = status;
00038     m_changed = true;
00039   }
00040 
00041   void RosterItem::setStatusMsg( const std::string& msg )
00042   {
00043     m_statusMessage = msg;
00044     m_changed = true;
00045   }
00046 
00047   void RosterItem::setSubscription( const std::string& subscription, bool ask )
00048   {
00049     if( subscription == "from" && !ask )
00050       m_subscription = S10N_FROM;
00051     else if( subscription == "from" && ask )
00052       m_subscription = S10N_FROM_OUT;
00053     else if( subscription == "to" && !ask )
00054       m_subscription = S10N_TO;
00055     else if( subscription == "to" && ask )
00056       m_subscription = S10N_TO_IN;
00057     else if( subscription == "none" && !ask )
00058       m_subscription = S10N_NONE;
00059     else if( subscription == "none" && ask )
00060       m_subscription = S10N_NONE_OUT;
00061     else if( subscription == "both" )
00062       m_subscription = S10N_BOTH;
00063   }
00064 
00065   void RosterItem::setGroups( const StringList& groups )
00066   {
00067     m_groups = groups;
00068     m_changed = true;
00069   }
00070 
00071 }

Generated on Mon Jan 16 16:19:54 2006 for gloox by  doxygen 1.4.6