1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 19:30:21 +02:00

Merge remote branch 'origin/master' into osxrelesae

This commit is contained in:
Leo Franchi
2011-05-09 16:26:22 +02:00
13 changed files with 471 additions and 134 deletions

View File

@@ -3,14 +3,6 @@ SET( OS_SPECIFIC_LINK_LIBRARIES
tomahawklib
)
IF( "${gui}" STREQUAL "no" )
ELSE()
SET( OS_SPECIFIC_LINK_LIBRARIES
${OS_SPECIFIC_LINK_LIBRARIES}
gnutls
)
ENDIF()
FILE( GLOB _icons "${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon-*.png" )
FOREACH( _file ${_icons} )
STRING( REPLACE "${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon-" "" _res ${_file} )

View File

@@ -122,13 +122,13 @@ void DiagnosticsDialog::updateLogView()
}
}
QVariantMap sipInfo = SipHandler::instance()->sipInfo( peerId );
if( sipInfo.value( "visible").toBool() )
SipInfo sipInfo = SipHandler::instance()->sipInfo( peerId );
if( sipInfo.isVisible() )
log.append(
QString(" %1: %2:%3 (%4)\n")
.arg( peerId )
.arg( sipInfo.value( "ip" ).toString() )
.arg( sipInfo.value( "port" ).toString() )
.arg( sipInfo.host().hostName() )
.arg( sipInfo.port() )
.arg( connected ? "connected" : "not connected")
);
else

View File

@@ -34,6 +34,7 @@ set( libSources
sip/SipPlugin.cpp
sip/SipHandler.cpp
sip/SipModel.cpp
sip/sipinfo.cpp
audio/audioengine.cpp
@@ -195,6 +196,7 @@ set( libHeaders
sip/SipPlugin.h
sip/SipHandler.h
sip/SipModel.h
sip/sipinfo.h
audio/audioengine.h

View File

@@ -25,7 +25,7 @@
#include "functimeout.h"
#include "database/database.h"
#define CONCURRENT_QUERIES 8
#define CONCURRENT_QUERIES 4
using namespace Tomahawk;
@@ -160,42 +160,50 @@ Pipeline::reportResults( QID qid, const QList< result_ptr >& results )
Q_ASSERT( false );
return;
}
if ( !m_qidsState.contains( qid ) )
{
qDebug() << "reportResults called for unknown QID-state" << qid;
Q_ASSERT( false );
return;
}
}
const query_ptr& q = m_qids.value( qid );
if ( !results.isEmpty() )
{
//qDebug() << Q_FUNC_INFO << qid;
//qDebug() << "solved query:" << (qlonglong)q.data() << q->toString();
q->addResults( results );
foreach( const result_ptr& r, q->results() )
{
m_rids.insert( r->id(), r );
}
if ( q->solved() )
{
qDebug() << "FINISHED RESOLVING EARLY" << q->toString();
q->onResolvingFinished();
setQIDState( q, 0 );
if ( m_qidsTimeout.contains( q->id() ) )
m_qidsTimeout.remove( q->id() );
qDebug() << "Queries running:" << m_qidsState.count();
shuntNext();
return;
}
}
if ( decQIDState( q ) == 0 )
{
// All resolvers have reported back their results for this query now
qDebug() << "Finished resolving:" << q->toString() << q->numResults();
if ( !q->solved() )
q->onResolvingFinished();
if ( m_qidsTimeout.contains( q->id() ) )
m_qidsTimeout.remove( q->id() );
qDebug() << "Queries running:" << m_qidsState.count();
shuntNext();
}
else
{
new FuncTimeout( 500, boost::bind( &Pipeline::timeoutShunt, this, q ), this );
}
}
@@ -229,11 +237,22 @@ Pipeline::shuntNext()
q->setLastPipelineWeight( 101 );
}
if ( !q.isNull() )
setQIDState( q, m_resolvers.count() );
new FuncTimeout( 500, boost::bind( &Pipeline::shunt, this, q ), this );
}
void
Pipeline::timeoutShunt( const query_ptr& q )
{
// are we still waiting for a timeout?
if ( m_qidsTimeout.contains( q->id() ) )
{
incQIDState( q );
shunt( q ); // bump into next stage of pipeline (highest weights are 100)
m_qidsTimeout.remove( q->id() );
shunt( q );
}
else
qDebug() << Q_FUNC_INFO << q->toString() << "Ignoring timeout";
}
@@ -243,45 +262,36 @@ Pipeline::shunt( const query_ptr& q )
qDebug() << Q_FUNC_INFO << q->solved() << q->toString() << q->id();
unsigned int lastweight = 0;
unsigned int lasttimeout = 0;
if ( q->solved() )
{
// qDebug() << "Query solved, pipeline aborted:" << q->toString()
// << "numresults:" << q->results().length();
QList< result_ptr > rl;
reportResults( q->id(), rl );
return;
}
int thisResolver = 0;
int i = 0;
foreach( Resolver* r, m_resolvers )
if ( !q->resolvingFinished() )
{
i++;
if ( r->weight() >= q->lastPipelineWeight() )
continue;
int i = 0;
foreach( Resolver* r, m_resolvers )
{
i++;
if ( r->weight() >= q->lastPipelineWeight() )
continue;
if ( lastweight == 0 )
{
lastweight = r->weight();
lasttimeout = r->timeout();
//qDebug() << "Shunting into weight" << lastweight << "q:" << q->toString();
}
if ( lastweight == r->weight() )
{
// snag the lowest timeout at this weight
if ( r->timeout() < lasttimeout )
if ( lastweight == 0 )
{
lastweight = r->weight();
lasttimeout = r->timeout();
//qDebug() << "Shunting into weight" << lastweight << "q:" << q->toString();
}
if ( lastweight == r->weight() )
{
// snag the lowest timeout at this weight
if ( r->timeout() < lasttimeout )
lasttimeout = r->timeout();
// resolvers aren't allowed to block in this call:
qDebug() << "Dispatching to resolver" << r->name() << q->toString();
thisResolver = i;
r->resolve( q );
qDebug() << "Dispatching to resolver" << r->name() << q->toString();
thisResolver = i;
r->resolve( q );
}
else
break;
}
else
break;
}
if ( lastweight > 0 )
@@ -290,18 +300,18 @@ Pipeline::shunt( const query_ptr& q )
if ( thisResolver < m_resolvers.count() )
{
incQIDState( q );
// qDebug() << "Shunting in" << lasttimeout << "ms, q:" << q->toString();
new FuncTimeout( lasttimeout, boost::bind( &Pipeline::shunt, this, q ), this );
qDebug() << "Shunting in" << lasttimeout << "ms, q:" << q->toString();
m_qidsTimeout.insert( q->id(), true );
new FuncTimeout( lasttimeout, boost::bind( &Pipeline::timeoutShunt, this, q ), this );
}
}
else
{
//qDebug() << "Reached end of pipeline for:" << q->toString();
// reached end of pipeline
QList< result_ptr > rl;
reportResults( q->id(), rl );
return;
qDebug() << "Reached end of pipeline for:" << q->toString();
setQIDState( q, 0 );
qDebug() << "Queries running:" << m_qidsState.count();
}
shuntNext();
@@ -318,6 +328,24 @@ Pipeline::resolverSorter( const Resolver* left, const Resolver* right )
}
void
Pipeline::setQIDState( const Tomahawk::query_ptr& query, int state )
{
QMutexLocker lock( &m_mut );
if ( state > 0 )
{
qDebug() << Q_FUNC_INFO << "inserting to qidsstate:" << query->id() << state;
m_qidsState.insert( query->id(), state );
}
else
{
qDebug() << Q_FUNC_INFO << "removing" << query->id() << state;
m_qidsState.remove( query->id() );
}
}
int
Pipeline::incQIDState( const Tomahawk::query_ptr& query )
{
@@ -329,7 +357,7 @@ Pipeline::incQIDState( const Tomahawk::query_ptr& query )
state = m_qidsState.value( query->id() ) + 1;
}
// qDebug() << Q_FUNC_INFO << "inserting to qidsstate:" << query->id() << state;
qDebug() << Q_FUNC_INFO << "inserting to qidsstate:" << query->id() << state;
m_qidsState.insert( query->id(), state );
return state;
@@ -341,15 +369,18 @@ Pipeline::decQIDState( const Tomahawk::query_ptr& query )
{
QMutexLocker lock( &m_mut );
if ( !m_qidsState.contains( query->id() ) )
return 0;
int state = m_qidsState.value( query->id() ) - 1;
if ( state )
{
// qDebug() << Q_FUNC_INFO << "replacing" << query->id() << state;
qDebug() << Q_FUNC_INFO << "replacing" << query->id() << state;
m_qidsState.insert( query->id(), state );
}
else
{
// qDebug() << Q_FUNC_INFO << "removing" << query->id() << state;
qDebug() << Q_FUNC_INFO << "removing" << query->id() << state;
m_qidsState.remove( query->id() );
}

View File

@@ -1,5 +1,5 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@@ -73,17 +73,20 @@ signals:
void idle();
private slots:
void timeoutShunt( const query_ptr& q );
void shunt( const query_ptr& q );
void shuntNext();
void indexReady();
private:
void setQIDState( const Tomahawk::query_ptr& query, int state );
int incQIDState( const Tomahawk::query_ptr& query );
int decQIDState( const Tomahawk::query_ptr& query );
QList< Resolver* > m_resolvers;
QMap< QID, bool > m_qidsTimeout;
QMap< QID, unsigned int > m_qidsState;
QMap< QID, query_ptr > m_qids;
QMap< RID, result_ptr > m_rids;

View File

@@ -80,7 +80,7 @@ const QPixmap SipHandler::avatar( const QString& name ) const
}
}
const QVariantMap
const SipInfo
SipHandler::sipInfo(const QString& peerId) const
{
return m_peersSipInfos.value( peerId );
@@ -193,6 +193,7 @@ SipHandler::hookUpPlugin( SipPlugin* sip )
QObject::connect( sip, SIGNAL( peerOnline( QString ) ), SLOT( onPeerOnline( QString ) ) );
QObject::connect( sip, SIGNAL( peerOffline( QString ) ), SLOT( onPeerOffline( QString ) ) );
QObject::connect( sip, SIGNAL( msgReceived( QString, QString ) ), SLOT( onMessage( QString, QString ) ) );
QObject::connect( sip, SIGNAL( sipInfoReceived( QString, SipInfo ) ), SLOT( onSipInfo( QString, SipInfo ) ) );
QObject::connect( sip, SIGNAL( error( int, QString ) ), SLOT( onError( int, QString ) ) );
QObject::connect( sip, SIGNAL( stateChanged( SipPlugin::ConnectionState ) ), SLOT( onStateChanged( SipPlugin::ConnectionState ) ) );
@@ -367,6 +368,7 @@ SipHandler::connectPlugin( bool startup, const QString &pluginId )
if ( sip->pluginId() == pluginId )
{
Q_ASSERT( m_enabledPlugins.contains( sip ) ); // make sure the plugin we're connecting is enabled. should always be the case
sip->setProxy( m_proxy );
sip->connectPlugin( startup );
}
}
@@ -417,6 +419,17 @@ SipHandler::toggleConnect()
connectAll();
}
void
SipHandler::setProxy( const QNetworkProxy& proxy )
{
qDebug() << Q_FUNC_INFO;
m_proxy = proxy;
foreach( SipPlugin* sip, m_allPlugins )
sip->setProxy( proxy );
}
void
SipHandler::onPeerOnline( const QString& jid )
@@ -471,39 +484,27 @@ SipHandler::onPeerOffline( const QString& jid )
qDebug() << "SIP offline:" << jid;
}
void
SipHandler::onMessage( const QString& from, const QString& msg )
SipHandler::onSipInfo( const QString& peerId, const SipInfo& info )
{
qDebug() << Q_FUNC_INFO;
qDebug() << "SIP Message:" << from << msg;
qDebug() << Q_FUNC_INFO << "SIP Message:" << peerId << info;
QJson::Parser parser;
bool ok;
QVariant v = parser.parse( msg.toAscii(), &ok );
if ( !ok || v.type() != QVariant::Map )
{
qDebug() << "Invalid JSON in XMPP msg";
return;
}
QVariantMap m = v.toMap();
/*
If only one party is externally visible, connection is obvious
If both are, peer with lowest IP address initiates the connection.
This avoids dupe connections.
*/
if ( m.value( "visible" ).toBool() )
if ( info.isVisible() )
{
if( !Servent::instance()->visibleExternally() ||
Servent::instance()->externalAddress() <= m.value( "ip" ).toString() )
Servent::instance()->externalAddress() <= info.host().hostName() )
{
qDebug() << "Initiate connection to" << from;
Servent::instance()->connectToPeer( m.value( "ip" ).toString(),
m.value( "port" ).toInt(),
m.value( "key" ).toString(),
from,
m.value( "uniqname" ).toString() );
qDebug() << "Initiate connection to" << peerId;
Servent::instance()->connectToPeer( info.host().hostName(),
info.port(),
info.key(),
peerId,
info.uniqname() );
}
else
{
@@ -515,7 +516,13 @@ SipHandler::onMessage( const QString& from, const QString& msg )
qDebug() << Q_FUNC_INFO << "They are not visible, doing nothing atm";
}
m_peersSipInfos.insert( from, m );
m_peersSipInfos.insert( peerId, info );
}
void
SipHandler::onMessage( const QString& from, const QString& msg )
{
qDebug() << Q_FUNC_INFO;
}

View File

@@ -52,7 +52,7 @@ public:
const QPixmap avatar( const QString& name ) const;
//TODO: implement a proper SipInfo class and maybe attach it to the source
const QVariantMap sipInfo( const QString& peerId ) const;
const SipInfo sipInfo( const QString& peerId ) const;
public slots:
void checkSettings();
@@ -67,6 +67,8 @@ public slots:
void toggleConnect();
void setProxy( const QNetworkProxy &proxy );
// create a new plugin of the given name. the name is the value returned in SipPluginFactory::pluginName
// be default sip plugins are NOt connected when created
SipPlugin* createPlugin( const QString& factoryName );
@@ -85,6 +87,7 @@ signals:
void pluginRemoved( SipPlugin* p );
private slots:
void onSipInfo( const QString& peerId, const SipInfo& info );
void onMessage( const QString&, const QString& );
void onPeerOffline( const QString& );
void onPeerOnline( const QString& );
@@ -116,9 +119,10 @@ private:
QList< SipPlugin* > m_enabledPlugins;
QList< SipPlugin* > m_connectedPlugins;
bool m_connected;
QNetworkProxy m_proxy;
//TODO: move this to source
QHash<QString, QVariantMap> m_peersSipInfos;
QHash<QString, SipInfo> m_peersSipInfos;
QHash<QString, QPixmap> m_usernameAvatars;
};

View File

@@ -20,6 +20,8 @@
#ifndef SIPPLUGIN_H
#define SIPPLUGIN_H
#include "sipinfo.h"
#include <QObject>
#include <QString>
#include <QMenu>
@@ -87,7 +89,7 @@ public slots:
virtual void addContact( const QString &jid, const QString& msg = QString() ) = 0;
virtual void sendMsg( const QString& to, const QString& msg ) = 0;
void setProxy( const QNetworkProxy &proxy );
virtual void setProxy( const QNetworkProxy &proxy );
signals:
void error( int, const QString& );
@@ -96,6 +98,7 @@ signals:
void peerOnline( const QString& );
void peerOffline( const QString& );
void msgReceived( const QString& from, const QString& msg );
void sipInfoReceived( const QString& peerId, const SipInfo& info );
// new data for own source
void avatarReceived ( const QPixmap& avatar );

View File

@@ -0,0 +1,229 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2011, Dominik Schmidt <dev@dominik-schmidt.de>
*
* Tomahawk 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 3 of the License, or
* (at your option) any later version.
*
* Tomahawk 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 Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "sipinfo.h"
#include <qjson/parser.h>
#include <qjson/serializer.h>
#include <QVariant>
class SipInfoPrivate : public QSharedData {
public:
SipInfoPrivate()
: port( -1 )
{
}
SipInfoPrivate( const SipInfoPrivate& other ) : QSharedData( other ),
visible(other.visible),
host(other.host),
port(other.port),
uniqname(other.uniqname),
key(other.key)
{
}
~SipInfoPrivate() { }
QVariant visible;
QHostInfo host;
int port;
QString uniqname;
QString key;
};
SipInfo::SipInfo()
{
d = new SipInfoPrivate;
}
SipInfo::SipInfo(const SipInfo& other): d ( other.d )
{
}
SipInfo::~SipInfo()
{
}
SipInfo&
SipInfo::operator=( const SipInfo& other )
{
d = other.d;
return *this;
}
void
SipInfo::clear()
{
d->visible.clear();
d->host = QHostInfo();
d->port = -1;
d->uniqname = QString();
d->key = QString();
}
bool
SipInfo::isValid() const
{
qDebug() << Q_FUNC_INFO << d->visible << d->host.hostName() << d->port << d->uniqname << d->key;
if( !d->visible.isNull() )
{
if(
// visible and all data available
( d->visible.toBool() && !d->host.hostName().isNull() && ( d->port > 0 ) && !d->uniqname.isNull() && !d->key.isNull() )
// invisible and no data available
|| ( !d->visible.toBool() && d->host.hostName().isNull() && ( d->port < 0 ) && d->uniqname.isNull() && d->key.isNull() )
)
return true;
}
return false;
}
void
SipInfo::setVisible(bool visible)
{
d->visible.setValue(visible);
}
bool
SipInfo::isVisible() const
{
Q_ASSERT( isValid() );
return d->visible.toBool();
}
void
SipInfo::setHost( const QHostInfo& host )
{
d->host = host;
}
const QHostInfo
SipInfo::host() const
{
Q_ASSERT( isValid() );
return d->host;
}
void
SipInfo::setPort( int port )
{
d->port = port;
}
int
SipInfo::port() const
{
Q_ASSERT( isValid() );
return d->port;
}
void
SipInfo::setUniqname( const QString& uniqname )
{
d->uniqname = uniqname;
}
const QString
SipInfo::uniqname() const
{
Q_ASSERT( isValid() );
return d->uniqname;
}
void
SipInfo::setKey( const QString& key )
{
d->key = key;
}
const QString
SipInfo::key() const
{
Q_ASSERT( isValid() );
return d->key;
}
const QString
SipInfo::toJson() const
{
// build variant map
QVariantMap m;
m["visible"] = isVisible();
if( isVisible() )
{
m["ip"] = host().hostName();
m["port"] = port();
m["key"] = key();
m["uniqname"] = uniqname();
}
// serialize
QJson::Serializer serializer;
QByteArray ba = serializer.serialize( m );
return QString::fromAscii( ba );
}
const SipInfo
SipInfo::fromJson( QString json )
{
SipInfo info;
QJson::Parser parser;
bool ok;
QVariant v = parser.parse( json.toAscii(), &ok );
if ( !ok || v.type() != QVariant::Map )
{
qDebug() << Q_FUNC_INFO << "Invalid JSON: " << json;
return info;
}
QVariantMap m = v.toMap();
info.setVisible( m["visible"].toBool() );
if( m["visible"].toBool() )
{
QHostInfo hostInfo;
hostInfo.setHostName( m["host"].toString() );
info.setHost( hostInfo );
info.setPort( m["port"].toInt() );
info.setUniqname( m["uniqname"].toString() );
info.setKey( m["key"].toString() );
}
return info;
}
QDebug operator<< ( QDebug dbg, const SipInfo& info )
{
if( !info.isValid() )
dbg.nospace() << "info is invalid";
else
dbg.nospace() << info.toJson();
return dbg.maybeSpace();
}

View File

@@ -0,0 +1,70 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2011, Dominik Schmidt <dev@dominik-schmidt.de>
*
* Tomahawk 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 3 of the License, or
* (at your option) any later version.
*
* Tomahawk 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 Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SIPINFO_H
#define SIPINFO_H
#include <QDebug>
#include <QSharedPointer>
#include <QHostInfo>
class SipInfoPrivate;
#include "../dllmacro.h"
class DLLEXPORT SipInfo : public QObject
{
Q_OBJECT
public:
SipInfo();
SipInfo(const SipInfo& other);
virtual ~SipInfo();
SipInfo& operator=(const SipInfo& info);
void clear();
bool isValid() const;
void setVisible( bool visible );
bool isVisible() const;
void setHost( const QHostInfo& host );
const QHostInfo host() const;
void setPort( int port );
int port() const;
void setUniqname( const QString& uniqname );
const QString uniqname() const;
void setKey( const QString& key );
const QString key() const;
const QString toJson() const;
static const SipInfo fromJson( QString json );
private:
QSharedDataPointer<SipInfoPrivate> d;
};
DLLEXPORT QDebug operator<<( QDebug dbg, const SipInfo &info );
#endif // SIPINFO_H

View File

@@ -41,6 +41,8 @@ GoogleWrapper::GoogleWrapper ( const QString& pluginID )
m_ui->emailLabel->setText( tr( "Google Address" ) );
m_ui->jabberBlurb->setText( tr( "Enter your Google login to connect with your friends using Tomahawk!" ) );
m_ui->logoLabel->setPixmap( QPixmap( ":/gmail-logo.png" ) );
m_ui->jabberServer->setText( "talk.google.com" );
m_ui->jabberPort->setValue( 5222 );
m_ui->groupBoxJabberAdvanced->hide();
}

View File

@@ -139,11 +139,13 @@ JabberPlugin::~JabberPlugin()
void
JabberPlugin::setProxy( const QNetworkProxy &proxy )
{
if(m_currentServer.isEmpty() || !(m_currentPort > 0))
qDebug() << Q_FUNC_INFO;
if( ( proxy.type() != QNetworkProxy::NoProxy ) && ( m_currentServer.isEmpty() || !(m_currentPort > 0) ) )
{
// patches are welcome in Jreen that implement jdns through proxy
qDebug() << Q_FUNC_INFO << "Jreen proxy only works when you explicitly set host and port";
Q_ASSERT(false);
emit error( SipPlugin::ConnectionError,
tr( "You need to set hostname and port of your jabber server, if you want to use it through a proxy" ) );
return;
}
@@ -554,13 +556,12 @@ void JabberPlugin::onNewMessage(const Jreen::Message& message)
QString from = message.from().full();
QString msg = message.body();
if ( msg.isEmpty() )
if(msg.isEmpty())
return;
QJson::Parser parser;
bool ok;
QVariant v = parser.parse( msg.toAscii(), &ok );
if ( !ok || v.type() != QVariant::Map )
SipInfo info = SipInfo::fromJson( msg );
if ( !info.isValid() )
{
QString to = from;
QString response = QString( tr("I'm sorry -- I'm just an automatic presence used by Tomahawk Player"
@@ -570,11 +571,12 @@ void JabberPlugin::onNewMessage(const Jreen::Message& message)
// this is not a sip message, so we send it directly through the client
m_client->send( Jreen::Message ( Jreen::Message::Chat, Jreen::JID(to), response) );
emit msgReceived( from, msg );
return;
}
qDebug() << Q_FUNC_INFO << "From:" << message.from().full() << ":" << message.body();
emit msgReceived( from, msg );
emit sipInfoReceived( from, info );
}
@@ -768,35 +770,29 @@ void JabberPlugin::onNewIq(const Jreen::IQ& iq, int context)
iq.accept();
qDebug() << Q_FUNC_INFO << "Got SipMessage ...";
qDebug() << "ip" << sipMessage->ip();
qDebug() << "port" << sipMessage->port();
qDebug() << "uniqname" << sipMessage->uniqname();
qDebug() << "key" << sipMessage->key();
qDebug() << "visible" << sipMessage->visible();
qDebug() << Q_FUNC_INFO << "ip" << sipMessage->ip();
qDebug() << Q_FUNC_INFO << "port" << sipMessage->port();
qDebug() << Q_FUNC_INFO << "uniqname" << sipMessage->uniqname();
qDebug() << Q_FUNC_INFO << "key" << sipMessage->key();
qDebug() << Q_FUNC_INFO << "visible" << sipMessage->visible();
QVariantMap m;
SipInfo info;
info.setVisible( sipMessage->visible() );
if( sipMessage->visible() )
{
m["visible"] = true;
m["ip"] = sipMessage->ip();
m["port"] = sipMessage->port();
m["key"] = sipMessage->key();
m["uniqname"] = sipMessage->uniqname();
}
else
{
m["visible"] = false;
QHostInfo hi;
hi.setHostName( sipMessage->ip() );
info.setHost( hi );
info.setPort( sipMessage->port() );
info.setUniqname( sipMessage->uniqname() );
info.setKey( sipMessage->key() );
}
Q_ASSERT( info.isValid() );
QJson::Serializer ser;
QByteArray ba = ser.serialize( m );
QString msg = QString::fromAscii( ba );
QString from = iq.from().full();
qDebug() << Q_FUNC_INFO << "From:" << from << ":" << msg;
emit msgReceived( from, msg );
qDebug() << Q_FUNC_INFO << "From:" << iq.from().full() << ":" << info;
emit sipInfoReceived( iq.from().full(), info );
}
}
}

View File

@@ -534,10 +534,8 @@ TomahawkApp::setupSIP()
#endif
qDebug() << "Connecting SIP classes";
SipHandler::instance()->setProxy( *TomahawkUtils::proxy() );
SipHandler::instance()->loadFromConfig( true );
// m_sipHandler->setProxy( *TomahawkUtils::proxy() );
}
}