From 9046079c9597c6fe50ba16a1c68b80c32c8b111e Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Sun, 27 Jan 2013 23:40:03 +0100 Subject: [PATCH] Streamline API: SipInfo::uniqname() -> SipInfo::nodeId() --- src/accounts/xmpp/sip/XmppSip.cpp | 6 +++--- src/accounts/zeroconf/Zeroconf.cpp | 2 +- src/libtomahawk/network/Servent.cpp | 12 ++++++------ src/libtomahawk/sip/SipInfo.cpp | 28 ++++++++++++++-------------- src/libtomahawk/sip/SipInfo.h | 4 ++-- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/accounts/xmpp/sip/XmppSip.cpp b/src/accounts/xmpp/sip/XmppSip.cpp index e8cea0c18..512217165 100644 --- a/src/accounts/xmpp/sip/XmppSip.cpp +++ b/src/accounts/xmpp/sip/XmppSip.cpp @@ -444,7 +444,7 @@ XmppSipPlugin::sendSipInfo( const Tomahawk::peerinfo_ptr& receiver, const SipInf TomahawkXmppMessage *sipMessage; 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 sipMessage = new TomahawkXmppMessage(); @@ -895,7 +895,7 @@ XmppSipPlugin::onNewIq( const Jreen::IQ& iq ) iq.accept(); 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; info.setVisible( sipMessage->visible() ); @@ -903,7 +903,7 @@ XmppSipPlugin::onNewIq( const Jreen::IQ& iq ) { info.setHost( sipMessage->ip() ); info.setPort( sipMessage->port() ); - info.setUniqname( sipMessage->uniqname() ); + info.setNodeId( sipMessage->uniqname() ); info.setKey( sipMessage->key() ); } diff --git a/src/accounts/zeroconf/Zeroconf.cpp b/src/accounts/zeroconf/Zeroconf.cpp index 15f8e10d2..e60d806ed 100644 --- a/src/accounts/zeroconf/Zeroconf.cpp +++ b/src/accounts/zeroconf/Zeroconf.cpp @@ -147,7 +147,7 @@ ZeroconfPlugin::lanHostFound( const QString& host, int port, const QString& name SipInfo sipInfo; sipInfo.setHost( host ); sipInfo.setPort( port ); - sipInfo.setUniqname( nodeid ); + sipInfo.setNodeId( nodeid ); sipInfo.setKey( "whitelist" ); sipInfo.setVisible( true ); diff --git a/src/libtomahawk/network/Servent.cpp b/src/libtomahawk/network/Servent.cpp index 7f2708a65..22c674635 100644 --- a/src/libtomahawk/network/Servent.cpp +++ b/src/libtomahawk/network/Servent.cpp @@ -303,7 +303,7 @@ Servent::registerPeer( const Tomahawk::peerinfo_ptr& peerInfo ) if ( peerInfo->type() == Tomahawk::PeerInfo::Local ) { peerInfoDebug(peerInfo) << "YAY, we need to establish the connection now.. thinking"; - if ( !connectedToSession( peerInfo->sipInfo().uniqname() ) ) + if ( !connectedToSession( peerInfo->sipInfo().nodeId() ) ) { connectToPeer( peerInfo ); } @@ -343,7 +343,7 @@ Servent::registerPeer( const Tomahawk::peerinfo_ptr& peerInfo ) info.setHost( externalAddress() ); info.setPort( externalPort() ); info.setKey( key ); - info.setUniqname( nodeid ); + info.setNodeId( nodeid ); tDebug() << "Asking them (" << peerInfo->id() << ") to connect to us:" << info; } @@ -707,7 +707,7 @@ Servent::connectToPeer( const peerinfo_ptr& peerInfo ) if ( !c ) continue; - if ( c->id() == sipInfo.uniqname() ) + if ( c->id() == sipInfo.nodeId() ) { conn = c; @@ -760,10 +760,10 @@ Servent::connectToPeer( const peerinfo_ptr& peerInfo ) if ( peerInfo->id().length() ) conn->setName( peerInfo->id() ); - if ( sipInfo.uniqname().length() ) - conn->setId( sipInfo.uniqname() ); + if ( sipInfo.nodeId().length() ) + conn->setId( sipInfo.nodeId() ); - conn->setProperty( "nodeid", sipInfo.uniqname() ); + conn->setProperty( "nodeid", sipInfo.nodeId() ); registerControlConnection( conn ); connectToPeer( sipInfo.host(), sipInfo.port(), sipInfo.key(), conn ); diff --git a/src/libtomahawk/sip/SipInfo.cpp b/src/libtomahawk/sip/SipInfo.cpp index 13cc40474..ef26ee7b3 100644 --- a/src/libtomahawk/sip/SipInfo.cpp +++ b/src/libtomahawk/sip/SipInfo.cpp @@ -39,7 +39,7 @@ public: visible(other.visible), host(other.host), port(other.port), - uniqname(other.uniqname), + nodeId(other.nodeId), key(other.key) { } @@ -48,7 +48,7 @@ public: QVariant visible; QString host; int port; - QString uniqname; + QString nodeId; QString key; }; @@ -85,7 +85,7 @@ SipInfo::clear() d->visible.clear(); d->host = QString(); d->port = -1; - d->uniqname = QString(); + d->nodeId = QString(); d->key = QString(); } @@ -93,14 +93,14 @@ SipInfo::clear() bool 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( // 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 - || ( !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; } @@ -158,18 +158,18 @@ SipInfo::port() const void -SipInfo::setUniqname( const QString& uniqname ) +SipInfo::setNodeId( const QString& nodeId ) { - d->uniqname = uniqname; + d->nodeId = nodeId; } const QString -SipInfo::uniqname() const +SipInfo::nodeId() const { Q_ASSERT( isValid() ); - return d->uniqname; + return d->nodeId; } @@ -200,7 +200,7 @@ SipInfo::toJson() const m["ip"] = host(); m["port"] = port(); m["key"] = key(); - m["uniqname"] = uniqname(); + m["uniqname"] = nodeId(); } // serialize @@ -231,7 +231,7 @@ SipInfo::fromJson( QString json ) { info.setHost( m["host"].toString() ); info.setPort( m["port"].toInt() ); - info.setUniqname( m["uniqname"].toString() ); + info.setNodeId( m["uniqname"].toString() ); info.setKey( m["key"].toString() ); } @@ -262,7 +262,7 @@ bool operator==( const SipInfo& one, const SipInfo& two ) if ( one.isVisible() == two.isVisible() && one.host() == two.host() && one.port() == two.port() - && one.uniqname() == two.uniqname() + && one.nodeId() == two.nodeId() && one.key() == two.key() ) { return true; @@ -279,7 +279,7 @@ SipInfo::debugString() const return debugString.arg( d->visible.toBool() ) .arg( d->host ) .arg( d->port ) - .arg( d->uniqname ) + .arg( d->nodeId ) .arg( d->key ); } diff --git a/src/libtomahawk/sip/SipInfo.h b/src/libtomahawk/sip/SipInfo.h index b10e50d33..fe337ea2d 100644 --- a/src/libtomahawk/sip/SipInfo.h +++ b/src/libtomahawk/sip/SipInfo.h @@ -48,8 +48,8 @@ public: void setPort( int port ); int port() const; - void setUniqname( const QString& uniqname ); - const QString uniqname() const; + void setNodeId( const QString& nodeId ); + const QString nodeId() const; void setKey( const QString& key ); const QString key() const;