1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-22 16:59:58 +01:00

sipjreen: regressions--: handle server and port settings correctly

This commit is contained in:
Dominik Schmidt 2011-05-02 22:11:47 +02:00
parent 92f23bc20b
commit 81065243f4
2 changed files with 25 additions and 5 deletions

View File

@ -61,6 +61,8 @@ JabberPlugin::JabberPlugin()
// general client setup
m_client = new Jreen::Client( jid, m_currentPassword );
setupClientHelper();
m_client->registerStanzaExtension(new TomahawkSipMessageFactory);
m_currentResource = QString::fromAscii( "tomahawk%1" ).arg( QString::number( qrand() % 10000 ) );
m_client->setResource( m_currentResource );
@ -439,17 +441,34 @@ JabberPlugin::checkSettings()
m_currentServer = TomahawkSettings::instance()->jabberServer();
m_currentPort = TomahawkSettings::instance()->jabberPort();
Jreen::JID jid = Jreen::JID( accountName() );
m_client->setJID( jid );
m_client->setPassword( m_currentPassword );
m_client->setServer( m_currentServer );
m_client->setPort( m_currentPort );
setupClientHelper();
qDebug() << Q_FUNC_INFO << "Updated settings";
connectPlugin( false );
}
}
void JabberPlugin::setupClientHelper()
{
Jreen::JID jid = Jreen::JID( m_currentUsername );
m_client->setJID( jid );
m_client->setPassword( m_currentPassword );
if( !m_currentServer.isEmpty() )
{
// set explicit server details
m_client->setServer( m_currentServer );
m_client->setPort( m_currentPort );
}
else
{
// let jreen find out server and port via jdns
m_client->setServer( jid.domain() );
m_client->setPort( -1 );
}
}
void JabberPlugin::addMenuHelper()
{
if( !m_menu )

View File

@ -93,6 +93,7 @@ private slots:
void onNewAvatar( const QString &jid );
private:
void setupClientHelper();
void addMenuHelper();
void removeMenuHelper();