gloox
1.0.9
Main Page
Related Pages
Namespaces
Classes
Files
File List
src
featureneg.cpp
1
/*
2
Copyright (c) 2007-2013 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 "featureneg.h"
15
#include "dataform.h"
16
#include "tag.h"
17
18
namespace
gloox
19
{
20
21
FeatureNeg::FeatureNeg
(
DataForm
* form )
22
:
StanzaExtension
(
ExtFeatureNeg
), m_form( form )
23
{
24
}
25
26
FeatureNeg::FeatureNeg
(
const
Tag
* tag )
27
:
StanzaExtension
(
ExtFeatureNeg
), m_form( 0 )
28
{
29
if
( !tag || tag->
name
() !=
"feature"
|| tag->
xmlns
() !=
XMLNS_FEATURE_NEG
)
30
return
;
31
32
const
Tag
* f = tag->
findTag
(
"feature/x[@xmlns='"
+
XMLNS_X_DATA
+
"']"
);
33
if
( f )
34
m_form =
new
DataForm
( f );
35
}
36
37
FeatureNeg::~FeatureNeg
()
38
{
39
delete
m_form;
40
}
41
42
const
std::string&
FeatureNeg::filterString
()
const
43
{
44
static
const
std::string filter =
"/message/feature[@xmlns='"
+
XMLNS_FEATURE_NEG
+
"']"
45
"|/iq/feature[@xmlns='"
+
XMLNS_FEATURE_NEG
+
"']"
;
46
return
filter;
47
}
48
49
Tag
*
FeatureNeg::tag
()
const
50
{
51
if
( !m_form )
52
return
0;
53
54
Tag
* t =
new
Tag
(
"feature"
);
55
t->
setXmlns
(
XMLNS_FEATURE_NEG
);
56
t->
addChild
( m_form->
tag
() );
57
return
t;
58
}
59
60
}
Generated on Tue Oct 15 2013 19:25:20 for gloox by
1.8.1.2