1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00

Rename tomahawksipmessage to tomahawkxmppmessage -- after all it's quite xmpp specific

This commit is contained in:
Jeff Mitchell
2011-11-05 15:51:31 -04:00
parent 9db0b5ed40
commit 1736f4caaa
8 changed files with 48 additions and 49 deletions

View File

@@ -140,7 +140,6 @@ public:
m_acl = s->value( "acl", QVariantMap() ).toMap(); m_acl = s->value( "acl", QVariantMap() ).toMap();
m_types = s->value( "types", QStringList() ).toStringList(); m_types = s->value( "types", QStringList() ).toStringList();
s->endGroup(); s->endGroup();
s->sync();
} }
virtual void syncConfig() virtual void syncConfig()

View File

@@ -8,8 +8,8 @@ add_definitions( -DSIPDLLEXPORT_PRO )
set( jabberSources set( jabberSources
jabber.cpp jabber.cpp
tomahawksipmessage.cpp tomahawkxmppmessage.cpp
tomahawksipmessagefactory.cpp tomahawkxmppmessagefactory.cpp
avatarmanager.cpp avatarmanager.cpp
xmlconsole.cpp xmlconsole.cpp
) )

View File

@@ -9,8 +9,8 @@ set( googleHeaders
set( googleSources set( googleSources
../jabber.cpp ../jabber.cpp
../tomahawksipmessage.cpp ../tomahawkxmppmessage.cpp
../tomahawksipmessagefactory.cpp ../tomahawkxmppmessagefactory.cpp
../avatarmanager.cpp ../avatarmanager.cpp
../xmlconsole.cpp ../xmlconsole.cpp
googlewrapper.cpp ) googlewrapper.cpp )

View File

@@ -25,8 +25,8 @@
#include "config.h" #include "config.h"
#include "tomahawksettings.h" #include "tomahawksettings.h"
#include "tomahawksipmessage.h" #include "tomahawkxmppmessage.h"
#include "tomahawksipmessagefactory.h" #include "tomahawkxmppmessagefactory.h"
#include <jreen/jid.h> #include <jreen/jid.h>
#include <jreen/capabilities.h> #include <jreen/capabilities.h>
@@ -96,7 +96,7 @@ JabberPlugin::JabberPlugin( const QString& pluginId )
m_client = new Jreen::Client( jid, m_currentPassword ); m_client = new Jreen::Client( jid, m_currentPassword );
setupClientHelper(); setupClientHelper();
m_client->registerPayload(new TomahawkSipMessageFactory); m_client->registerPayload(new TomahawkXMPPMessageFactory);
m_currentResource = QString::fromAscii( "tomahawk%1" ).arg( QString::number( qrand() % 10000 ) ); m_currentResource = QString::fromAscii( "tomahawk%1" ).arg( QString::number( qrand() % 10000 ) );
m_client->setResource( m_currentResource ); m_client->setResource( m_currentResource );
@@ -402,10 +402,10 @@ JabberPlugin::sendMsg(const QString& to, const QString& msg)
QVariantMap m = v.toMap(); QVariantMap m = v.toMap();
/*******************************************************/ /*******************************************************/
TomahawkSipMessage *sipMessage; TomahawkXMPPMessage *sipMessage;
if(m["visible"].toBool()) if(m["visible"].toBool())
{ {
sipMessage = new TomahawkSipMessage(m["ip"].toString(), sipMessage = new TomahawkXMPPMessage(m["ip"].toString(),
m["port"].toInt(), m["port"].toInt(),
m["uniqname"].toString(), m["uniqname"].toString(),
m["key"].toString() m["key"].toString()
@@ -413,7 +413,7 @@ JabberPlugin::sendMsg(const QString& to, const QString& msg)
} }
else else
{ {
sipMessage = new TomahawkSipMessage(); sipMessage = new TomahawkXMPPMessage();
} }
qDebug() << "Send sip messsage to " << to; qDebug() << "Send sip messsage to " << to;
@@ -802,7 +802,7 @@ void JabberPlugin::onNewIq(const Jreen::IQ& iq)
}*/ }*/
else else
{ {
TomahawkSipMessage::Ptr sipMessage = iq.payload<TomahawkSipMessage>(); TomahawkXMPPMessage::Ptr sipMessage = iq.payload<TomahawkXMPPMessage>();
if(sipMessage) if(sipMessage)
{ {
iq.accept(); iq.accept();

View File

@@ -16,12 +16,12 @@
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>. * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tomahawksipmessage.h" #include "tomahawkxmppmessage.h"
#include "utils/logger.h" #include "utils/logger.h"
class TomahawkSipMessagePrivate class TomahawkXMPPMessagePrivate
{ {
public: public:
QString ip; QString ip;
@@ -31,9 +31,9 @@ public:
bool visible; bool visible;
}; };
TomahawkSipMessage::TomahawkSipMessage(const QString &ip, unsigned int port, const QString &uniqname, const QString &key) : d_ptr(new TomahawkSipMessagePrivate) TomahawkXMPPMessage::TomahawkXMPPMessage(const QString &ip, unsigned int port, const QString &uniqname, const QString &key) : d_ptr(new TomahawkXMPPMessagePrivate)
{ {
Q_D(TomahawkSipMessage); Q_D(TomahawkXMPPMessage);
d->ip = ip; d->ip = ip;
d->port = port; d->port = port;
d->uniqname = uniqname; d->uniqname = uniqname;
@@ -41,39 +41,39 @@ TomahawkSipMessage::TomahawkSipMessage(const QString &ip, unsigned int port, con
d->visible = true; d->visible = true;
} }
TomahawkSipMessage::TomahawkSipMessage() : d_ptr(new TomahawkSipMessagePrivate) TomahawkXMPPMessage::TomahawkXMPPMessage() : d_ptr(new TomahawkXMPPMessagePrivate)
{ {
Q_D(TomahawkSipMessage); Q_D(TomahawkXMPPMessage);
d->visible = false; d->visible = false;
d->port = -1; d->port = -1;
} }
TomahawkSipMessage::~TomahawkSipMessage() TomahawkXMPPMessage::~TomahawkXMPPMessage()
{ {
} }
const QString TomahawkSipMessage::ip() const const QString TomahawkXMPPMessage::ip() const
{ {
return d_func()->ip; return d_func()->ip;
} }
unsigned int TomahawkSipMessage::port() const unsigned int TomahawkXMPPMessage::port() const
{ {
return d_func()->port; return d_func()->port;
} }
const QString TomahawkSipMessage::uniqname() const const QString TomahawkXMPPMessage::uniqname() const
{ {
return d_func()->uniqname; return d_func()->uniqname;
} }
const QString TomahawkSipMessage::key() const const QString TomahawkXMPPMessage::key() const
{ {
return d_func()->key; return d_func()->key;
} }
bool TomahawkSipMessage::visible() const bool TomahawkXMPPMessage::visible() const
{ {
return d_func()->visible; return d_func()->visible;
} }

View File

@@ -25,18 +25,18 @@
#include "../sipdllmacro.h" #include "../sipdllmacro.h"
class TomahawkSipMessagePrivate; class TomahawkXMPPMessagePrivate;
class SIPDLLEXPORT TomahawkSipMessage : public Jreen::Payload class SIPDLLEXPORT TomahawkXMPPMessage : public Jreen::Payload
{ {
J_PAYLOAD(TomahawkSipMessage) J_PAYLOAD(TomahawkXMPPMessage)
Q_DECLARE_PRIVATE(TomahawkSipMessage) Q_DECLARE_PRIVATE(TomahawkXMPPMessage)
public: public:
// sets visible to true // sets visible to true
TomahawkSipMessage(const QString &ip, unsigned int port, const QString &uniqname, const QString &key); TomahawkXMPPMessage(const QString &ip, unsigned int port, const QString &uniqname, const QString &key);
// sets visible to false as we dont have any extra information // sets visible to false as we dont have any extra information
TomahawkSipMessage(); TomahawkXMPPMessage();
~TomahawkSipMessage(); ~TomahawkXMPPMessage();
const QString ip() const; const QString ip() const;
unsigned int port() const; unsigned int port() const;
@@ -44,7 +44,7 @@ class SIPDLLEXPORT TomahawkSipMessage : public Jreen::Payload
const QString key() const; const QString key() const;
bool visible() const; bool visible() const;
private: private:
QScopedPointer<TomahawkSipMessagePrivate> d_ptr; QScopedPointer<TomahawkXMPPMessagePrivate> d_ptr;
}; };
#endif // ENTITYTIME_H #endif // ENTITYTIME_H

View File

@@ -16,7 +16,7 @@
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>. * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tomahawksipmessagefactory.h" #include "tomahawkxmppmessagefactory.h"
#include <QStringList> #include <QStringList>
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
@@ -26,29 +26,29 @@
using namespace Jreen; using namespace Jreen;
TomahawkSipMessageFactory::TomahawkSipMessageFactory() TomahawkXMPPMessageFactory::TomahawkXMPPMessageFactory()
{ {
m_depth = 0; m_depth = 0;
m_state = AtNowhere; m_state = AtNowhere;
} }
TomahawkSipMessageFactory::~TomahawkSipMessageFactory() TomahawkXMPPMessageFactory::~TomahawkXMPPMessageFactory()
{ {
} }
QStringList TomahawkSipMessageFactory::features() const QStringList TomahawkXMPPMessageFactory::features() const
{ {
return QStringList(TOMAHAWK_SIP_MESSAGE_NS); return QStringList(TOMAHAWK_SIP_MESSAGE_NS);
} }
bool TomahawkSipMessageFactory::canParse(const QStringRef &name, const QStringRef &uri, const QXmlStreamAttributes &attributes) bool TomahawkXMPPMessageFactory::canParse(const QStringRef &name, const QStringRef &uri, const QXmlStreamAttributes &attributes)
{ {
Q_UNUSED(uri); Q_UNUSED(uri);
Q_UNUSED(attributes); Q_UNUSED(attributes);
return name == QLatin1String("tomahawk") && uri == TOMAHAWK_SIP_MESSAGE_NS; return name == QLatin1String("tomahawk") && uri == TOMAHAWK_SIP_MESSAGE_NS;
} }
void TomahawkSipMessageFactory::handleStartElement(const QStringRef &name, const QStringRef &uri, void TomahawkXMPPMessageFactory::handleStartElement(const QStringRef &name, const QStringRef &uri,
const QXmlStreamAttributes &attributes) const QXmlStreamAttributes &attributes)
{ {
m_depth++; m_depth++;
@@ -83,7 +83,7 @@ void TomahawkSipMessageFactory::handleStartElement(const QStringRef &name, const
Q_UNUSED(attributes); Q_UNUSED(attributes);
} }
void TomahawkSipMessageFactory::handleEndElement(const QStringRef &name, const QStringRef &uri) void TomahawkXMPPMessageFactory::handleEndElement(const QStringRef &name, const QStringRef &uri)
{ {
if (m_depth == 3) if (m_depth == 3)
m_state = AtNowhere; m_state = AtNowhere;
@@ -92,7 +92,7 @@ void TomahawkSipMessageFactory::handleEndElement(const QStringRef &name, const Q
m_depth--; m_depth--;
} }
void TomahawkSipMessageFactory::handleCharacterData(const QStringRef &text) void TomahawkXMPPMessageFactory::handleCharacterData(const QStringRef &text)
{ {
/*if (m_state == AtUtc) { /*if (m_state == AtUtc) {
//m_utc = Util::fromStamp(text.toString()); //m_utc = Util::fromStamp(text.toString());
@@ -105,9 +105,9 @@ void TomahawkSipMessageFactory::handleCharacterData(const QStringRef &text)
Q_UNUSED(text); Q_UNUSED(text);
} }
void TomahawkSipMessageFactory::serialize(Payload *extension, QXmlStreamWriter *writer) void TomahawkXMPPMessageFactory::serialize(Payload *extension, QXmlStreamWriter *writer)
{ {
TomahawkSipMessage *sipMessage = se_cast<TomahawkSipMessage*>(extension); TomahawkXMPPMessage *sipMessage = se_cast<TomahawkXMPPMessage*>(extension);
writer->writeStartElement(QLatin1String("tomahawk")); writer->writeStartElement(QLatin1String("tomahawk"));
writer->writeDefaultNamespace(TOMAHAWK_SIP_MESSAGE_NS); writer->writeDefaultNamespace(TOMAHAWK_SIP_MESSAGE_NS);
@@ -137,10 +137,10 @@ void TomahawkSipMessageFactory::serialize(Payload *extension, QXmlStreamWriter *
writer->writeEndElement(); writer->writeEndElement();
} }
Payload::Ptr TomahawkSipMessageFactory::createPayload() Payload::Ptr TomahawkXMPPMessageFactory::createPayload()
{ {
if(m_visible) if(m_visible)
return Payload::Ptr(new TomahawkSipMessage(m_ip, m_port, m_uniqname, m_key)); return Payload::Ptr(new TomahawkXMPPMessage(m_ip, m_port, m_uniqname, m_key));
else else
return Payload::Ptr(new TomahawkSipMessage()); return Payload::Ptr(new TomahawkXMPPMessage());
} }

View File

@@ -19,17 +19,17 @@
#ifndef ENTITYTIMEFACTORY_P_H #ifndef ENTITYTIMEFACTORY_P_H
#define ENTITYTIMEFACTORY_P_H #define ENTITYTIMEFACTORY_P_H
#include "tomahawksipmessage.h" #include "tomahawkxmppmessage.h"
#include <jreen/stanzaextension.h> #include <jreen/stanzaextension.h>
#include "../sipdllmacro.h" #include "../sipdllmacro.h"
class SIPDLLEXPORT TomahawkSipMessageFactory : public Jreen::PayloadFactory<TomahawkSipMessage> class SIPDLLEXPORT TomahawkXMPPMessageFactory : public Jreen::PayloadFactory<TomahawkXMPPMessage>
{ {
public: public:
TomahawkSipMessageFactory(); TomahawkXMPPMessageFactory();
virtual ~TomahawkSipMessageFactory(); virtual ~TomahawkXMPPMessageFactory();
QStringList features() const; QStringList features() const;
bool canParse(const QStringRef &name, const QStringRef &uri, const QXmlStreamAttributes &attributes); bool canParse(const QStringRef &name, const QStringRef &uri, const QXmlStreamAttributes &attributes);
void handleStartElement(const QStringRef &name, const QStringRef &uri, const QXmlStreamAttributes &attributes); void handleStartElement(const QStringRef &name, const QStringRef &uri, const QXmlStreamAttributes &attributes);