mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 03:40:16 +02:00
Make the sip plugin aware of subscription requests again
This commit is contained in:
committed by
Christian Muehlhaeuser
parent
1697b27aca
commit
cb405cde15
@@ -28,6 +28,7 @@
|
|||||||
#include <utils/tomahawkutils.h>
|
#include <utils/tomahawkutils.h>
|
||||||
#include <gloox/capabilities.h>
|
#include <gloox/capabilities.h>
|
||||||
#include <qjson/parser.h>
|
#include <qjson/parser.h>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
using namespace gloox;
|
using namespace gloox;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -150,6 +151,7 @@ Jabber_p::go()
|
|||||||
|
|
||||||
m_client->registerPresenceHandler( this );
|
m_client->registerPresenceHandler( this );
|
||||||
m_client->registerConnectionListener( this );
|
m_client->registerConnectionListener( this );
|
||||||
|
m_client->rosterManager()->registerRosterListener( this );
|
||||||
m_client->logInstance().registerLogHandler( LogLevelWarning, LogAreaAll, this );
|
m_client->logInstance().registerLogHandler( LogLevelWarning, LogAreaAll, this );
|
||||||
m_client->registerMessageHandler( this );
|
m_client->registerMessageHandler( this );
|
||||||
|
|
||||||
@@ -609,12 +611,26 @@ bool
|
|||||||
Jabber_p::handleSubscriptionRequest( const JID& jid, const std::string& /*msg*/ )
|
Jabber_p::handleSubscriptionRequest( const JID& jid, const std::string& /*msg*/ )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << jid.bare().c_str();
|
qDebug() << Q_FUNC_INFO << jid.bare().c_str();
|
||||||
|
|
||||||
|
QMessageBox::StandardButton allowSubscription;
|
||||||
|
allowSubscription = QMessageBox::question( 0,
|
||||||
|
tr("Friend Request in Jabber"),
|
||||||
|
QString(tr("Do you want to be friends with <b>%1</b>?")).arg(QLatin1String(jid.bare().c_str())),
|
||||||
|
QMessageBox::Ok | QMessageBox::Cancel
|
||||||
|
);
|
||||||
|
|
||||||
|
if(allowSubscription == QMessageBox::Ok)
|
||||||
|
{
|
||||||
StringList groups;
|
StringList groups;
|
||||||
groups.push_back( "Tomahawk" );
|
groups.push_back( "Tomahawk" );
|
||||||
m_client->rosterManager()->subscribe( jid, "", groups, "" );
|
m_client->rosterManager()->subscribe( jid, "", groups, "" );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Jabber_p::handleUnsubscriptionRequest( const JID& jid, const std::string& /*msg*/ )
|
Jabber_p::handleUnsubscriptionRequest( const JID& jid, const std::string& /*msg*/ )
|
||||||
|
@@ -76,6 +76,7 @@ class SIPDLLEXPORT Jabber_p :
|
|||||||
public gloox::MessageHandler,
|
public gloox::MessageHandler,
|
||||||
public gloox::VCardHandler,
|
public gloox::VCardHandler,
|
||||||
public gloox::PresenceHandler,
|
public gloox::PresenceHandler,
|
||||||
|
public gloox::RosterListener,
|
||||||
gloox::LogHandler
|
gloox::LogHandler
|
||||||
//public gloox::DiscoHandler,
|
//public gloox::DiscoHandler,
|
||||||
{
|
{
|
||||||
@@ -109,6 +110,11 @@ public:
|
|||||||
|
|
||||||
virtual void handleRoster( const gloox::Roster& roster );
|
virtual void handleRoster( const gloox::Roster& roster );
|
||||||
virtual void handleRosterError( const gloox::IQ& /*iq*/ );
|
virtual void handleRosterError( const gloox::IQ& /*iq*/ );
|
||||||
|
|
||||||
|
// not actually used, just needed for the interface to support subscription requests, see handlePresence for presence handling
|
||||||
|
virtual void handleRosterPresence( const gloox::RosterItem&, const std::string&, gloox::Presence::PresenceType, const std::string& ) {}
|
||||||
|
virtual void handleSelfPresence( const gloox::RosterItem&, const std::string&, gloox::Presence::PresenceType, const std::string& ) {}
|
||||||
|
|
||||||
virtual void handlePresence( const gloox::Presence& presence );
|
virtual void handlePresence( const gloox::Presence& presence );
|
||||||
virtual bool handleSubscription( const gloox::JID& jid, const std::string& /*msg*/ );
|
virtual bool handleSubscription( const gloox::JID& jid, const std::string& /*msg*/ );
|
||||||
virtual bool handleSubscriptionRequest( const gloox::JID& jid, const std::string& /*msg*/ );
|
virtual bool handleSubscriptionRequest( const gloox::JID& jid, const std::string& /*msg*/ );
|
||||||
|
Reference in New Issue
Block a user