gloox  0.9.9.12
mucmessagesession.cpp
1 /*
2  Copyright (c) 2006-2008 by Jakob Schroeter <js@camaya.net>
3  This file is part of the gloox library. http://camaya.net/gloox
4 
5  This software is distributed under a license. The full license
6  agreement can be found in the file LICENSE in this distribution.
7  This software may not be copied, modified, sold or distributed
8  other than expressed in the named license agreement.
9 
10  This software is distributed without any warranty.
11 */
12 
13 
14 #include "mucmessagesession.h"
15 #include "clientbase.h"
16 #include "stanza.h"
17 #include "messagehandler.h"
18 
19 namespace gloox
20 {
21 
25  {
26  }
27 
29  {
30  }
31 
32  void MUCMessageSession::handleMessage( Stanza *stanza )
33  {
34  if( m_messageHandler )
35  m_messageHandler->handleMessage( stanza );
36  }
37 
38  void MUCMessageSession::send( const std::string& message )
39  {
40  Tag *m = new Tag( "message" );
41  m->addAttribute( "type", "groupchat" );
42  new Tag( m, "body", message );
43 
44  m->addAttribute( "from", m_parent->jid().full() );
45  m->addAttribute( "to", m_target.full() );
46 
47 // decorate( m );
48 
49  m_parent->send( m );
50  }
51 
52  void MUCMessageSession::setSubject( const std::string& subject )
53  {
54  Tag *m = new Tag( "message" );
55  m->addAttribute( "to", m_target.bare() );
56  m->addAttribute( "type", "groupchat" );
57  new Tag( m, "subject", subject );
58 
59  m_parent->send( m );
60  }
61 
62 }