1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-25 10:19:41 +01: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_types = s->value( "types", QStringList() ).toStringList();
s->endGroup();
s->sync();
}
virtual void syncConfig()

View File

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

View File

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

View File

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

View File

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

View File

@ -25,18 +25,18 @@
#include "../sipdllmacro.h"
class TomahawkSipMessagePrivate;
class SIPDLLEXPORT TomahawkSipMessage : public Jreen::Payload
class TomahawkXMPPMessagePrivate;
class SIPDLLEXPORT TomahawkXMPPMessage : public Jreen::Payload
{
J_PAYLOAD(TomahawkSipMessage)
Q_DECLARE_PRIVATE(TomahawkSipMessage)
J_PAYLOAD(TomahawkXMPPMessage)
Q_DECLARE_PRIVATE(TomahawkXMPPMessage)
public:
// 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
TomahawkSipMessage();
~TomahawkSipMessage();
TomahawkXMPPMessage();
~TomahawkXMPPMessage();
const QString ip() const;
unsigned int port() const;
@ -44,7 +44,7 @@ class SIPDLLEXPORT TomahawkSipMessage : public Jreen::Payload
const QString key() const;
bool visible() const;
private:
QScopedPointer<TomahawkSipMessagePrivate> d_ptr;
QScopedPointer<TomahawkXMPPMessagePrivate> d_ptr;
};
#endif // ENTITYTIME_H

View File

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

View File

@ -19,17 +19,17 @@
#ifndef ENTITYTIMEFACTORY_P_H
#define ENTITYTIMEFACTORY_P_H
#include "tomahawksipmessage.h"
#include "tomahawkxmppmessage.h"
#include <jreen/stanzaextension.h>
#include "../sipdllmacro.h"
class SIPDLLEXPORT TomahawkSipMessageFactory : public Jreen::PayloadFactory<TomahawkSipMessage>
class SIPDLLEXPORT TomahawkXMPPMessageFactory : public Jreen::PayloadFactory<TomahawkXMPPMessage>
{
public:
TomahawkSipMessageFactory();
virtual ~TomahawkSipMessageFactory();
TomahawkXMPPMessageFactory();
virtual ~TomahawkXMPPMessageFactory();
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);