Example #1
0
void CoreConnection::connectToCurrentAccount()
{
    if (_authHandler) {
        qWarning() << Q_FUNC_INFO << "Already connected!";
        return;
    }

    if (currentAccount().isInternal()) {
        if (Quassel::runMode() != Quassel::Monolithic) {
            qWarning() << "Cannot connect to internal core in client-only mode!";
            return;
        }

        InternalPeer *peer = new InternalPeer();
        _peer = peer;
        Client::instance()->signalProxy()->addPeer(peer); // sigproxy will take ownership
        emit connectionMsg(tr("Initializing..."));
        emit connectToInternalCore(peer);
        setState(Connected);
        return;
    }

    _authHandler = new ClientAuthHandler(currentAccount(), this);

    connect(_authHandler, SIGNAL(disconnected()), SLOT(coreSocketDisconnected()));
    connect(_authHandler, SIGNAL(connectionReady()), SLOT(onConnectionReady()));
    connect(_authHandler, SIGNAL(socketError(QAbstractSocket::SocketError,QString)), SLOT(coreSocketError(QAbstractSocket::SocketError,QString)));
    connect(_authHandler, SIGNAL(transferProgress(int,int)), SLOT(updateProgress(int,int)));
    connect(_authHandler, SIGNAL(requestDisconnect(QString,bool)), SLOT(disconnectFromCore(QString,bool)));

    connect(_authHandler, SIGNAL(errorMessage(QString)), SIGNAL(connectionError(QString)));
    connect(_authHandler, SIGNAL(errorPopup(QString)), SIGNAL(connectionErrorPopup(QString)), Qt::QueuedConnection);
    connect(_authHandler, SIGNAL(statusMessage(QString)), SIGNAL(connectionMsg(QString)));
    connect(_authHandler, SIGNAL(encrypted(bool)), SIGNAL(encrypted(bool)));
    connect(_authHandler, SIGNAL(startCoreSetup(QVariantList, QVariantList)), SIGNAL(startCoreSetup(QVariantList, QVariantList)));
    connect(_authHandler, SIGNAL(coreSetupFailed(QString)), SIGNAL(coreSetupFailed(QString)));
    connect(_authHandler, SIGNAL(coreSetupSuccessful()), SIGNAL(coreSetupSuccess()));
    connect(_authHandler, SIGNAL(userAuthenticationRequired(CoreAccount*,bool*,QString)), SIGNAL(userAuthenticationRequired(CoreAccount*,bool*,QString)));
    connect(_authHandler, SIGNAL(handleNoSslInClient(bool*)), SIGNAL(handleNoSslInClient(bool*)));
    connect(_authHandler, SIGNAL(handleNoSslInCore(bool*)), SIGNAL(handleNoSslInCore(bool*)));
#ifdef HAVE_SSL
    connect(_authHandler, SIGNAL(handleSslErrors(const QSslSocket*,bool*,bool*)), SIGNAL(handleSslErrors(const QSslSocket*,bool*,bool*)));
#endif

    connect(_authHandler, SIGNAL(loginSuccessful(CoreAccount)), SLOT(onLoginSuccessful(CoreAccount)));
    connect(_authHandler, SIGNAL(handshakeComplete(RemotePeer*,Protocol::SessionState)), SLOT(onHandshakeComplete(RemotePeer*,Protocol::SessionState)));

    setState(Connecting);
    _authHandler->connectToCore();
}
Example #2
0
WebUi::WebUi(WApplication *app) :
    AbstractUi(),
    m_app(app)
{
    app->setTitle("Quassel web interface");
    WVBoxLayout *layout = new WVBoxLayout;
    app->root()->setLayout(layout);
    
    /*m_loginButton = new WPushButton("Connect");
    m_loginButton->clicked().connect(this, &WebUi::connect);
    layout->addWidget(m_loginButton);*/

    _chatView = new WTableView(app->root());
    layout->addWidget(_chatView);

    _inputWidget = new WLineEdit(app->root());
    layout->addWidget(_inputWidget);
    

    QObject::connect(Client::coreConnection(), SIGNAL(userAuthenticationRequired(CoreAccount*,bool*,QString)), SLOT(userAuthenticationRequired(CoreAccount*,bool*,QString)));
    QObject::connect(Client::coreConnection(), SIGNAL(connectionMsg(QString)), SLOT(printMsg(QString)));
    QObject::connect(Client::coreConnection(), SIGNAL(progressTextChanged(QString)), SLOT(printMsg(QString)));
    QObject::connect(Client::coreConnection(), SIGNAL(connectionError(QString)), SLOT(printMsg(QString)));
    QObject::connect(Client::coreConnection(), SIGNAL(connectionErrorPopup(QString)), SLOT(printMsg(QString)));
    //QObject::connect(Client::coreConnection(), SIGNAL(userAuthenticationRequired(CoreAccount*,bool*,QString)), SLOT(userAuthenticationRequired(CoreAccount*,bool*,QString)));
    //Client::coreAccountModel()->load();
    //if (!Client::coreConnection()->connectToCore()) {
        bool ok;
        userAuthenticationRequired(0, &ok, "");
    //}
}
Example #3
0
void ClientSyncer::clientInitAck(const QVariantMap &msg) {
  // Core has accepted our version info and sent its own. Let's see if we accept it as well...
  uint ver = msg["ProtocolVersion"].toUInt();
  if(ver < Quassel::buildInfo().clientNeedsProtocol) {
    emit connectionError(tr("<b>The Quassel Core you are trying to connect to is too old!</b><br>"
        "Need at least core/client protocol v%1 to connect.").arg(Quassel::buildInfo().clientNeedsProtocol));
    disconnectFromCore();
    return;
  }
  emit connectionMsg(msg["CoreInfo"].toString());

#ifndef QT_NO_COMPRESS
  if(msg["SupportsCompression"].toBool()) {
    _socket->setProperty("UseCompression", true);
  }
#endif

  _coreMsgBuffer = msg;
#ifdef HAVE_SSL
  if(coreConnectionInfo["useSsl"].toBool()) {
    if(msg["SupportSsl"].toBool()) {
      QSslSocket *sslSocket = qobject_cast<QSslSocket *>(_socket);
      Q_ASSERT(sslSocket);
      connect(sslSocket, SIGNAL(encrypted()), this, SLOT(sslSocketEncrypted()));
      connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(sslErrors(const QList<QSslError> &)));

      sslSocket->startClientEncryption();
    } else {
Example #4
0
void CoreConnection::onLoginSuccessful(const CoreAccount &account)
{
    updateProgress(0, 0);

    // save current account data
    accountModel()->createOrUpdateAccount(account);
    accountModel()->save();

    _reconnectTimer.stop();

    setProgressText(tr("Receiving session state"));
    setState(Synchronizing);
    emit connectionMsg(tr("Synchronizing to %1...").arg(account.accountName()));
}
void MpRtpInputAudioConnection::sendConnectionNotification(MpNotificationMsgType type, intptr_t data)
{
   if (m_pConnectionNotificationQueue && areNotificationsEnabled())
   {
      // create message and send it to connection notification queue
      OsIntPtrMsg connectionMsg(OsMsg::MP_CONNECTION_NOTF_MSG,
               (unsigned char)MP_NOTIFICATION_AUDIO,
               (int)type,
               mMyID,
               data);

      m_pConnectionNotificationQueue->send(connectionMsg, OsTime::NO_WAIT_TIME);
   }
}
Example #6
0
void CoreConnection::onHandshakeComplete(RemotePeer *peer, const Protocol::SessionState &sessionState)
{
    updateProgress(100, 100);

    disconnect(_authHandler, 0, this, 0);
    _authHandler->deleteLater();
    _authHandler = 0;

    _peer = peer;
    connect(peer, SIGNAL(disconnected()), SLOT(coreSocketDisconnected()));
    connect(peer, SIGNAL(statusMessage(QString)), SIGNAL(connectionMsg(QString)));
    connect(peer, SIGNAL(socketError(QAbstractSocket::SocketError,QString)), SLOT(coreSocketError(QAbstractSocket::SocketError,QString)));

    Client::signalProxy()->addPeer(_peer);  // sigproxy takes ownership of the peer!

    syncToCore(sessionState);
}
Example #7
0
void CoreConnection::resetConnection(bool wantReconnect)
{
    if (_resetting)
        return;
    _resetting = true;

    _wantReconnect = wantReconnect;

    if (_authHandler) {
        disconnect(_authHandler, 0, this, 0);
        _authHandler->close();
        _authHandler->deleteLater();
        _authHandler = 0;
    }

    if (_peer) {
        disconnect(_peer, 0, this, 0);
        // peer belongs to the sigproxy and thus gets deleted by it
        _peer->close();
        _peer = 0;
    }

    _netsToSync.clear();
    _numNetsToSync = 0;

    setProgressMaximum(-1); // disable
    setState(Disconnected);
    emit lagUpdated(-1);

    emit connectionMsg(tr("Disconnected from core."));
    emit encrypted(false);
    setState(Disconnected);

    // initiate if a reconnect if appropriate
    CoreConnectionSettings s;
    if (wantReconnect && s.autoReconnect()) {
        _reconnectTimer.start();
    }

    _resetting = false;
}