1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-16 19:14:06 +02:00

* Cleaned up Jabber auth.

This commit is contained in:
Christian Muehlhaeuser
2011-03-28 07:13:20 +02:00
parent 4d23dea891
commit e24aea480e
2 changed files with 13 additions and 14 deletions

View File

@@ -638,9 +638,9 @@ Jabber_p::handleSubscriptionRequest( const JID& jid, const std::string& /*msg*/
// preparing the confirm box for the user // preparing the confirm box for the user
QMessageBox *confirmBox = new QMessageBox( QMessageBox *confirmBox = new QMessageBox(
QMessageBox::Question, QMessageBox::Question,
tr("Friend Request in Jabber"), tr( "Authorize User" ),
QString(tr("Do you want to be friends with <b>%1</b>?")).arg(QLatin1String(jid.bare().c_str())), QString( tr( "Do you want to grant <b>%1</b> access to your Collection?" ) ).arg( QLatin1String( jid.bare().c_str() ) ),
QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Yes | QMessageBox::No,
0 0
); );
@@ -653,6 +653,7 @@ Jabber_p::handleSubscriptionRequest( const JID& jid, const std::string& /*msg*/
return false; return false;
} }
void void
Jabber_p::onSubscriptionRequestConfirmed( int result ) Jabber_p::onSubscriptionRequestConfirmed( int result )
{ {
@@ -660,6 +661,7 @@ Jabber_p::onSubscriptionRequestConfirmed(int result)
QList< QMessageBox* > confirmBoxes = m_subscriptionConfirmBoxes.values(); QList< QMessageBox* > confirmBoxes = m_subscriptionConfirmBoxes.values();
JID jid; JID jid;
foreach( QMessageBox* currentBox, confirmBoxes ) foreach( QMessageBox* currentBox, confirmBoxes )
{ {
if( currentBox == sender() ) if( currentBox == sender() )
@@ -676,25 +678,22 @@ Jabber_p::onSubscriptionRequestConfirmed(int result)
QMessageBox::StandardButton allowSubscription = static_cast<QMessageBox::StandardButton>( result ); QMessageBox::StandardButton allowSubscription = static_cast<QMessageBox::StandardButton>( result );
if(allowSubscription == QMessageBox::Ok) if ( allowSubscription == QMessageBox::Yes )
{ {
qDebug() << Q_FUNC_INFO << jid.bare().c_str() << "accepted by user, adding to roster"; qDebug() << Q_FUNC_INFO << jid.bare().c_str() << "accepted by user, adding to roster";
StringList groups; StringList groups;
groups.push_back( "Tomahawk" ); groups.push_back( "Tomahawk" );
m_client->rosterManager()->subscribe( jid, "", groups, "" ); m_client->rosterManager()->subscribe( jid, "", groups, "" );
// ack the request
m_client->rosterManager()->ackSubscriptionRequest( jid, true );
} }
else else
{ {
qDebug() << Q_FUNC_INFO << jid.bare().c_str() << "declined by user"; qDebug() << Q_FUNC_INFO << jid.bare().c_str() << "declined by user";
}
// decl the request m_client->rosterManager()->ackSubscriptionRequest( jid, allowSubscription == QMessageBox::Yes );
m_client->rosterManager()->ackSubscriptionRequest( jid, false );
}
} }
bool bool
Jabber_p::handleUnsubscriptionRequest( const JID& jid, const std::string& /*msg*/ ) Jabber_p::handleUnsubscriptionRequest( const JID& jid, const std::string& /*msg*/ )
{ {