mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 03:40:16 +02:00
* Added more Jabber debug output for Jason.
This commit is contained in:
@@ -49,22 +49,24 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <utils/tomahawkutilsgui.h>
|
#include <utils/tomahawkutilsgui.h>
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
|
||||||
|
|
||||||
SipPlugin*
|
SipPlugin*
|
||||||
JabberFactory::createPlugin( const QString& pluginId )
|
JabberFactory::createPlugin( const QString& pluginId )
|
||||||
{
|
{
|
||||||
return new JabberPlugin( pluginId.isEmpty() ? generateId() : pluginId );
|
return new JabberPlugin( pluginId.isEmpty() ? generateId() : pluginId );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QIcon
|
QIcon
|
||||||
JabberFactory::icon() const
|
JabberFactory::icon() const
|
||||||
{
|
{
|
||||||
return QIcon( ":/jabber-icon.png" );
|
return QIcon( ":/jabber-icon.png" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
JabberPlugin::JabberPlugin( const QString& pluginId )
|
JabberPlugin::JabberPlugin( const QString& pluginId )
|
||||||
: SipPlugin( pluginId )
|
: SipPlugin( pluginId )
|
||||||
, m_state( Disconnected )
|
, m_state( Disconnected )
|
||||||
@@ -155,6 +157,7 @@ JabberPlugin::JabberPlugin( const QString& pluginId )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
JabberPlugin::~JabberPlugin()
|
JabberPlugin::~JabberPlugin()
|
||||||
{
|
{
|
||||||
delete m_avatarManager;
|
delete m_avatarManager;
|
||||||
@@ -173,18 +176,21 @@ JabberPlugin::name() const
|
|||||||
return QString( MYNAME );
|
return QString( MYNAME );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const QString
|
const QString
|
||||||
JabberPlugin::friendlyName() const
|
JabberPlugin::friendlyName() const
|
||||||
{
|
{
|
||||||
return QString( "Jabber" );
|
return QString( "Jabber" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const QString
|
const QString
|
||||||
JabberPlugin::accountName() const
|
JabberPlugin::accountName() const
|
||||||
{
|
{
|
||||||
return TomahawkSettings::instance()->value( pluginId() + "/username" ).toString();
|
return TomahawkSettings::instance()->value( pluginId() + "/username" ).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
QMenu*
|
QMenu*
|
||||||
JabberPlugin::menu()
|
JabberPlugin::menu()
|
||||||
@@ -192,12 +198,14 @@ JabberPlugin::menu()
|
|||||||
return m_menu;
|
return m_menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QWidget*
|
QWidget*
|
||||||
JabberPlugin::configWidget()
|
JabberPlugin::configWidget()
|
||||||
{
|
{
|
||||||
return m_configWidget.data();
|
return m_configWidget.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QIcon
|
QIcon
|
||||||
JabberPlugin::icon() const
|
JabberPlugin::icon() const
|
||||||
{
|
{
|
||||||
@@ -205,6 +213,7 @@ JabberPlugin::icon() const
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
JabberPlugin::connectPlugin( bool startup )
|
JabberPlugin::connectPlugin( bool startup )
|
||||||
{
|
{
|
||||||
@@ -223,13 +232,14 @@ JabberPlugin::connectPlugin( bool startup )
|
|||||||
QTimer::singleShot( 1000, m_client, SLOT( connectToServer() ) );
|
QTimer::singleShot( 1000, m_client, SLOT( connectToServer() ) );
|
||||||
|
|
||||||
if ( m_client->connection() )
|
if ( m_client->connection() )
|
||||||
connect(m_client->connection(), SIGNAL(error(SocketError)), SLOT(onError(SocketError)));
|
connect(m_client->connection(), SIGNAL(error(Jreen::Connection::SocketError)), SLOT(onError(Jreen::Connection::SocketError)));
|
||||||
|
|
||||||
m_state = Connecting;
|
m_state = Connecting;
|
||||||
emit stateChanged( m_state );
|
emit stateChanged( m_state );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JabberPlugin::disconnectPlugin()
|
JabberPlugin::disconnectPlugin()
|
||||||
{
|
{
|
||||||
@@ -255,6 +265,7 @@ JabberPlugin::disconnectPlugin()
|
|||||||
emit stateChanged( m_state );
|
emit stateChanged( m_state );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JabberPlugin::onConnect()
|
JabberPlugin::onConnect()
|
||||||
{
|
{
|
||||||
@@ -297,6 +308,7 @@ JabberPlugin::onConnect()
|
|||||||
addMenuHelper();
|
addMenuHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JabberPlugin::onDisconnect( Jreen::Client::DisconnectReason reason )
|
JabberPlugin::onDisconnect( Jreen::Client::DisconnectReason reason )
|
||||||
{
|
{
|
||||||
@@ -338,12 +350,14 @@ JabberPlugin::onDisconnect( Jreen::Client::DisconnectReason reason )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JabberPlugin::onError( const Jreen::Connection::SocketError& e )
|
JabberPlugin::onError( const Jreen::Connection::SocketError& e )
|
||||||
{
|
{
|
||||||
tLog() << "JABBER error:" << e;
|
tDebug() << "JABBER error:" << e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
JabberPlugin::errorMessage( Jreen::Client::DisconnectReason reason )
|
JabberPlugin::errorMessage( Jreen::Client::DisconnectReason reason )
|
||||||
{
|
{
|
||||||
@@ -393,6 +407,7 @@ JabberPlugin::errorMessage( Jreen::Client::DisconnectReason reason )
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JabberPlugin::sendMsg(const QString& to, const QString& msg)
|
JabberPlugin::sendMsg(const QString& to, const QString& msg)
|
||||||
{
|
{
|
||||||
@@ -438,6 +453,7 @@ JabberPlugin::sendMsg(const QString& to, const QString& msg)
|
|||||||
connect(reply, SIGNAL(received(Jreen::IQ)), SLOT(onNewIq(Jreen::IQ)));
|
connect(reply, SIGNAL(received(Jreen::IQ)), SLOT(onNewIq(Jreen::IQ)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JabberPlugin::broadcastMsg(const QString& msg)
|
JabberPlugin::broadcastMsg(const QString& msg)
|
||||||
{
|
{
|
||||||
@@ -452,6 +468,7 @@ JabberPlugin::broadcastMsg(const QString& msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JabberPlugin::addContact(const QString& jid, const QString& msg)
|
JabberPlugin::addContact(const QString& jid, const QString& msg)
|
||||||
{
|
{
|
||||||
@@ -466,6 +483,7 @@ JabberPlugin::addContact(const QString& jid, const QString& msg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JabberPlugin::showAddFriendDialog()
|
JabberPlugin::showAddFriendDialog()
|
||||||
{
|
{
|
||||||
@@ -481,6 +499,7 @@ JabberPlugin::showAddFriendDialog()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
JabberPlugin::defaultSuffix() const
|
JabberPlugin::defaultSuffix() const
|
||||||
{
|
{
|
||||||
@@ -496,6 +515,7 @@ JabberPlugin::showXmlConsole()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JabberPlugin::checkSettings()
|
JabberPlugin::checkSettings()
|
||||||
{
|
{
|
||||||
@@ -548,6 +568,7 @@ JabberPlugin::checkSettings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JabberPlugin::setupClientHelper()
|
void JabberPlugin::setupClientHelper()
|
||||||
{
|
{
|
||||||
Jreen::JID jid = Jreen::JID( m_currentUsername );
|
Jreen::JID jid = Jreen::JID( m_currentUsername );
|
||||||
@@ -568,6 +589,7 @@ void JabberPlugin::setupClientHelper()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JabberPlugin::addMenuHelper()
|
void JabberPlugin::addMenuHelper()
|
||||||
{
|
{
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
@@ -589,6 +611,7 @@ void JabberPlugin::addMenuHelper()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JabberPlugin::removeMenuHelper()
|
void JabberPlugin::removeMenuHelper()
|
||||||
{
|
{
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
@@ -602,6 +625,7 @@ void JabberPlugin::removeMenuHelper()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JabberPlugin::onNewMessage(const Jreen::Message& message)
|
void JabberPlugin::onNewMessage(const Jreen::Message& message)
|
||||||
{
|
{
|
||||||
if ( m_state != Connected )
|
if ( m_state != Connected )
|
||||||
@@ -617,7 +641,7 @@ void JabberPlugin::onNewMessage(const Jreen::Message& message)
|
|||||||
|
|
||||||
if( message.subtype() == Jreen::Message::Error )
|
if( message.subtype() == Jreen::Message::Error )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << "Received error message from " << from << ", not answering... (Condition: "
|
tDebug() << Q_FUNC_INFO << "Received error message from " << from << ", not answering... (Condition: "
|
||||||
<< ( message.error().isNull() ? -1 : message.error()->condition() ) << ")";
|
<< ( message.error().isNull() ? -1 : message.error()->condition() ) << ")";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -652,7 +676,7 @@ void JabberPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr &item, const
|
|||||||
Jreen::JID jid = presence.from();
|
Jreen::JID jid = presence.from();
|
||||||
QString fulljid( jid.full() );
|
QString fulljid( jid.full() );
|
||||||
|
|
||||||
// qDebug() << Q_FUNC_INFO << "* New presence:" << fulljid << presence.subtype();
|
qDebug() << Q_FUNC_INFO << "* New presence:" << fulljid << presence.subtype();
|
||||||
|
|
||||||
if( jid == m_client->jid() )
|
if( jid == m_client->jid() )
|
||||||
return;
|
return;
|
||||||
@@ -666,7 +690,7 @@ void JabberPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr &item, const
|
|||||||
Jreen::Capabilities::Ptr caps = presence.payload<Jreen::Capabilities>();
|
Jreen::Capabilities::Ptr caps = presence.payload<Jreen::Capabilities>();
|
||||||
if( caps )
|
if( caps )
|
||||||
{
|
{
|
||||||
// qDebug() << Q_FUNC_INFO << fulljid << "Running tomahawk: maybe" << "caps " << caps->node() << "requesting disco...";
|
qDebug() << Q_FUNC_INFO << fulljid << "Running tomahawk: maybe" << "caps " << caps->node() << "requesting disco...";
|
||||||
|
|
||||||
// request disco features
|
// request disco features
|
||||||
QString node = caps->node() + '#' + caps->ver();
|
QString node = caps->node() + '#' + caps->ver();
|
||||||
@@ -686,6 +710,7 @@ void JabberPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr &item, const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JabberPlugin::onSubscriptionReceived(const Jreen::RosterItem::Ptr& item, const Jreen::Presence& presence)
|
void JabberPlugin::onSubscriptionReceived(const Jreen::RosterItem::Ptr& item, const Jreen::Presence& presence)
|
||||||
{
|
{
|
||||||
if ( m_state != Connected )
|
if ( m_state != Connected )
|
||||||
@@ -738,6 +763,7 @@ void JabberPlugin::onSubscriptionReceived(const Jreen::RosterItem::Ptr& item, co
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JabberPlugin::onSubscriptionRequestConfirmed( int result )
|
JabberPlugin::onSubscriptionRequestConfirmed( int result )
|
||||||
{
|
{
|
||||||
@@ -775,6 +801,7 @@ JabberPlugin::onSubscriptionRequestConfirmed( int result )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JabberPlugin::onNewIq(const Jreen::IQ& iq)
|
void JabberPlugin::onNewIq(const Jreen::IQ& iq)
|
||||||
{
|
{
|
||||||
if ( m_state != Connected )
|
if ( m_state != Connected )
|
||||||
@@ -856,6 +883,7 @@ void JabberPlugin::onNewIq(const Jreen::IQ& iq)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool JabberPlugin::presenceMeansOnline(Jreen::Presence::Type p)
|
bool JabberPlugin::presenceMeansOnline(Jreen::Presence::Type p)
|
||||||
{
|
{
|
||||||
switch(p)
|
switch(p)
|
||||||
@@ -870,6 +898,7 @@ bool JabberPlugin::presenceMeansOnline(Jreen::Presence::Type p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JabberPlugin::handlePeerStatus(const Jreen::JID& jid, Jreen::Presence::Type presenceType)
|
void JabberPlugin::handlePeerStatus(const Jreen::JID& jid, Jreen::Presence::Type presenceType)
|
||||||
{
|
{
|
||||||
QString fulljid = jid.full();
|
QString fulljid = jid.full();
|
||||||
@@ -919,6 +948,7 @@ void JabberPlugin::handlePeerStatus(const Jreen::JID& jid, Jreen::Presence::Type
|
|||||||
m_peers[ jid ] = presenceType;
|
m_peers[ jid ] = presenceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JabberPlugin::onNewAvatar(const QString& jid)
|
void JabberPlugin::onNewAvatar(const QString& jid)
|
||||||
{
|
{
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
@@ -947,6 +977,7 @@ void JabberPlugin::onNewAvatar(const QString& jid)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
JabberPlugin::readXmlConsoleEnabled()
|
JabberPlugin::readXmlConsoleEnabled()
|
||||||
{
|
{
|
||||||
@@ -960,12 +991,14 @@ JabberPlugin::readPassword()
|
|||||||
return TomahawkSettings::instance()->value( pluginId() + "/password" ).toString();
|
return TomahawkSettings::instance()->value( pluginId() + "/password" ).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
JabberPlugin::readPort()
|
JabberPlugin::readPort()
|
||||||
{
|
{
|
||||||
return TomahawkSettings::instance()->value( pluginId() + "/port", 5222 ).toInt();
|
return TomahawkSettings::instance()->value( pluginId() + "/port", 5222 ).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
JabberPlugin::readServer()
|
JabberPlugin::readServer()
|
||||||
{
|
{
|
||||||
@@ -1010,6 +1043,7 @@ JabberPlugin::saveConfig()
|
|||||||
checkSettings();
|
checkSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JabberPlugin::deletePlugin()
|
JabberPlugin::deletePlugin()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user