-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for Attentions (XEP-0224)
- Loading branch information
Showing
6 changed files
with
235 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/**************************************************************************** | ||
** | ||
** Jreen | ||
** | ||
** Copyright © 2012 Nicolay Izoderov <nico-izo@ya.ru> | ||
** | ||
***************************************************************************** | ||
** | ||
** $JREEN_BEGIN_LICENSE$ | ||
** This program is free software: you can redistribute it and/or modify | ||
** it under the terms of the GNU General Public License as published by | ||
** the Free Software Foundation, either version 2 of the License, or | ||
** (at your option) any later version. | ||
** | ||
** This program is distributed in the hope that it will be useful, | ||
** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
** See the GNU General Public License for more details. | ||
** | ||
** You should have received a copy of the GNU General Public License | ||
** along with this program. If not, see http://www.gnu.org/licenses/. | ||
** $JREEN_END_LICENSE$ | ||
** | ||
****************************************************************************/ | ||
|
||
#include "attention.h" | ||
|
||
namespace Jreen { | ||
|
||
class AttentionPrivate | ||
{ | ||
public: | ||
}; | ||
|
||
Attention::Attention() | ||
: d_ptr(new AttentionPrivate) | ||
{ | ||
} | ||
|
||
Attention::~Attention() | ||
{ | ||
} | ||
|
||
} | ||
// namespace Jreen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/**************************************************************************** | ||
** | ||
** Jreen | ||
** | ||
** Copyright © 2012 Nicolay Izoderov <nico-izo@ya.ru> | ||
** | ||
***************************************************************************** | ||
** | ||
** $JREEN_BEGIN_LICENSE$ | ||
** This program is free software: you can redistribute it and/or modify | ||
** it under the terms of the GNU General Public License as published by | ||
** the Free Software Foundation, either version 2 of the License, or | ||
** (at your option) any later version. | ||
** | ||
** This program is distributed in the hope that it will be useful, | ||
** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
** See the GNU General Public License for more details. | ||
** | ||
** You should have received a copy of the GNU General Public License | ||
** along with this program. If not, see http://www.gnu.org/licenses/. | ||
** $JREEN_END_LICENSE$ | ||
** | ||
****************************************************************************/ | ||
#ifndef ATTENTION_H | ||
#define ATTENTION_H | ||
#include "stanzaextension.h" | ||
|
||
namespace Jreen { | ||
|
||
class AttentionPrivate; | ||
|
||
//XEP-0224 Attention | ||
//http://xmpp.org/extensions/xep-0224.html | ||
class JREEN_EXPORT Attention : public Payload | ||
{ | ||
Q_DECLARE_PRIVATE(Attention) | ||
J_PAYLOAD(Jreen::Attention) | ||
public: | ||
Attention(); | ||
~Attention(); | ||
private: | ||
QScopedPointer<AttentionPrivate> d_ptr; | ||
}; | ||
|
||
} // namespace Jreen | ||
|
||
#endif // ATTENTION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/**************************************************************************** | ||
** | ||
** Jreen | ||
** | ||
** Copyright © 2012 Nicolay Izoderov <nico-izo@ya.ru> | ||
** | ||
***************************************************************************** | ||
** | ||
** $JREEN_BEGIN_LICENSE$ | ||
** This program is free software: you can redistribute it and/or modify | ||
** it under the terms of the GNU General Public License as published by | ||
** the Free Software Foundation, either version 2 of the License, or | ||
** (at your option) any later version. | ||
** | ||
** This program is distributed in the hope that it will be useful, | ||
** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
** See the GNU General Public License for more details. | ||
** | ||
** You should have received a copy of the GNU General Public License | ||
** along with this program. If not, see http://www.gnu.org/licenses/. | ||
** $JREEN_END_LICENSE$ | ||
** | ||
****************************************************************************/ | ||
|
||
#include "attentionfactory_p.h" | ||
#include <QMap> | ||
#include <QXmlStreamReader> | ||
#include <QStringList> | ||
#include "jstrings.h" | ||
|
||
#define NS_ATTENTION QLatin1String("urn:xmpp:attention:0") | ||
|
||
namespace Jreen { | ||
|
||
AttentionFactory::AttentionFactory() | ||
{ | ||
|
||
} | ||
|
||
AttentionFactory::~AttentionFactory() | ||
{ | ||
|
||
} | ||
|
||
QStringList AttentionFactory::features() const | ||
{ | ||
return QStringList(NS_ATTENTION); | ||
} | ||
|
||
bool AttentionFactory::canParse(const QStringRef &name, | ||
const QStringRef &uri, const QXmlStreamAttributes &attributes) | ||
{ | ||
Q_UNUSED(attributes); | ||
return name == QLatin1String("attention") && uri == NS_ATTENTION; | ||
} | ||
|
||
void AttentionFactory::handleStartElement(const QStringRef &name, const QStringRef &uri, const QXmlStreamAttributes &attributes) | ||
{ | ||
Q_UNUSED(uri); | ||
Q_UNUSED(attributes); | ||
Q_UNUSED(name); | ||
} | ||
|
||
void AttentionFactory::handleEndElement(const QStringRef &name, const QStringRef &uri) | ||
{ | ||
Q_UNUSED(name); | ||
Q_UNUSED(uri); | ||
} | ||
|
||
void AttentionFactory::handleCharacterData(const QStringRef &text) | ||
{ | ||
Q_UNUSED(text); | ||
} | ||
|
||
void AttentionFactory::serialize(Payload *extension, QXmlStreamWriter *writer) | ||
{ | ||
writer->writeStartElement(QLatin1String("attention")); | ||
writer->writeDefaultNamespace(NS_ATTENTION); | ||
writer->writeEndElement(); | ||
} | ||
|
||
Payload::Ptr AttentionFactory::createPayload() | ||
{ | ||
return Payload::Ptr(new Attention()); | ||
} | ||
|
||
} // namespace Jreen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/**************************************************************************** | ||
** | ||
** Jreen | ||
** | ||
** Copyright © 2012 Nicolay Izoderov <nico-izo@ya.ru> | ||
** | ||
***************************************************************************** | ||
** | ||
** $JREEN_BEGIN_LICENSE$ | ||
** This program is free software: you can redistribute it and/or modify | ||
** it under the terms of the GNU General Public License as published by | ||
** the Free Software Foundation, either version 2 of the License, or | ||
** (at your option) any later version. | ||
** | ||
** This program is distributed in the hope that it will be useful, | ||
** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
** See the GNU General Public License for more details. | ||
** | ||
** You should have received a copy of the GNU General Public License | ||
** along with this program. If not, see http://www.gnu.org/licenses/. | ||
** $JREEN_END_LICENSE$ | ||
** | ||
****************************************************************************/ | ||
|
||
#ifndef ATTENTIONFACTORY_P_H | ||
#define ATTENTIONFACTORY_P_H | ||
#include "stanzaextension.h" | ||
#include "attention.h" | ||
|
||
namespace Jreen { | ||
|
||
class JREEN_AUTOTEST_EXPORT AttentionFactory : public PayloadFactory<Attention> | ||
{ | ||
public: | ||
AttentionFactory(); | ||
virtual ~AttentionFactory(); | ||
QStringList features() const; | ||
bool canParse(const QStringRef &name, const QStringRef &uri, const QXmlStreamAttributes &attributes); | ||
void handleStartElement(const QStringRef &name, const QStringRef &uri, const QXmlStreamAttributes &attributes); | ||
void handleEndElement(const QStringRef &name, const QStringRef &uri); | ||
void handleCharacterData(const QStringRef &text); | ||
void serialize(Payload *extension, QXmlStreamWriter *writer); | ||
Payload::Ptr createPayload(); | ||
}; | ||
|
||
} // namespace Jreen | ||
|
||
#endif // ATTENTIONFACTORY_P_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters