1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-15 02:24:50 +02:00

Streamline API: SipInfo::uniqname() -> SipInfo::nodeId()

This commit is contained in:
Dominik Schmidt
2013-01-27 23:40:03 +01:00
parent d8f6378739
commit 9046079c95
5 changed files with 26 additions and 26 deletions

View File

@@ -444,7 +444,7 @@ XmppSipPlugin::sendSipInfo( const Tomahawk::peerinfo_ptr& receiver, const SipInf
TomahawkXmppMessage *sipMessage; TomahawkXmppMessage *sipMessage;
if ( info.isVisible() ) if ( info.isVisible() )
{ {
sipMessage = new TomahawkXmppMessage( info.host(), info.port(), info.uniqname(), info.key() ); sipMessage = new TomahawkXmppMessage( info.host(), info.port(), info.nodeId(), info.key() );
} }
else else
sipMessage = new TomahawkXmppMessage(); sipMessage = new TomahawkXmppMessage();
@@ -895,7 +895,7 @@ XmppSipPlugin::onNewIq( const Jreen::IQ& iq )
iq.accept(); iq.accept();
qDebug() << Q_FUNC_INFO << "Got SipMessage ..." qDebug() << Q_FUNC_INFO << "Got SipMessage ..."
<< "ip" << sipMessage->ip() << "port" << sipMessage->port() << "uniqname" << sipMessage->uniqname() << "key" << sipMessage->key() << "visible" << sipMessage->visible(); << "ip" << sipMessage->ip() << "port" << sipMessage->port() << "nodeId" << sipMessage->uniqname() << "key" << sipMessage->key() << "visible" << sipMessage->visible();
SipInfo info; SipInfo info;
info.setVisible( sipMessage->visible() ); info.setVisible( sipMessage->visible() );
@@ -903,7 +903,7 @@ XmppSipPlugin::onNewIq( const Jreen::IQ& iq )
{ {
info.setHost( sipMessage->ip() ); info.setHost( sipMessage->ip() );
info.setPort( sipMessage->port() ); info.setPort( sipMessage->port() );
info.setUniqname( sipMessage->uniqname() ); info.setNodeId( sipMessage->uniqname() );
info.setKey( sipMessage->key() ); info.setKey( sipMessage->key() );
} }

View File

@@ -147,7 +147,7 @@ ZeroconfPlugin::lanHostFound( const QString& host, int port, const QString& name
SipInfo sipInfo; SipInfo sipInfo;
sipInfo.setHost( host ); sipInfo.setHost( host );
sipInfo.setPort( port ); sipInfo.setPort( port );
sipInfo.setUniqname( nodeid ); sipInfo.setNodeId( nodeid );
sipInfo.setKey( "whitelist" ); sipInfo.setKey( "whitelist" );
sipInfo.setVisible( true ); sipInfo.setVisible( true );

View File

@@ -303,7 +303,7 @@ Servent::registerPeer( const Tomahawk::peerinfo_ptr& peerInfo )
if ( peerInfo->type() == Tomahawk::PeerInfo::Local ) if ( peerInfo->type() == Tomahawk::PeerInfo::Local )
{ {
peerInfoDebug(peerInfo) << "YAY, we need to establish the connection now.. thinking"; peerInfoDebug(peerInfo) << "YAY, we need to establish the connection now.. thinking";
if ( !connectedToSession( peerInfo->sipInfo().uniqname() ) ) if ( !connectedToSession( peerInfo->sipInfo().nodeId() ) )
{ {
connectToPeer( peerInfo ); connectToPeer( peerInfo );
} }
@@ -343,7 +343,7 @@ Servent::registerPeer( const Tomahawk::peerinfo_ptr& peerInfo )
info.setHost( externalAddress() ); info.setHost( externalAddress() );
info.setPort( externalPort() ); info.setPort( externalPort() );
info.setKey( key ); info.setKey( key );
info.setUniqname( nodeid ); info.setNodeId( nodeid );
tDebug() << "Asking them (" << peerInfo->id() << ") to connect to us:" << info; tDebug() << "Asking them (" << peerInfo->id() << ") to connect to us:" << info;
} }
@@ -707,7 +707,7 @@ Servent::connectToPeer( const peerinfo_ptr& peerInfo )
if ( !c ) if ( !c )
continue; continue;
if ( c->id() == sipInfo.uniqname() ) if ( c->id() == sipInfo.nodeId() )
{ {
conn = c; conn = c;
@@ -760,10 +760,10 @@ Servent::connectToPeer( const peerinfo_ptr& peerInfo )
if ( peerInfo->id().length() ) if ( peerInfo->id().length() )
conn->setName( peerInfo->id() ); conn->setName( peerInfo->id() );
if ( sipInfo.uniqname().length() ) if ( sipInfo.nodeId().length() )
conn->setId( sipInfo.uniqname() ); conn->setId( sipInfo.nodeId() );
conn->setProperty( "nodeid", sipInfo.uniqname() ); conn->setProperty( "nodeid", sipInfo.nodeId() );
registerControlConnection( conn ); registerControlConnection( conn );
connectToPeer( sipInfo.host(), sipInfo.port(), sipInfo.key(), conn ); connectToPeer( sipInfo.host(), sipInfo.port(), sipInfo.key(), conn );

View File

@@ -39,7 +39,7 @@ public:
visible(other.visible), visible(other.visible),
host(other.host), host(other.host),
port(other.port), port(other.port),
uniqname(other.uniqname), nodeId(other.nodeId),
key(other.key) key(other.key)
{ {
} }
@@ -48,7 +48,7 @@ public:
QVariant visible; QVariant visible;
QString host; QString host;
int port; int port;
QString uniqname; QString nodeId;
QString key; QString key;
}; };
@@ -85,7 +85,7 @@ SipInfo::clear()
d->visible.clear(); d->visible.clear();
d->host = QString(); d->host = QString();
d->port = -1; d->port = -1;
d->uniqname = QString(); d->nodeId = QString();
d->key = QString(); d->key = QString();
} }
@@ -93,14 +93,14 @@ SipInfo::clear()
bool bool
SipInfo::isValid() const SipInfo::isValid() const
{ {
// qDebug() << Q_FUNC_INFO << d->visible << d->host.hostName() << d->port << d->uniqname << d->key; // qDebug() << Q_FUNC_INFO << d->visible << d->host.hostName() << d->port << d->nodeId << d->key;
if( !d->visible.isNull() ) if( !d->visible.isNull() )
{ {
if( if(
// visible and all data available // visible and all data available
( d->visible.toBool() && !d->host.isEmpty() && ( d->port > 0 ) && !d->uniqname.isNull() && !d->key.isNull() ) ( d->visible.toBool() && !d->host.isEmpty() && ( d->port > 0 ) && !d->nodeId.isNull() && !d->key.isNull() )
// invisible and no data available // invisible and no data available
|| ( !d->visible.toBool() && d->host.isEmpty() && ( d->port < 0 ) && d->uniqname.isNull() && d->key.isNull() ) || ( !d->visible.toBool() && d->host.isEmpty() && ( d->port < 0 ) && d->nodeId.isNull() && d->key.isNull() )
) )
return true; return true;
} }
@@ -158,18 +158,18 @@ SipInfo::port() const
void void
SipInfo::setUniqname( const QString& uniqname ) SipInfo::setNodeId( const QString& nodeId )
{ {
d->uniqname = uniqname; d->nodeId = nodeId;
} }
const QString const QString
SipInfo::uniqname() const SipInfo::nodeId() const
{ {
Q_ASSERT( isValid() ); Q_ASSERT( isValid() );
return d->uniqname; return d->nodeId;
} }
@@ -200,7 +200,7 @@ SipInfo::toJson() const
m["ip"] = host(); m["ip"] = host();
m["port"] = port(); m["port"] = port();
m["key"] = key(); m["key"] = key();
m["uniqname"] = uniqname(); m["uniqname"] = nodeId();
} }
// serialize // serialize
@@ -231,7 +231,7 @@ SipInfo::fromJson( QString json )
{ {
info.setHost( m["host"].toString() ); info.setHost( m["host"].toString() );
info.setPort( m["port"].toInt() ); info.setPort( m["port"].toInt() );
info.setUniqname( m["uniqname"].toString() ); info.setNodeId( m["uniqname"].toString() );
info.setKey( m["key"].toString() ); info.setKey( m["key"].toString() );
} }
@@ -262,7 +262,7 @@ bool operator==( const SipInfo& one, const SipInfo& two )
if ( one.isVisible() == two.isVisible() if ( one.isVisible() == two.isVisible()
&& one.host() == two.host() && one.host() == two.host()
&& one.port() == two.port() && one.port() == two.port()
&& one.uniqname() == two.uniqname() && one.nodeId() == two.nodeId()
&& one.key() == two.key() ) && one.key() == two.key() )
{ {
return true; return true;
@@ -279,7 +279,7 @@ SipInfo::debugString() const
return debugString.arg( d->visible.toBool() ) return debugString.arg( d->visible.toBool() )
.arg( d->host ) .arg( d->host )
.arg( d->port ) .arg( d->port )
.arg( d->uniqname ) .arg( d->nodeId )
.arg( d->key ); .arg( d->key );
} }

View File

@@ -48,8 +48,8 @@ public:
void setPort( int port ); void setPort( int port );
int port() const; int port() const;
void setUniqname( const QString& uniqname ); void setNodeId( const QString& nodeId );
const QString uniqname() const; const QString nodeId() const;
void setKey( const QString& key ); void setKey( const QString& key );
const QString key() const; const QString key() const;