gloox
1.0.22
src
nickname.cpp
1
/*
2
Copyright (c) 2007-2017 by Jakob Schröter <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
#include "nickname.h"
14
#include "tag.h"
15
16
namespace
gloox
17
{
18
19
Nickname::Nickname
(
const
Tag
* tag )
20
:
StanzaExtension
(
ExtNickname
)
21
{
22
if
(
tag
)
23
m_nick =
tag
->
cdata
();
24
}
25
26
const
std::string&
Nickname::filterString
()
const
27
{
28
static
const
std::string filter =
29
"/presence/nick[@xmlns='"
+
XMLNS_NICKNAME
+
"']"
30
"|/message/nick[@xmlns='"
+
XMLNS_NICKNAME
+
"']"
;
31
return
filter;
32
}
33
34
Tag
*
Nickname::tag
()
const
35
{
36
if
( m_nick.empty() )
37
return
0;
38
39
Tag
* n =
new
Tag
(
"nick"
,
XMLNS
,
XMLNS_NICKNAME
);
40
n->
setCData
( m_nick );
41
return
n;
42
}
43
44
}
gloox::XMLNS
const std::string XMLNS
Definition:
gloox.cpp:122
gloox::StanzaExtension
This class abstracts a stanza extension, which is usually an XML child element in a specific namespac...
Definition:
stanzaextension.h:203
gloox::Nickname::tag
Tag * tag() const
Definition:
nickname.cpp:34
gloox::Nickname::filterString
virtual const std::string & filterString() const
Definition:
nickname.cpp:26
gloox::ExtNickname
@ ExtNickname
Definition:
stanzaextension.h:53
gloox
The namespace for the gloox library.
Definition:
adhoc.cpp:27
gloox::XMLNS_NICKNAME
const std::string XMLNS_NICKNAME
Definition:
gloox.cpp:99
gloox::Tag
This is an abstraction of an XML element.
Definition:
tag.h:46
gloox::Tag::setCData
bool setCData(const std::string &cdata)
Definition:
tag.cpp:447
gloox::Nickname::Nickname
Nickname(const Tag *tag)
Definition:
nickname.cpp:19
gloox::Tag::cdata
const std::string cdata() const
Definition:
tag.cpp:497
Generated on Tue Mar 24 2020 14:04:23 for gloox by
1.8.17