1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-13 17:43:59 +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;
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() );
}

View File

@@ -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 );

View File

@@ -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 );

View File

@@ -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 );
}

View File

@@ -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;