gloox
0.9.9.12
Main Page
Related Pages
Namespaces
Classes
Files
File List
src
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
22
MUCMessageSession::MUCMessageSession
(
ClientBase
*parent,
const
JID
& jid )
23
:
MessageSession
( parent, jid, false,
StanzaMessageGroupchat
|
StanzaMessageChat
24
|
StanzaMessageNormal
|
StanzaMessageError
)
25
{
26
}
27
28
MUCMessageSession::~MUCMessageSession
()
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
}
Generated on Thu Jun 27 2013 13:05:48 for gloox by
1.8.1.2