1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-09 07:36:48 +02:00

* Fixed forgotten merge.

This commit is contained in:
Christian Muehlhaeuser
2012-07-12 10:24:19 +02:00
parent 318866d37a
commit c144a0142f
5 changed files with 18 additions and 40 deletions

View File

@@ -59,10 +59,10 @@ public slots:
void disconnectPlugin(); void disconnectPlugin();
void configurationChanged(); void configurationChanged();
void sendMsg( const QString& to, const QString& msg ) void sendMsg( const QString& peerId, const SipInfo& info )
{ {
Q_UNUSED( to ); Q_UNUSED( peerId );
Q_UNUSED( msg ); Q_UNUSED( info );
} }
void broadcastMsg( const QString &msg ) void broadcastMsg( const QString &msg )
@@ -70,9 +70,9 @@ public slots:
Q_UNUSED( msg ); Q_UNUSED( msg );
} }
void addContact( const QString &jid, const QString& msg = QString() ) void addContact( const QString &peerId, const QString& msg = QString() )
{ {
Q_UNUSED( jid ); Q_UNUSED( peerId );
Q_UNUSED( msg ); Q_UNUSED( msg );
} }

View File

@@ -425,30 +425,15 @@ XmppSipPlugin::errorMessage( Jreen::Client::DisconnectReason reason )
void void
XmppSipPlugin::sendMsg( const QString& to, const QString& msg ) XmppSipPlugin::sendMsg( const QString& to, const SipInfo& info )
{ {
qDebug() << Q_FUNC_INFO << to << msg; qDebug() << Q_FUNC_INFO << to << info;
if ( !m_client ) if ( !m_client )
return; return;
/*******************************************************
* Obsolete this by a SipMessage class
*/
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();
/*******************************************************/
TomahawkXmppMessage *sipMessage; TomahawkXmppMessage *sipMessage;
if ( m["visible"].toBool() ) if ( info.isVisible() )
{ {
sipMessage = new TomahawkXmppMessage( info.host(), info.port(), info.uniqname(), info.key() ); sipMessage = new TomahawkXmppMessage( info.host(), info.port(), info.uniqname(), info.key() );
} }
@@ -467,13 +452,6 @@ XmppSipPlugin::sendMsg( const QString& to, const QString& msg )
void void
XmppSipPlugin::broadcastMsg( const QString& msg ) XmppSipPlugin::broadcastMsg( const QString& msg )
{ {
if ( !m_client )
return;
foreach ( const Jreen::JID& jid, m_peers.keys() )
{
sendMsg( jid.full(), msg );
}
} }

View File

@@ -86,8 +86,8 @@ public slots:
virtual void disconnectPlugin(); virtual void disconnectPlugin();
virtual void checkSettings(); virtual void checkSettings();
virtual void configurationChanged(); virtual void configurationChanged();
virtual void sendMsg( const QString& to, const QString& msg ); virtual void sendMsg( const QString& peerId, const SipInfo& info );
virtual void addContact( const QString& jid, const QString& msg = QString() ); virtual void addContact( const QString& peerId, const QString& msg = QString() );
void broadcastMsg( const QString& msg ); void broadcastMsg( const QString& msg );
void showAddFriendDialog(); void showAddFriendDialog();

View File

@@ -64,7 +64,7 @@ public slots:
void advertise(); void advertise();
void sendMsg( const QString& , const QString& ) {} void sendMsg( const QString& peerId , const SipInfo& ) {}
void broadcastMsg( const QString & ) {} void broadcastMsg( const QString & ) {}
void addContact( const QString &, const QString& ) {} void addContact( const QString &, const QString& ) {}

View File

@@ -142,12 +142,12 @@ SipHandler::onPeerOnline( const QString& peerId )
info.setKey( key ); info.setKey( key );
info.setUniqname( nodeid ); info.setUniqname( nodeid );
qDebug() << "Asking them to connect to us:" << info; tDebug() << "Asking them to connect to us:" << info;
} }
else else
{ {
info.setVisible( false ); info.setVisible( false );
qDebug() << "We are not visible externally:" << info; tDebug() << "We are not visible externally:" << info;
} }
sip->sendMsg( peerId, info ); sip->sendMsg( peerId, info );
@@ -158,7 +158,7 @@ void
SipHandler::onPeerOffline( const QString& peerId ) SipHandler::onPeerOffline( const QString& peerId )
{ {
// qDebug() << Q_FUNC_INFO; // qDebug() << Q_FUNC_INFO;
qDebug() << "SIP offline:" << peerId; tDebug() << "SIP offline:" << peerId;
} }
@@ -192,12 +192,12 @@ SipHandler::onSipInfo( const QString& peerId, const SipInfo& info )
} }
else else
{ {
qDebug() << Q_FUNC_INFO << "They should be conecting to us..."; tDebug() << Q_FUNC_INFO << "They should be conecting to us...";
} }
} }
else else
{ {
qDebug() << Q_FUNC_INFO << "They are not visible, doing nothing atm"; tDebug() << Q_FUNC_INFO << "They are not visible, doing nothing atm";
} }
m_peersSipInfos.insert( peerId, info ); m_peersSipInfos.insert( peerId, info );