gloox 1.0

mucmessagesession.cpp

00001 /*
00002   Copyright (c) 2006-2009 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 "mucmessagesession.h"
00015 #include "clientbase.h"
00016 #include "message.h"
00017 #include "messagehandler.h"
00018 
00019 namespace gloox
00020 {
00021 
00022   MUCMessageSession::MUCMessageSession( ClientBase* parent, const JID& jid )
00023     : MessageSession( parent, jid, false, Message::Groupchat | Message::Chat
00024                                           | Message::Normal | Message::Error,
00025                       false )
00026   {
00027   }
00028 
00029   MUCMessageSession::~MUCMessageSession()
00030   {
00031   }
00032 
00033   void MUCMessageSession::handleMessage( Message& msg )
00034   {
00035     if( m_messageHandler )
00036       m_messageHandler->handleMessage( msg );
00037   }
00038 
00039   void MUCMessageSession::send( const std::string& message )
00040   {
00041     Message m( Message::Groupchat, m_target, message );
00042 
00043 //     decorate( m );
00044 
00045     m_parent->send( m );
00046   }
00047 
00048   void MUCMessageSession::setSubject( const std::string& subject )
00049   {
00050     Message m( Message::Groupchat, m_target.bareJID(), EmptyString, subject );
00051     m_parent->send( m );
00052   }
00053 
00054 }