00001 /* 00002 Copyright (c) 2005-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 #include "messagefilter.h" 00015 00016 00017 namespace gloox 00018 { 00019 00020 MessageFilter::MessageFilter( MessageSession *parent ) 00021 : m_parent( 0 ) 00022 { 00023 if( parent ) 00024 attachTo( parent ); 00025 } 00026 00027 MessageFilter::~MessageFilter() 00028 { 00029 } 00030 00031 void MessageFilter::attachTo( MessageSession *session ) 00032 { 00033 if( m_parent ) 00034 m_parent->removeMessageFilter( this ); 00035 00036 if( session ) 00037 session->registerMessageFilter( this ); 00038 00039 m_parent = session; 00040 } 00041 00042 }