1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-04 05:07:27 +02:00

Rename sipInfo to sipInfos at various places

This commit is contained in:
Uwe L. Korn
2013-05-14 11:06:38 +02:00
parent 175c765253
commit 152609e68d
13 changed files with 61 additions and 58 deletions

View File

@@ -21,11 +21,13 @@
#include "utils/Logger.h" #include "utils/Logger.h"
TomahawkXmppMessage::TomahawkXmppMessage() : m_sipInfo() TomahawkXmppMessage::TomahawkXmppMessage()
: m_sipInfos()
{ {
} }
TomahawkXmppMessage::TomahawkXmppMessage( const QList<SipInfo> &sipInfo ) : m_sipInfo( sipInfo ) TomahawkXmppMessage::TomahawkXmppMessage( const QList<SipInfo> &sipInfos )
: m_sipInfos( sipInfos )
{ {
} }
@@ -34,26 +36,26 @@ TomahawkXmppMessage::~TomahawkXmppMessage()
} }
const QList<SipInfo> const QList<SipInfo>
TomahawkXmppMessage::sipInfo() const TomahawkXmppMessage::sipInfos() const
{ {
return m_sipInfo; return m_sipInfos;
} }
const QString const QString
TomahawkXmppMessage::key() const TomahawkXmppMessage::key() const
{ {
if ( m_sipInfo.length() > 0 ) if ( m_sipInfos.isEmpty() )
return m_sipInfo.first().key();
else
return QString(); return QString();
else
return m_sipInfos.first().key();
} }
const QString const QString
TomahawkXmppMessage::uniqname() const TomahawkXmppMessage::uniqname() const
{ {
if ( m_sipInfo.length() > 0 ) if ( m_sipInfos.isEmpty() )
return m_sipInfo.first().nodeId();
else
return QString(); return QString();
else
return m_sipInfos.first().nodeId();
} }

View File

@@ -33,13 +33,13 @@ class ACCOUNTDLLEXPORT TomahawkXmppMessage : public Jreen::Payload
J_PAYLOAD(TomahawkXmppMessage) J_PAYLOAD(TomahawkXmppMessage)
public: public:
TomahawkXmppMessage(); TomahawkXmppMessage();
TomahawkXmppMessage(const QList<SipInfo>& sipInfo); TomahawkXmppMessage(const QList<SipInfo>& sipInfos);
~TomahawkXmppMessage(); ~TomahawkXmppMessage();
/** /**
* The SipInfo objects that are wrapped in this XmppMessage * The SipInfo objects that are wrapped in this XmppMessage
*/ */
const QList<SipInfo> sipInfo() const; const QList<SipInfo> sipInfos() const;
/** /**
* The name of the peer contained in this message * The name of the peer contained in this message
@@ -52,7 +52,7 @@ class ACCOUNTDLLEXPORT TomahawkXmppMessage : public Jreen::Payload
const QString uniqname() const; const QString uniqname() const;
private: private:
QList<SipInfo> m_sipInfo; QList<SipInfo> m_sipInfos;
}; };
#endif // ENTITYTIME_H #endif // ENTITYTIME_H

View File

@@ -29,7 +29,8 @@
using namespace Jreen; using namespace Jreen;
TomahawkXmppMessageFactory::TomahawkXmppMessageFactory() : m_sipInfo() TomahawkXmppMessageFactory::TomahawkXmppMessageFactory()
: m_sipInfos()
{ {
m_depth = 0; m_depth = 0;
m_state = AtNowhere; m_state = AtNowhere;
@@ -60,7 +61,7 @@ void TomahawkXmppMessageFactory::handleStartElement(const QStringRef &name, cons
m_state = AtNowhere; m_state = AtNowhere;
m_uniqname = QString(); m_uniqname = QString();
m_key = QString(); m_key = QString();
m_sipInfo = QList<SipInfo>(); m_sipInfos = QList<SipInfo>();
} }
else if ( m_depth == 2 ) else if ( m_depth == 2 )
{ {
@@ -83,7 +84,7 @@ void TomahawkXmppMessageFactory::handleStartElement(const QStringRef &name, cons
info.setKey( m_key ); info.setKey( m_key );
info.setNodeId( m_uniqname ); info.setNodeId( m_uniqname );
Q_ASSERT( info.isValid() ); Q_ASSERT( info.isValid() );
m_sipInfo.append( info ); m_sipInfos.append( info );
} }
} }
Q_UNUSED(uri); Q_UNUSED(uri);
@@ -98,14 +99,14 @@ void TomahawkXmppMessageFactory::handleEndElement(const QStringRef &name, const
{ {
m_state = AtNowhere; m_state = AtNowhere;
// Check that we have at least one SipInfo so that we provide some information about invisible peers. // Check that we have at least one SipInfo so that we provide some information about invisible peers.
if ( m_sipInfo.length() == 0 ) if ( m_sipInfos.isEmpty() )
{ {
SipInfo info = SipInfo(); SipInfo info = SipInfo();
info.setVisible( false ); info.setVisible( false );
info.setKey( m_key ); info.setKey( m_key );
info.setNodeId( m_uniqname ); info.setNodeId( m_uniqname );
Q_ASSERT( info.isValid() ); Q_ASSERT( info.isValid() );
m_sipInfo.append( info ); m_sipInfos.append( info );
} }
} }
Q_UNUSED(name); Q_UNUSED(name);
@@ -134,9 +135,9 @@ void TomahawkXmppMessageFactory::serialize(Payload *extension, QXmlStreamWriter
writer->writeDefaultNamespace( TOMAHAWK_SIP_MESSAGE_NS ); writer->writeDefaultNamespace( TOMAHAWK_SIP_MESSAGE_NS );
// Get a copy of the list, so that we can modify it here. // Get a copy of the list, so that we can modify it here.
QList<SipInfo> sipInfo = QList<SipInfo>( sipMessage->sipInfo() ); QList<SipInfo> sipInfos = QList<SipInfo>( sipMessage->sipInfos() );
QSharedPointer<SipInfo> lastInfo = QSharedPointer<SipInfo>(); QSharedPointer<SipInfo> lastInfo = QSharedPointer<SipInfo>();
foreach ( SipInfo info, sipInfo ) foreach ( SipInfo info, sipInfos )
{ {
if ( info.isVisible() ) if ( info.isVisible() )
{ {
@@ -145,7 +146,7 @@ void TomahawkXmppMessageFactory::serialize(Payload *extension, QXmlStreamWriter
{ {
// For comapability reasons, this shall be put as the last candidate // For comapability reasons, this shall be put as the last candidate
lastInfo = QSharedPointer<SipInfo>( new SipInfo( info ) ); lastInfo = QSharedPointer<SipInfo>( new SipInfo( info ) );
sipInfo.removeOne( info ); sipInfos.removeOne( info );
break; break;
} }
} }
@@ -155,7 +156,7 @@ void TomahawkXmppMessageFactory::serialize(Payload *extension, QXmlStreamWriter
writer->writeAttribute( QLatin1String( "pwd" ), sipMessage->key() ); writer->writeAttribute( QLatin1String( "pwd" ), sipMessage->key() );
writer->writeAttribute( QLatin1String( "uniqname" ), sipMessage->uniqname() ); writer->writeAttribute( QLatin1String( "uniqname" ), sipMessage->uniqname() );
foreach ( SipInfo info, sipInfo ) foreach ( SipInfo info, sipInfos )
{ {
if ( info.isVisible() ) if ( info.isVisible() )
serializeSipInfo( info, writer ); serializeSipInfo( info, writer );
@@ -176,7 +177,7 @@ void TomahawkXmppMessageFactory::serialize(Payload *extension, QXmlStreamWriter
Payload::Ptr Payload::Ptr
TomahawkXmppMessageFactory::createPayload() TomahawkXmppMessageFactory::createPayload()
{ {
return Payload::Ptr( new TomahawkXmppMessage( m_sipInfo ) ); return Payload::Ptr( new TomahawkXmppMessage( m_sipInfos ) );
} }
void void

View File

@@ -46,7 +46,7 @@ private:
/** /**
* All the provided Sip informations * All the provided Sip informations
*/ */
QList<SipInfo> m_sipInfo; QList<SipInfo> m_sipInfos;
/** /**
* The current parsing depth * The current parsing depth

View File

@@ -435,7 +435,7 @@ XmppSipPlugin::errorMessage( Jreen::Client::DisconnectReason reason )
void void
XmppSipPlugin::sendSipInfo( const Tomahawk::peerinfo_ptr& receiver, const QList<SipInfo>& info ) XmppSipPlugin::sendSipInfos( const Tomahawk::peerinfo_ptr& receiver, const QList<SipInfo>& info )
{ {
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << receiver << info; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << receiver << info;
@@ -909,7 +909,7 @@ XmppSipPlugin::onNewIq( const Jreen::IQ& iq )
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Received Sip Information from:" << iq.from().full(); tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Received Sip Information from:" << iq.from().full();
// Check that all received SipInfos are valid. // Check that all received SipInfos are valid.
foreach ( SipInfo info, sipMessage->sipInfo() ) foreach ( SipInfo info, sipMessage->sipInfos() )
{ {
Q_ASSERT( info.isValid() ); Q_ASSERT( info.isValid() );
} }
@@ -921,7 +921,7 @@ XmppSipPlugin::onNewIq( const Jreen::IQ& iq )
tDebug() << Q_FUNC_INFO << "no valid peerInfo for" << iq.from().full(); tDebug() << Q_FUNC_INFO << "no valid peerInfo for" << iq.from().full();
return; return;
} }
peerInfo->setSipInfo( sipMessage->sipInfo() ); peerInfo->setSipInfos( sipMessage->sipInfos() );
} }
} }
} }

View File

@@ -90,7 +90,7 @@ public slots:
virtual void configurationChanged(); virtual void configurationChanged();
virtual void addContact( const QString& peerId, const QString& msg = QString() ); virtual void addContact( const QString& peerId, const QString& msg = QString() );
virtual void sendSipInfo( const Tomahawk::peerinfo_ptr& receiver, const QList<SipInfo>& info ); virtual void sendSipInfos( const Tomahawk::peerinfo_ptr& receiver, const QList<SipInfo>& info );
void showAddFriendDialog(); void showAddFriendDialog();
void publishTune( const QUrl& url, const Tomahawk::InfoSystem::InfoStringHash& trackInfo ); void publishTune( const QUrl& url, const Tomahawk::InfoSystem::InfoStringHash& trackInfo );

View File

@@ -161,9 +161,9 @@ ZeroconfPlugin::lanHostFound( const QString& host, int port, const QString& name
sipInfo.setVisible( true ); sipInfo.setVisible( true );
Tomahawk::peerinfo_ptr peerInfo = Tomahawk::PeerInfo::get( this, host, Tomahawk::PeerInfo::AutoCreate ); Tomahawk::peerinfo_ptr peerInfo = Tomahawk::PeerInfo::get( this, host, Tomahawk::PeerInfo::AutoCreate );
QList<SipInfo> sipInfoList = QList<SipInfo>(); QList<SipInfo> sipInfos = QList<SipInfo>();
sipInfoList.append( sipInfo ); sipInfos.append( sipInfo );
peerInfo->setSipInfo( sipInfoList ); peerInfo->setSipInfos( sipInfos );
peerInfo->setContactId( host ); peerInfo->setContactId( host );
peerInfo->setFriendlyName( name ); peerInfo->setFriendlyName( name );
peerInfo->setType( PeerInfo::Local ); peerInfo->setType( PeerInfo::Local );

View File

@@ -65,7 +65,7 @@ public slots:
void advertise(); void advertise();
virtual void sendSipInfo( const Tomahawk::peerinfo_ptr& receiver, const QList<SipInfo>& info ) {} virtual void sendSipInfos( const Tomahawk::peerinfo_ptr& receiver, const QList<SipInfo>& info ) {}
void broadcastMsg( const QString & ) {} void broadcastMsg( const QString & ) {}
void addContact( const QString &, const QString& ) {} void addContact( const QString &, const QString& ) {}

View File

@@ -398,7 +398,7 @@ Servent::registerPeer( const Tomahawk::peerinfo_ptr& peerInfo )
conn->addPeerInfo( peerInfo ); conn->addPeerInfo( peerInfo );
registerOffer( key, conn ); registerOffer( key, conn );
QList<SipInfo> sipInfo = QList<SipInfo>(); QList<SipInfo> sipInfos = QList<SipInfo>();
foreach ( QHostAddress ha, m_externalAddresses ) foreach ( QHostAddress ha, m_externalAddresses )
{ {
SipInfo info = SipInfo(); SipInfo info = SipInfo();
@@ -407,7 +407,7 @@ Servent::registerPeer( const Tomahawk::peerinfo_ptr& peerInfo )
info.setKey( key ); info.setKey( key );
info.setVisible( true ); info.setVisible( true );
info.setNodeId( nodeid ); info.setNodeId( nodeid );
sipInfo.append( info ); sipInfos.append( info );
} }
if ( m_externalHostname.length() > 0) if ( m_externalHostname.length() > 0)
{ {
@@ -417,10 +417,10 @@ Servent::registerPeer( const Tomahawk::peerinfo_ptr& peerInfo )
info.setKey( key ); info.setKey( key );
info.setVisible( true ); info.setVisible( true );
info.setNodeId( nodeid ); info.setNodeId( nodeid );
sipInfo.append( info ); sipInfos.append( info );
} }
if ( sipInfo.length() == 0 ) if ( sipInfos.length() == 0 )
{ {
// We are not visible via any IP, send a dummy SipInfo // We are not visible via any IP, send a dummy SipInfo
SipInfo info = SipInfo(); SipInfo info = SipInfo();
@@ -430,7 +430,7 @@ Servent::registerPeer( const Tomahawk::peerinfo_ptr& peerInfo )
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Only accepting connections, no usable IP to listen to found."; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Only accepting connections, no usable IP to listen to found.";
} }
peerInfo->sendLocalSipInfo( sipInfo ); peerInfo->sendLocalSipInfos( sipInfos );
handleSipInfo( peerInfo ); handleSipInfo( peerInfo );
connect( peerInfo.data(), SIGNAL( sipInfoChanged() ), SLOT( onSipInfoChanged() ) ); connect( peerInfo.data(), SIGNAL( sipInfoChanged() ), SLOT( onSipInfoChanged() ) );
@@ -454,10 +454,10 @@ void Servent::handleSipInfo( const Tomahawk::peerinfo_ptr& peerInfo )
{ {
// We do not have received the initial SipInfo for this client yet, so wait for it. // We do not have received the initial SipInfo for this client yet, so wait for it.
// Each client will have at least one non-visible SipInfo // Each client will have at least one non-visible SipInfo
if ( peerInfo->sipInfo().length() == 0 ) if ( peerInfo->sipInfos().isEmpty() )
return; return;
foreach ( SipInfo info, peerInfo->sipInfo() ) foreach ( SipInfo info, peerInfo->sipInfos() )
{ {
if (info.isVisible()) if (info.isVisible())
{ {
@@ -842,7 +842,7 @@ Servent::connectToPeer( const peerinfo_ptr& peerInfo )
conn->setProperty( "nodeid", peerInfo->nodeId() ); conn->setProperty( "nodeid", peerInfo->nodeId() );
registerControlConnection( conn ); registerControlConnection( conn );
connectToPeer( peerInfo, peerInfo->sipInfo(), conn ); connectToPeer( peerInfo, peerInfo->sipInfos(), conn );
} }

View File

@@ -202,9 +202,9 @@ PeerInfo::sipPlugin() const
void void
PeerInfo::sendLocalSipInfo( const QList<SipInfo>& sipInfoList ) PeerInfo::sendLocalSipInfos( const QList<SipInfo>& sipInfos )
{ {
sipPlugin()->sendSipInfo( weakRef().toStrongRef(), sipInfoList ); sipPlugin()->sendSipInfos( weakRef().toStrongRef(), sipInfos );
} }
@@ -231,17 +231,17 @@ PeerInfo::contactId() const
const QString const QString
PeerInfo::nodeId() const PeerInfo::nodeId() const
{ {
Q_ASSERT( m_sipInfo.length() > 0 ); Q_ASSERT( !m_sipInfos.isEmpty() );
// All sip infos share the same nodeId // All sip infos share the same nodeId
return m_sipInfo.first().nodeId(); return m_sipInfos.first().nodeId();
} }
const QString const QString
PeerInfo::key() const PeerInfo::key() const
{ {
Q_ASSERT( m_sipInfo.length() > 0 ); Q_ASSERT( !m_sipInfos.isEmpty() );
// All sip infos share the same key // All sip infos share the same key
return m_sipInfo.first().key(); return m_sipInfos.first().key();
} }
@@ -276,19 +276,19 @@ PeerInfo::status() const
void void
PeerInfo::setSipInfo( const QList<SipInfo>& sipInfo ) PeerInfo::setSipInfos( const QList<SipInfo>& sipInfos )
{ {
m_sipInfo = QList<SipInfo>(sipInfo); m_sipInfos = QList<SipInfo>( sipInfos );
tLog() << "id:" << id() << "info changed" << sipInfo; tLog() << "id:" << id() << "info changed" << sipInfos;
emit sipInfoChanged(); emit sipInfoChanged();
} }
const QList<SipInfo> const QList<SipInfo>
PeerInfo::sipInfo() const PeerInfo::sipInfos() const
{ {
return m_sipInfo; return m_sipInfos;
} }

View File

@@ -74,7 +74,7 @@ public:
const QString id() const; const QString id() const;
SipPlugin* sipPlugin() const; SipPlugin* sipPlugin() const;
const QString debugName() const; const QString debugName() const;
void sendLocalSipInfo( const QList<SipInfo>& sipInfoList ); void sendLocalSipInfos( const QList<SipInfo>& sipInfos );
QWeakPointer< Tomahawk::PeerInfo > weakRef(); QWeakPointer< Tomahawk::PeerInfo > weakRef();
void setWeakRef( QWeakPointer< Tomahawk::PeerInfo > weakRef ); void setWeakRef( QWeakPointer< Tomahawk::PeerInfo > weakRef );
@@ -96,8 +96,8 @@ public:
void setStatus( Status status ); void setStatus( Status status );
Status status() const; Status status() const;
void setSipInfo( const QList<SipInfo>& sipInfo ); void setSipInfos( const QList<SipInfo>& sipInfos );
const QList<SipInfo> sipInfo() const; const QList<SipInfo> sipInfos() const;
void setFriendlyName( const QString& friendlyName ); void setFriendlyName( const QString& friendlyName );
const QString friendlyName() const; const QString friendlyName() const;
@@ -141,7 +141,7 @@ private:
QString m_id; QString m_id;
QString m_contactId; QString m_contactId;
Status m_status; Status m_status;
QList<SipInfo> m_sipInfo; QList<SipInfo> m_sipInfos;
QString m_friendlyName; QString m_friendlyName;
QString m_versionString; QString m_versionString;
QVariant m_data; QVariant m_data;

View File

@@ -74,7 +74,7 @@ public slots:
/** /**
* Send a list of SipInfos to all contacts. * Send a list of SipInfos to all contacts.
*/ */
virtual void sendSipInfo( const Tomahawk::peerinfo_ptr& receiver, const QList<SipInfo>& info ) = 0; virtual void sendSipInfos( const Tomahawk::peerinfo_ptr& receiver, const QList<SipInfo>& infos ) = 0;
signals: signals:
void peerStatusChanged( const Tomahawk::peerinfo_ptr& ); void peerStatusChanged( const Tomahawk::peerinfo_ptr& );

View File

@@ -165,14 +165,14 @@ DiagnosticsDialog::accountLog( Tomahawk::Accounts::Account* account )
foreach( const Tomahawk::peerinfo_ptr& peerInfo, account->sipPlugin()->peersOnline() ) foreach( const Tomahawk::peerinfo_ptr& peerInfo, account->sipPlugin()->peersOnline() )
{ {
accountInfo.append( QString( " %1: " ).arg( peerInfo->id() ) ); accountInfo.append( QString( " %1: " ).arg( peerInfo->id() ) );
foreach ( SipInfo info, peerInfo->sipInfo() ) foreach ( SipInfo info, peerInfo->sipInfos() )
{ {
if ( info.isValid() ) if ( info.isValid() )
accountInfo.append( QString( "[%1]:%2; " ).arg( info.host() ).arg( info.port() ) ); accountInfo.append( QString( "[%1]:%2; " ).arg( info.host() ).arg( info.port() ) );
else else
accountInfo.append( "SipInfo invalid; " ); accountInfo.append( "SipInfo invalid; " );
} }
if ( ( peerInfo->sipInfo().length() == 1 ) && ( !peerInfo->sipInfo().first().isVisible() ) || ( peerInfo->sipInfo().length() == 0 ) ) if ( ( ( peerInfo->sipInfos().length() == 1 ) && ( !peerInfo->sipInfos().first().isVisible() ) ) || ( peerInfo->sipInfos().isEmpty() ) )
accountInfo.append( "(outbound connections only) "); accountInfo.append( "(outbound connections only) ");
accountInfo.append( QString( " (%1)\n" ).arg( peerInfo->versionString() ) ); accountInfo.append( QString( " (%1)\n" ).arg( peerInfo->versionString() ) );
} }