mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 03:10:12 +02:00
Do some cleanup and add comments in jreen sip plugin
This commit is contained in:
@@ -4,10 +4,10 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
||||
###
|
||||
### Tomahawk application info
|
||||
###
|
||||
SET( ORGANIZATION_NAME "Tomahawk" )
|
||||
SET( ORGANIZATION_DOMAIN "tomahawk-player.org" )
|
||||
SET( APPLICATION_NAME "Tomahawk" )
|
||||
SET( VERSION "0.0.2" )
|
||||
SET( TOMAHAWK_ORGANIZATION_NAME "Tomahawk" )
|
||||
SET( TOMAHAWK_ORGANIZATION_DOMAIN "tomahawk-player.org" )
|
||||
SET( TOMAHAWK_APPLICATION_NAME "Tomahawk" )
|
||||
SET( TOMAHAWK_VERSION "0.0.2" )
|
||||
|
||||
|
||||
# set paths
|
||||
|
@@ -1,14 +1,15 @@
|
||||
#ifndef CONFIG_H_IN
|
||||
#define CONFIG_H_IN
|
||||
|
||||
#cmakedefine ORGANIZATION_NAME "${ORGANIZATION_NAME}"
|
||||
#cmakedefine ORGANIZATION_DOMAIN "${ORGANIZATION_DOMAIN}"
|
||||
#cmakedefine APPLICATION_NAME "${APPLICATION_NAME}"
|
||||
#cmakedefine VERSION "${VERSION}"
|
||||
#cmakedefine TOMAHAWK_ORGANIZATION_NAME "${TOMAHAWK_ORGANIZATION_NAME}"
|
||||
#cmakedefine TOMAHAWK_ORGANIZATION_DOMAIN "${TOMAHAWK_ORGANIZATION_DOMAIN}"
|
||||
#cmakedefine TOMAHAWK_APPLICATION_NAME "${TOMAHAWK_APPLICATION_NAME}"
|
||||
#cmakedefine TOMAHAWK_VERSION "${TOMAHAWK_VERSION}"
|
||||
|
||||
#cmakedefine DEBUG_BUILD
|
||||
|
||||
#define CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}"
|
||||
#define CMAKE_SYSTEM "${CMAKE_SYSTEM}"
|
||||
|
||||
#cmakedefine SNOW_LEOPARD
|
||||
#cmakedefine LEOPARD
|
||||
|
@@ -22,7 +22,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
|
||||
)
|
||||
|
||||
qt4_wrap_cpp( jabberMoc ${jabberHeaders} )
|
||||
add_library( tomahawk_sipjreen SHARED ${jabberSources} ${jabberMoc} )
|
||||
add_library( tomahawk_sipjabber SHARED ${jabberSources} ${jabberMoc} )
|
||||
|
||||
IF( WIN32 )
|
||||
SET( OS_SPECIFIC_LINK_LIBRARIES
|
||||
@@ -33,7 +33,7 @@ SET( OS_SPECIFIC_LINK_LIBRARIES
|
||||
)
|
||||
ENDIF( WIN32 )
|
||||
|
||||
target_link_libraries( tomahawk_sipjreen
|
||||
target_link_libraries( tomahawk_sipjabber
|
||||
${QT_LIBRARIES}
|
||||
${LIBJREEN_LIBRARY}
|
||||
${OS_SPECIFIC_LINK_LIBRARIES}
|
||||
@@ -43,4 +43,4 @@ IF( APPLE )
|
||||
# SET( CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-undefined dynamic_lookup" )
|
||||
ENDIF( APPLE )
|
||||
|
||||
install( TARGETS tomahawk_sipjreen DESTINATION lib${LIB_SUFFIX} )
|
||||
install( TARGETS tomahawk_sipjabber DESTINATION lib${LIB_SUFFIX} )
|
||||
|
@@ -1,5 +1,6 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
*
|
||||
* Copyright 2010-2011, Dominik Schmidt <dev@dominik-schmidt.de>
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
|
@@ -1,5 +1,6 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
*
|
||||
* Copyright 2010-2011, Dominik Schmidt <dev@dominik-schmidt.de>
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
@@ -24,7 +25,7 @@
|
||||
|
||||
#include "../sipdllmacro.h"
|
||||
|
||||
#define MYNAME "SIPJABBER"
|
||||
#define MYNAME "SIPJREEN"
|
||||
|
||||
class SIPDLLEXPORT JabberPlugin : public SipPlugin
|
||||
{
|
||||
|
@@ -1,5 +1,6 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Dominik Schmidt <dev@dominik-schmidt.de>
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
@@ -18,21 +19,16 @@
|
||||
|
||||
#include "jabber_p.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QTime>
|
||||
#include <QTimer>
|
||||
#include <QString>
|
||||
#include <QRegExp>
|
||||
#include <QThread>
|
||||
#include <utils/tomahawkutils.h>
|
||||
|
||||
#include <jreen/abstractroster.h>
|
||||
#include <jreen/capabilities.h>
|
||||
|
||||
|
||||
//remove
|
||||
#include <QMessageBox>
|
||||
#include <jreen/connection.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -44,35 +40,30 @@ Jabber_p::Jabber_p( const QString& jid, const QString& password, const QString&
|
||||
, m_server()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
//qsrand( QTime( 0, 0, 0 ).secsTo( QTime::currentTime() ) );
|
||||
qsrand(QDateTime::currentDateTime().toTime_t());
|
||||
|
||||
m_presences[Jreen::Presence::Available] = "available";
|
||||
m_presences[Jreen::Presence::Chat] = "chat";
|
||||
m_presences[Jreen::Presence::Away] = "away";
|
||||
m_presences[Jreen::Presence::DND] = "dnd";
|
||||
m_presences[Jreen::Presence::XA] = "xa";
|
||||
m_presences[Jreen::Presence::Unavailable] = "unavailable";
|
||||
m_presences[Jreen::Presence::Probe] = "probe";
|
||||
m_presences[Jreen::Presence::Error] = "error";
|
||||
m_presences[Jreen::Presence::Invalid] = "invalid";
|
||||
|
||||
// setup JID object
|
||||
m_jid = Jreen::JID( jid );
|
||||
|
||||
// general client setup
|
||||
m_client = new Jreen::Client( jid, password );
|
||||
m_client->disco()->setSoftwareVersion( "Tomahawk JREEN", "0.0.0.0", "Foobar" );
|
||||
m_client->setResource( QString( "tomahawk%1" ).arg( qrand() ) );
|
||||
|
||||
// setup disco
|
||||
m_client->disco()->setSoftwareVersion( "Tomahawk Player", TOMAHAWK_VERSION, CMAKE_SYSTEM );
|
||||
m_client->disco()->addIdentity( Jreen::Disco::Identity( "client", "type", "tomahawk", "en" ) );
|
||||
m_client->disco()->addFeature( "tomahawk" );
|
||||
m_client->setResource( QString( "tomahawk%1" ).arg( "DOMME" ) );
|
||||
m_client->disco()->addFeature( "tomahawk:sip:v1" );
|
||||
|
||||
// setup caps node, legacy peer detection - used before 0.1
|
||||
Jreen::Capabilities::Ptr caps = m_client->presence().findExtension<Jreen::Capabilities>();
|
||||
caps->setNode(TOMAHAWK_CAP_NODE_NAME);
|
||||
|
||||
// print connection parameters
|
||||
qDebug() << "Our JID set to:" << m_client->jid().full();
|
||||
qDebug() << "Our Server set to:" << m_client->server();
|
||||
qDebug() << "Our Port set to" << m_client->port();
|
||||
|
||||
// setup slots
|
||||
connect(m_client->connection(), SIGNAL(error(SocketError)), SLOT(onError(SocketError)));
|
||||
connect(m_client, SIGNAL(serverFeaturesReceived(QSet<QString>)), SLOT(onConnect()));
|
||||
connect(m_client, SIGNAL(disconnected(Jreen::Client::DisconnectReason)), SLOT(onDisconnect(Jreen::Client::DisconnectReason)));
|
||||
@@ -81,7 +72,7 @@ Jabber_p::Jabber_p( const QString& jid, const QString& password, const QString&
|
||||
connect(m_client, SIGNAL(newPresence(Jreen::Presence)), SLOT(onNewPresence(Jreen::Presence)));
|
||||
|
||||
|
||||
qDebug() << "DISCOFEATURES:" << m_client->disco()->features();
|
||||
// connect
|
||||
qDebug() << "Connecting to the XMPP server...";
|
||||
m_client->connectToServer();
|
||||
}
|
||||
@@ -112,18 +103,6 @@ void
|
||||
Jabber_p::sendMsg( const QString& to, const QString& msg )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if ( QThread::currentThread() != thread() )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "invoking in correct thread, not"
|
||||
<< QThread::currentThread();
|
||||
|
||||
QMetaObject::invokeMethod( this, "sendMsg",
|
||||
Qt::QueuedConnection,
|
||||
Q_ARG( const QString, to ),
|
||||
Q_ARG( const QString, msg )
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !m_client ) {
|
||||
return;
|
||||
@@ -132,7 +111,7 @@ Jabber_p::sendMsg( const QString& to, const QString& msg )
|
||||
qDebug() << Q_FUNC_INFO << to << msg;
|
||||
Jreen::Message m( Jreen::Message::Chat, Jreen::JID(to), msg);
|
||||
|
||||
m_client->send( m ); // assuming this is threadsafe
|
||||
m_client->send( m );
|
||||
}
|
||||
|
||||
|
||||
@@ -140,14 +119,6 @@ void
|
||||
Jabber_p::broadcastMsg( const QString &msg )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if ( QThread::currentThread() != thread() )
|
||||
{
|
||||
QMetaObject::invokeMethod( this, "broadcastMsg",
|
||||
Qt::QueuedConnection,
|
||||
Q_ARG(const QString, msg)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !m_client )
|
||||
return;
|
||||
@@ -155,7 +126,7 @@ Jabber_p::broadcastMsg( const QString &msg )
|
||||
foreach( const QString& jidstr, m_peers.keys() )
|
||||
{
|
||||
qDebug() << "Broadcasting to" << jidstr <<"...";
|
||||
Jreen::Message m(Jreen::Message::Chat, Jreen::JID(jidstr), msg, "");
|
||||
Jreen::Message m( Jreen::Message::Chat, Jreen::JID(jidstr), msg, "" );
|
||||
m_client->send( m );
|
||||
}
|
||||
}
|
||||
@@ -164,16 +135,6 @@ Jabber_p::broadcastMsg( const QString &msg )
|
||||
void
|
||||
Jabber_p::addContact( const QString& jid, const QString& msg )
|
||||
{
|
||||
if ( QThread::currentThread() != thread() )
|
||||
{
|
||||
QMetaObject::invokeMethod( this, "addContact",
|
||||
Qt::QueuedConnection,
|
||||
Q_ARG(const QString, jid),
|
||||
Q_ARG(const QString, msg)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Add contact to the Tomahawk group on the roster
|
||||
m_roster->add( jid, jid, QStringList() << "Tomahawk" );
|
||||
|
||||
@@ -189,6 +150,7 @@ Jabber_p::onConnect()
|
||||
// have changed our requested /resource
|
||||
if ( m_client->jid().resource() != m_jid.resource() )
|
||||
{
|
||||
// TODO: check if this is still neccessary with jreen
|
||||
m_jid.setResource( m_client->jid().resource() );
|
||||
QString jidstr( m_jid.full() );
|
||||
emit jidChanged( jidstr );
|
||||
@@ -197,18 +159,21 @@ Jabber_p::onConnect()
|
||||
emit connected();
|
||||
qDebug() << "Connected as:" << m_jid.full();
|
||||
|
||||
m_client->setPresence(Jreen::Presence::Available, "Tomahawk-JREEN available", 1);
|
||||
// set presence to least valid value
|
||||
m_client->setPresence(Jreen::Presence::XA, "Got Tomahawk? http://gettomahawk.com", -127);
|
||||
|
||||
qDebug() << "DISCOFEATURES connected:" << m_client->disco()->features();
|
||||
m_client->setPingInterval(60000);
|
||||
// set ping timeout to 15 secs (TODO: verify if this works)
|
||||
m_client->setPingInterval(15000);
|
||||
|
||||
// load roster
|
||||
m_roster = new Jreen::SimpleRoster( m_client );
|
||||
m_roster->load();
|
||||
|
||||
//FIXME: this implementation is totally broken atm, so it's disabled to avoid harm :P
|
||||
// join MUC with bare jid as nickname
|
||||
//TODO: make the room a list of rooms and make that configurable
|
||||
QString bare(m_jid.bare());
|
||||
m_room = new Jreen::MUCRoom(m_client, Jreen::JID(QString("tomahawk@conference.qutim.org/").append(bare.replace("@", "-"))));
|
||||
QString mucNickname = QString( "tomahawk@conference.qutim.org/" ).append( QString( m_jid.bare() ).replace( "@", "-" ) );
|
||||
m_room = new Jreen::MUCRoom(m_client, Jreen::JID( mucNickname ) );
|
||||
//m_room->setHistorySeconds(0);
|
||||
//m_room->join();
|
||||
|
||||
@@ -286,110 +251,59 @@ Jabber_p::onNewMessage( const Jreen::Message& m )
|
||||
if ( msg.isEmpty() )
|
||||
return;
|
||||
|
||||
qDebug() << Q_FUNC_INFO << m.from().full() << ":" << m.body();
|
||||
qDebug() << Q_FUNC_INFO << "From:" << m.from().full() << ":" << m.body();
|
||||
emit msgReceived( from, msg );
|
||||
}
|
||||
|
||||
|
||||
void Jabber_p::onNewPresence( const Jreen::Presence& presence)
|
||||
{
|
||||
|
||||
Jreen::JID jid = presence.from();
|
||||
QString fulljid( jid.full() );
|
||||
|
||||
qDebug() << Q_FUNC_INFO << "handle presence" << fulljid << presence.subtype();
|
||||
|
||||
Jreen::IQ iq(Jreen::IQ::Get,jid);
|
||||
|
||||
Jreen::Capabilities::Ptr caps = presence.findExtension<Jreen::Capabilities>();
|
||||
if(caps)
|
||||
{
|
||||
QString node = caps->node() + '#' + caps->ver();
|
||||
iq.addExtension(new Jreen::Disco::Info(node));
|
||||
m_client->send(iq,this,SLOT(onIQ(Jreen::IQ,int)),RequestDisco);
|
||||
}
|
||||
qDebug() << Q_FUNC_INFO << "* New presence: " << fulljid << presence.subtype();
|
||||
|
||||
if( jid == m_jid )
|
||||
return;
|
||||
|
||||
if ( presence.error() ) {
|
||||
qDebug() << Q_FUNC_INFO << "presence error: no tomahawk";
|
||||
qDebug() << Q_FUNC_INFO << "tomahawk: no" << "presence error";
|
||||
return;
|
||||
}
|
||||
|
||||
// ignore anyone not running tomahawk:
|
||||
//Jreen::Capabilities::Ptr caps = presence.findExtension<Jreen::Capabilities>();
|
||||
Jreen::Capabilities::Ptr caps = presence.findExtension<Jreen::Capabilities>();
|
||||
if ( caps && (caps->node() == TOMAHAWK_CAP_NODE_NAME ))
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << presence.from().full() << "tomahawk detected by caps";
|
||||
qDebug() << Q_FUNC_INFO << presence.from().full() << "tomahawk: yes" << "caps " << caps->node();
|
||||
}
|
||||
// this is a hack actually as long as gloox based libsip_jabber is around
|
||||
// remove this as soon as everyone is using jreen
|
||||
else if( presence.from().resource().startsWith( QLatin1String("tomahawk") ) )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << presence.from().full() << "tomahawk detected by resource";
|
||||
// this is a hack actually as long as gloox based libsip_jabber is around
|
||||
// remove this as soon as everyone is using jreen
|
||||
// supported by gloox too - should be removed
|
||||
qDebug() << Q_FUNC_INFO << presence.from().full() << "tomahawk: yes" << "resource";
|
||||
}
|
||||
else if( caps && caps->node() != TOMAHAWK_CAP_NODE_NAME )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << presence.from().full() << "*no tomahawk* detected by caps!" << caps->node() << presence.from().resource();
|
||||
qDebug() << Q_FUNC_INFO << presence.from().full() << "tomahawk: no" << "caps" << caps->node();
|
||||
return;
|
||||
}
|
||||
else if( !caps )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "no tomahawk detected by resource and !caps";
|
||||
qDebug() << Q_FUNC_INFO << "tomahawk: no" << "no indication";
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << Q_FUNC_INFO << fulljid << " is a tomahawk resource.";
|
||||
|
||||
// "going offline" event
|
||||
if ( !presenceMeansOnline( presence.subtype() ) &&
|
||||
( !m_peers.contains( fulljid ) ||
|
||||
presenceMeansOnline( m_peers.value( fulljid ) )
|
||||
)
|
||||
)
|
||||
{
|
||||
m_peers[ fulljid ] = presence.subtype();
|
||||
qDebug() << Q_FUNC_INFO << "* Peer goes offline:" << fulljid;
|
||||
emit peerOffline( fulljid );
|
||||
return;
|
||||
}
|
||||
|
||||
// "coming online" event
|
||||
if( presenceMeansOnline( presence.subtype() ) &&
|
||||
( !m_peers.contains( fulljid ) ||
|
||||
!presenceMeansOnline( m_peers.value( fulljid ) )
|
||||
)
|
||||
)
|
||||
{
|
||||
m_peers[ fulljid ] = presence.subtype();
|
||||
qDebug() << Q_FUNC_INFO << "* Peer goes online:" << fulljid;
|
||||
emit peerOnline( fulljid );
|
||||
return;
|
||||
}
|
||||
|
||||
//qDebug() << "Updating presence data for" << fulljid;
|
||||
m_peers[ fulljid ] = presence.subtype();
|
||||
|
||||
handlePeerStatus( fulljid, presence.subtype() );
|
||||
}
|
||||
|
||||
void
|
||||
Jabber_p::onIQ( const Jreen::IQ &iq, int context )
|
||||
Jabber_p::onNewIq( const Jreen::IQ &iq, int context )
|
||||
{
|
||||
if(context == RequestDisco) {
|
||||
Jreen::Disco::Info *discoInfo = iq.findExtension<Jreen::Disco::Info>().data();
|
||||
if(!discoInfo)
|
||||
return;
|
||||
iq.accept();
|
||||
|
||||
|
||||
QString jid = iq.from().full();
|
||||
Jreen::DataForm::Ptr form = discoInfo->form();
|
||||
|
||||
qDebug() << jid << "NODE" << discoInfo->node();
|
||||
qDebug() << "jid:" << jid << "FEATURES" << discoInfo->features();
|
||||
qDebug() << jid << "DATA" << form;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -406,3 +320,37 @@ Jabber_p::presenceMeansOnline( Jreen::Presence::Type p )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Jabber_p::handlePeerStatus( const QString& fulljid, Jreen::Presence::Type presenceType )
|
||||
{
|
||||
// "going offline" event
|
||||
if ( !presenceMeansOnline( presenceType ) &&
|
||||
( !m_peers.contains( fulljid ) ||
|
||||
presenceMeansOnline( m_peers.value( fulljid ) )
|
||||
)
|
||||
)
|
||||
{
|
||||
m_peers[ fulljid ] = presenceType;
|
||||
qDebug() << Q_FUNC_INFO << "* Peer goes offline:" << fulljid;
|
||||
emit peerOffline( fulljid );
|
||||
return;
|
||||
}
|
||||
|
||||
// "coming online" event
|
||||
if( presenceMeansOnline( presenceType ) &&
|
||||
( !m_peers.contains( fulljid ) ||
|
||||
!presenceMeansOnline( m_peers.value( fulljid ) )
|
||||
)
|
||||
)
|
||||
{
|
||||
m_peers[ fulljid ] = presenceType;
|
||||
qDebug() << Q_FUNC_INFO << "* Peer goes online:" << fulljid;
|
||||
emit peerOnline( fulljid );
|
||||
return;
|
||||
}
|
||||
|
||||
//qDebug() << "Updating presence data for" << fulljid;
|
||||
m_peers[ fulljid ] = presenceType;
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Dominik Schmidt <dev@dominik-schmidt.de>
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
@@ -16,20 +17,10 @@
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
This is the Jabber client that the rest of the app sees
|
||||
Gloox stuff should NOT leak outside this class.
|
||||
We may replace jreen later, this interface should remain the same.
|
||||
*/
|
||||
#ifndef JABBER_P_H
|
||||
#define JABBER_P_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
#include <QMap>
|
||||
#include <QNetworkProxy>
|
||||
|
||||
#include <string>
|
||||
#include "../sipdllmacro.h"
|
||||
|
||||
#include <jreen/client.h>
|
||||
#include <jreen/disco.h>
|
||||
@@ -41,16 +32,19 @@
|
||||
#include <jreen/presence.h>
|
||||
#include <jreen/vcard.h>
|
||||
#include <jreen/abstractroster.h>
|
||||
#include <jreen/connection.h>
|
||||
#include <jreen/mucroom.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
#include <QMap>
|
||||
#include <QNetworkProxy>
|
||||
|
||||
|
||||
#if defined( WIN32 ) || defined( _WIN32 )
|
||||
# include <windows.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "../sipdllmacro.h"
|
||||
#include <jreen/connection.h>
|
||||
#include <jreen/mucroom.h>
|
||||
|
||||
class SIPDLLEXPORT Jabber_p :
|
||||
public QObject
|
||||
{
|
||||
@@ -87,10 +81,12 @@ private slots:
|
||||
{
|
||||
qDebug() << e;
|
||||
}
|
||||
virtual void onIQ( const Jreen::IQ &iq, int context );
|
||||
virtual void onNewIq( const Jreen::IQ &iq, int context );
|
||||
|
||||
private:
|
||||
bool presenceMeansOnline( Jreen::Presence::Type p );
|
||||
void handlePeerStatus( const QString &fulljid, Jreen::Presence::Type presenceType );
|
||||
|
||||
Jreen::Client *m_client;
|
||||
Jreen::MUCRoom *m_room;
|
||||
Jreen::SimpleRoster *m_roster;
|
||||
@@ -99,7 +95,7 @@ private:
|
||||
QMap<QString, Jreen::Presence::Type> m_peers;
|
||||
QString m_server;
|
||||
|
||||
enum m_iqContext { RequestDisco };
|
||||
enum IqContext { RequestDisco };
|
||||
};
|
||||
|
||||
#endif // JABBER_H
|
||||
|
@@ -151,15 +151,15 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
|
||||
, m_infoSystem( 0 )
|
||||
{
|
||||
qsrand( QTime( 0, 0, 0 ).secsTo( QTime::currentTime() ) );
|
||||
|
||||
|
||||
// send the first arg to an already running instance, but don't open twice no matter what
|
||||
if( ( argc > 1 && sendMessage( argv[ 1 ] ) ) || sendMessage( "" ) ) {
|
||||
qDebug() << "Sent message, already exists";
|
||||
throw runtime_error( "Already Running" );
|
||||
}
|
||||
|
||||
|
||||
connect( this, SIGNAL( messageReceived( QString ) ), this, SLOT( messageReceived( QString ) ) );
|
||||
|
||||
|
||||
#ifdef TOMAHAWK_HEADLESS
|
||||
m_headless = true;
|
||||
#else
|
||||
@@ -169,18 +169,18 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
|
||||
#endif
|
||||
|
||||
qDebug() << "TomahawkApp thread:" << this->thread();
|
||||
setOrganizationName( QLatin1String( ORGANIZATION_NAME ) );
|
||||
setOrganizationDomain( QLatin1String( ORGANIZATION_DOMAIN ) );
|
||||
setApplicationName( QLatin1String( APPLICATION_NAME ) );
|
||||
setApplicationVersion( QLatin1String( VERSION ) );
|
||||
setOrganizationName( QLatin1String( TOMAHAWK_ORGANIZATION_NAME ) );
|
||||
setOrganizationDomain( QLatin1String( TOMAHAWK_ORGANIZATION_DOMAIN ) );
|
||||
setApplicationName( QLatin1String( TOMAHAWK_APPLICATION_NAME ) );
|
||||
setApplicationVersion( QLatin1String( TOMAHAWK_VERSION ) );
|
||||
registerMetaTypes();
|
||||
setupLogfile();
|
||||
|
||||
|
||||
new TomahawkSettings( this );
|
||||
m_audioEngine = new AudioEngine;
|
||||
new ScanManager( this );
|
||||
new Pipeline( this );
|
||||
|
||||
|
||||
m_servent = new Servent( this );
|
||||
connect( m_servent, SIGNAL( ready() ), SLOT( setupSIP() ) );
|
||||
|
||||
@@ -189,7 +189,7 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
|
||||
|
||||
qDebug() << "Init Echonest Factory.";
|
||||
GeneratorFactory::registerFactory( "echonest", new EchonestFactory );
|
||||
|
||||
|
||||
m_scrubFriendlyName = arguments().contains( "--demo" );
|
||||
// Register shortcut handler for this platform
|
||||
#ifdef Q_WS_MAC
|
||||
@@ -252,10 +252,10 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
|
||||
else
|
||||
TomahawkUtils::setProxy( new QNetworkProxy( QNetworkProxy::NoProxy ) );
|
||||
|
||||
|
||||
|
||||
Echonest::Config::instance()->setAPIKey( "JRIHWEP6GPOER2QQ6" );
|
||||
Echonest::Config::instance()->setNetworkAccessManager( TomahawkUtils::nam() );
|
||||
|
||||
|
||||
QNetworkProxy::setApplicationProxy( *TomahawkUtils::proxy() );
|
||||
|
||||
qDebug() << "Init SIP system.";
|
||||
@@ -343,7 +343,7 @@ TomahawkApp::registerMetaTypes()
|
||||
qRegisterMetaType< QMap<QString, unsigned int> >("QMap<QString, unsigned int>");
|
||||
qRegisterMetaType< QMap< QString, plentry_ptr > >("QMap< QString, plentry_ptr >");
|
||||
qRegisterMetaType< QHash< QString, QMap<quint32, quint16> > >("QHash< QString, QMap<quint32, quint16> >");
|
||||
|
||||
|
||||
qRegisterMetaType< GeneratorMode>("GeneratorMode");
|
||||
qRegisterMetaType<Tomahawk::GeneratorMode>("Tomahawk::GeneratorMode");
|
||||
// Extra definition for namespaced-versions of signals/slots required
|
||||
@@ -534,14 +534,14 @@ TomahawkApp::loadUrl( const QString& url )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkApp::messageReceived( const QString& msg )
|
||||
void
|
||||
TomahawkApp::messageReceived( const QString& msg )
|
||||
{
|
||||
qDebug() << "MESSAGE RECEIVED" << msg;
|
||||
if( msg.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
loadUrl( msg );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user