Beispiel #1
0
void XMPPStream::onXmlStreamStateChange () {
	XMLStreamDecoder::State s = mXmlStreamDecoder.state();
	if (s == XMLStreamDecoder::XS_ReadXmlBegin) return; // ignore
	if (s == XMLStreamDecoder::XS_ReadOpener) {
		if (mState == XMS_StartInitializing) {
			if (!decodeStreamInit()) {
				finishOp (XMO_StartInitialize, mError);
				return;
			}
			mState = XMS_Initialized;
			finishOp (XMO_StartInitialize, NoError);
			return;
		} else
		if (mState == XMS_RespondInitializing) {
			if (!decodeStreamInit()){
				finishOp (XMO_RespondInitialize, mError);
				return;
			}
			sendStreamInit();
			mState = XMS_Initialized;
			finishOp (XMO_RespondInitialize, NoError);
		} else {
			onChannelError (error::BadProtocol);
		}
	}
	if (s == XMLStreamDecoder::XS_Closed) {
		mState = XMS_End;
		if (mClosed)
			xcall (mClosed);
	}
}
Beispiel #2
0
void XMPPStream::onChannelChange   () {
	ByteArrayPtr data = mChannel->read();
	if (data && data->size() > 0){
#ifndef NDEBUG
		Log (LogInfo) << LOGID << "recv " << *data << std::endl;
#endif
		mXmlStreamDecoder.onWrite(*data);
	}
	// mXmlStreamDecoder can remove the channel by its own callbacks!
	if (mChannel && mChannel->error()) {
		onChannelError (mChannel->error());
	}
}
void SecureFileUploader::onConnected()
{
    qDebug() << "SecureUploader: Connected";
    qDebug() << "SecureUploader: Creating SFTP channel...";

    m_channel = m_connection->createSftpChannel();

    if (m_channel) {
        connect(m_channel.data(), SIGNAL(initialized()),
                SLOT(onChannelInitialized()));
        connect(m_channel.data(), SIGNAL(initializationFailed(QString)),
                SLOT(onChannelError(QString)));
        connect(m_channel.data(), SIGNAL(finished(QSsh::SftpJobId, QString)),
                SLOT(onOpfinished(QSsh::SftpJobId, QString)));

        m_channel->initialize();

    } else {
        qDebug() << "SecureUploader: Error null channel";
    }
}